From b8c5abc6e897d5df5a4795dabadd9bbaf405c59b Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Thu, 15 Apr 2021 07:05:21 +0200 Subject: [PATCH] TMSS-261: added cancel methods --- SAS/TMSS/client/lib/tmss_http_rest_client.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/SAS/TMSS/client/lib/tmss_http_rest_client.py b/SAS/TMSS/client/lib/tmss_http_rest_client.py index 2409220e473..a4175393de1 100644 --- a/SAS/TMSS/client/lib/tmss_http_rest_client.py +++ b/SAS/TMSS/client/lib/tmss_http_rest_client.py @@ -324,6 +324,21 @@ class TMSSsession(object): self.session.patch(self.get_full_url_for_path('subtask/%s' % subtask_id), {'start_time': datetime.utcnow()}) return self.get_path_as_json_object('subtask/%s/schedule' % subtask_id) + def cancel_subtask(self, subtask_id: int) -> {}: + """cancel the subtask for the given subtask_id, either preventing it to start, or to kill it while running. + returns the cancelled subtask upon success, or raises.""" + return self.get_path_as_json_object('subtask/%s/cancel' % subtask_id) + + def cancel_task_blueprint(self, task_blueprint_id: int) -> {}: + """cancel the task_blueprint for the given task_blueprint_id, either preventing it to start, or to kill it while running. + returns the cancelled task_blueprint upon success, or raises.""" + return self.get_path_as_json_object('task_blueprint/%s/cancel' % task_blueprint_id) + + def cancel_scheduling_unit_blueprint(self, scheduling_unit_blueprint_id: int) -> {}: + """cancel the scheduling_unit_blueprint for the given scheduling_unit_blueprint_id, either preventing it to start, or to kill it while running. + returns the cancelled scheduling_unit_blueprint upon success, or raises.""" + return self.get_path_as_json_object('scheduling_unit_blueprint/%s/cancel' % scheduling_unit_blueprint_id) + def create_blueprints_and_subtasks_from_scheduling_unit_draft(self, scheduling_unit_draft_id: int) -> {}: """create a scheduling_unit_blueprint, its specified taskblueprints and subtasks for the given scheduling_unit_draft_id. returns the scheduled subtask upon success, or raises.""" -- GitLab