Skip to content

Commit

Permalink
always use My. to add ads to JDL. Fix dmwm#8919
Browse files Browse the repository at this point in the history
  • Loading branch information
belforte committed Feb 13, 2025
1 parent 93bc614 commit 95ae037
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/python/TaskWorker/Actions/DagmanSubmitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ def submitDirect(self, schedd, cmd, arg, dagJobJDL, task):
environmentString += " useHtcV2=True"
# Environment command in JDL requires proper quotes https://htcondor.readthedocs.io/en/latest/man-pages/condor_submit.html#environment
dagJobJDL["Environment"] = classad.quote(environmentString)
dagJobJDL['+CRAB_TaskLifetimeDays'] = str(TASKLIFETIME // 24 // 60 // 60)
dagJobJDL['+CRAB_TaskEndTime'] = str(int(task['tm_start_time']) + TASKLIFETIME)
dagJobJDL['My.CRAB_TaskLifetimeDays'] = str(TASKLIFETIME // 24 // 60 // 60)
dagJobJDL['My.CRAB_TaskEndTime'] = str(int(task['tm_start_time']) + TASKLIFETIME)
#For task management info see https://github.com/dmwm/CRABServer/issues/4681#issuecomment-302336451
dagJobJDL["LeaveJobInQueue"] = "True"
dagJobJDL["PeriodicHold"] = "time() > CRAB_TaskEndTime"
Expand Down
8 changes: 4 additions & 4 deletions src/python/TaskWorker/Actions/PreDAG.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,10 @@ def executeInternal(self, *args):
def submitSubdag(subdag, maxidle, maxpost, stage):
""" Submit a subdag
"""
subprocess.check_call(['condor_submit_dag', '-DoRecov', '-AutoRescue', '0', '-MaxPre', '20', '-MaxIdle', str(maxidle),
'-MaxPost', str(maxpost), '-insert_sub_file', 'subdag.jdl',
'-append', '+Environment = strcat(Environment," _CONDOR_DAGMAN_LOG={0}/{1}.dagman.out")'.format(os.getcwd(), subdag),
'-append', '+CRAB_DAGType = "{0}"'.format(stage.upper()), subdag])
subprocess.check_call(['condor_submit_dag', '-DoRecov', '-AutoRescue', '0', '-MaxPre', '20',
'-MaxIdle', str(maxidle), '-MaxPost', str(maxpost), '-insert_sub_file', 'subdag.jdl',
'-append', f'Environment = "_CONDOR_DAGMAN_LOG={os.getcwd()}/{subdag}.dagman.out"',
'-append', f'My.CRAB_DAGType = "{stage.upper()}"', subdag])

def adjustLumisForCompletion(self, task, unprocessed):
"""Sets the run, lumi information in the task information for the
Expand Down
34 changes: 17 additions & 17 deletions src/python/TaskWorker/Actions/PreJob.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ def alter_submit(self, crab_retry):
(e.g. MaxWallTimeMins, RequestMemory, RequestCores, JobPrio, DESIRED_SITES).
"""
## Start the Job.<job_id>.submit content with the CRAB_Retry.
new_submit_text = '+CRAB_Retry = %d\n' % (crab_retry)
new_submit_text = 'My.CRAB_Retry = %d\n' % (crab_retry)
msg = "Setting CRAB_Retry = %s" % (crab_retry)
self.logger.info(msg)
## Add job and postjob log URLs
job_retry = "%s.%s" % (self.job_id, crab_retry)
new_submit_text += '+CRAB_JobLogURL = %s\n' % classad.quote(os.path.join(self.userWebDirPrx, "job_out."+job_retry+".txt"))
new_submit_text += '+CRAB_PostJobLogURL = %s\n' % classad.quote(os.path.join(self.userWebDirPrx, "postjob."+job_retry+".txt"))
new_submit_text += 'My.CRAB_JobLogURL = %s\n' % classad.quote(os.path.join(self.userWebDirPrx, "job_out."+job_retry+".txt"))
new_submit_text += 'My.CRAB_PostJobLogURL = %s\n' % classad.quote(os.path.join(self.userWebDirPrx, "postjob."+job_retry+".txt"))
## For the parameters that can be overwritten at each manual job resubmission,
## read them from the task ad, unless there is resubmission information there
## and this job is not one that has to be resubmitted, in which case we should
Expand Down Expand Up @@ -318,11 +318,11 @@ def alter_submit(self, crab_retry):
## Add the resubmission parameters to the Job.<job_id>.submit content.
savelogs = 0 if self.stage == 'probe' else self.task_ad.lookup('CRAB_SaveLogsFlag')
saveoutputs = 0 if self.stage == 'probe' else self.task_ad.lookup('CRAB_TransferOutputs')
new_submit_text += '+CRAB_TransferOutputs = {0}\n+CRAB_SaveLogsFlag = {1}\n'.format(saveoutputs, savelogs)
new_submit_text += 'My.CRAB_TransferOutputs = {0}\n+CRAB_SaveLogsFlag = {1}\n'.format(saveoutputs, savelogs)
if maxjobruntime is not None:
new_submit_text += '+EstimatedWallTimeMins = %s\n' % str(maxjobruntime)
new_submit_text += '+MaxWallTimeMinsRun = %s\n' % str(maxjobruntime) # how long it can run
new_submit_text += '+MaxWallTimeMins = %s\n' % str(maxjobruntime) # how long a slot can it match to
new_submit_text += 'My.EstimatedWallTimeMins = %s\n' % str(maxjobruntime)
new_submit_text += 'My.MaxWallTimeMinsRun = %s\n' % str(maxjobruntime) # how long it can run
new_submit_text += 'My.MaxWallTimeMins = %s\n' % str(maxjobruntime) # how long a slot can it match to
# no plus sign for next 3 attributes, since those are Condor standard ones
if maxmemory is not None:
new_submit_text += 'RequestMemory = %s\n' % (str(maxmemory))
Expand All @@ -335,15 +335,15 @@ def alter_submit(self, crab_retry):
pre_job_prio = 1
if int(self.job_id.split('-')[0]) <= 5:
pre_job_prio = 0
new_submit_text += '+PreJobPrio1 = %d\n' % pre_job_prio
new_submit_text += 'My.PreJobPrio1 = %d\n' % pre_job_prio

## The schedd will use PostJobPrio1 as a secondary job-priority sorting key: it
## will first run jobs by JobPrio; then, for jobs with the same JobPrio, it will
## run the job with the higher PostJobPrio1.
new_submit_text += '+PostJobPrio1 = -%s\n' % str(self.task_ad.lookup('QDate'))
new_submit_text += 'My.PostJobPrio1 = -%s\n' % str(self.task_ad.lookup('QDate'))

## Order retries before all other jobs in this task
new_submit_text += '+PostJobPrio2 = %d\n' % crab_retry
new_submit_text += 'My.PostJobPrio2 = %d\n' % crab_retry

## Add the site black- and whitelists and the DESIRED_SITES to the
## Job.<job_id>.submit content.
Expand All @@ -367,7 +367,7 @@ def redo_sites(self, new_submit_text, crab_retry, use_resubmit_info):
automatic_siteblacklist = self.calculate_blacklist()
if automatic_siteblacklist:
self.task_ad['CRAB_SiteAutomaticBlacklist'] = automatic_siteblacklist
new_submit_text += '+CRAB_SiteAutomaticBlacklist = %s\n' % str(self.task_ad.lookup('CRAB_SiteAutomaticBlacklist'))
new_submit_text += 'My.CRAB_SiteAutomaticBlacklist = %s\n' % str(self.task_ad.lookup('CRAB_SiteAutomaticBlacklist'))
## Get the site black- and whitelists either from the task ad or from
## self.resubmit_info.
siteblacklist = set()
Expand All @@ -393,13 +393,13 @@ def redo_sites(self, new_submit_text, crab_retry, use_resubmit_info):
## Add the current site black- and whitelists to the Job.<job_id>.submit
## content.
if siteblacklist:
new_submit_text += '+CRAB_SiteBlacklist = {"%s"}\n' % ('", "'.join(siteblacklist))
new_submit_text += 'My.CRAB_SiteBlacklist = {"%s"}\n' % ('", "'.join(siteblacklist))
else:
new_submit_text += '+CRAB_SiteBlacklist = {}\n'
new_submit_text += 'My.CRAB_SiteBlacklist = {}\n'
if sitewhitelist:
new_submit_text += '+CRAB_SiteWhitelist = {"%s"}\n' % ('", "'.join(sitewhitelist))
new_submit_text += 'My.CRAB_SiteWhitelist = {"%s"}\n' % ('", "'.join(sitewhitelist))
else:
new_submit_text += '+CRAB_SiteWhitelist = {}\n'
new_submit_text += 'My.CRAB_SiteWhitelist = {}\n'
## Get the list of available sites (the sites where this job could run).
with open("site.ad.json", 'r', encoding='utf-8') as fd:
site_info = json.load(fd)
Expand All @@ -425,8 +425,8 @@ def redo_sites(self, new_submit_text, crab_retry, use_resubmit_info):
datasites = list(datasites)
datasites.sort()
## Add DESIRED_SITES to the Job.<job_id>.submit content.
new_submit_text = '+DESIRED_SITES="%s"\n%s' % (",".join(available), new_submit_text)
new_submit_text = '+DESIRED_CMSDataLocations="%s"\n%s' % (",".join(datasites), new_submit_text)
new_submit_text = 'My.DESIRED_SITES="%s"\n%s' % (",".join(available), new_submit_text)
new_submit_text = 'My.DESIRED_CMSDataLocations="%s"\n%s' % (",".join(datasites), new_submit_text)
return new_submit_text

def touch_logs(self, crab_retry):
Expand Down
4 changes: 2 additions & 2 deletions test/makeTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@
changeDict = {'param': name, 'section': 'Site',
'value': "['T1_IT*','T1_DE*','T1_ES*','T1_FR*','T1_RU*','T1_UK*','T2_*','T3_*']"}
confChangesList.append(changeDict)
changeDict = {'section':'Debug', 'param': 'extraJDL', 'value': "['+CMS_ALLOW_OVERFLOW=False']"}
changeDict = {'section':'Debug', 'param': 'extraJDL', 'value': "['My.CMS_ALLOW_OVERFLOW=False']"}
confChangesList.append(changeDict)
testSubmitScript = dummyTestScript
validationScript = """
Expand Down Expand Up @@ -674,7 +674,7 @@

# extraJDL
name = 'extraJDL'
changeDict = {'param': name, 'value': "['+CMS_ALLOW_OVERFLOW=False', '+CRAB_StageoutPolicy=\"remote\"']", 'section': 'Debug'}
changeDict = {'param': name, 'value': "['My.CMS_ALLOW_OVERFLOW=False', 'My.CRAB_StageoutPolicy=\"remote\"']", 'section': 'Debug'}
confChangesList = [changeDict]
testSubmitScript = dummyTestScript
validationScript = """
Expand Down

0 comments on commit 95ae037

Please # to comment.