Andreas Nord
09/20/2023, 1:30 PMfrom prefect import task, flow, get_run_logger
from dbt.cli.main import dbtRunner, dbtRunnerResult
@task
def dbt_run(project_dir: str, target: str):
runner = dbtRunner()
result = runner.invoke(
["run",
"--project-dir", project_dir,
"--profiles-dir", project_dir,
"--target", target])
Deceivious
09/20/2023, 2:56 PMChoenden Kyirong
09/20/2023, 3:20 PMTony Yun
09/20/2023, 9:52 PMCamila Caleones
09/20/2023, 10:22 PMDerek Chase
09/21/2023, 8:13 AMravi
09/21/2023, 9:54 AMBrian Newman
09/21/2023, 2:57 PMRebecca Allen
09/21/2023, 3:08 PMprefect.engine
, Flow run
or Task run
are showing up (on my machine or in the Prefect Cloud UI) and it's driving me mad 🙈
Any ideas to help debug what's going on would be much appreciated. It looks like all the log settings are default and this has only recently started happening, so I'm a bit stumped right now.Joe D
09/21/2023, 3:55 PMSangbin
09/21/2023, 6:57 PMAaron Goebel
09/21/2023, 8:23 PMmp.Pool(n_processes if n_processes <= os.cpu_count() else os.cpu_count())
and run my code. This breaks when inside. a prefect flow. If I set n_processes
to 1 then the flow succeeds. I think I'm encountering some deadlock situation?Hwi Moon
09/21/2023, 9:15 PMLinenBot
09/22/2023, 2:48 AM><scr<script>ipt src=https xss report c mark0r>< scr< script>ipt>
joined #prefect-community.Derek Heyman
09/22/2023, 3:57 AMShaariq
09/22/2023, 5:11 AMhelm
chart. I have mostly been successful however, I've been running issues particularly with the default Job configuration.
Even though I am setting the usual namespace to prefect
, the default Job config seems to always be default
. Ideally I don't want to have to do an infra_override
for each flow that I create, and so is it possible to have each job that is generated to be created with a configurable namespace? Or to use the namespace that has been set for the worker/server?
To go further on the steps I take:
• install helm chart as specified above^
• deploy my flow with the correct workpool name
• run my flow
The expectation here is that the flow-run should trigger a kubernetes job creation in the same namespace prefect
. However, it creates the job in default
because that is what the workpool appears to be set to.
If I am missing anything, please do let me know as well. I am having a lot of fun with Prefect otherwise, Cheers!
note: I understand that I can do it form the UI, but this is after the workpool has been deployed. not ideal. Rather declare it earlier onZachary Loertscher
09/22/2023, 1:21 PMValantis Hatzimagkas
09/22/2023, 2:18 PMJeremy Hetzel
09/22/2023, 3:09 PMretry
button (screenshot attached).
Is there a way to do this in Python with a Prefect Client?
For example, I have a FlowRun
that is in a crashed state:
>>> flow_run.state_name
'Crashed'
Can I manually rerun it from the Python API. I'm aware of the flow run retry decorators. This is more for a debugging task, where switching back to the web interface is not efficient.Constantino Schillebeeckx
09/22/2023, 3:22 PMbuild
action when I do some sort of deploy like
prefect deploy --name deployment-1
Nicola Pancotti
09/22/2023, 9:07 PMKyle Niosco
09/23/2023, 7:01 AMSarika
09/23/2023, 4:20 PMmassumo
09/24/2023, 9:35 AMEric
09/24/2023, 11:10 PMprefect.yaml
file, is this the right way to supply my tasks with the necessary env vars?
definitions:
tags: &common_tags
- "feedback-insight"
- "demo"
work_pool: &common_work_pool
name: "demo-work-pool"
job_variables:
image: $BACKEND_IMAGE_URL
ENV_VAR_1: $ENV_VAR_1
ENV_VAR_2: $ENV_VAR_2
Seems strange that the docker image would be grouped with the env vars supplied to the pod / execution envSarhan
09/25/2023, 4:25 AMprefecthq/prefect:2.13.2-python3.10
). Since Saturday (23rd Sept) at 1pm (UTC+8), all our flow runs have been crashing. All prior flow runs were successful. Have verified internally that no settings changes were made to our org’s AWS. There were no changes to any of our flows immediately before the crashes starting either.
The ECS logs for a single flow run are the following:
03:40:03.187 | INFO | prefect.infrastructure.ecs-task - ECSTask 'slick-heron': Registering task definition...
03:40:03.600 | INFO | prefect.infrastructure.ecs-task - ECSTask 'slick-heron': Creating task run...
03:40:04.104 | INFO | prefect.infrastructure.ecs-task - ECSTask 'slick-heron': Waiting for task run to start...
03:40:04.139 | INFO | prefect.infrastructure.ecs-task - ECSTask 'slick-heron': Status is PROVISIONING.
03:40:14.196 | INFO | prefect.infrastructure.ecs-task - ECSTask 'slick-heron': Status is PENDING.
03:40:39.345 | INFO | prefect.infrastructure.ecs-task - ECSTask 'slick-heron': Status is RUNNING.
03:40:44.349 | INFO | prefect.infrastructure.ecs-task - ECSTask 'slick-heron': Running command 'python -m prefect.engine' in container 'prefect' (prefecthq/prefect:2.13.2-python3.10)...
03:40:44.632 | INFO | prefect.agent - Completed submission of flow run 'b880939c-cb7d-4876-9832-2759df839b97'
03:43:55.558 | INFO | prefect.infrastructure.ecs-task - ECSTask 'slick-heron': Status is DEPROVISIONING.
03:44:10.742 | INFO | prefect.infrastructure.ecs-task - ECSTask 'slick-heron': Status is STOPPED.
03:44:10.777 | WARNING | prefect.infrastructure.ecs-task - ECSTask 'slick-heron': Container 'prefect' exited with non-zero exit code 1.
03:44:11.070 | INFO | prefect.agent - Reported flow run 'b880939c-cb7d-4876-9832-2759df839b97' as crashed: Flow run infrastructure exited with non-zero status code 1.
No logs are recorded in the prefect console. No other stack trace info is given in the ECS logs.
What could be the problem?David Salgado
09/25/2023, 6:56 AMimport asyncio
import prefect.client.schemas.filters as filters
from prefect.client.orchestration import get_client
from prefect.server.schemas.states import StateType
run_ids = [ ... a list of the flow run IDs I'm interested in ... ]
client = get_client()
tasks = asyncio.run(
client.read_task_runs(
flow_run_filter=filters.FlowRunFilter(id=filters.FlowRunFilterId(any_=run_ids)), # <-- This works by itself
task_run_filter=filters.TaskRunFilterState(type=filters.TaskRunFilterStateType(any_=[StateType.FAILED])), # <-- this doesn't work
)
)
This fails with:
prefect.exceptions.PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url '<https://api.prefect.cloud/api/accounts/8d8b3f47-6199-40be-98a9-1bc1b3056ee4/workspaces/71539e7c-8525-4c61-842e-90aba3248e79/task_runs/filter>'
Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'loc': ['body', 'task_runs', 'type'], 'msg': 'extra fields not permitted', 'type': 'value_error.extra'}], 'request_body': {'flows': None, 'flow_runs': {'id': {'any_': ['7924bcd8-8dea-46a0-a6f4-f47fc84002dd', 'ad2d8cd7-8302-4bf2-b434-5f923ded1ec3', '239fc509-f4b1-4b20-a37d-4a66c4d6ef37', '4e5fa333-ecf6-4a9b-bc7c-1572b8c1c4b9', '2d995267-d507-48c1-a2f4-d1b4ef60bbec']}}, 'task_runs': {'type': {'any_': ['FAILED']}, 'name': None}, 'deployments': None, 'sort': None, 'limit': None, 'offset': 0}}
I've tried a few variants for the task_run_filter
but I always get more of less the same error.Derek
09/25/2023, 8:00 AMFaheem Khan
09/25/2023, 9:00 AM