def _save_build_provenance_cesm(case, lid): # pylint: disable=unused-argument version = case.get_value("MODEL_VERSION") # version has already been recorded srcroot = case.get_value("SRCROOT") manic = os.path.join("manage_externals","checkout_externals") manic_full_path = os.path.join(srcroot, manic) out = None if os.path.exists(manic_full_path): args = " --status --verbose --no-logging" stat, out, err = run_cmd(manic_full_path + args, from_dir=srcroot) errmsg = """Error gathering provenance information from manage_externals. manage_externals error message: {err} manage_externals output: {out} To solve this, either: (1) Find and fix the problem: From {srcroot}, try to get this command to work: {manic}{args} (2) If you don't need provenance information, rebuild with --skip-provenance-check """.format(out=indent_string(out, 4), err=indent_string(err, 4), srcroot=srcroot, manic=manic, args=args) expect(stat==0,errmsg) caseroot = case.get_value("CASEROOT") with open(os.path.join(caseroot, "CaseStatus"), "a") as fd: if version is not None and version != "unknown": fd.write("CESM version is {}\n".format(version)) if out is not None: fd.write("{}\n".format(out))
def test_indent_string_singleline(self): """Test the indent_string function with a single-line string """ mystr = 'foo' result = indent_string(mystr, 4) expected = ' foo' self.assertEqual(expected, result)
def test_indent_string_singleline(self): """Test the indent_string function with a single-line string """ mystr = 'foo' result = indent_string(mystr, 4) expected = ' foo' self.assertEqual(expected, result)
def test_indent_string_multiline(self): """Test the indent_string function with a multi-line string""" mystr = """hello hi goodbye """ result = indent_string(mystr, 2) expected = """ hello hi goodbye """ self.assertEqual(expected, result)
def test_indent_string_multiline(self): """Test the indent_string function with a multi-line string """ mystr = """hello hi goodbye """ result = indent_string(mystr, 2) expected = """ hello hi goodbye """ self.assertEqual(expected, result)
stat, out, err = run_cmd(manic_full_path + args, from_dir=srcroot) errmsg = """Error gathering provenance information from manage_externals. manage_externals error message: {err} manage_externals output: {out} To solve this, either: (1) Find and fix the problem: From {srcroot}, try to get this command to work: {manic}{args} (2) If you don't need provenance information, rebuild with --skip-provenance-check """.format(out=indent_string(out, 4), err=indent_string(err, 4), srcroot=srcroot, manic=manic, args=args) expect(stat==0,errmsg) caseroot = case.get_value("CASEROOT") with open(os.path.join(caseroot, "CaseStatus"), "a") as fd: if version is not None and version != "unknown": fd.write("CESM version is {}\n".format(version)) if out is not None: fd.write("{}\n".format(out)) def save_build_provenance(case, lid=None): with SharedArea(): model = case.get_value("MODEL") lid = os.environ["LID"] if lid is None else lid
errmsg = """Error gathering provenance information from manage_externals. manage_externals error message: {err} manage_externals output: {out} To solve this, either: (1) Find and fix the problem: From {srcroot}, try to get this command to work: {manic}{args} (2) If you don't need provenance information, rebuild with --skip-provenance-check """.format( out=indent_string(out, 4), err=indent_string(err, 4), srcroot=srcroot, manic=manic, args=args, ) expect(stat == 0, errmsg) caseroot = case.get_value("CASEROOT") with open(os.path.join(caseroot, "CaseStatus"), "a") as fd: if version is not None and version != "unknown": fd.write("CESM version is {}\n".format(version)) if out is not None: fd.write("{}\n".format(out))