David DeStefano
03/25/2025, 5:01 PMFailed to submit flow run '0147a3d2-e189-487f-9434-d3905f69b4bc' to infrastructure.
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/prefect/workers/base.py", line 1011, in _submit_run_and_capture_errors
result = await self.run(
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/prefect_aws/workers/ecs_worker.py", line 680, in run
) = await run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 233, in run_sync_in_worker_thread
result = await anyio.to_thread.run_sync(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 243, in call_with_mark
return call()
^^^^^^
File "/usr/local/lib/python3.12/site-packages/prefect_aws/workers/ecs_worker.py", line 762, in _create_task_and_wait_for_start
template_with_placeholders = self.work_pool.base_job_template[
^^^^^^^^^^^^^^
AttributeError: 'ECSWorker' object has no attribute 'work_pool'. Did you mean: '_work_pool'?
Marvin
03/25/2025, 5:01 PMECSWorker
object not having a work_pool
attribute. This could be due to a mismatch or misconfiguration in the Prefect setup, particularly with how work pools are being defined or utilized in your environment.
Here's what you can do to address this:
1. Verify Work Pool Configuration: Ensure that your work pool is correctly configured and that the base_job_template
is properly set. You might want to create or update your work pool configuration. Here's an example snippet from a script that shows how to create a work pool:
python
from prefect import flow, get_client
from prefect.client.schemas.actions import WorkPoolCreate
async def create_work_pool():
async with get_client() as client:
await client.create_work_pool(
WorkPoolCreate(
name="ecs-work-pool",
description="A work pool for ECS work",
base_job_template=dict(
variables=dict(
type="object", properties=dict(vpc_id=dict(type="string"))
),
job_configuration=dict(
vpc_id="{{ prefect.variables.some_vpc_id }}"
),
),
)
)
2. Review ECS Worker Documentation: Make sure to review the ECS Worker Guide to ensure that your ECS setup aligns with Prefect's expectations.
If you haven't changed anything in your environment, consider whether there might have been updates or changes in the Prefect library or its dependencies that could affect the behavior. If the issue persists, it might be worth checking for any recent updates or patches in the Prefect library that could address this problem.Jake Kaplan
03/25/2025, 5:31 PMprefect-aws
likely needs a higher prefect compatible version.
You can either downgrade prefect-aws
to 0.5.6
or upgrade prefect>=3.2.13
to fixJake Kaplan
03/25/2025, 5:35 PMprefect-aws==0.5.8
with the correctly pinned prefect dependency shortlyNate
03/25/2025, 6:07 PMprefect-aws==0.5.8
is now released - sorry about that!David DeStefano
03/25/2025, 6:35 PMDavid DeStefano
03/25/2025, 6:36 PMdependencies = [
"prefect-docker>=0.6.2",
"prefect[aws,github]>=3.2.7",
]
David DeStefano
03/25/2025, 6:49 PMprefect[aws,github]>=3.2.13
but still seeing the same error..Nate
03/25/2025, 6:57 PMprefect[github]>=3.2.13
prefect-aws>=0.5.8
depending on how you're running your worker, this prefect[aws,github]>=3.2.13
doesn't necessarily guarantee you're getting the newest prefect-aws
David DeStefano
03/25/2025, 6:58 PMDavid DeStefano
03/25/2025, 6:58 PMdependencies = [
"prefect-aws>=0.5.8",
"prefect>=3.2.14",
"prefect-docker>=0.6.2",
]
David DeStefano
03/25/2025, 7:11 PMNate
03/25/2025, 7:12 PMDavid DeStefano
03/25/2025, 7:13 PMDavid DeStefano
03/25/2025, 7:23 PMDavid DeStefano
03/25/2025, 7:23 PMDavid DeStefano
03/25/2025, 7:24 PMDavid DeStefano
03/25/2025, 7:24 PMDavid DeStefano
03/25/2025, 7:24 PMDavid DeStefano
03/25/2025, 7:24 PMFailed to submit flow run 'e5341de9-f047-4730-b45a-05b3fa81fe91' to infrastructure.
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/prefect/workers/base.py", line 1011, in _submit_run_and_capture_errors
result = await self.run(
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/prefect_aws/workers/ecs_worker.py", line 680, in run
) = await run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 233, in run_sync_in_worker_thread
result = await anyio.to_thread.run_sync(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2461, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 962, in run
result = context.run(func, *args)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 243, in call_with_mark
return call()
^^^^^^
File "/usr/local/lib/python3.12/site-packages/prefect_aws/workers/ecs_worker.py", line 762, in _create_task_and_wait_for_start
template_with_placeholders = self.work_pool.base_job_template[
^^^^^^^^^^^^^^
AttributeError: 'ECSWorker' object has no attribute 'work_pool'. Did you mean: '_work_pool'?
Nate
03/25/2025, 7:25 PMDavid DeStefano
03/25/2025, 7:25 PMNate
03/25/2025, 7:25 PMpip list | grep prefect
or similar while exec'd in?David DeStefano
03/25/2025, 7:26 PMDavid DeStefano
03/25/2025, 7:27 PMDavid DeStefano
03/25/2025, 7:27 PMFROM prefecthq/prefect:3.1.5-python3.10 AS base
COPY --from=<http://ghcr.io/astral-sh/uv:0.5.9|ghcr.io/astral-sh/uv:0.5.9> /uv /uvx /bin/
ARG WORKDIR=/opt
WORKDIR $WORKDIR
RUN apt-get update && \
apt-get install -y --no-install-recommends make && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY . ./
ENV PATH="/app/.venv/bin:$PATH"
ENV UV_PROJECT_ENVIRONMENT=/opt/.venv
RUN --mount=type=secret,id=codeartifact_token \
export UV_INDEX_PRIVATE_PYPI_PASSWORD="$(cat /run/secrets/codeartifact_token)" && \
export UV_INDEX_ADONIS_ML_MONO_PASSWORD="$(cat /run/secrets/codeartifact_token)" && \
uv sync
David DeStefano
03/25/2025, 9:39 PMNate
03/25/2025, 10:32 PMprefect
(or prefect-aws
here because ECS worker) and then you can set image
on the work pool and we'll create a task definition automatically (unless you provide your own otherwise on the work pool) that uses that image
for flow run containers
sorry if I'm saying things you already know, i'm just trying to figure out what the disconnect isNate
03/25/2025, 10:34 PMDavid DeStefano
03/25/2025, 11:53 PMDavid DeStefano
03/25/2025, 11:56 PMself.work_pool
). This makes sense because yesterday, as is, my worker was working without issues. Today with the updates it no longer is (I was never pinning a version to the worker).
https://github.com/PrefectHQ/prefect/commit/e33dab815ad01b7ba611910500fd3fafc9a22d72
I'm waiting for a PR review to test the following command for my updated worker. Anticipating is will fail.
"pip install \"prefect[aws]>=3.2.13\" && prefect worker start --pool ${var.prefect.work_pool.name} --type ${var.prefect.work_pool.kind}"
I'm designing my worker off of the following docs.
https://docs.prefect.io/integrations/prefect-aws/ecs_guide#step-3%3A-creating-an-ecs-worker-serviceDavid DeStefano
03/26/2025, 12:38 PM