From 6d6d0b09ffde5262ff32ab8c885e0e5be3ff2e02 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Mon, 3 Sep 2018 06:41:09 +0200 Subject: [PATCH] [enh] implement cli cancel --- cli.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cli.py b/cli.py index 408efce..2a53efc 100644 --- a/cli.py +++ b/cli.py @@ -97,7 +97,21 @@ def delete(job_id, domain=DOMAIN): def update(job_id, domain=DOMAIN): pass -def stop(job_id, domain=DOMAIN): pass +def stop(job_id, domain=DOMAIN): + response = request_api( + path=f"job/{job_id}/stop", + 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 + + def resume(job_id, domain=DOMAIN): pass