Skip to content

Commit ed898e1

Browse files
authored
Merge pull request #154 from jbernal0019/master
Fix bug when a chris link points to an empty dir
2 parents 1158683 + d5db1e6 commit ed898e1

File tree

5 files changed

+22
-17
lines changed

5 files changed

+22
-17
lines changed

pfcon/storage/base_storage.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ def process_chrislink_files(self, job_incoming_dir):
5858

5959
for folder in linked_path_top_folders:
6060
if folder not in self._linked_paths:
61-
self.deletesrc(os.path.join(job_incoming_dir, folder))
62-
61+
try:
62+
self.deletesrc(os.path.join(job_incoming_dir, folder))
63+
except FileNotFoundError:
64+
pass
6365
return self._nlinks
6466

6567
def _process_chrislink_files(self, dir):
@@ -84,7 +86,10 @@ def _process_chrislink_files(self, dir):
8486
dst_path = os.path.join(root, source_trace_dir)
8587

8688
if not os.path.isdir(dst_path): # only copy once to a dest path
87-
self.copysrc(abs_path, dst_path)
89+
try:
90+
self.copysrc(abs_path, dst_path)
91+
except FileNotFoundError:
92+
pass
8893
self._already_copied_src_set.add(abs_path)
8994
self._process_chrislink_files(dst_path) # recursive call
9095

tests/test_resources.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_post(self):
8787
data = {
8888
'jid': job_id,
8989
'entrypoint': ['python3', '/usr/local/bin/simplefsapp'],
90-
'args': ['--saveinputmeta', '--saveoutputmeta', '--dir', '/share/incoming'],
90+
'args': ['--dir', '/share/incoming'],
9191
'auid': 'cube',
9292
'number_of_workers': '1',
9393
'cpu_limit': '1000',
@@ -130,8 +130,8 @@ def setUp(self):
130130
self.image = 'fnndsc/pl-simplefsapp'
131131
self.env = []
132132

133-
self.cmd = ['python3', '/usr/local/bin/simplefsapp', '--saveinputmeta',
134-
'--saveoutputmeta', '--dir', '/share/incoming', '/share/outgoing']
133+
self.cmd = ['python3', '/usr/local/bin/simplefsapp',
134+
'--dir', '/share/incoming', '/share/outgoing']
135135

136136
self.resources_dict = {'number_of_workers': 1, 'cpu_limit': 1000,
137137
'memory_limit': 200, 'gpu_limit': 0}

tests/test_resources_innetwork.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_post(self):
109109
data = {
110110
'jid': job_id,
111111
'entrypoint': ['python3', '/usr/local/bin/simplefsapp'],
112-
'args': ['--saveinputmeta', '--saveoutputmeta', '--dir', '/share/incoming'],
112+
'args': ['--dir', '/share/incoming'],
113113
'auid': 'cube',
114114
'number_of_workers': '1',
115115
'cpu_limit': '1000',
@@ -149,7 +149,7 @@ def test_post_with_chris_links(self):
149149
data = {
150150
'jid': job_id,
151151
'entrypoint': ['python3', '/usr/local/bin/simpledsapp'],
152-
'args': ['--saveinputmeta', '--saveoutputmeta', '--prefix', 'lo'],
152+
'args': ['--prefix', 'lo'],
153153
'auid': 'cube',
154154
'number_of_workers': '1',
155155
'cpu_limit': '1000',
@@ -207,8 +207,8 @@ def setUp(self):
207207
self.image = 'fnndsc/pl-simplefsapp'
208208
self.env = []
209209

210-
self.cmd = ['python3', '/usr/local/bin/simplefsapp', '--saveinputmeta',
211-
'--saveoutputmeta', '--dir', '/share/incoming', '/share/outgoing']
210+
self.cmd = ['python3', '/usr/local/bin/simplefsapp',
211+
'--dir', '/share/incoming', '/share/outgoing']
212212

213213
self.resources_dict = {'number_of_workers': 1, 'cpu_limit': 1000,
214214
'memory_limit': 200, 'gpu_limit': 0}

tests/test_resources_innetwork_fs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_post(self):
9191
data = {
9292
'jid': job_id,
9393
'entrypoint': ['python3', '/usr/local/bin/simplefsapp'],
94-
'args': ['--saveinputmeta', '--saveoutputmeta', '--dir', '/share/incoming'],
94+
'args': ['--dir', '/share/incoming'],
9595
'auid': 'cube',
9696
'number_of_workers': '1',
9797
'cpu_limit': '1000',
@@ -136,8 +136,8 @@ def setUp(self):
136136
self.image = 'fnndsc/pl-simplefsapp'
137137
self.env = []
138138

139-
self.cmd = ['python3', '/usr/local/bin/simplefsapp', '--saveinputmeta',
140-
'--saveoutputmeta', '--dir', '/share/incoming', '/share/outgoing']
139+
self.cmd = ['python3', '/usr/local/bin/simplefsapp',
140+
'--dir', '/share/incoming', '/share/outgoing']
141141

142142
self.resources_dict = {'number_of_workers': 1, 'cpu_limit': 1000,
143143
'memory_limit': 200, 'gpu_limit': 0}

tests/test_resources_innetwork_fslink.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_post(self):
9595
data = {
9696
'jid': job_id,
9797
'entrypoint': ['python3', '/usr/local/bin/simplefsapp'],
98-
'args': ['--saveinputmeta', '--saveoutputmeta', '--dir', '/share/incoming'],
98+
'args': ['--dir', '/share/incoming'],
9999
'auid': 'cube',
100100
'number_of_workers': '1',
101101
'cpu_limit': '1000',
@@ -135,7 +135,7 @@ def test_post_with_chris_links(self):
135135
data = {
136136
'jid': job_id,
137137
'entrypoint': ['python3', '/usr/local/bin/simpledsapp'],
138-
'args': ['--saveinputmeta', '--saveoutputmeta', '--prefix', 'lo'],
138+
'args': ['--prefix', 'lo'],
139139
'auid': 'cube',
140140
'number_of_workers': '1',
141141
'cpu_limit': '1000',
@@ -194,8 +194,8 @@ def setUp(self):
194194
self.image = 'fnndsc/pl-simplefsapp'
195195
self.env = []
196196

197-
self.cmd = ['python3', '/usr/local/bin/simplefsapp', '--saveinputmeta',
198-
'--saveoutputmeta', '--dir', '/share/incoming', '/share/outgoing']
197+
self.cmd = ['python3', '/usr/local/bin/simplefsapp',
198+
'--dir', '/share/incoming', '/share/outgoing']
199199

200200
self.resources_dict = {'number_of_workers': 1, 'cpu_limit': 1000,
201201
'memory_limit': 200, 'gpu_limit': 0}

0 commit comments

Comments
 (0)