13
13
14
14
from DIRAC import gLogger , gConfig , S_OK , S_ERROR
15
15
from DIRAC .Core .Security .ProxyInfo import getProxyInfo
16
+ from DIRAC .Core .Utilities import DErrno
16
17
from DIRAC .Core .Utilities .Decorators import deprecated
17
18
from DIRAC .Resources .Computing .ComputingElementFactory import ComputingElementFactory
18
19
from DIRAC .ConfigurationSystem .Client .Helpers .Resources import getQueue
@@ -63,7 +64,7 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
63
64
# Check whether CE parameters are set
64
65
result = self ._checkParameters ()
65
66
if not result ["OK" ]:
66
- result ["Value " ] = ( - 1 , "" , result [ "Message" ])
67
+ result ["Errno " ] = DErrno . ESECTION
67
68
return result
68
69
self .log .verbose (
69
70
"The command will be sent to" ,
@@ -73,7 +74,7 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
73
74
# Set up Application Queue
74
75
result = self ._setUpWorkloadCE (numberOfProcessors )
75
76
if not result ["OK" ]:
76
- result ["Value " ] = ( - 1 , "" , result [ "Message" ])
77
+ result ["Errno " ] = DErrno . ERESUNA
77
78
return result
78
79
workloadCE = result ["Value" ]
79
80
self .log .debug ("The CE interface has been set up" )
@@ -93,7 +94,7 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
93
94
# Submit the command as a job
94
95
result = workloadCE .submitJob (executable , workloadCE .proxy , inputs = inputs , outputs = outputs )
95
96
if not result ["OK" ]:
96
- result ["Value " ] = ( - 1 , "" , result [ "Message" ])
97
+ result ["Errno " ] = DErrno . EWMSSUBM
97
98
return result
98
99
jobID = result ["Value" ][0 ]
99
100
stamp = result ["PilotStampDict" ][jobID ]
@@ -104,24 +105,23 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
104
105
time .sleep (120 )
105
106
result = workloadCE .getJobStatus ([jobID ])
106
107
if not result ["OK" ]:
107
- result ["Value " ] = ( - 1 , "" , result [ "Message" ])
108
+ result ["Errno " ] = DErrno . EWMSSTATUS
108
109
return result
109
110
jobStatus = result ["Value" ][jobID ]
110
111
self .log .verbose ("The final status of the application/script is: " , jobStatus )
111
112
112
113
# Get job outputs
113
114
result = workloadCE .getJobOutput ("%s:::%s" % (jobID , stamp ), os .path .abspath ("." ))
114
115
if not result ["OK" ]:
115
- result ["Value " ] = ( - 1 , "" , result [ "Message" ])
116
+ result ["Errno " ] = DErrno . EWMSJMAN
116
117
return result
117
118
output , error = result ["Value" ]
118
119
119
- # Clean job on the remote resource
120
+ # Clean job in the remote resource
120
121
if cleanRemoteJob :
121
122
result = workloadCE .cleanJob (jobID )
122
123
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" ])
125
125
126
126
commandStatus = {"Done" : 0 , "Failed" : - 1 , "Killed" : - 2 }
127
127
return S_OK ((commandStatus [jobStatus ], output , error ))
0 commit comments