Repository: ESMCI/cime

Issue:
Fewer newlines in CaseStatus
This seems to be new in 5.2.  I like the old format of CaseStatus with fewer newlines .

Current format:

```
2017-03-06 22:37:50: case.setup starting

 ---------------------------------------------------

2017-03-06 22:37:52: case.setup complete

 ---------------------------------------------------

2017-03-06 22:37:55: case.build starting

 --------------------------------------------------
```

Can we instead have:

```
2017-03-06 22:37:50: case.setup starting
 ---------------------------------------------------
2017-03-06 22:37:52: case.setup complete
 ---------------------------------------------------
2017-03-06 22:37:55: case.build starting
 ---------------------------------------------------
```


Discussion:
I agree. I believe I was the one that introduced these new lines as part of
having the TestStatus.log be easier to read. But now the CaseStatus is more
cumbersome to read. I'd like to keep the horizontal lines - but we can
remove the blank lines.

On Mon, Mar 6, 2017 at 10:20 PM, Robert Jacob <notifications@github.com>
wrote:

> This seems to be new in 5.2. I like the old format of CaseStatus with
> fewer newlines .
>
> Current format:
>
> 2017-03-06 22:37:50: case.setup starting
>
>  ---------------------------------------------------
>
> 2017-03-06 22:37:52: case.setup complete
>
>  ---------------------------------------------------
>
> 2017-03-06 22:37:55: case.build starting
>
>  --------------------------------------------------
> ```-
>
> Can we instead have:
>
> 2017-03-06 22:37:50: case.setup starting 2017-03-06 22:37:52: case.setup
> complete 2017-03-06 22:37:55: case.build starting
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/ESMCI/cime/issues/1212>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AHlxE6l26OPlMGA99G_OgExPXEqLUuP3ks5rjOkdgaJpZM4MVDfj>
> .
>


Resolving patch:
diff --git a/scripts/lib/CIME/case_setup.py b/scripts/lib/CIME/case_setup.py
--- a/scripts/lib/CIME/case_setup.py
+++ b/scripts/lib/CIME/case_setup.py
@@ -69,7 +69,7 @@ def _case_setup_impl(case, caseroot, clean=False, test_mode=False, reset=False,
     din_loc_root = case.get_value("DIN_LOC_ROOT")
     testcase     = case.get_value("TESTCASE")
     expect(not (not os.path.isdir(din_loc_root) and testcase != "SBN"),
-           "inputdata root is not a directory: \"$din_loc_root\" ")
+           "inputdata root is not a directory: %s" % din_loc_root)
 
     # Check that userdefine settings are specified before expanding variable
     for vid, value in case:
diff --git a/scripts/lib/CIME/utils.py b/scripts/lib/CIME/utils.py
--- a/scripts/lib/CIME/utils.py
+++ b/scripts/lib/CIME/utils.py
@@ -854,9 +854,14 @@ def append_status(msg, sfile, caseroot='.'):
     Append msg to sfile in caseroot
     """
     ctime = time.strftime("%Y-%m-%d %H:%M:%S: ")
+
+    # Reduce empty lines in CaseStatus. It's a very concise file
+    # and does not need extra newlines for readability
+    line_ending = "" if sfile == "CaseStatus" else "\n"
+
     with open(os.path.join(caseroot, sfile), "a") as fd:
-        fd.write(ctime + msg + "\n")
-        fd.write("\n ---------------------------------------------------\n\n")
+        fd.write(ctime + msg + line_ending)
+        fd.write("\n ---------------------------------------------------\n" + line_ending)
 
 def append_testlog(msg, caseroot='.'):
     """


Test patch: