Skip to content

Commit

Permalink
fix: update to pydantic 2.x.x
Browse files Browse the repository at this point in the history
Signed-off-by: Guilhem Barthés <[email protected]>
  • Loading branch information
guilhem-barthes committed Feb 8, 2024
1 parent 6372488 commit 5ce6013
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/builder/tasks/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ def before_start(self, task_id: str, args: tuple, kwargs: dict) -> None:
)

def get_task_info(self, args: tuple, kwargs: dict) -> tuple[str, str]:
function = orchestrator.Function.parse_raw(kwargs["function_serialized"])
function = orchestrator.Function.model_validate_json(kwargs["function_serialized"])
channel_name = kwargs["channel_name"]
return function.key, channel_name
2 changes: 1 addition & 1 deletion backend/builder/tasks/tasks_build_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# see http://docs.celeryproject.org/en/latest/userguide/configuration.html#task-reject-on-worker-lost
# and https://github.com/celery/celery/issues/5106
def build_image(task: BuildTask, function_serialized: str, channel_name: str) -> None:
function = orchestrator.Function.parse_raw(function_serialized)
function = orchestrator.Function.model_validate_json(function_serialized)

attempt = 0
while attempt <= task.max_retries:
Expand Down
2 changes: 1 addition & 1 deletion backend/substrapp/tasks/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def on_retry(self, exc: Exception, task_id: str, args: tuple, kwargs: dict[str,

def split_args(self, celery_args: tuple) -> tuple[str, orchestrator.ComputeTask]:
channel_name = celery_args[0]
task = orchestrator.ComputeTask.parse_raw(celery_args[1])
task = orchestrator.ComputeTask.model_validate_json(celery_args[1])
return channel_name, task

def get_task_info(self, args: tuple, kwargs: dict) -> tuple[str, str]:
Expand Down
4 changes: 2 additions & 2 deletions backend/substrapp/tasks/tasks_save_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def attempt(self) -> int:

# Returns (function key, channel)
def get_task_info(self, args: tuple, kwargs: dict) -> tuple[str, str]:
function = orchestrator.Function.parse_raw(kwargs["function_serialized"])
function = orchestrator.Function.model_validate_json(kwargs["function_serialized"])
channel_name = kwargs["channel_name"]
return function.key, channel_name

Expand Down Expand Up @@ -75,7 +75,7 @@ def save_image_task(task: SaveImageTask, function_serialized: str, channel_name:
logger.info("Starting save_image_task")
logger.info(f"Parameters: function_serialized {function_serialized}, " f"channel_name {channel_name}")
# create serialized image
function = orchestrator.Function.parse_raw(function_serialized)
function = orchestrator.Function.model_validate_json(function_serialized)
container_image_tag = utils.container_image_tag_from_function(function)

os.makedirs(SUBTUPLE_TMP_DIR, exist_ok=True)
Expand Down

0 comments on commit 5ce6013

Please sign in to comment.