JSON log-file

This example demonstrated how to manually write a log-file in the SLURM_SUBMIT_DIR (the directory, on the head node, from which the job is submitted) when the job is submitted. This file, job.slurm.json, is formatted using JSON to facilitate (automatic) readability.

Job script

[source: job.slurm]

#SBATCH --job-name json
#SBATCH --out job.slurm.out
#SBATCH --nodes 1
#SBATCH --ntasks 1
#SBATCH --cpus-per-task 1
#SBATCH --partition debug

# Write job info to a JSON-log file
# =================================

# get hostname

# write log file
cat <<EOF > job.slurm.json
  "hostname"            : "${myhost}",
  "SLURM_JOB_ID"        : "${SLURM_JOB_ID}",

# Execute
# =======

# simplest example in the world, sleep a bit to allow a bit of monitoring
echo "hello world" > "test.log"
sleep 10


To facilitate writing job-scripts, it can be created using the GooseSLURM Python module: [source: writeJob.py].