From 04588195bb8ed8c9f0d4c0d365012213160fb5c6 Mon Sep 17 00:00:00 2001 From: jakekaplan <40362401+jakekaplan@users.noreply.github.com> Date: Fri, 14 Jul 2023 14:45:16 -0400 Subject: [PATCH] dont break on debug logs (#296) --- CHANGELOG.md | 9 +++++++-- prefect_aws/workers/ecs_worker.py | 13 ++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 023cb879..a7b63fe9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Fixed `S3Bucket.stream_from` path resolution - [#291](https://github.com/PrefectHQ/prefect-aws/pull/291) - ### Deprecated ### Removed +## 0.3.5 + +### Fixed + +- Fixed `S3Bucket.stream_from` path resolution - [#291](https://github.com/PrefectHQ/prefect-aws/pull/291) +- Fixed `ECSWorker` debug logs from failing to parse json - [#296](https://github.com/PrefectHQ/prefect-aws/pull/296) + ## 0.3.4 Released on June 15th, 2023. diff --git a/prefect_aws/workers/ecs_worker.py b/prefect_aws/workers/ecs_worker.py index 64d206e5..27544e6e 100644 --- a/prefect_aws/workers/ecs_worker.py +++ b/prefect_aws/workers/ecs_worker.py @@ -675,7 +675,9 @@ def _create_task_and_wait_for_start( _TASK_DEFINITION_CACHE[flow_run.deployment_id] = task_definition_arn logger.info(f"Using ECS task definition {task_definition_arn!r}...") - logger.debug(f"Task definition {json.dumps(task_definition, indent=2)}") + logger.debug( + f"Task definition {json.dumps(task_definition, indent=2, default=str)}" + ) # Prepare the task run request task_run_request = self._prepare_task_run_request( @@ -686,7 +688,9 @@ def _create_task_and_wait_for_start( ) logger.info("Creating ECS task run...") - logger.debug(f"Task run request {json.dumps(task_run_request, indent=2)}") + logger.debug( + f"Task run request {json.dumps(task_run_request, indent=2, default=str)}" + ) try: task = self._create_task_run(ecs_client, task_run_request) task_arn = task["taskArn"] @@ -861,7 +865,10 @@ def _register_task_definition( Returns the ARN. """ logger.info("Registering ECS task definition...") - logger.debug(f"Task definition request {json.dumps(task_definition, indent=2)}") + logger.debug( + "Task definition request" + f"{json.dumps(task_definition, indent=2, default=str)}" + ) response = ecs_client.register_task_definition(**task_definition) return response["taskDefinition"]["taskDefinitionArn"]