@@ -154,7 +154,6 @@ def _save_yaml(yaml_content, **kwargs):
154
154
f .write (yaml_content )
155
155
print (f"Job run info saved to { yaml_path } " )
156
156
157
-
158
157
def run (config : Dict , ** kwargs ) -> Dict :
159
158
"""
160
159
Run a job given configuration and command line args passed in (kwargs).
@@ -171,7 +170,15 @@ def run(config: Dict, **kwargs) -> Dict:
171
170
Dict
172
171
dictionary of job id and run id in case of ML Job run, else empty if running locally
173
172
"""
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 )
175
182
if config .get ("kind" ) == "distributed" : # TODO: add kind factory
176
183
print (
177
184
"......................... Initializing the process ..................................."
@@ -243,14 +250,6 @@ def run(config: Dict, **kwargs) -> Dict:
243
250
_save_yaml (yamlContent , ** kwargs )
244
251
return cluster_run_info
245
252
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
-
254
253
if "ocid" in p .config ["execution" ]:
255
254
resource_to_backend = {
256
255
DataScienceResource .JOB : BACKEND_NAME .JOB ,
0 commit comments