Skip to content

Commit

Permalink
fix: added check of result
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Sep 12, 2024
1 parent 83219e3 commit c42ff89
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/DIRAC/Resources/Computing/SSHComputingElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,8 @@ def _submitJobToHost(self, executableFile, numberOfJobs, host=None):
return resultCommand

result = resultCommand["Value"]
if not isinstance(result, dict) or "Status" not in result:
return S_ERROR("Invalid result from job submission")
if result["Status"] != 0:
return S_ERROR(f"Failed job submission: {result['Message']}")
else:
Expand Down Expand Up @@ -639,6 +641,8 @@ def _killJobOnHost(self, jobIDList, host=None):
return resultCommand

result = resultCommand["Value"]
if not isinstance(result, dict) or "Status" not in result:
return S_ERROR("Invalid result from job submission")
if result["Status"] != 0:
return S_ERROR(f"Failed job kill: {result['Message']}")

Expand Down Expand Up @@ -674,6 +678,8 @@ def _getHostStatus(self, host=None):
return resultCommand

result = resultCommand["Value"]
if not isinstance(result, dict) or "Status" not in result:
return S_ERROR("Invalid result from job submission")
if result["Status"] != 0:
return S_ERROR(f"Failed to get CE status: {result['Message']}")

Expand All @@ -697,6 +703,8 @@ def _getJobStatusOnHost(self, jobIDList, host=None):
return resultCommand

result = resultCommand["Value"]
if not isinstance(result, dict) or "Status" not in result:
return S_ERROR("Invalid result from job submission")
if result["Status"] != 0:
return S_ERROR(f"Failed to get job status: {result['Message']}")

Expand Down Expand Up @@ -779,6 +787,8 @@ def _getJobOutputFiles(self, jobID):
return resultCommand

result = resultCommand["Value"]
if not isinstance(result, dict) or "Status" not in result:
return S_ERROR("Invalid result from job submission")
if result["Status"] != 0:
return S_ERROR(f"Failed to get job output files: {result['Message']}")

Expand Down

0 comments on commit c42ff89

Please sign in to comment.