Skip to content

Commit eedd88f

Browse files
Merge pull request #142 from valeriupredoi/dev_slurm_mass
Slurm Batch script to automatically download ukesm data from mass overnight
2 parents babe5ef + 9817668 commit eedd88f

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

lotus_mass.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
#SBATCH --job-name=massbgcval
3+
#SBATCH --partition=mass
4+
#SBATCH --time 24:00:00
5+
#SBATCH --qos=mass
6+
#SBATCH --account=mass
7+
#SBATCH -o /home/users/ldemora/mass2_logs/log_mass2.out
8+
#SBATCH -e /home/users/ldemora/mass2_logs/log_mass2.err
9+
10+
# Submit this script to mass-cli2.jasmin.ac.uk
11+
# sbatch lotus_mass.sh
12+
#
13+
# moo passwd -r # if mass password is expired
14+
15+
16+
##########################
17+
# Run mass download.
18+
source /etc/bashrc
19+
20+
# Set your target directory for scripts
21+
TARGET_DIR="/gws/nopw/j04/esmeval/bgcval2/shared_mass_scripts/"
22+
23+
# delete old scripts
24+
find /gws/nopw/j04/esmeval/bgcval2/shared_mass_scripts -mindepth 1 -mtime +15 -print -delete -name 'u-*.sh'
25+
26+
27+
# Create an array of filenames without extensions
28+
file_list=()
29+
for file in "$TARGET_DIR"*; do
30+
basename=$(basename "$file")
31+
name="${basename%.*}" # Remove extension
32+
file_list+=("$name")
33+
done
34+
35+
36+
# Shuffle the list and iterate through it
37+
for JOBID in $(printf "%s\n" "${file_list[@]}" | shuf); do
38+
# make an output folder (typically done elsewhere)
39+
mkdir -p /gws/nopw/j04/ukesm/BGC_data/$JOBID/
40+
41+
# Download jobID from mass to the standard location:
42+
moo get --fill-gaps moose:/crum/$JOBID/ony.nc.file/*.nc /gws/nopw/j04/ukesm/BGC_data/$JOBID/
43+
done
44+
45+
46+

0 commit comments

Comments
 (0)