@@ -317,15 +317,15 @@ def check_docker_image_update():
317317 tag = Settings .DOCKER_IMAGE_TAG ,
318318 docker_base_url = Settings .CONTAINER_SOCKET
319319 )
320- result = checker .compare_local_vs_remote_images ()
320+ result = checker .compare_local_vs_remote_images (container_id = socket . gethostname () )
321321 status = result ["status" ]
322322
323323 log_level = logging .INFO
324324
325325 log_lines = [
326326 "" ,
327327 "=" * 60 ,
328- "DOCKER IMAGE UPDATE CHECK" ,
328+ "COMPUTE WORKER DOCKER IMAGE UPDATE CHECK" ,
329329 "=" * 60 ,
330330 f"Image: { result .get ('image_name' )} " ,
331331 ]
@@ -350,7 +350,7 @@ def check_docker_image_update():
350350 log_level = logging .ERROR
351351
352352 elif status == DockerImageStatus .LOCAL_MISSING :
353- log_lines .append ("Status: Local image is not present . Pull required" )
353+ log_lines .append ("Status: Local image not found . Pull required" )
354354 log_level = logging .ERROR
355355
356356 elif status == DockerImageStatus .REMOTE_UNAVAILABLE :
@@ -368,6 +368,10 @@ def check_docker_image_update():
368368
369369 logger .log (log_level , "\n " .join (log_lines ))
370370
371+ if status != DockerImageStatus .UP_TO_DATE :
372+ return "\n " .join (log_lines ) + "\n "
373+ return None
374+
371375
372376# -----------------------------------------------------------------------------
373377# The main compute worker entrypoint, this is how a job is ran at the highest
@@ -376,12 +380,14 @@ def check_docker_image_update():
376380@shared_task (name = "compute_worker_run" )
377381def run_wrapper (run_args ):
378382 # Check for docker image update
379- check_docker_image_update ()
383+ docker_image_warning = check_docker_image_update ()
380384
381385 # We need to convert the UUID given by celery into a byte like object otherwise things will break
382386 run_args .update (secret = str (run_args ["secret" ]))
383387 logger .info (f"Received run arguments: \n { colorize_run_args (json .dumps (run_args ))} " )
384388 run = Run (run_args )
389+ if docker_image_warning :
390+ run .docker_image_warning = docker_image_warning .encode ()
385391 try :
386392 run .prepare ()
387393 run .start ()
@@ -531,6 +537,7 @@ def __init__(self, run_args):
531537 self .output_dir = os .path .join (self .root_dir , "output" )
532538 self .data_dir = os .path .join (Settings .HOST_DIRECTORY , "data" ) # absolute path to data in the host
533539 self .logs = {}
540+ self .docker_image_warning = None
534541
535542 # Details for submission
536543 self .is_scoring = run_args ["is_scoring" ]
@@ -626,6 +633,8 @@ def push_logs(self):
626633 continue
627634 location = entry .get ("location" )
628635 data = entry .get ("data" ) or b""
636+ if self .docker_image_warning and stream_key == "stderr" :
637+ data = self .docker_image_warning + data
629638 if location :
630639 self ._put_file (location , raw_data = data )
631640 except Exception as e :
0 commit comments