job: fix not being able to kill a running metronome job (#948)
This commit is contained in:
committed by
tamarrow
parent
5226dfbf3c
commit
0a94d2b9d4
@@ -10,7 +10,7 @@ Description:
|
||||
dcos job remove <job-id> [--stop-current-job-runs]
|
||||
dcos job show <job-id>
|
||||
dcos job update <job-file>
|
||||
dcos job kill <job-id> [run-id][--all]
|
||||
dcos job kill <job-id> [<run-id>][--all]
|
||||
dcos job run <job-id>
|
||||
dcos job list [--json]
|
||||
dcos job schedule add <job-id> <schedule-file>
|
||||
|
||||
@@ -216,7 +216,6 @@ def _kill(job_id, run_id, all=False):
|
||||
:returns: process return code
|
||||
:rtype: int
|
||||
"""
|
||||
response = None
|
||||
deadpool = []
|
||||
if run_id is None and all is True:
|
||||
deadpool = _get_ids(_get_runs(job_id))
|
||||
@@ -226,7 +225,7 @@ def _kill(job_id, run_id, all=False):
|
||||
client = metronome.create_client()
|
||||
for dead in deadpool:
|
||||
try:
|
||||
client.kill_run(job_id, run_id)
|
||||
client.kill_run(job_id, dead)
|
||||
except DCOSHTTPException as e:
|
||||
if e.response.status_code == 404:
|
||||
raise DCOSException("Job ID or Run ID does NOT exist.")
|
||||
@@ -234,9 +233,8 @@ def _kill(job_id, run_id, all=False):
|
||||
raise DCOSException("Unable stop run ID '{}' for job ID '{}'"
|
||||
.format(dead, job_id))
|
||||
else:
|
||||
if response.status_code == 200:
|
||||
emitter.publish("Run '{}' for job '{}' killed."
|
||||
.format(dead, job_id))
|
||||
emitter.publish("Run '{}' for job '{}' killed."
|
||||
.format(dead, job_id))
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user