Skip to content

Commit c15d455

Browse files
authored
Check minimum file size, misc updates for 1.2.1 (#97)
* Add min file size, bump DCP versions * Update Dockerfile * Update Makefile * Update Makefile * Update fabfile.py * Update cp-worker to check for a minimum file size If not specified, use 1 byte * Don't write bad code * Don't write bad code * Don't check alarms at midnight
1 parent fa2e17c commit c15d455

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@
3636
# REDUNDANCY CHECKS
3737
CHECK_IF_DONE_BOOL = 'True' #True or False- should it check if there are a certain number of non-empty files and delete the job if yes?
3838
EXPECTED_NUMBER_FILES = 7 #What is the number of files that trigger skipping a job?
39+
MIN_FILE_SIZE_BYTES = 1 #What is the minimal number of bytes an object should be to "count"?

fabfile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ def generate_task_definition():
154154
{
155155
"name": "SECONDS_TO_START",
156156
"value": str(SECONDS_TO_START)
157+
},
158+
{
159+
"name": "MIN_FILE_SIZE_BYTES",
160+
"value": str(MIN_FILE_SIZE_BYTES)
157161
}
158162
]
159163
return task_definition

run.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ def monitor():
305305
#This is slooooooow, which is why we don't just do it at the end
306306
curtime=datetime.datetime.now().strftime('%H%M')
307307
if curtime[-2:]=='00':
308-
killdeadAlarms(fleetId,monitorapp)
308+
if curtime[:2]!='00':
309+
killdeadAlarms(fleetId,monitorapp)
309310
#Once every 10 minutes, check if all jobs are in process, and if so scale the spot fleet size to match
310311
#the number of jobs still in process WITHOUT force terminating them.
311312
#This can help keep costs down if, for example, you start up 100+ machines to run a large job, and

worker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# This wraps the cellprofiler docker registry
66
#
77

8-
FROM cellprofiler/cellprofiler:3.1.5
8+
FROM cellprofiler/cellprofiler:3.1.9
99

1010
# Install S3FS
1111

worker/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
user = cellprofiler
22
project = distributed-cellprofiler
3-
tag = latest
3+
tag = 1.2.1_3.1.9
44

55
.DEFAULT_GOAL: build
66
build:

worker/cp-worker.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
LOG_GROUP_NAME= os.environ['LOG_GROUP_NAME']
2323
CHECK_IF_DONE_BOOL= os.environ['CHECK_IF_DONE_BOOL']
2424
EXPECTED_NUMBER_FILES= os.environ['EXPECTED_NUMBER_FILES']
25+
if 'MIN_FILE_SIZE_BYTES' not in os.environ:
26+
MIN_FILE_SIZE_BYTES = 1
27+
else:
28+
MIN_FILE_SIZE_BYTES = int(os.environ['MIN_FILE_SIZE_BYTES'])
2529

2630
#################################
2731
# CLASS TO HANDLE THE SQS QUEUE
@@ -132,9 +136,9 @@ def runCellProfiler(message):
132136
s3client=boto3.client('s3')
133137
bucketlist=s3client.list_objects(Bucket=AWS_BUCKET,Prefix=remoteOut+'/')
134138
objectsizelist=[k['Size'] for k in bucketlist['Contents']]
139+
objectsizelist = [i for i in objectsizelist if i >= MIN_FILE_SIZE_BYTES]
135140
if len(objectsizelist)>=int(EXPECTED_NUMBER_FILES):
136-
if 0 not in objectsizelist:
137-
return 'SUCCESS'
141+
return 'SUCCESS'
138142
except KeyError: #Returned if that folder does not exist
139143
pass
140144

0 commit comments

Comments
 (0)