diff --git a/divvy_templates/localhost_bulker_template.sub b/divvy_templates/localhost_bulker_template.sub deleted file mode 100755 index 8ef7e7e3f..000000000 --- a/divvy_templates/localhost_bulker_template.sub +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -echo 'Compute node:' `hostname` -echo 'Start time:' `date +'%Y-%m-%d %T'` - -eval "$(bulker activate -e {BULKER_CRATE})" - -{ - {CODE} -} | tee {LOGFILE} -i diff --git a/divvy_templates/localhost_docker_template.sub b/divvy_templates/localhost_docker_template.sub deleted file mode 100755 index a00ad0379..000000000 --- a/divvy_templates/localhost_docker_template.sub +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -echo 'Compute node:' `hostname` -echo 'Start time:' `date +'%Y-%m-%d %T'` - -{ -docker run --rm -it {DOCKER_ARGS} {DOCKER_IMAGE} {CODE} -} | tee {LOGFILE} --ignore-interrupts diff --git a/divvy_templates/localhost_singularity_template.sub b/divvy_templates/localhost_singularity_template.sub deleted file mode 100755 index fdb1e486f..000000000 --- a/divvy_templates/localhost_singularity_template.sub +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -echo 'Compute node:' `hostname` -echo 'Start time:' `date +'%Y-%m-%d %T'` - -{ -singularity instance.start {SINGULARITY_ARGS} {SINGULARITY_IMAGE} {JOBNAME}_image -singularity exec instance://{JOBNAME}_image {CODE} -} | tee {LOGFILE} --ignore-interrupts diff --git a/divvy_templates/localhost_template.sub b/divvy_templates/localhost_template.sub deleted file mode 100755 index 9b64b7547..000000000 --- a/divvy_templates/localhost_template.sub +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -echo 'Compute node:' `hostname` -echo 'Start time:' `date +'%Y-%m-%d %T'` - -{ -{CODE} -} | tee {LOGFILE} diff --git a/divvy_templates/lsf_template.sub b/divvy_templates/lsf_template.sub deleted file mode 100755 index ac2bfc1e8..000000000 --- a/divvy_templates/lsf_template.sub +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -bsub -n{CORES} -W {TIME} -R \"rusage[mem={MEM}]\" -o {LOGFILE} {CODE} - diff --git a/divvy_templates/sge_template.sub b/divvy_templates/sge_template.sub deleted file mode 100755 index 0964f4dfb..000000000 --- a/divvy_templates/sge_template.sub +++ /dev/null @@ -1 +0,0 @@ -This has not been implemented, but you could add whatever cluster submission systems here, just use the slurm_template as an example. diff --git a/divvy_templates/slurm_singularity_template.sub b/divvy_templates/slurm_singularity_template.sub deleted file mode 100755 index eb8359bed..000000000 --- a/divvy_templates/slurm_singularity_template.sub +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -#SBATCH --job-name='{JOBNAME}' -#SBATCH --output='{LOGFILE}' -#SBATCH --mem='{MEM}' -#SBATCH --cpus-per-task='{CORES}' -#SBATCH --time='{TIME}' -#SBATCH --partition='{PARTITION}' -#SBATCH -m block -#SBATCH --ntasks=1 - -echo 'Compute node:' `hostname` -echo 'Start time:' `date +'%Y-%m-%d %T'` - -singularity instance.start {SINGULARITY_ARGS} {SINGULARITY_IMAGE} {JOBNAME}_image -srun singularity exec instance://{JOBNAME}_image {CODE} - -singularity instance.stop {JOBNAME}_image diff --git a/divvy_templates/slurm_template.sub b/divvy_templates/slurm_template.sub deleted file mode 100755 index f9d745645..000000000 --- a/divvy_templates/slurm_template.sub +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -#SBATCH --job-name='{JOBNAME}' -#SBATCH --output='{LOGFILE}' -#SBATCH --mem='{MEM}' -#SBATCH --cpus-per-task='{CORES}' -#SBATCH --time='{TIME}' -#SBATCH --partition='{PARTITION}' -#SBATCH -m block -#SBATCH --ntasks=1 - -echo 'Compute node:' `hostname` -echo 'Start time:' `date +'%Y-%m-%d %T'` - -{CODE} diff --git a/looper/command_models/arguments.py b/looper/command_models/arguments.py index 8c484d33d..7fe640f54 100644 --- a/looper/command_models/arguments.py +++ b/looper/command_models/arguments.py @@ -281,3 +281,9 @@ class ArgumentEnum(enum.Enum): default=(bool, False), description="Is this command executed for project-level?", ) + + BULKER = Argument( + name="bulker", + default=(bool, False), + description="Run bulker", + ) diff --git a/looper/command_models/commands.py b/looper/command_models/commands.py index 233cfd0b7..932261d93 100644 --- a/looper/command_models/commands.py +++ b/looper/command_models/commands.py @@ -79,6 +79,7 @@ def create_model(self) -> Type[pydantic.BaseModel]: ArgumentEnum.SKIP_FILE_CHECKS.value, ArgumentEnum.COMPUTE.value, ArgumentEnum.PACKAGE.value, + ArgumentEnum.BULKER.value, ], ) diff --git a/looper/conductor.py b/looper/conductor.py index 4e23d0b32..ee4758f3e 100644 --- a/looper/conductor.py +++ b/looper/conductor.py @@ -151,6 +151,7 @@ def __init__( max_jobs=None, automatic=True, collate=False, + bulker=False, ): """ Create a job submission manager. @@ -214,6 +215,20 @@ def __init__( self._failed_sample_names = [] self._curr_skip_pool = [] self.process_id = None # this is used for currently submitted subprocess + self.bulker = bulker + + if bulker: + if "bulker_crate" in self.pl_iface.exp: + crates = [] + self.bulker_commands = [] + if isinstance(self.pl_iface.exp["bulker_crate"], str): + crates = [self.pl_iface.exp["bulker_crate"]] + elif isinstance(self.pl_iface.exp["bulker_crate"], list): + crates = self.pl_iface.exp["bulker_crate"] + for crate in crates: + bulker_load_cmd = f"bulker load -b -f {crate}" + bulker_load_process = subprocess.Popen(bulker_load_cmd, shell=True) + bulker_load_process.wait() if self.extra_pipe_args: _LOGGER.debug( @@ -685,6 +700,7 @@ def write_script(self, pool, size): else EXTRA_SAMPLE_CMD_TEMPLATE ) templ += extras_template + for sample in pool: # cascading compute settings determination: # divcfg < pipeline interface < config < CLI diff --git a/looper/looper.py b/looper/looper.py index 1eea6edd6..665340864 100755 --- a/looper/looper.py +++ b/looper/looper.py @@ -419,6 +419,7 @@ def __call__(self, args, top_level_args=None, rerun=False, **compute_kwargs): max_cmds=getattr(args, "lump_n", None), max_size=getattr(args, "lump", None), max_jobs=getattr(args, "lump_j", None), + bulker=getattr(args, "bulker", None), ) submission_conductors[piface.pipe_iface_file] = conductor