Skip to content

Commit

Permalink
transform_file task uses ack_late=True
Browse files Browse the repository at this point in the history
We found that when the autoscaler decides to scale down the number of transformers
that the science image dies immediatly which  causes the "sync" call to fail. When this
happens we need to put the transform request back onto rabbit queue and die
gracefully.

Add the acks_late propoerty to the transform_file request and now the failure
to receive the sync command from the science container is a fatal error.
  • Loading branch information
BenGalewsky committed Oct 11, 2024
1 parent 261045c commit dd5bc89
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions transformer_sidecar/src/transformer_sidecar/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import json
import os
import shutil
import sys
import timeit
from argparse import Namespace
from hashlib import sha1, sha256
Expand All @@ -42,7 +43,8 @@
import time
from celery import Celery, shared_task

from transformer_sidecar.science_container_command import ScienceContainerCommand
from transformer_sidecar.science_container_command import ScienceContainerCommand, \
ScienceContainerException
from transformer_sidecar.transformer_logging import initialize_logging
from transformer_sidecar.transformer_stats import TransformerStats
from transformer_sidecar.transformer_stats.aod_stats import AODStats # NOQA: 401
Expand Down Expand Up @@ -82,7 +84,7 @@
logger = initialize_logging()


@shared_task
@shared_task(acks_late=True)
def transform_file(
request_id,
file_id,
Expand Down Expand Up @@ -276,6 +278,9 @@ def transform_file(
},
)

except ScienceContainerException as error:
logger.exception("Science container not responding. Shutting down this transformer.")
sys.exit(0)
except Exception as error:
logger.exception(f"Received exception doing transform: {error}")
rec = FileCompleteRecord(
Expand Down

0 comments on commit dd5bc89

Please sign in to comment.