Skip to content

Commit 138a27c

Browse files
committed
reorganzing and cleaning of compute worker
rebasing
1 parent 1ad888d commit 138a27c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

compute_worker/compute_worker.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def to_bool(val):
114114
WORKER_BUNDLE_URL_REWRITE = get("WORKER_BUNDLE_URL_REWRITE", "").strip()
115115

116116

117+
117118
# -----------------------------------------------
118119
# Program Kind
119120
# -----------------------------------------------
@@ -264,7 +265,6 @@ def setup_celery_logging(**kwargs):
264265
),
265266
]
266267

267-
268268
# -----------------------------------------------
269269
# Exceptions
270270
# -----------------------------------------------
@@ -291,7 +291,9 @@ def rewrite_bundle_url_if_needed(url):
291291
292292
Example: http://localhost:9000|http://minio:9000
293293
"""
294+
294295
rule = Settings.WORKER_BUNDLE_URL_REWRITE
296+
295297
if not rule or "|" not in rule:
296298
return url
297299
src, dst = rule.split("|", 1)
@@ -1229,6 +1231,8 @@ def prepare(self):
12291231
# Only during prediction step do we want to announce "preparing"
12301232
self._update_status(SubmissionStatus.PREPARING, extra_information=f"ingestion_hostname-{hostname}")
12311233

1234+
1235+
12321236
# Setup cache and prune if it's out of control
12331237
self._prep_cache_dir()
12341238

@@ -1301,25 +1305,24 @@ def start(self):
13011305
"error_message": error_message,
13021306
"is_scoring": self.is_scoring,
13031307
}
1308+
13041309
# Cleanup containers
13051310
containers_to_kill = [
13061311
self.ingestion_container_name,
13071312
self.program_container_name
13081313
]
1309-
logger.debug(
1310-
"Trying to kill and remove container " + str(containers_to_kill)
1311-
)
1314+
logger.debug("Trying to kill and remove container " + str(containers_to_kill))
1315+
13121316
for container in containers_to_kill:
13131317
try:
13141318
client.remove_container(str(container), force=True)
13151319
except docker.errors.APIError as e:
13161320
logger.error(e)
13171321
except Exception as e:
1318-
logger.error(
1319-
f"There was a problem killing {containers_to_kill}: {e}"
1320-
)
1322+
logger.error(f"There was a problem killing {containers_to_kill}: {e}")
13211323
if Settings.LOG_LEVEL == Settings.LOG_LEVEL_DEBUG:
13221324
logger.exception(e)
1325+
13231326
# Send data to be written to ingestion/scoring std_err
13241327
self._update_submission(execution_time_limit_exceeded_data)
13251328
# Send error through web socket to the frontend

0 commit comments

Comments
 (0)