Skip to content

Instantly share code, notes, and snippets.

@kazuki
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuki/4aa221c9fb22ee34d6b2 to your computer and use it in GitHub Desktop.
Save kazuki/4aa221c9fb22ee34d6b2 to your computer and use it in GitHub Desktop.
diff --git a/sahara/service/edp/job_manager.py b/sahara/service/edp/job_manager.py
index 9d52ef8..12f4bfe 100644
--- a/sahara/service/edp/job_manager.py
+++ b/sahara/service/edp/job_manager.py
@@ -58,7 +58,7 @@ def _write_job_status(job_execution, job_info):
update['end_time'] = datetime.datetime.now()
job_configs = p.delete_proxy_user_for_job_execution(job_execution)
if job_configs:
- update['job_configs'] = job_configs
+ update.update(job_configs)
return conductor.job_execution_update(context.ctx(),
job_execution,
update)
diff --git a/sahara/utils/proxy.py b/sahara/utils/proxy.py
index ddfe806..d2c4430 100644
--- a/sahara/utils/proxy.py
+++ b/sahara/utils/proxy.py
@@ -77,7 +77,7 @@ def delete_proxy_user_for_job_execution(job_execution):
'''Delete a proxy user based on a JobExecution
:param job_execution: The job execution with proxy user information
- :returns: An updated job_configs dictionary or None
+ :returns: A delta dictionary of updated job_execution or None
'''
proxy_configs = job_execution.job_configs.get('proxy_configs')
diff --git a/sahara/service/edp/job_manager.py b/sahara/service/edp/job_manager.py
index 9d52ef8..8e6d902 100644
--- a/sahara/service/edp/job_manager.py
+++ b/sahara/service/edp/job_manager.py
@@ -56,9 +56,7 @@ def _write_job_status(job_execution, job_info):
update = {"info": job_info}
if job_info['status'] in edp.JOB_STATUSES_TERMINATED:
update['end_time'] = datetime.datetime.now()
- job_configs = p.delete_proxy_user_for_job_execution(job_execution)
- if job_configs:
- update['job_configs'] = job_configs
+ job_execution = p.delete_proxy_user_for_job_execution(job_execution)
return conductor.job_execution_update(context.ctx(),
job_execution,
update)
diff --git a/sahara/utils/proxy.py b/sahara/utils/proxy.py
index ddfe806..96961c1 100644
--- a/sahara/utils/proxy.py
+++ b/sahara/utils/proxy.py
@@ -77,7 +77,7 @@ def delete_proxy_user_for_job_execution(job_execution):
'''Delete a proxy user based on a JobExecution
:param job_execution: The job execution with proxy user information
- :returns: An updated job_configs dictionary or None
+ :returns: A updated job_execution
'''
proxy_configs = job_execution.job_configs.get('proxy_configs')
@@ -92,8 +92,9 @@ def delete_proxy_user_for_job_execution(job_execution):
proxy_user_delete(proxy_username)
update = {'job_configs': job_execution.job_configs.to_dict()}
del update['job_configs']['proxy_configs']
- return update
- return None
+ return conductor.job_execution_update(context.ctx(),
+ job_execution, update)
+ return job_execution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment