Assaf Pinhasi
07/03/2023, 12:01 PMTadej Boncelj
07/03/2023, 2:38 PMversion: "3.9"
services:
### Prefect Database
database:
container_name: database
image: postgres:14.1-alpine
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=orion
expose:
- 5432
volumes:
- db:/var/lib/postgresql/data
profiles: ["orion"]
### Prefect Orion API
orion:
container_name: orion
image: prefecthq/prefect:2-python3.10
restart: always
volumes:
- prefect:/root/.prefect
entrypoint: ["prefect", "orion", "start"]
environment:
- PREFECT_ORION_API_HOST=0.0.0.0
- PREFECT_API_URL=<http://127.0.01:4200/api>
- PREFECT_ORION_DATABASE_CONNECTION_URL=<postgresql+asyncpg://postgres:postgres@database:5432/orion>
ports:
- 4200:4200
depends_on:
- database
profiles: ["orion"]
## Prefect Agent
agent:
container_name: agent
image: prefecthq/prefect:2-python3.10
restart: always
entrypoint: ["prefect", "agent", "start", "-q", "default"]
volumes:
- "./src:/root/src"
environment:
- PREFECT_API_URL=<http://orion:4200/api>
depends_on:
- orion
profiles: ["agent"]
cli:
image: prefecthq/prefect:2.10.17-python3.11
entrypoint: "bash"
working_dir: "/root/flows"
volumes:
- "./flows:/root/flows"
environment:
- PREFECT_API_URL=<http://server:4200/api>
# Use PREFECT_API_KEY to use the CLI to interact with Prefect Cloud
# - PREFECT_API_KEY=YOUR_API_KEY
profiles: ["cli"]
volumes:
prefect:
db:
networks:
default:
name: prefect-network
juan suarez (hf)
07/03/2023, 4:48 PMCody
07/03/2023, 11:05 PMSubmission failed. botocore.errorfactory.ClientException: An error occurred (ClientException) when calling the RegisterTaskDefinition operation: Fargate requires task definition to have execution role ARN to support ECR images
My ecsTask block looks like:
ecs-task/trigger-flow
┌─────────────────────────────────┬─────────────────────────────────────────────────────────────────────┐
│ Block Type │ ECS Task │
│ Block id │ a084e009-76b4-47d6-a249-b92bd98dc45b
├─────────────────────────────────┼─────────────────────────────────────────────────────────────────────┤
│ cpu │ 512
│ vpc_id │ vpc-xxxxxxxxx
│ cluster │ arn:aws:ecs:us-east-1:xxxxxxxxx:cluster/prefect
│ stream_output │ True
│ task_role_arn │ arn:aws:iam::xxxxxxxxx:role/ecsTaskExecutionRolePrefect
│ task_definition │
│ execution_role_arn │ arn:aws:iam::xxxxxxxxx:role/ecsTaskExecutionRolePrefect
│ task_customizations │ []
│ task_definition_arn │ arn:aws:ecs:us-east-1:xxxxxxxxx:task-definition/flow-run-a-test:4
│ cloudwatch_logs_options │ {}
│ configure_cloudwatch_logs │ True
│ auto_deregister_task_definition │ False
└─────────────────────────────────┴─────────────────────────────────────────────────────────────────────┘
And the execution_role and task_role both have the managed AmazonECSTaskExecutionRolePolicy which includes
"Action": [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
Am I going crazy, or are those not sufficient permissions? Stackoverflow says that they are, but I could be misinterpreting things.
It seems like the ECS Task that should run the Prefect task isnt inheriting the execution role from the Task Definition.Malavika S Menon
07/04/2023, 5:10 AMKeyError: "No class found for dispatch key 'process' in registry for type 'Block'." prefect
Getting this error when a flow run is submitted to the agent. The error causes the agent process to terminate as well. This is the corresponding deployment-yaml file
infrastructure:
type: process
env: {}
labels: {}
name: null
command:
- python
- -m
- prefect.engine
stream_output: true
_block_type_slug: Process
Andrew W
07/04/2023, 10:20 AMDownloading flow code from storage at 'C:...'
flow could not be retrieved from deployment.
Traceback (most recent call last):
lib\site-packages\prefect\engine.py", line 318, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
lib\site-packages\prefect\client\utilities.py", line 40, in with_injected_client
return await fn(*args, **kwargs)
lib\site-packages\prefect\deployments.py", line 197, in load_flow_from_flow_run
await storage_block.get_directory(from_path=deployment.path, local_path=".")
lib\site-packages\prefect\filesystems.py", line 963, in get_directory
process = await run_process(cmd, stream_output=(out_stream, err_stream))
lib\site-packages\prefect\utilities\processutils.py", line 258, in run_process
async with open_process(
lib\contextlib.py", line 181, in __aenter__
return await self.gen.__anext__()
lib\site-packages\prefect\utilities\processutils.py", line 200, in open_process
process = await _open_anyio_process(command, **kwargs)
lib\site-packages\prefect\utilities\processutils.py", line 162, in _open_anyio_process
process = await asyncio.create_subprocess_shell(
lib\asyncio\subprocess.py", line 216, in create_subprocess_shell
transport, protocol = await loop.subprocess_shell(
lib\asyncio\base_events.py", line 1643, in subprocess_shell
transport = await self._make_subprocess_transport(
lib\asyncio\base_events.py", line 498, in _make_subprocess_transport
raise NotImplementedError
NotImplementedError
The problem has occured in a number of different places for me, for example, when trying to use a prefect shell or using a GitHub block.
In this case, it seems like the storage_block.get_directory()
is called which then causes a cmd shell command to be run. And this process always ends up in the _make_subprocess_transport
function which hasn't been implemented.
Has anyone bumped into this error before? Any help would be extremely appreciated. Thanks.
P.S I'm using prefect 2.10.12, python 3.9.13, and I am on Windows
Joshua Greenhalgh
07/04/2023, 12:08 PMRomain Vincent
07/04/2023, 12:59 PMprefect.deployments.steps.run_shell_script
to install my project dependancies using poetry (rather than with pip_install_requirements
). The script seems to run, but nothing happens and nothing is streamed to my ECS logs or the Prefect console. Here is my pull configuration :
pull:
- prefect.deployments.steps.git_clone:
id: clone-step
repository: "{{ prefect.blocks.secret.repository }}"
branch: master
- prefect.deployments.steps.run_shell_script:
directory: "{{ clone-step.directory }}"
script: "pip install poetry && poetry install"
stream_output: true
And the subsequent log from my ECS task :
04/07/2023 14:45:34 UTC+2 > Running git_clone step...
04/07/2023 14:45:34 UTC+2 > Running run_shell_script step...
04/07/2023 14:45:34 UTC+2 12:45:34.403 | ERROR | Flow run 'screeching-cuttlefish' - Flow could not be retrieved from deployment.
04/07/2023 14:45:34 UTC+2 Traceback (most recent call last):
04/07/2023 14:45:34 UTC+2 File "<frozen importlib._bootstrap_external>", line 883, in exec_module
04/07/2023 14:45:34 UTC+2 File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
04/07/2023 14:45:34 UTC+2 File "/opt/prefect/prefect_testing/prefect_testing/flows/test.py", line 3, in <module>
04/07/2023 14:45:34 UTC+2 import pandas as pd
04/07/2023 14:45:34 UTC+2 (...)
Any idea? Should I use pip_install_requirements
instead?Andres
07/04/2023, 1:22 PMsignals.LOOP
in prefect 2?Mike
07/04/2023, 1:43 PMmerlin
07/04/2023, 3:17 PMsbrabez
07/04/2023, 3:30 PMdatamongus
07/04/2023, 7:14 PMAdi Gandra
07/05/2023, 3:05 AMMoty
07/05/2023, 9:40 AMAshish Gupta
07/05/2023, 11:31 AMGabrielle Bennett
07/05/2023, 1:27 PMRasmus Lindqvist
07/05/2023, 1:34 PMprefecthq/prefect:latest-python3.8
image. (More context in thread). Does anyone have a template for a Dockerfile to run a agent? Tried googling but have not found any examples.Ouail Bendidi
07/05/2023, 2:21 PMDeceivious
07/05/2023, 2:31 PMRonald Sam
07/05/2023, 5:51 PMkasteph
07/05/2023, 6:19 PMretries
and retry_delay_seconds
with the flow
decorator, I get the following error when running a task within the flow:
_pickle.PicklingError: Pickling client objects is explicitly not supported.
However removing those parameters will make the flow run just fine. Has anyone else encountered this?Robert Banick
07/05/2023, 7:17 PMAlix Cook
07/06/2023, 12:05 AMAnyigor Tobias
07/06/2023, 12:54 AMTom Klein
07/06/2023, 9:12 AMput_record
func there is sync (the batch “ingest” is not working for us right now but that’s not important).
We thought of using Prefect to parallelize the put_record
invocations by wrapping each one with a @task , but since we have tens of thousands of records, this would yield tens of thousands of tasks and in practice, it seems that we can’t even get to the point of them running, since over 10+ minutes are just spent submitting these tasks - and they’re all pending….
is this the wrong approach?Deceivious
07/06/2023, 11:13 AMArjun Krishnamurthy
07/06/2023, 11:19 AMFerdinand Biere
07/06/2023, 12:14 PM12:11:31.720 | INFO | Flow run 'tiny-binturong' - Downloading flow code from storage at '/Users/fb/repositories/prefect'
12:11:32.102 | ERROR | Flow run 'tiny-binturong' - Flow could not be retrieved from deployment.
Any input is highly appreciated ☀️Steven Trimboli
07/06/2023, 2:03 PM