Skip to content

Commit

Permalink
custom attributs in JDL need classad.quote. Fix #8471 (#8476)
Browse files Browse the repository at this point in the history
  • Loading branch information
belforte authored Jun 4, 2024
1 parent 20d4f90 commit 2023176
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/python/TaskWorker/Actions/DagmanSubmitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

## These are the CRAB attributes that we want to add to the job class ad when
## using the submitDirect() method.
# SB: do we really need all of this ? Most of them are in Job.submit created by
# DagmanCreator and are not needed to submit/run the DagMan.
SUBMIT_INFO = [ \
('+CRAB_ReqName', 'requestname'),
('+CRAB_Workflow', 'workflow'),
Expand Down Expand Up @@ -93,7 +95,7 @@ def addCRABInfoToJobJDL(jdl, info):
"""
for adName, dictName in SUBMIT_INFO:
if dictName in info and (info[dictName] is not None):
jdl[adName] = info[dictName]
jdl[adName] = classad.quote(info[dictName])


class ScheddStats(dict):
Expand Down Expand Up @@ -471,7 +473,7 @@ def submitDirect(self, schedd, cmd, arg, info): #pylint: disable=R0201

# NOTE: Changes here must be synchronized with the job_submit in DagmanCreator.py in CAFTaskWorker
jobJDL["+CRAB_Attempt"] = 0
jobJDL["+CMS_SubmissionTool"] = "CRAB"
jobJDL["+CMS_SubmissionTool"] = classad.quote("CRAB")
# We switched from local to scheduler universe. Why? It seems there's no way in the
# local universe to change the hold signal at runtime. That's fairly important for our
# resubmit implementation.
Expand All @@ -485,10 +487,10 @@ def submitDirect(self, schedd, cmd, arg, info): #pylint: disable=R0201
environmentString += " " + " ".join(info['additional_environment_options'].split(';'))
# Environment command in JDL requires proper quotes https://htcondor.readthedocs.io/en/latest/man-pages/condor_submit.html#environment
jobJDL["Environment"] = classad.quote(environmentString)
jobJDL["+RemoteCondorSetup"] = info['remote_condor_setup']
jobJDL["+CRAB_TaskSubmitTime"] = info['start_time']
jobJDL['+CRAB_TaskLifetimeDays'] = TASKLIFETIME // 24 // 60 // 60
jobJDL['+CRAB_TaskEndTime'] = int(info['start_time']) + TASKLIFETIME
jobJDL["+RemoteCondorSetup"] = classad.quote(info['remote_condor_setup'])
jobJDL["+CRAB_TaskSubmitTime"] = classad.quote(info['start_time'])
jobJDL['+CRAB_TaskLifetimeDays'] = classad.quote(TASKLIFETIME // 24 // 60 // 60)
jobJDL['+CRAB_TaskEndTime'] = classad.quote(int(info['start_time']) + TASKLIFETIME)
#For task management info see https://github.com/dmwm/CRABServer/issues/4681#issuecomment-302336451
jobJDL["LeaveJobInQueue"] = "True"
jobJDL["PeriodicHold"] = "time() > CRAB_TaskEndTime"
Expand All @@ -507,7 +509,7 @@ def submitDirect(self, schedd, cmd, arg, info): #pylint: disable=R0201
with open('subdag.jdl', 'w', encoding='utf-8') as fd:
print(subdagJDL, file=fd)

jobJDL["+TaskType"] = "ROOT"
jobJDL["+TaskType"] = classad.quote("ROOT")
jobJDL["output"] = os.path.join(info['scratch'], "request.out")
jobJDL["error"] = os.path.join(info['scratch'], "request.err")
jobJDL["Cmd"] = cmd
Expand Down

0 comments on commit 2023176

Please sign in to comment.