Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
habrok:advanced_job_management:passing_parameters_to_a_job_script [2020/12/22 10:08] – external edit 127.0.0.1habrok:advanced_job_management:passing_parameters_to_a_job_script [2026/03/16 13:41] (current) pedro
Line 11: Line 11:
 Example for a Python script: Example for a Python script:
  
-<code>+<code python>
 #!/bin/env python #!/bin/env python
 import sys import sys
Line 21: Line 21:
 This file should be saved as python_passing_parameters.py, so that it can be run by the following batch script: This file should be saved as python_passing_parameters.py, so that it can be run by the following batch script:
  
-<code>+<code bash>
 #!/bin/bash #!/bin/bash
 #SBATCH --time=00:01:00 #SBATCH --time=00:01:00
Line 28: Line 28:
 #SBATCH --job-name=python_passing_parameters #SBATCH --job-name=python_passing_parameters
 #SBATCH --mem=500 #SBATCH --mem=500
-module load Python/3.4.2-goolfc-2.7.11+module purge 
 +module load Python/3.10.4-GCCcore-11.3.0
 python python_passing_parameters.py $* python python_passing_parameters.py $*
 </code> </code>
 You can now submit the job with “sbatch jobscript.sh 1 2 a b”, and your input parameters (1 2 a b) will be forwarded to the Python script. You can now submit the job with “sbatch jobscript.sh 1 2 a b”, and your input parameters (1 2 a b) will be forwarded to the Python script.