https://prefect.io logo
c

Carlos Velazquez

07/18/2023, 9:24 PM
Hello team. i have been working with ECSWorkers with WorkPool, And everything works OK, When i'll tried to edited the base_job_template parms and put it the task_definition_arn i have the follows error: Any clu?? my code:
Copy code
work_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:
Copy code
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
1
j

Jake Kaplan

07/18/2023, 11:11 PM
what version of prefect-aws are you on? The latest version addressed a bug that would lead to this error
c

Carlos Velazquez

07/19/2023, 11:40 AM
These are the version that i use:
Copy code
prefect==2.10.21
prefect-aws==0.3.4
j

Jake Kaplan

07/19/2023, 12:41 PM
if you upgrade to
prefect-aws==0.3.5
you should see that resolved, but let me know if you still see the issue after upgrading
👀 1
c

Carlos Velazquez

07/19/2023, 12:43 PM
Exc, i'll implement this!
yes, version
0.3.5
did fixing out this!
🙌 1