Carlos Velazquez
07/18/2023, 9:24 PMwork_pool_type = 'ecs'
base_job_template = await get_default_base_job_template_for_infrastructure_type(infra_type=work_pool_type)
job_template = deepcopy(base_job_template)
_env_vars = {
.....
}
override_template(job_template, {
'cpu': 510,
'memory': 1024,
'env': _env_vars,
'stream_output': True,
'task_definition_arn': RUNNER_TASK_ARN
})
_work_pool_name = NAME
async with get_client() as client:
wp = WorkPoolCreate(
name=_work_pool_name,
type=work_pool_type,
base_job_template=job_template,
is_paused=False,
)
Error prefect logs:
Failed to submit flow run '3ad086e4-fc7c-4da6-86cb-81a322d568d0' to infrastructure.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/prefect/workers/base.py", line 834, in _submit_run_and_capture_errors
result = await self.run(
File "/usr/local/lib/python3.8/site-packages/prefect_aws/workers/ecs_worker.py", line 538, in run
) = await run_sync_in_worker_thread(
File "/usr/local/lib/python3.8/site-packages/prefect/utilities/asyncutils.py", line 91, in run_sync_in_worker_thread
return await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.8/site-packages/prefect_aws/workers/ecs_worker.py", line 678, in _create_task_and_wait_for_start
logger.debug(f"Task definition {json.dumps(task_definition, indent=2)}")
File "/usr/local/lib/python3.8/json/__init__.py", line 234, in dumps
return cls(
File "/usr/local/lib/python3.8/json/encoder.py", line 201, in encode
chunks = list(chunks)
File "/usr/local/lib/python3.8/json/encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/usr/local/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/local/lib/python3.8/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "/usr/local/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type datetime is not JSON serializable
Jake Kaplan
07/18/2023, 11:11 PMCarlos Velazquez
07/19/2023, 11:40 AMprefect==2.10.21
prefect-aws==0.3.4
Jake Kaplan
07/19/2023, 12:41 PMprefect-aws==0.3.5
you should see that resolved, but let me know if you still see the issue after upgradingCarlos Velazquez
07/19/2023, 12:43 PM0.3.5
did fixing out this!