Skip to content

Commit 6c59afc

Browse files
committed
keep CSVs from overwriting one another
1 parent 6563264 commit 6c59afc

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎python2worker/cp-worker.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ def runCellProfiler(message):
214214
tag = str(random.randint(100000,999999)) #keep files from overwriting one another
215215
local_csv_name = os.path.join(localIn,tag,os.path.split(csv_name)[1])
216216
if not os.path.exists(local_csv_name):
217+
if not os.path.exists(os.path.split(local_csv_name)[0]):
218+
os.makedirs(os.path.split(local_csv_name)[0])
217219
csv_in = pandas.read_csv(os.path.join(DATA_ROOT,message['data_file']))
218220
csv_in.replace(DATA_ROOT,localIn,regex=True, inplace=True)
219221
csv_in.to_csv(local_csv_name,index=False)

‎worker/cp-worker.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ def runCellProfiler(message):
213213
tag = str(random.randint(100000,999999)) #keep files from overwriting one another
214214
local_csv_name = os.path.join(localIn,tag,os.path.split(csv_name)[1])
215215
if not os.path.exists(local_csv_name):
216+
if not os.path.exists(os.path.split(local_csv_name)[0]):
217+
os.makedirs(os.path.split(local_csv_name)[0])
216218
csv_in = pandas.read_csv(os.path.join(DATA_ROOT,message['data_file']))
217219
csv_in.replace(DATA_ROOT,localIn,regex=True, inplace=True)
218220
csv_in.to_csv(local_csv_name,index=False)

0 commit comments

Comments
 (0)