File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -621,6 +621,24 @@ def test_setup_command():
621
621
assert os .path .exists (ws .root + '/all_experiments' )
622
622
623
623
624
+ def test_setup_command_with_missing_log_dir ():
625
+ ws_name = "test"
626
+ workspace ("create" , ws_name )
627
+
628
+ with ramble .workspace .read ("test" ) as ws :
629
+ add_basic (ws )
630
+ check_basic (ws )
631
+ # Missing log directory shouldn't prevent workspace
632
+ # setup, as long as the workspace is considered valid
633
+ # by the `is_workspace_dir` check.
634
+ os .rmdir (ws .log_dir )
635
+
636
+ workspace ("concretize" )
637
+
638
+ workspace ("setup" )
639
+ assert os .path .exists (ws .root + "/all_experiments" )
640
+
641
+
624
642
def test_setup_nothing ():
625
643
ws_name = 'test'
626
644
workspace ('create' , ws_name )
Original file line number Diff line number Diff line change 11
11
import llnl .util .tty .color
12
12
13
13
from contextlib import contextmanager
14
+ from pathlib import Path
14
15
15
16
16
17
class Logger (object ):
@@ -43,7 +44,7 @@ def add_log(self, path):
43
44
path: File path for the new log file
44
45
"""
45
46
if isinstance (path , str ) and self .enabled :
46
- stream = None
47
+ Path ( path ). parent . mkdir ( parents = True , exist_ok = True )
47
48
stream = llnl .util .tty .log .Unbuffered (open (path , 'a+' ))
48
49
self .log_stack .append ((path , stream ))
49
50
You can’t perform that action at this time.
0 commit comments