Skip to content

Commit

Permalink
Allow making directories when they exist
Browse files Browse the repository at this point in the history
  • Loading branch information
fridex committed Mar 31, 2022
1 parent ea3ee5b commit c570226
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions selinon/storages/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def is_connected(self):

def connect(self):
if not os.path.isdir(self.path):
os.makedirs(self.path)
os.makedirs(self.path, exist_ok=True)
self._connected = True

def disconnect(self):
Expand All @@ -50,7 +50,7 @@ def retrieve(self, flow_name, task_name, task_id):
def store(self, node_args, flow_name, task_name, task_id, result): # noqa
base_path = self._construct_base_path(flow_name, task_name)
if not os.path.isdir(base_path):
os.makedirs(base_path)
os.makedirs(base_path, exist_ok=True)

path = self._construct_path(flow_name, task_name, task_id)
with open(path, 'w') as result_file:
Expand Down

0 comments on commit c570226

Please sign in to comment.