Gregory Hunt
09/18/2023, 7:43 PMKiley Roberson
09/18/2023, 9:24 PMasync def my_subflow(id: str):
def run_logic():
product_logic(id)
loop = asyncio.get_running_loop()
await loop.run_in_executor(None, run_logic)
However - I am getting this error when trying to set up the logger:
Flow run encountered an exception. MissingContextError: There is no active flow or task run context
So some needed context is being lost when I create the new thread. Im wondering if there is a different approach for how I can execute the logic as a non blocking routine or maybe some way I can set the needed context? Thanks!Alex Hornbake
09/19/2023, 7:00 AMScheduled → Pending → Crashed → Running → Completed
For now, we've adjusted our alerting to only trigger if a flow "stays in {state} for 5 minutes", but it would be nice to be able to alert when a flow "enters {state}".
lmk if there is a better forum for this bug report.Yoshi
09/19/2023, 12:59 PM/opt/prefect/entrypoint.sh failed: Permission denied
. Curious if anyone else has seen this error before? Happy to share more if it could be helpful.Zachary Loertscher
09/19/2023, 1:42 PM952909cb-fc80-4942-8868-8995b83b00b7
, 62a4e24c-c6ad-47ac-b017-6d0836c62b8c
Prefect version: 2.8.7
Full trace-back of an example task error included in threadRemington Hackbarth
09/19/2023, 2:42 PMinfrastructure:
type: process
env: {}
labels: {}
name: null
command:
- poetry
- run
- python
- -m
- prefect.engine
stream_output: true
_block_type_slug: Process
however if I kick off this deployment from the cloud UI, it fails, and doesn't generate any logs. Is there a different way to run a flow within a specific VENV? Thanks!Max Kolasinski
09/19/2023, 3:29 PMJan Malek
09/19/2023, 3:47 PMYD
09/19/2023, 4:11 PMprefect deployment build my_flow.py:flow_name -q que1 --tag LIN --name proj_name --skip-upload --pool "default-agent-pool"
and I get en error:
encountered an exception: ModuleNotFoundError("No module named 'my_project_source")
I tried to add everywhere where that are imports in the project, from other parts of the project
from pathlib import Path
import sys
import os
path = Path(os.path.dirname(__file__))
sys.path.append(path)
sys.path.append(path.parent)
but this did not help
do I have to create a python package from the code in order to deploy it?
if there is a way to deploy a project without turning it to a python package, what is it ?
I do not see in https://docs.prefect.io/latest/concepts/deployments/
information on prefect deployment build
was this deprecated ?Tony Yun
09/20/2023, 1:03 AMMohamed Rafiyudeen
09/20/2023, 4:49 AMHans Lellelid
09/20/2023, 9:02 AMJustin Trautmann
09/20/2023, 9:42 AMMichał Augoff
09/20/2023, 10:15 AMJonathan Aschan
09/20/2023, 12:38 PMimport asyncio
from typing import Any
from prefect import flow
@flow
async def subflow(should_fail: bool = False):
if should_fail:
raise ValueError("I failed!")
return 42
@flow
async def create_sub_flows():
parallel_subflows: list[Any] = []
for i in range(10):
parallel_subflows.append(subflow(i % 2 == 0))
await asyncio.gather(*parallel_subflows)
if __name__ == '__main__':
asyncio.run(create_sub_flows())
Idan
09/20/2023, 12:58 PMAndreas 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 PM