Sorry, I'm still confused around blocks! I underst...
# ask-community
c
Sorry, I'm still confused around blocks! I understand that I might want to add a block in order to centrally coordinate access to configuration inside my flow. At this point, I'm just trying to get my flow running though, using an ECS-Task block. 1. I've defined a block in Python with
ECSTask(...).save("dev-trial", overwrite=True)
on my dev machine. It shows up in Prefect Cloud. 2. I have created a deployment with
prefect deployment build -n dev-trial -q dev -ib ecs-task/dev-trial -a flows/healthcheck.py:healcheck
again from my dev machine 3. I have started a local agent with
prefect agent start -q dev
and triggered a job. All works. 4. I have started an agent inside a container and triggered the job, but now it fails with the error
KeyError: "No class found for dispatch key 'ecs-task' in registry for type 'Block'."
It seems like in the container, it's not able to resolve the block reference. But isn't that embedded inside the yaml downloaded from Prefect Cloud?
1
Ah maybe I need to install prefect-aws inside the agent container so that it knows how to actually use the ECSTask configuration
z
^ Yep. If
prefect-aws
isn’t installed, the implementation of the block will not be discoverable.
j
...
is prefect-aws not installed on the prefecthq/prefect:latest-python3.10 images?
I too am running into this issue, now it seems we must build our own image
c
I've worked around it by adding the installation to the entrypoint command
j
yeah, we'll work around it.. i would just assume the docker image prefect says to run as the aws ecs fargate agent would have the prefect-aws module lol
👍 1
🤷
z
We do not include collections in our base images because otherwise we’d need all the cloud-providers installed which is really heavy.
You can use the
EXTRA_PIP_PACKAGES
environment variable to install it with our default entrypoint e.g.
EXTRA_PIP_PACKAGES=prefect-aws
🙌 1
197 Views