diff --git a/SAS/TMSS/client/lib/tmss_http_rest_client.py b/SAS/TMSS/client/lib/tmss_http_rest_client.py index 25f2b5258879fbe15212c44d49d3d0b4fe4f761c..baf653c10f8812fa75c5113de0a9c0ceaba11632 100644 --- a/SAS/TMSS/client/lib/tmss_http_rest_client.py +++ b/SAS/TMSS/client/lib/tmss_http_rest_client.py @@ -327,6 +327,18 @@ class TMSSsession(object): returns the scheduled subtask upon success, or raises.""" return self.get_path_as_json_object('subtask/%s/schedule' % subtask_id) + def try_schedule_subtask(self, subtask_id: int) -> {}: + """try to schedule the subtask for the given subtask_id. + returns the scheduled subtask upon success. + resets the subtask's state if it ends up in error state.""" + try: + return self.get_path_as_json_object('subtask/%s/schedule' % subtask_id) + except Exception as e: + logger.error(str(e)) + subtask = self.get_subtask(subtask_id) + if subtask['state_value'] == 'error': + self.set_subtask_status(subtask_id, 'defined') + def get_subtask_progress(self, subtask_id: int) -> {}: """get the progress [0.0, 1.0] of a running subtask. returns a dict with the 'id' and 'progress', or raises."""