Skip to content

Commit 33f49b4

Browse files
committed
Updated pr.
1 parent 965c33b commit 33f49b4

File tree

2 files changed

+9
-29
lines changed

2 files changed

+9
-29
lines changed

ads/opctl/cli.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import ads.opctl.spark.cli
1818
from ads.common import auth as authutil
1919
from ads.common.auth import AuthType
20-
from ads.opctl.cmds import apply as apply_cmd
2120
from ads.opctl.cmds import activate as activate_cmd
2221
from ads.opctl.cmds import cancel as cancel_cmd
2322
from ads.opctl.cmds import configure as configure_cmd
@@ -389,6 +388,7 @@ def run(file, **kwargs):
389388
Jobs
390389
"""
391390
debug = kwargs["debug"]
391+
config = {}
392392
if file:
393393
if os.path.exists(file):
394394
auth = {}
@@ -402,14 +402,6 @@ def run(file, **kwargs):
402402
else:
403403
raise FileNotFoundError(f"{file} is not found")
404404

405-
if (
406-
"kind" in config
407-
and config["execution"].get("backend", None) != BACKEND_NAME.LOCAL.value
408-
):
409-
return suppress_traceback(debug)(apply_cmd)(config, **kwargs)
410-
else:
411-
# If no yaml is provided, we assume there's cmdline args to define a job.
412-
config = {"kind": "job"}
413405
suppress_traceback(debug)(run_cmd)(config, **kwargs)
414406

415407

ads/opctl/cmds.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -154,26 +154,6 @@ def _save_yaml(yaml_content, **kwargs):
154154
f.write(yaml_content)
155155
print(f"Job run info saved to {yaml_path}")
156156

157-
158-
def apply(config: Dict, **kwargs) -> Dict:
159-
"""Creates a Job, DataFlow, Pipeline or Model Deployment from YAML.
160-
161-
Parameters
162-
----------
163-
config: dict
164-
dictionary of configurations
165-
kwargs: dict
166-
keyword arguments, stores configuration from command line args
167-
168-
Returns
169-
-------
170-
Dict
171-
dictionary of service id and service run id if not running locally, else empty.
172-
"""
173-
p = ConfigProcessor(config).step(ConfigMerger, **kwargs)
174-
p.config["execution"]["backend"] = p.config["kind"]
175-
return _BackendFactory(p.config).backend.apply()
176-
177157
def run(config: Dict, **kwargs) -> Dict:
178158
"""
179159
Run a job given configuration and command line args passed in (kwargs).
@@ -191,6 +171,14 @@ def run(config: Dict, **kwargs) -> Dict:
191171
dictionary of job id and run id in case of ML Job run, else empty if running locally
192172
"""
193173
p = ConfigProcessor(config).step(ConfigMerger, **kwargs)
174+
if config:
175+
if p.config["kind"] != BACKEND_NAME.LOCAL.value and p.config["kind"] != "distributed":
176+
p.config["execution"]["backend"] = p.config["kind"]
177+
return _BackendFactory(p.config).backend.apply()
178+
else:
179+
# If no yaml is provided and config is empty, we assume there's cmdline args to define a job.
180+
config = {"kind": "job"}
181+
p.config["kind"] = config["kind"]
194182
if config.get("kind") == "distributed": # TODO: add kind factory
195183
print(
196184
"......................... Initializing the process ..................................."

0 commit comments

Comments
 (0)