diff --git a/shared/workspaces/workspaces/capability/schema.py b/shared/workspaces/workspaces/capability/schema.py index e0edc8359e358ed2e8643fdf0565192d6ba53596..f655932724bdc026e097958c1d53343e767c655c 100644 --- a/shared/workspaces/workspaces/capability/schema.py +++ b/shared/workspaces/workspaces/capability/schema.py @@ -539,15 +539,23 @@ class QaPass(Action): @staticmethod def check_still_running(version: CapabilityVersion) -> bool: workflow_service_url = CapoConfig().settings(WORKFLOW_SETTINGS_KEY).serviceUrl - if version.current_execution.current_workflow_request_id: - response = requests.get( - f"{workflow_service_url}/workflows/{version.capability.name}/requests/" - f"{version.current_execution.current_workflow_request_id}/htcondor_id" - ) - if json.loads(response.content.decode())["htcondor_job_id"] == "None": + # check for execution + if version.current_execution: + # version is submitted, check for workflow + if version.current_execution.current_workflow_request_id: + response = requests.get( + f"{workflow_service_url}/workflows/{version.capability.name}/requests/" + f"{version.current_execution.current_workflow_request_id}/htcondor_id" + ) + if json.loads(response.content.decode())["htcondor_job_id"] == "None": + # not running in HTCondor + return False + return True + else: + # workflow not submitted return False - return True else: + # version is not submitted return False @staticmethod