From 84b989faa2b8bfd108ab63deb5512e0a93772c34 Mon Sep 17 00:00:00 2001
From: lkugler <lukas.kugler@gmail.com>
Date: Thu, 3 Feb 2022 16:52:56 +0100
Subject: [PATCH] debug without SLURM

---
 dartwrf/assim_synth_obs.py |  1 -
 scheduler.py               | 14 +++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dartwrf/assim_synth_obs.py b/dartwrf/assim_synth_obs.py
index d006be6..dc6460e 100755
--- a/dartwrf/assim_synth_obs.py
+++ b/dartwrf/assim_synth_obs.py
@@ -467,7 +467,6 @@ def set_obserr_assimilate_in_obsseqout(obsseqout, outfile="./obs_seq.out"):
     for obscfg in exp.observations:
         kind_str = obscfg['kind']
         kind = osq.obs_kind_nrs[kind_str]
-        print('kind=',kind)
 
         # modify each kind separately, one after each other
         mask_kind = obsseqout.df.kind == kind
diff --git a/scheduler.py b/scheduler.py
index 8a79465..2e64c42 100755
--- a/scheduler.py
+++ b/scheduler.py
@@ -15,14 +15,26 @@ slurm_scripts_dir = cluster.archivedir+'/slurm-scripts/'
 print('logging to', log_dir)
 print('scripts, which are submitted to SLURM:', slurm_scripts_dir)
 
+class Shellslurm():
+    def __init__(self, *args, **kwargs):
+        pass
+    def run(self, *args, **kwargs):
+        print(args[0])
+        os.system(args[0])
+
 def my_Slurm(*args, cfg_update=dict(), **kwargs):
     """Shortcut to slurmpy's class; keep certain default kwargs
     and only update some with kwarg `cfg_update`
     see https://github.com/brentp/slurmpy
     """
+    debug = True  # run without SLURM, locally on headnode
+    if debug:
+        return Shellslurm(*args)
     return Slurm(*args, slurm_kwargs=dict(cluster.slurm_cfg, **cfg_update), 
                  log_dir=log_dir, scripts_dir=slurm_scripts_dir, **kwargs)
 
+
+
 def backup_scripts():
     os.makedirs(cluster.archivedir, exist_ok=True)
 
@@ -245,7 +257,7 @@ if __name__ == "__main__":
         prior_valid_time = time
 
         id = assimilate(time, prior_init_time, prior_valid_time, prior_path_exp, depends_on=id)
-
+        sys.exit()
         # 1) Set posterior = prior
         id = prepare_IC_from_prior(prior_path_exp, prior_init_time, prior_valid_time, depends_on=id)
 
-- 
GitLab