Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| habrok:advanced_job_management:passing_parameters_to_a_job_script [2020/12/22 10:08] – external edit 127.0.0.1 | habrok: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: | ||
| - | < | + | < |
| #!/bin/env python | #!/bin/env python | ||
| import sys | import sys | ||
| Line 21: | Line 21: | ||
| This file should be saved as python_passing_parameters.py, | This file should be saved as python_passing_parameters.py, | ||
| - | < | + | < |
| #!/bin/bash | #!/bin/bash | ||
| #SBATCH --time=00: | #SBATCH --time=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 $* | ||
| </ | </ | ||
| 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. | ||