Skip to content

Commit

Permalink
Feature: option to use containers for ND280 RDP
Browse files Browse the repository at this point in the history
  • Loading branch information
NickHastings committed Jan 21, 2025
1 parent 9fe6086 commit a39f32c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ganga/GangaND280/ND280Control/runND280RDP.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
from GangaCore.GPIDev.Adapters.IPrepareApp import IPrepareApp
from GangaCore.GPIDev.Adapters.IRuntimeHandler import IRuntimeHandler
from GangaCore.GPIDev.Lib.File import FileBuffer
from GangaCore.GPIDev.Lib.File.MassStorageFile import MassStorageFile, SharedFile
from GangaCore.GPIDev.Schema import Schema, SimpleItem, Version
from GangaCore.Utility.Config import getConfig
from GangaCore.Utility.files import expandfilename
from GangaCore.GPIDev.Adapters.ApplicationRuntimeHandlers import allHandlers
from GangaCore.Lib.Virtualization import Apptainer
from . import ND280Configs

shared_path = os.path.join(
Expand Down Expand Up @@ -75,6 +77,16 @@ class runND280RDP(IPrepareApp):
comparable=1,
doc='Location of shared resources. Presence of this attribute implies the application has been prepared.',
),
'container': SimpleItem(
defvalue=None, doc='Path to container', typelist=['type(None)', 'str']
),
'mounts': SimpleItem(
defvalue=[],
doc='Container paths to mount',
typelist=['str'],
sequence=1,
strict_sequence=0,
),
},
)
_category = 'applications'
Expand All @@ -88,6 +100,11 @@ def configure(self, masterappconfig):
args = convertIntToStringArgs(self.args)

job = self.getJobObject()
if self.container:
job.virtualization = Apptainer(image=self.container)

if len(self.mounts) > 0:
job.virtualization.mounts = {mount: mount for mount in self.mounts}

if self.cmtsetup == []:
raise ApplicationConfigurationError('No cmt setup script given.')
Expand Down

0 comments on commit a39f32c

Please sign in to comment.