Skip to content

Commit 7fc9838

Browse files
authored
Move logging to after CHECK_IF_DONE (#68)
1 parent b4e1396 commit 7fc9838

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

worker/cp-worker.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ def runCellProfiler(message):
119119
else: #backwards compatability with 1.0.0 and/or no desire to structure output
120120
metadataID = '-'.join([x.split('=')[1] for x in message['Metadata'].split(',')]) # Strip equal signs from the metadata
121121

122-
watchtowerlogger=watchtower.CloudWatchLogHandler(log_group=LOG_GROUP_NAME, stream_name=metadataID,create_log_group=False)
123-
logger.addHandler(watchtowerlogger)
124-
125122
localOut = LOCAL_OUTPUT + '/%(MetadataID)s' % {'MetadataID': metadataID}
126123
remoteOut= os.path.join(message['output'],metadataID)
127124
replaceValues = {'PL':message['pipeline'], 'OUT':localOut, 'FL':message['data_file'],
@@ -139,6 +136,10 @@ def runCellProfiler(message):
139136
except KeyError: #Returned if that folder does not exist
140137
pass
141138

139+
# Start loggging now that we have a job we care about
140+
watchtowerlogger=watchtower.CloudWatchLogHandler(log_group=LOG_GROUP_NAME, stream_name=metadataID,create_log_group=False)
141+
logger.addHandler(watchtowerlogger)
142+
142143
# Build and run CellProfiler command
143144
cpDone = localOut + '/cp.is.done'
144145
if message['pipeline'][-3:]!='.h5':

0 commit comments

Comments
 (0)