diff --git a/core/modes/__init__.py b/core/modes/__init__.py index 76ed01a2d0850acc493c3f54b448c633c18914f3..062d7c01fe4b53ee196993d635313993069f188f 100644 --- a/core/modes/__init__.py +++ b/core/modes/__init__.py @@ -249,6 +249,17 @@ class Sbatch(Slurm): self.slurm_output_dir = f'{self.job.clone_path}/slurm_output' self.slurm_output_file = f'{self.slurm_output_dir}/so_{self.job.jobid}.txt' + def get_batch_properties(self, batch_script): + # cmd_out = "" + if self.job.down_scoping: + stdout = self.job.execute(f"{srun_path} /usr/bin/cat {batch_script}", '', + f"{self.job.driver_path}/core/scripts/runHelper.sh", stdout=subprocess.PIPE, + text=True).stdout + cmd_out = ' '.join([l.split()[1] for l in stdout.split("\n") if l.startswith('#SBATCH')]) + else: + with open(batch_script, 'r') as f: + cmd_out = ' '.join([l.split()[1] for l in f.readlines() if l.startswith('#SBATCH')]) + return cmd_out def get_combiner_script(self): self._combiner_script = f"{self.job.driver_path}/core/scripts/pipeHelper.sh" @@ -256,7 +267,9 @@ class Sbatch(Slurm): def get_run_properties(self): - self._run_properties = f'{sbatch_path} --wait --output={self.slurm_output_file} {self.job.get_parameters()}' + batch_script = f'{self.job.clone_path}/{get_cenv("BATCH_SCRIPT")}' + self._run_properties = f'{sbatch_path} --wait {self.get_batch_properties(batch_script)} ' \ + f'{self.job.get_parameters()} --output={self.slurm_output_file}' return self._run_properties def custom_run_setup(self, **kwargs): diff --git a/core/utility/defines.py b/core/utility/defines.py index 76ca915c58dc5dadb0a30b33d8e6ec7b52b55df6..b2a5a6603edaa295a1fb57b29a7f4491572a5e8d 100644 --- a/core/utility/defines.py +++ b/core/utility/defines.py @@ -1,6 +1,6 @@ import logging name = 'Aixcellenz CI Driver' -version = '0.3.0' +version = '0.3.1' debug = False stdout_logging = True