@@ -154,7 +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-
158157def run (config : Dict , ** kwargs ) -> Dict :
159158 """
160159 Run a job given configuration and command line args passed in (kwargs).
@@ -171,7 +170,15 @@ def run(config: Dict, **kwargs) -> Dict:
171170 Dict
172171 dictionary of job id and run id in case of ML Job run, else empty if running locally
173172 """
174- p = ConfigProcessor (config ).step (ConfigMerger , ** kwargs )
173+ if config :
174+ p = ConfigProcessor (config ).step (ConfigMerger , ** kwargs )
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 = ConfigProcessor (config ).step (ConfigMerger , ** kwargs )
175182 if config .get ("kind" ) == "distributed" : # TODO: add kind factory
176183 print (
177184 "......................... Initializing the process ..................................."
@@ -243,14 +250,6 @@ def run(config: Dict, **kwargs) -> Dict:
243250 _save_yaml (yamlContent , ** kwargs )
244251 return cluster_run_info
245252 else :
246- if (
247- "kind" in p .config
248- and p .config ["execution" ].get ("backend" , None ) != BACKEND_NAME .LOCAL .value
249- and "ocid" not in p .config ["execution" ]
250- ):
251- p .config ["execution" ]["backend" ] = p .config ["kind" ]
252- return _BackendFactory (p .config ).backend .apply ()
253-
254253 if "ocid" in p .config ["execution" ]:
255254 resource_to_backend = {
256255 DataScienceResource .JOB : BACKEND_NAME .JOB ,
0 commit comments