Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: nd280 updates for 2024/2025 #2393

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

NickHastings
Copy link
Contributor

This branch has two minor feature updates for ND280 processing and some code cleanups.

- Remove obsolete _GUIPrefs and _GUIAdvancedPrefs
- Indenting, imports, and other style updates
@NickHastings NickHastings temporarily deployed to Integrate Pull Request January 8, 2025 00:56 — with GitHub Actions Inactive
@NickHastings
Copy link
Contributor Author

Had a quick look but I don't see what needs to be done to get the failing checks to pass. Any hints?

@egede
Copy link
Member

egede commented Jan 13, 2025

@NickHastings You are seeing a weakness of our CI. If the PR branch of your fork doesn't allow for the Ganga developers to edit (a box that you can tick or not), then the PEP8 compliance testing will fail. As all your changes are within the nd280 part, I think it is really up to you if you want to fix the PEP8 compliance or not. I suggest that we just merge this PR without it.

Comment on lines 156 to 162
if self.container:
bs = ' '.join([f'--bind {b}' for b in self.binds])
script += 'AM_IN_CONTAINER="$1"\n'
script += 'if [ "$AM_IN_CONTAINER" = "" ]; then\n'
script += f' exec apptainer exec {bs} {self.container} {self._scriptname} "1"\n'
script += 'fi\n'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ganga has a general support for running jobs inside a container. It will be more flexible than what you implement here. I copy the documentation of the Apptainer class here for reference.

class Apptainer(GPIProxyObject)
 |  Apptainer(*args, **kwds)
 |  
 |      The Apptainer class can be used for either Apptainer or Docker images.
 |      It requires that apptainer is installed on the worker node.
 |  
 |      For Apptainer images you provide the image name and tag from Apptainer
 |      hub like
 |  
 |        j=Job()
 |        j.application=Executable(exe=File('my/full/path/to/executable'))
 |        j.virtualization = Apptainer("shub://image:tag")
 |  
 |      Notice how the executable is given as a `File` object. This ensures that it
 |      is copied to the working directory and thus will be accessible inside the
 |      container.
 |  
 |      The container can also be provided as a Docker image from a repository. The
 |      default repository is Docker hub.
 |  
 |        j.virtualization = Apptainer("docker://gitlab-registry.cern.ch/lhcb-core/lbdocker/centos7-build:v3")
 |  
 |        j.virtualization = Apptainer("docker://fedora:latest")
 |  
 |      Another option is to provide a `GangaFile` Object which points to a
 |      apptainer file. In that case the apptainer image file will be copied to
 |      the worker node. The first example is with an image located on some shared
 |      disk. This will be effective for running on a local backend or a batch
 |      system with a shared disk system.
 |  
 |        imagefile = SharedFile('myimage.sif', locations=['/my/full/path/myimage.sif'])
 |        j.virtualization = Apptainer(image= imagefile)
 |  
 |      while a second example is with an image located in the Dirac Storage
 |      Element. This will be effective when using the Dirac backend.
 |  
 |        imagefile = DiracFile('myimage.sif', lfn=['/some/lfn/path'])
 |        j.virtualization = Apptainer(image= imagefile)
 |  
 |      If the image is a private image, the username and password of the deploy
 |      token can be given like the example below. Look inside Gitlab setting for
 |      how to set this up. The token will only need access to the images and
 |      nothing else.
 |  
 |        j.virtualization.tokenuser = 'gitlab+deploy-token-123'
 |        j.virtualization.tokenpassword = 'gftrh84dgel-245^ghHH'
 |  
 |      Directories can be mounted from the host to the container using key-value
 |      pairs to the mounts option. If the directory is not available on the host, a
 |      warning will be written to stderr of the job and no mount will be attempted.
 |  
 |        j.virtualization.mounts = {'/cvmfs':'/cvmfs'}
 |  
 |      By default the container is started in apptainer with the `--nohome`
 |      option. Extra options can be provided through the `options` attribute. See
 |      the Apptainer documentation for what is possible.
 |  
 |      If the apptainer binary is not available in the PATH on the remote node - or has a different name,
 |      it is possible to give the name of it like
 |  
 |        j.virtualization.binary='/cvmfs/oasis.opensciencegrid.org/mis/apptainer/current/bin/apptainer'
 |  

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@egede thanks for the info about the Apptainer class. I knew there would be a cleaner way to do this but I needed to get something up and running on a very short timescale, and my little hack that you see above fitted in with that. I'll back that commit out of the PR shortly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If what you want is to run inside a centos7 container for a Grid job (or in fact anywhere with /cvmfs access), there is a very efficient way of doing this. For a given job,

j.virtualization = Apptainer()
j.virtualization.image = '/cvmfs/cernvm-prod.cern.ch/cvm4'

is all that is required. It takes advantage of that this cvmfs location has an unpacked container image. Read the documentation for some more information about how this works.

@NickHastings NickHastings deployed to Integrate Pull Request January 15, 2025 07:40 — with GitHub Actions Active
@NickHastings NickHastings changed the title nd280 updates for 2024/2025 WIP: nd280 updates for 2024/2025 Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants