|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +#SBATCH --job-name="nf_master" ## Replace job_name with the name of the job you are running ## |
| 4 | +#SBATCH --output=nf_master.o.%j ## Replace job_name with the name of the job you are running ## |
| 5 | +#SBATCH --error=nf_master.e.%j ## Replace job_name with the name of the job you are running ## |
| 6 | +#SBATCH --partition=normal ## Specifies the job queue to use, for urgent jobs change normal to priority ## |
| 7 | +#SBATCH --mem=2G ## Memory required to run the job in MB, this example is showing 10,000 MB or 10GB, change this number based on how much RAM you need ## |
| 8 | +#SBATCH --cpus-per-task=1 ## Number of CPUs to run the job, this example is showing 5 CPUs, change this number based on how many CPUs you need ## |
| 9 | +#SBATCH --mail-user=email@domain.com ## Specifies the e-mail address to e-mail when the job is complete, replace this e-mail address with your NASA e-mail address ## |
| 10 | +#SBATCH --mail-type=END ## Tells slurm to e-mail the address above when the job has completed ## |
| 11 | + |
| 12 | +. ~/.profile |
| 13 | + |
| 14 | + |
| 15 | +echo "nf_master" ## Replace job_name with the name of the job you are running ## |
| 16 | +echo "" |
| 17 | + |
| 18 | + |
| 19 | +## Add a time-stamp at the start of the job ## |
| 20 | +start=$(date +%s) |
| 21 | +echo "start time: $start" |
| 22 | + |
| 23 | +## Print the name of the compute node executing the job ## |
| 24 | +echo $HOSTNAME |
| 25 | + |
| 26 | + |
| 27 | +## Activate the conda environemnt containing the tools you need to run your job ## |
| 28 | +## You can see a list of all available environments by running the command: conda env list ## |
| 29 | +## If you need a conda envrionment installed request it using JIRA ## |
| 30 | + |
| 31 | +source activate /path/to/envs/nextflow ## Replace conda_env_name with the name of the environment ## |
| 32 | + |
| 33 | + |
| 34 | +## Print the version of the tool you are using to ensure the tool version is recorded ## |
| 35 | +echo "" |
| 36 | +echo "Nextflow version: " ## Replace Tool with the name of the tool you are using ## |
| 37 | +nextflow -v ## Replace this command with the command the tool uses to print its version ## |
| 38 | +echo "" |
| 39 | + |
| 40 | + |
| 41 | +## The command(s) that you want to run in this slurm job ## |
| 42 | +export NXF_SINGULARITY_CACHEDIR=singularity/ |
| 43 | +nextflow run main.nf -resume -profile slurm_sing --GLDS_accession GLDS-487 --target_region 16S --F_primer AGAGTTTGATCCTGGCTCAG --R_primer CTGCCTCCCGTAGGAGT ## Replace command with the command(s) you want to run ## |
| 44 | + |
| 45 | + |
| 46 | +## Add a time-stamp at the end of the job then calculate how long the job took to run in seconds, minutes, and hours ## |
| 47 | +echo "" |
| 48 | +end=$(date +%s) |
| 49 | +echo "end time: $end" |
| 50 | +runtime_s=$(echo $(( end - start ))) |
| 51 | +echo "total run time(s): $runtime_s" |
| 52 | +sec_per_min=60 |
| 53 | +sec_per_hr=3600 |
| 54 | +runtime_m=$(echo "scale=2; $runtime_s / $sec_per_min;" | bc) |
| 55 | +echo "total run time(m): $runtime_m" |
| 56 | +runtime_h=$(echo "scale=2; $runtime_s / $sec_per_hr;" | bc) |
| 57 | +echo "total run time(h): $runtime_h" |
| 58 | +echo "" |
| 59 | + |
| 60 | + |
| 61 | +## Print the slurm job ID so you have it recorded and can view slurm job statistics if needed ## |
| 62 | +echo "slurm job ID: ${SLURM_JOB_ID}" |
| 63 | + |
0 commit comments