@@ -49,6 +49,11 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
49
49
f"site { self ._workloadSite } , CE { self ._workloadCE } , queue { self ._workloadQueue } " ,
50
50
)
51
51
52
+ # The CE interface needs to drop the token section from the proxy file to interact with the CE
53
+ # So we save the current proxy file location (which likely contains the DiracX token)
54
+ # and we will restore it at the end of the job
55
+ originalProxyLocation = os .environ .get ("X509_USER_PROXY" )
56
+
52
57
# Set up Application Queue
53
58
if not (result := self ._setUpWorkloadCE (numberOfProcessors ))["OK" ]:
54
59
result ["Errno" ] = DErrno .ERESUNA
@@ -87,6 +92,8 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
87
92
time .sleep (timeBetweenRetries )
88
93
else :
89
94
result ["Errno" ] = DErrno .EWMSSUBM
95
+ # Restore the original proxy location
96
+ os .environ ["X509_USER_PROXY" ] = originalProxyLocation
90
97
return result
91
98
92
99
jobID = result ["Value" ][0 ]
@@ -107,6 +114,8 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
107
114
time .sleep (timeBetweenRetries )
108
115
else :
109
116
result ["Errno" ] = DErrno .EWMSSTATUS
117
+ # Restore the original proxy location
118
+ os .environ ["X509_USER_PROXY" ] = originalProxyLocation
110
119
return result
111
120
112
121
jobStatus = result ["Value" ][jobID ]
@@ -123,6 +132,8 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
123
132
time .sleep (timeBetweenRetries )
124
133
else :
125
134
result ["Errno" ] = DErrno .EWMSJMAN
135
+ # Restore the original proxy location
136
+ os .environ ["X509_USER_PROXY" ] = originalProxyLocation
126
137
return result
127
138
128
139
output , error = result ["Value" ]
@@ -131,6 +142,8 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
131
142
self .log .info ("Checking the integrity of the outputs..." )
132
143
if not (result := self ._checkOutputIntegrity ("." ))["OK" ]:
133
144
result ["Errno" ] = DErrno .EWMSJMAN
145
+ # Restore the original proxy location
146
+ os .environ ["X509_USER_PROXY" ] = originalProxyLocation
134
147
return result
135
148
self .log .info ("The output has been retrieved and declared complete" )
136
149
@@ -146,6 +159,9 @@ def execute(self, command, workingDirectory=".", numberOfProcessors=1, cleanRemo
146
159
self .log .warn ("Failed to clean the output remotely" , result ["Message" ])
147
160
self .log .info ("The job has been remotely removed" )
148
161
162
+ # Restore the original proxy location
163
+ os .environ ["X509_USER_PROXY" ] = originalProxyLocation
164
+
149
165
commandStatus = {"Done" : 0 , "Failed" : - 1 , "Killed" : - 2 }
150
166
return S_OK ((commandStatus [jobStatus ], output , error ))
151
167
0 commit comments