Add updating jobs statuses before cluster deletion

We need to update statuses of jobs of current cluster before
deletion. This patch will allow to mark success in Sahara
already success jobs in Oozie.

Change-Id: If504a459e9d39031a7de0f20ea91124f6eed1253
Closes-bug: 1459226
This commit is contained in:
Vitaly Gridnev 2015-05-27 16:19:01 +03:00
parent 1210d718da
commit d640d3cb18
2 changed files with 6 additions and 2 deletions

View File

@ -189,9 +189,12 @@ def get_job_status(job_execution_id):
return job_execution
def update_job_statuses():
def update_job_statuses(cluster_id=None):
ctx = context.ctx()
for je in conductor.job_execution_get_all(ctx, end_time=None):
kwargs = {'end_time': None}
if cluster_id:
kwargs.update({'cluster_id': cluster_id})
for je in conductor.job_execution_get_all(ctx, **kwargs):
try:
get_job_status(je.id)
except Exception as e:

View File

@ -305,6 +305,7 @@ def _provision_scaled_cluster(cluster_id, node_group_id_map):
_("Terminating cluster failed for the following reason(s): {reason}"))
def terminate_cluster(cluster_id):
ctx = context.ctx()
job_manager.update_job_statuses(cluster_id=cluster_id)
cluster = conductor.cluster_get(ctx, cluster_id)
plugin = plugin_base.PLUGINS.get_plugin(cluster.plugin_name)