Skip to content

Commit

Permalink
Merge pull request #1076 from MetPX/fix_mkdir_failures_on_hpc
Browse files Browse the repository at this point in the history
Fix mkdir failures on hpc
  • Loading branch information
petersilva authored May 30, 2024
2 parents c647b96 + 4ac239a commit 5981d51
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sarracenia/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def save_configs(self, savename):
other_config_dir = sarracenia.user_config_dir(savename, self.appauthor)

if not os.path.exists(other_config_dir):
os.mkdir(other_config_dir)
pathlib.Path(other_config_dir).mkdir(parents=True, exist_ok=True)

for f in ['default.conf', 'admin.conf']:
to = other_config_dir + os.sep + f
Expand Down Expand Up @@ -457,7 +457,6 @@ def _read_state_dir(self):
for cfg in self.configs[c]:
#print( f" {self.configs[c][cfg]['statehost']=} " )
if 'options' in self.configs[c][cfg] and self.configs[c][cfg]['options'].statehost:
print('statehost')
state_dir=self.user_cache_dir + os.sep + self.hostdir + os.sep + c + os.sep + cfg
else:
state_dir=self.user_cache_dir + os.sep + c + os.sep + cfg
Expand Down Expand Up @@ -901,14 +900,15 @@ def _resolve(self):
}
for c in self.components:
if not os.path.exists( self.user_cache_dir + os.sep + c ):
os.mkdir(self.user_cache_dir + os.sep + c )
pathlib.Path(self.user_cache_dir + os.sep + c ).mkdir(parents=True, exist_ok=True)
if (c not in self.states) or (c not in self.configs):
continue

for cfg in self.configs[c]:
if cfg not in self.states[c]:
print('missing state for %s/%s' % (c,cfg))
os.mkdir(self.user_cache_dir + os.sep + c + os.sep + cfg)
if not os.path.exists(self.user_cache_dir + os.sep + c + os.sep + cfg):
pathlib.Path(self.user_cache_dir + os.sep + c + os.sep + cfg).mkdir(parents=True, exist_ok=True)
# add config as state in .cache under right directory.
self.states[c][cfg] = {}
self.states[c][cfg]['instance_pids'] = {}
Expand Down

0 comments on commit 5981d51

Please sign in to comment.