Skip to content

Commit b79e367

Browse files
authored
Merge pull request DIRACGrid#5443 from chrisburr/rel-v7r2-merge-2021-10-01
[v7r2] Merge party for rel-v7r2
2 parents e3160e4 + 94bbe96 commit b79e367

File tree

5 files changed

+27
-17
lines changed

5 files changed

+27
-17
lines changed

src/DIRAC/Core/Utilities/List.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def getChunk(aList, chunkSize):
111111
process( chunk )
112112
113113
"""
114+
chunkSize = int(chunkSize)
114115
for i in range(0, len(aList), chunkSize):
115116
yield aList[i:i + chunkSize]
116117

src/DIRAC/DataManagementSystem/Client/DataManager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
from __future__ import print_function
1414

1515
# # imports
16-
import six
1716
from datetime import datetime, timedelta
1817
import fnmatch
1918
import os
2019
import time
2120
import errno
21+
import six
2222

2323
# # from DIRAC
2424
import DIRAC
@@ -187,7 +187,6 @@ def __cleanDirectory(self, folder):
187187
return res
188188

189189
# create a list of folders so that empty folders are also deleted
190-
listOfFolders = []
191190
areDirs = self.fileCatalog.isDirectory(res['Value'])
192191
if not areDirs['OK']:
193192
return areDirs

src/DIRAC/RequestManagementSystem/private/RequestTask.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
# # imports
3030
import os
3131
import time
32+
import datetime
3233

3334
# # from DIRAC
3435
from DIRAC import gLogger, S_OK, S_ERROR, gConfig
36+
from DIRAC.Core.Utilities import DErrno
3537
from DIRAC.FrameworkSystem.Client.MonitoringClient import gMonitor
3638
from DIRAC.RequestManagementSystem.Client.ReqClient import ReqClient
3739
from DIRAC.RequestManagementSystem.Client.Request import Request
@@ -55,15 +57,8 @@ class RequestTask(object):
5557
request's processing task
5658
"""
5759

58-
def __init__(
59-
self,
60-
requestJSON,
61-
handlersDict,
62-
csPath,
63-
agentName,
64-
standalone=False,
65-
requestClient=None,
66-
rmsMonitoring=False):
60+
def __init__(self, requestJSON, handlersDict, csPath, agentName,
61+
standalone=False, requestClient=None, rmsMonitoring=False):
6762
"""c'tor
6863
6964
:param self: self reference
@@ -190,6 +185,7 @@ def setupProxy(self):
190185

191186
@staticmethod
192187
def getPluginName(pluginPath):
188+
""" return plugin name """
193189
if not pluginPath:
194190
return ''
195191
if "/" in pluginPath:
@@ -282,19 +278,25 @@ def __call__(self):
282278
# # setup proxy for request owner
283279
setupProxy = self.setupProxy()
284280
if not setupProxy["OK"]:
281+
userSuspended = "User is currently suspended"
285282
self.request.Error = setupProxy["Message"]
286-
if 'has no proxy registered' in setupProxy["Message"]:
283+
# In case the user does not have proxy
284+
if DErrno.cmpError(setupProxy, DErrno.EPROXYFIND):
287285
self.log.error('Error setting proxy. Request set to Failed:', setupProxy["Message"])
288286
# If user is no longer registered, fail the request
289287
for operation in self.request:
290288
for opFile in operation:
291289
opFile.Status = 'Failed'
292290
operation.Status = 'Failed'
291+
elif userSuspended in setupProxy['Message']:
292+
# If user is suspended, wait for a long time
293+
self.request.delayNextExecution(6 * 60)
294+
self.request.Error = userSuspended
295+
self.log.error("Error setting proxy: " + userSuspended, self.request.OwnerDN)
293296
else:
294297
self.log.error("Error setting proxy", setupProxy["Message"])
295298
return S_OK(self.request)
296299
shifter = setupProxy["Value"]["Shifter"]
297-
proxyFile = setupProxy["Value"]["ProxyFile"]
298300

299301
error = None
300302

src/DIRAC/Resources/MessageQueue/StompMQConnector.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ def put(self, message, parameters=None):
158158
destination = parameters.get('destination', '')
159159

160160
try:
161-
self.connection.send(body=json.dumps(message), destination=destination)
161+
try:
162+
self.connection.send(body=json.dumps(message), destination=destination)
163+
except stomp.exception.StompException:
164+
self.connect()
165+
self.connection.send(body=json.dumps(message), destination=destination)
162166
except Exception as e:
163167
log.debug("Failed to send message", repr(e))
164168
return S_ERROR(EMQUKN, 'Failed to send message: %s' % repr(e))

src/DIRAC/WorkloadManagementSystem/Executor/JobSanity.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def optimizeJob(self, jid, jobState):
6868
return result
6969
self.jobLog.info("Found LFNs", result['Value'])
7070

71-
# Input Sandbox uploaded check
71+
# Input Sandbox check
7272
if self.ex_getOption('InputSandboxCheck', True):
7373
result = self.checkInputSandbox(jobState, manifest)
7474
if not result['OK']:
@@ -141,9 +141,13 @@ def checkInputSandbox(self, jobState, manifest):
141141
isbList = manifest.getOption('InputSandbox', [])
142142
sbsToAssign = []
143143
for isb in isbList:
144-
if isb.find("SB:") == 0:
145-
self.jobLog.info("Found a sandbox", isb)
144+
if isb.startswith("SB:"):
145+
self.jobLog.debug("Found a sandbox", isb)
146146
sbsToAssign.append((isb, "Input"))
147+
if isb.startswith("LFN:"):
148+
self.jobLog.debug("Found a LFN sandbox", isb)
149+
if isb[4] != '/': # the LFN does not start with /
150+
return S_ERROR("LFNs should always start with '/'")
147151
numSBsToAssign = len(sbsToAssign)
148152
if not numSBsToAssign:
149153
return S_OK(0)

0 commit comments

Comments
 (0)