@@ -65,8 +65,7 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
65
65
self .log .verbose ("Command to submit:" , command )
66
66
67
67
# Check whether CE parameters are set
68
- result = self ._checkParameters ()
69
- if not result ["OK" ]:
68
+ if not (result := self ._checkParameters ())["OK" ]:
70
69
result ["Errno" ] = DErrno .ESECTION
71
70
return result
72
71
self .log .info (
@@ -75,8 +74,7 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
75
74
)
76
75
77
76
# Set up Application Queue
78
- result = self ._setUpWorkloadCE (numberOfProcessors )
79
- if not result ["OK" ]:
77
+ if not (result := self ._setUpWorkloadCE (numberOfProcessors ))["OK" ]:
80
78
result ["Errno" ] = DErrno .ERESUNA
81
79
return result
82
80
workloadCE = result ["Value" ]
@@ -94,8 +92,9 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
94
92
outputs = ["/" ]
95
93
96
94
# Submit the command as a job
97
- result = workloadCE .submitJob (self .executable , workloadCE .proxy , inputs = inputs , outputs = outputs )
98
- if not result ["OK" ]:
95
+ if not (result := workloadCE .submitJob (self .executable , workloadCE .proxy , inputs = inputs , outputs = outputs ))[
96
+ "OK"
97
+ ]:
99
98
result ["Errno" ] = DErrno .EWMSSUBM
100
99
return result
101
100
jobID = result ["Value" ][0 ]
@@ -116,24 +115,21 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
116
115
117
116
# Get job outputs
118
117
self .log .info ("Getting the outputs of the command..." )
119
- result = workloadCE .getJobOutput (f"{ jobID } :::{ stamp } " , os .path .abspath ("." ))
120
- if not result ["OK" ]:
118
+ if not (result := workloadCE .getJobOutput (f"{ jobID } :::{ stamp } " , os .path .abspath ("." )))["OK" ]:
121
119
result ["Errno" ] = DErrno .EWMSJMAN
122
120
return result
123
121
output , error = result ["Value" ]
124
122
125
123
# Make sure the output is correct
126
124
self .log .info ("Checking the integrity of the outputs..." )
127
- result = self ._checkOutputIntegrity ("." )
128
- if not result ["OK" ]:
125
+ if not (result := self ._checkOutputIntegrity ("." ))["OK" ]:
129
126
result ["Errno" ] = DErrno .EWMSJMAN
130
127
return result
131
128
self .log .info ("The output has been retrieved and declared complete" )
132
129
133
130
# Clean job in the remote resource
134
131
if cleanRemoteJob :
135
- result = workloadCE .cleanJob (jobID )
136
- if not result ["OK" ]:
132
+ if not (result := workloadCE .cleanJob (jobID ))["OK" ]:
137
133
self .log .warn ("Failed to clean the output remotely" , result ["Message" ])
138
134
self .log .info ("The job has been remotely removed" )
139
135
@@ -261,7 +257,6 @@ def _checkOutputIntegrity(self, workingDirectory):
261
257
while chunk := f .read (128 * hash .block_size ):
262
258
hash .update (chunk )
263
259
if checkSum != hash .hexdigest ():
264
- print (hash .hexdigest ())
265
260
return S_ERROR (f"{ localOutput } is corrupted" )
266
261
267
262
return S_OK ()
0 commit comments