From da0f257deb8bc73f52241c3a6b8cb03c15c57f73 Mon Sep 17 00:00:00 2001 From: Lee de Mora Date: Fri, 24 Nov 2023 14:13:11 +0000 Subject: [PATCH] testing sbatch --- bgcval2/parrellel_timeseries.py | 13 +++++++++--- lotus_timeseries.sh | 35 +++++++++++---------------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/bgcval2/parrellel_timeseries.py b/bgcval2/parrellel_timeseries.py index fc98c324..e914eb84 100644 --- a/bgcval2/parrellel_timeseries.py +++ b/bgcval2/parrellel_timeseries.py @@ -31,6 +31,7 @@ """ import argparse import subprocess +from getpass import getuser from bgcval2.analysis_compare import load_comparison_yml @@ -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(): diff --git a/lotus_timeseries.sh b/lotus_timeseries.sh index c2e21e32..92488145 100644 --- a/lotus_timeseries.sh +++ b/lotus_timeseries.sh @@ -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... ######################### @@ -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