Skip to content

Commit

Permalink
add container support (#379)
Browse files Browse the repository at this point in the history
* add container support

* fix syntax error
  • Loading branch information
dsschult authored Oct 4, 2024
1 parent cc8f5e3 commit b8fa632
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions iceprod/server/plugins/condor.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ def __init__(self, cfg: IceProdConfig, submit_dir: Path, credentials_dir: Path):
self.transfer_plugins = self.condor_plugin_discovery()
logger.info('transfer plugins installed: %s', list(self.transfer_plugins.keys()))

self.default_container = self.cfg['queue'].get('default_container', 'Undefined')

def condor_plugin_discovery(self):
"""Find all available HTCondor transfer plugins, and copy them to the submit_dir"""
src_dir = importlib.resources.files('iceprod.server')/'data'/'condor_transfer_plugins'
Expand Down Expand Up @@ -290,6 +292,7 @@ async def submit(self, tasks: list[Task], jel: Path):
+OriginalTime = $(time)
+TargetTime = (!isUndefined(Target.PYGLIDEIN_TIME_TO_LIVE) ? Target.PYGLIDEIN_TIME_TO_LIVE : Target.TimeToLive)
requirements = $($(reqs))
+SingularityImage= $(container)
transfer_plugins = {transfer_plugin_str}
when_to_transfer_output = ON_EXIT
Expand Down Expand Up @@ -327,6 +330,10 @@ async def submit(self, tasks: list[Task], jel: Path):
ads.update(self.condor_outfiles(s.outfiles))
ads.update(self.condor_resource_reqs(task))

container = task.get_task_config().get('container', self.default_container)
if container != 'Undefined':
container = f'"{container}"'

reqs2 = reqs
for k,v in tasks[0].get_task_config()['batchsys'].get('condor', {}).items():
if k.lower() == 'requirements':
Expand All @@ -353,6 +360,7 @@ async def submit(self, tasks: list[Task], jel: Path):
'disk': f'{ads["request_disk"]}',
'time': f'{ads["+OriginalTime"]}',
'reqs': f'reqs{task.task_id}',
'container': f'{container}',
'prec': f'{ads["PreCmd"]}',
'prea': f'{ads["PreArguments"]}',
'infiles': f'"{";".join(ads["transfer_input_files"])}"',
Expand Down

0 comments on commit b8fa632

Please sign in to comment.