diff --git a/deploy.py b/deploy.py index c19229310a28df0b637da10cb0548250ee61ba62..2c838b60898ff7bff027412b13b811227ec86ff0 100755 --- a/deploy.py +++ b/deploy.py @@ -29,9 +29,7 @@ PROGRAMS = ['eic-shell', 'ipython'] ## URL for the current container (git tag will be filled in by the script) -CONTAINER_URL = r'https://eicweb.phy.anl.gov/{group}/{project}/-/jobs/artifacts/{version}/raw/build/{img}.sif?job={img}_singularity' - -CONTAINER_ENV=r'''source /etc/profile''' +CONTAINER_URL = r'https://eicweb.phy.anl.gov/{group}/{project}/-/jobs/artifacts/{version}/raw/build/{img}.sif?job=release_singularity' ## Singularity bind directive BIND_DIRECTIVE= '-B {0}:{0}' @@ -66,10 +64,13 @@ if __name__ == "__main__": dest='local', help='Local deploy, will not install the modulefiles (you will have to run' 'the launchers scripts from their relative paths).') - parser.add_argument( - '--install-builder', - dest='builder', - help='(opt.) Install fat builder image, instead of normal slim image') + ## deprecated, we should just make sure the release image is good enough + ## builder singularity image will most likely be removed from the CI + ## in a future release + #parser.add_argument( + #'--install-builder', + #dest='builder', + #help='(opt.) Install fat builder image, instead of normal slim image') args = parser.parse_args() @@ -119,8 +120,9 @@ if __name__ == "__main__": ## Get the container ## We want to slightly modify our version specifier: if it leads with a 'v' drop the v img = IMAGE_ROOT - if args.builder: - img += "_builder" + ## Builder SIF is not built anymore, deprecated + #if args.builder: + #img += "_builder" container = '{}/{}.sif.{}'.format(libdir, img, version) if not os.path.exists(container) or args.force: url = CONTAINER_URL.format(group=GROUP_NAME, project=PROJECT_NAME, @@ -145,8 +147,6 @@ if __name__ == "__main__": exe = prog[1] make_launcher(app, container, bindir, bind=bind_directive, - libexecdir=libexecdir, - exe=exe, - env=CONTAINER_ENV) + exe=exe) print('Container deployment successful!') diff --git a/install/launcher.py b/install/launcher.py index 00742a6262502cdb365bafd912dbc8604358a1e8..535ffcf6c59e6bb4d6396d42c0914a6ec4c110ed 100644 --- a/install/launcher.py +++ b/install/launcher.py @@ -3,9 +3,9 @@ ''' Generic launcher script to launch applications in this container. -The launcher script fires off an auxilary wrapper script in the container, -responsible to correctly setup the environment and then launch the application -of choice. +The launcher script calls the desired executable from the singularity image. +As the new images have the environment properly setup, we can accomplish this +without using any wrapper scripts. Authors: - Whitney Armstrong <warmstrong@anl.gov> @@ -32,37 +32,9 @@ fi ## Fire off the application wrapper if [ ${{piped_args}} ] ; then - echo -e ${{piped_args}} | singularity exec {bind} {container} {wrapper} $@ + echo -e ${{piped_args}} | singularity exec {bind} {container} {exe} $@ else - singularity exec {bind} {container} {wrapper} $@ -fi -''' - -## Wrapper script called from within the container that loads the propper environment and -## to then actually call our app -_WRAPPER='''#!/usr/bin/env bash - -## setup container environment -{env} - -## Boilerplate to make pipes work -piped_args= -if [ -p /dev/stdin ]; then - # If we want to read the input line by line - while IFS= read line; do - if [ -z "$piped_args" ]; then - piped_args="${{line}}" - else - piped_args="${{piped_args}}\n${{line}}" - fi - done -fi - -## Launch the exe -if [ ${{piped_args}} ] ; then - echo -e ${{piped_args}} | {exe} $@ -else - {exe} $@ + singularity exec {bind} {container} {exe} $@ fi ''' @@ -73,8 +45,8 @@ def _write_script(path, content): os.system('chmod +x {}'.format(path)) def make_launcher(app, container, bindir, - bind='', libexecdir=None, exe=None, env=''): - '''Configure and install a launcher/wrapper pair. + bind='', exe=None): + '''Configure and install a launcher. Arguments: - app: our application @@ -82,30 +54,22 @@ def make_launcher(app, container, bindir, - bindir: absolute launcher install path Optional: - bind: singularity bind directives - - libexecdir: absolute wrapper install path. - Default is bindir. - exe: executable to be associated with app. Default is app. - env: environment directives to be added to the wrapper. Multiline string. Default is nothing ''' - ## assume bindir and libexecdir exist, are absolute, and are writable - if libexecdir is None: - libexecdir = bindir + if not exe: + exe = app + - ## actual exe we want to run, default: same as app - exe=exe - ## paths launcher_path = '{}/{}'.format(bindir, app) - wrapper_path = '{}/{}_wrap'.format(libexecdir, app) ## scripts --> use absolute path for wrapper path inside launcher launcher = _LAUNCHER.format(container=container, bind=bind, - wrapper=wrapper_path) - wrapper = _WRAPPER.format(env=env, exe=exe) + exe=exe) ## write our scripts _write_script(launcher_path, launcher) - _write_script(wrapper_path, wrapper)