Skip to content

Commit e731057

Browse files
committed
Fix MTJs with an outdated existing cluster giving an error- MTJ with an invalid cluster will now use the default cluster template
1 parent eb6037c commit e731057

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

dbclient/JobsClient.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,19 @@ def adjust_ids_for_cluster(settings): #job_settings or task_settings
186186
create_resp = self.post('/jobs/create', job_settings)
187187
if logging_utils.check_error(create_resp):
188188
logging.info("Resetting job to use default cluster configs due to expired configurations.")
189-
job_settings['new_cluster'] = self.get_jobs_default_cluster_conf()
189+
if job_settings.get("format", "") == "MULTI_TASK":
190+
191+
# if an MTJ has a cluster that no longer exists, use the default configuration for all tasks
192+
updated_tasks = []
193+
for task in job_settings.get("tasks"):
194+
if task.get("existing_cluster_id", None):
195+
task.pop("existing_cluster_id")
196+
task["new_cluster"] = self.get_jobs_default_cluster_conf()
197+
updated_tasks.append(task)
198+
job_settings["tasks"] = updated_tasks
199+
else:
200+
job_settings['new_cluster'] = self.get_jobs_default_cluster_conf()
201+
190202
create_resp_retry = self.post('/jobs/create', job_settings)
191203
if not logging_utils.log_response_error(error_logger, create_resp_retry):
192204
if 'job_id' in job_conf:

0 commit comments

Comments
 (0)