@@ -154,26 +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
- 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
-
177
157
def run (config : Dict , ** kwargs ) -> Dict :
178
158
"""
179
159
Run a job given configuration and command line args passed in (kwargs).
@@ -191,6 +171,14 @@ def run(config: Dict, **kwargs) -> Dict:
191
171
dictionary of job id and run id in case of ML Job run, else empty if running locally
192
172
"""
193
173
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" ]
194
182
if config .get ("kind" ) == "distributed" : # TODO: add kind factory
195
183
print (
196
184
"......................... Initializing the process ..................................."
0 commit comments