diff --git a/core/modes/__init__.py b/core/modes/__init__.py index 062d7c01fe4b53ee196993d635313993069f188f..5e1c1603c455745ed37cae4c95b407288a6fffd5 100644 --- a/core/modes/__init__.py +++ b/core/modes/__init__.py @@ -404,14 +404,25 @@ class Batch(Slurm): class Singularity_Batch(Default): container = '' + @staticmethod + def escape(s): + return s.replace('/', '\/') + def custom_run_setup(self, **kwargs): Sbatch.custom_run_setup(self, **kwargs) if kwargs["script_execution"] and kwargs["do_inbetween_processing"]: logging.debug('Creating param file') # write env_file - with open(f'{self.slurm_output_dir}/env{self.job.jobid}', 'w') as file: + with open(f'{self.job.tmp_dir}/env{self.job.jobid}', 'w') as file: file.write(f"CONTAINER={self.container}\0EXEC_WRAPPER={srun_path}\0PARAMS={self.job.get_parameters()}\0OUTPUT_FILE=--output={self.slurm_output_file}") + + self.job.execute(f'/usr/bin/cp /dev/stdin ' + f'{self.slurm_output_dir}/batchEnv{self.job.jobid}', + f"{self.job.tmp_dir}/env{self.job.jobid}", + f"{self.job.driver_path}/core/scripts/pipeHelper.sh", + skip_env=True, srun_wrap=True) + def get_combiner_script(self): self._combiner_script = f"{self.job.driver_path}/core/scripts/pipeHelper.sh" return self._combiner_script @@ -445,7 +456,7 @@ class Singularity_Batch(Default): skip_env=True, srun_wrap=True) # add singularity specific parameter to the properties property_split = self._run_properties.split(" ") - property_split.insert(1, f'--export-file={self.slurm_output_dir}/env{self.job.jobid}') + property_split.insert(1, f'--export-file={self.slurm_output_dir}/batchEnv{self.job.jobid}') self._run_properties = " ".join(property_split) return self._run_properties diff --git a/core/scripts/batch.env b/core/scripts/batch.env new file mode 100644 index 0000000000000000000000000000000000000000..33cedb8d5ed013736c211c60501a4360b678467f --- /dev/null +++ b/core/scripts/batch.env @@ -0,0 +1 @@ +CONTAINER=_CONTAINER\0EXEC_WRAPPER=_EXEC_WRAPPER\0PARAMS=_PARAMS\0OUTPUT_FILE=_OUTPUT_FILE diff --git a/core/scripts/chmodPath.sh b/core/scripts/chmodPath.sh index 18893a454f44f3b57537ed8fc671a09886b676d3..cb9816560ccd10507f9b1dd998f7837fd4e42d51 100755 --- a/core/scripts/chmodPath.sh +++ b/core/scripts/chmodPath.sh @@ -2,7 +2,7 @@ _path=$1 set -e while test "$_path" != "/work"; do - chmod o+wx "$_path" + chmod o+x "$_path" _path=$(dirname "$_path") done