Skip to content

Commit 15f5743

Browse files
authored
Merge pull request #6987 from aldbr/rel-v7r3_FIX_RemoteRunnerExitCode
[v7r3] fix: return a specific error code in RemoteRunner in case of failure
2 parents 1a6d036 + 1af049e commit 15f5743

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/DIRAC/WorkloadManagementSystem/Utilities/RemoteRunner.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from DIRAC import gLogger, gConfig, S_OK, S_ERROR
1515
from DIRAC.Core.Security.ProxyInfo import getProxyInfo
16+
from DIRAC.Core.Utilities import DErrno
1617
from DIRAC.Core.Utilities.Decorators import deprecated
1718
from DIRAC.Resources.Computing.ComputingElementFactory import ComputingElementFactory
1819
from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getQueue
@@ -63,7 +64,7 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
6364
# Check whether CE parameters are set
6465
result = self._checkParameters()
6566
if not result["OK"]:
66-
result["Value"] = (-1, "", result["Message"])
67+
result["Errno"] = DErrno.ESECTION
6768
return result
6869
self.log.verbose(
6970
"The command will be sent to",
@@ -73,7 +74,7 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
7374
# Set up Application Queue
7475
result = self._setUpWorkloadCE(numberOfProcessors)
7576
if not result["OK"]:
76-
result["Value"] = (-1, "", result["Message"])
77+
result["Errno"] = DErrno.ERESUNA
7778
return result
7879
workloadCE = result["Value"]
7980
self.log.debug("The CE interface has been set up")
@@ -93,7 +94,7 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
9394
# Submit the command as a job
9495
result = workloadCE.submitJob(executable, workloadCE.proxy, inputs=inputs, outputs=outputs)
9596
if not result["OK"]:
96-
result["Value"] = (-1, "", result["Message"])
97+
result["Errno"] = DErrno.EWMSSUBM
9798
return result
9899
jobID = result["Value"][0]
99100
stamp = result["PilotStampDict"][jobID]
@@ -104,24 +105,23 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
104105
time.sleep(120)
105106
result = workloadCE.getJobStatus([jobID])
106107
if not result["OK"]:
107-
result["Value"] = (-1, "", result["Message"])
108+
result["Errno"] = DErrno.EWMSSTATUS
108109
return result
109110
jobStatus = result["Value"][jobID]
110111
self.log.verbose("The final status of the application/script is: ", jobStatus)
111112

112113
# Get job outputs
113114
result = workloadCE.getJobOutput("%s:::%s" % (jobID, stamp), os.path.abspath("."))
114115
if not result["OK"]:
115-
result["Value"] = (-1, "", result["Message"])
116+
result["Errno"] = DErrno.EWMSJMAN
116117
return result
117118
output, error = result["Value"]
118119

119-
# Clean job on the remote resource
120+
# Clean job in the remote resource
120121
if cleanRemoteJob:
121122
result = workloadCE.cleanJob(jobID)
122123
if not result["OK"]:
123-
result["Value"] = (-1, "", result["Message"])
124-
return result
124+
self.log.warn("Failed to clean the output remotely", result["Message"])
125125

126126
commandStatus = {"Done": 0, "Failed": -1, "Killed": -2}
127127
return S_OK((commandStatus[jobStatus], output, error))

0 commit comments

Comments
 (0)