Skip to content

Commit

Permalink
testing sbatch
Browse files Browse the repository at this point in the history
  • Loading branch information
ledm committed Nov 24, 2023
1 parent 9a25b7e commit da0f257
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
13 changes: 10 additions & 3 deletions bgcval2/parrellel_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"""
import argparse
import subprocess
from getpass import getuser

from bgcval2.analysis_compare import load_comparison_yml

Expand Down Expand Up @@ -75,17 +76,23 @@ def submits_lotus(compare_yml, config_user, dry_run=False):
details = load_comparison_yml(compare_yml)
jobs = details['jobs']

user='ldemora'
user = getuser()
out = str(subprocess.check_output(["squeue", "--user="+user]))

for job in jobs:
suites = details['suites'][job]

if out.find(job) > -1:
print("That job exists already: skipping", job)

command_txt = ['sbatch', '-J', job, 'lotus_timeseries.sh', job]
for suite in suites:
command_txt.append(suite)
if dry_run:
print(' '.join(['sbatch', 'lotus_timeseries.sh', job, suites]) )
print(' '.join(command_txt))
else:
command1 = subprocess.Popen(['sbatch', 'lotus_timeseries.sh', job, suites])
# Submit job:
command1 = subprocess.Popen(command_txt)


def main():
Expand Down
35 changes: 12 additions & 23 deletions lotus_timeseries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,10 @@


######################
# First make a copy of this file:
# rysnc -av lotus_bgcval2.sh lotus_bgcval2_$USER.sh
#
# Then edit your new copy (lotus_bgcval2_$USER.sh):
#
# 1. Check the name of your conda environment: CONDA_ENV
# "bgcval2" is the default, but may have a different one.
#
# 2. Check the path to your bgcval2 directory: BGCVAL2_PATH
#
# 3. Change the analyses to run: BGCVAL2_SUITE
# You can add several suites here if needed.
#
# 4. Submit this script with with:
# sbatch lotus_bgcval2_$USER.sh
#
# 5. Monitor progress with:
# squeue | grep $USER
# This script runs a single time series job.
#
# Runs:
# lotus_timeseries.sh jobID suite1 suite2 etc...
#########################


Expand Down Expand Up @@ -61,11 +46,15 @@ conda activate ${CONDA_ENV}
#cd $BGCVAL2_PATH
#pwd

jobID=$1
keys=$2

echo "analysis timeseries -j $jobID -k $2"
#analysis_timeseries -j $jobID -k $2
##########################
# Load command line arguments:
args=$@
jobID="${a%% *}"
suites="${@:2}"
echo $suites

echo "analysis timeseries -j $jobID -k $suites"
#analysis_timeseries -j $jobID -k $suites
#########################
# Add one or more input_yml files here
#cho analysis_timeseries -y $BGCVAL2_SUITE
Expand Down

0 comments on commit da0f257

Please sign in to comment.