mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[enh] new cli command to restart a job
This commit is contained in:
parent
f1d9623d8b
commit
49a899263d
1 changed files with 13 additions and 1 deletions
14
cli.py
14
cli.py
|
@ -113,7 +113,19 @@ def stop(job_id, domain=DOMAIN):
|
||||||
|
|
||||||
|
|
||||||
def resume(job_id, domain=DOMAIN): pass
|
def resume(job_id, domain=DOMAIN): pass
|
||||||
def restart(job_id, domain=DOMAIN): pass
|
def restart(job_id, domain=DOMAIN):
|
||||||
|
response = request_api(
|
||||||
|
path=f"job/{job_id}/restart",
|
||||||
|
verb="post",
|
||||||
|
domain=domain,
|
||||||
|
check_return_code=False
|
||||||
|
)
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
print(f"Error: no job with the id '{job_id}'")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
assert response.status_code == 200, response.content
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Add table
Reference in a new issue