Repository: ESMCI/cime

Issue:
Run script thinks its being called directly on Blues when it isn't
Using latest master 9a4db4d,
Create an X-case on blues:
./create_newcase -case Xcase3 -compset X -res f19_g16 -compiler intel
setup, build and apply workaround for Issue #265 .

After executing "case.submit", the following error message appears and the job ends.

ERROR: You are not calling the run script via the submit script. As a result, short-term archiving will not be called automatically. Please submit your run using the submit script like so: ./case.submit

This happens if DOUT_S is TRUE or FALSE.



Discussion:

Resolving patch:
diff --git a/utils/python/CIME/XML/env_batch.py b/utils/python/CIME/XML/env_batch.py
--- a/utils/python/CIME/XML/env_batch.py
+++ b/utils/python/CIME/XML/env_batch.py
@@ -420,9 +420,6 @@ def submit_single_job(self, case, job, depid=None, no_batch=False):
             if  string is not None:
                 submitcmd += string + " "
 
-        if self.batchtype == "pbs":
-            submitcmd += " -F \"--caseroot %s\""%caseroot
-
         logger.info("Submitting job script %s"%submitcmd)
         output = run_cmd(submitcmd)
         jobid = self.get_job_id(output)
diff --git a/utils/python/CIME/case_run.py b/utils/python/CIME/case_run.py
--- a/utils/python/CIME/case_run.py
+++ b/utils/python/CIME/case_run.py
@@ -156,10 +156,10 @@ def save_timing_setup_acme(case, lid):
         return
 
     timing_dir = case.get_value("SAVE_TIMING_DIR")
-    if timing_dir is None:
+    if timing_dir is None or timing_dir == 'UNSET':
         logger.warning("ACME requires SAVE_TIMING_DIR to be set in order to save timings. Skipping save timings")
         return
-
+    logger.warn("timing dir is %s"%timing_dir)
     rundir = case.get_value("RUNDIR")
     caseroot = case.get_value("CASEROOT")
     cimeroot = case.get_value("CIMEROOT")


Test patch:
diff --git a/cime_config/acme/machines/template.case.test b/cime_config/acme/machines/template.case.test
--- a/cime_config/acme/machines/template.case.test
+++ b/cime_config/acme/machines/template.case.test
@@ -6,12 +6,9 @@ by case.submit when on batch system. This script only exists as a way of providi
 batch directives. Use case.submit from the command line to run your case.
 """
 import os, sys
+os.chdir( '{{ caseroot }}')
 
-_CIMEROOT = os.environ.get("CIMEROOT")
-if _CIMEROOT is None:
-    raise SystemExit("ERROR: must set CIMEROOT environment variable")
-
-_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools")
+_LIBDIR = os.path.join("{{ cimeroot }}", "scripts", "Tools")
 sys.path.append(_LIBDIR)
 
 from standard_script_setup import *
diff --git a/cime_config/cesm/machines/template.case.test b/cime_config/cesm/machines/template.case.test
--- a/cime_config/cesm/machines/template.case.test
+++ b/cime_config/cesm/machines/template.case.test
@@ -6,12 +6,9 @@ by case.submit when on batch system. This script only exists as a way of providi
 batch directives. Use case.submit from the command line to run your case.
 """
 import os, sys
+os.chdir( '{{ caseroot }}')
 
-_CIMEROOT = os.environ.get("CIMEROOT")
-if _CIMEROOT is None:
-    raise SystemExit("ERROR: must set CIMEROOT environment variable")
-
-_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools")
+_LIBDIR = os.path.join("{{ cimeroot }}", "scripts", "Tools")
 sys.path.append(_LIBDIR)
 
 from standard_script_setup import *
diff --git a/scripts/Tools/bless_test_results b/scripts/Tools/bless_test_results
--- a/scripts/Tools/bless_test_results
+++ b/scripts/Tools/bless_test_results
@@ -179,8 +179,9 @@ def bless_test_results(baseline_name, test_root, compiler, test_id=None, namelis
     baseline_area = os.path.join(baseline_root, baseline_tag)
 
     # The env_mach_specific script may need these to be defined
-    os.environ["COMPILER"] = _MACHINE.get_default_compiler() # this MUST match compiler that cprnc was built with
-    os.environ["MPILIB"] = _MACHINE.get_default_MPIlib()
+    compiler = _MACHINE.get_default_compiler() # this MUST match compiler that cprnc was built with
+    os.environ["COMPILER"]  = compiler
+    os.environ["MPILIB"] = _MACHINE.get_default_MPIlib(attributes={"compiler":compiler})
 
     broken_blesses = []
     for test_status_file in test_status_files: