From 95ae0374f5681055a320751236239159f71b5d0e Mon Sep 17 00:00:00 2001 From: Stefano Belforte Date: Thu, 13 Feb 2025 10:03:55 +0100 Subject: [PATCH] always use My. to add ads to JDL. Fix #8919 --- .../TaskWorker/Actions/DagmanSubmitter.py | 4 +-- src/python/TaskWorker/Actions/PreDAG.py | 8 ++--- src/python/TaskWorker/Actions/PreJob.py | 34 +++++++++---------- test/makeTests.py | 4 +-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/python/TaskWorker/Actions/DagmanSubmitter.py b/src/python/TaskWorker/Actions/DagmanSubmitter.py index 640f523535..81cc564cc4 100644 --- a/src/python/TaskWorker/Actions/DagmanSubmitter.py +++ b/src/python/TaskWorker/Actions/DagmanSubmitter.py @@ -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" diff --git a/src/python/TaskWorker/Actions/PreDAG.py b/src/python/TaskWorker/Actions/PreDAG.py index de58d55ede..a3cba8e3af 100644 --- a/src/python/TaskWorker/Actions/PreDAG.py +++ b/src/python/TaskWorker/Actions/PreDAG.py @@ -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 diff --git a/src/python/TaskWorker/Actions/PreJob.py b/src/python/TaskWorker/Actions/PreJob.py index 3cec9466ae..6f29dd3d47 100644 --- a/src/python/TaskWorker/Actions/PreJob.py +++ b/src/python/TaskWorker/Actions/PreJob.py @@ -245,13 +245,13 @@ def alter_submit(self, crab_retry): (e.g. MaxWallTimeMins, RequestMemory, RequestCores, JobPrio, DESIRED_SITES). """ ## Start the Job..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 @@ -318,11 +318,11 @@ def alter_submit(self, crab_retry): ## Add the resubmission parameters to the Job..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)) @@ -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..submit content. @@ -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() @@ -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..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) @@ -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..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): diff --git a/test/makeTests.py b/test/makeTests.py index 2441a2e869..120fff92ff 100644 --- a/test/makeTests.py +++ b/test/makeTests.py @@ -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 = """ @@ -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 = """