Apoorva Desai04/14/2022, 12:20 AM
Anna Geller04/14/2022, 12:39 AM
Apoorva Desai04/14/2022, 3:33 AM
on my docker container and yet prefect doesn't seem to be able to do it.
[2022-04-14T03:30:34.389Z] from src.prefect_state_handlers import FlowStateHandler [2022-04-14T03:30:34.389Z] ModuleNotFoundError: No module named 'src'
Kevin Kho04/14/2022, 3:33 AM
Apoorva Desai04/14/2022, 3:34 AM
Kevin Kho04/14/2022, 3:35 AM
would not copy source in right? Does it actually when you exec in?
ADD . .
Apoorva Desai04/14/2022, 3:35 AM
during flow execution (without
) and see this
src @ file:///root/prefect-docker
during my flow execution and see all of those files listed there
Kevin Kho04/14/2022, 3:37 AM
Apoorva Desai04/14/2022, 3:39 AM
from setuptools import setup, find_packages with open('requirements.txt') as f: requirements = f.read().splitlines() setup( name="src", version='0.1.0', description='Python library for use across repositories and prefect flows', packages=find_packages(), install_requires=requirements )
Kevin Kho04/14/2022, 3:41 AM
Apoorva Desai04/14/2022, 3:42 AM
Kevin Kho04/14/2022, 3:43 AM
Apoorva Desai04/14/2022, 3:45 AM
Kevin Kho04/14/2022, 3:46 AM
in the container and try importing
cd somewhere else
to make sure it’s really in the python path after the pip install because this might work if you just happen to be in the right directory also
Apoorva Desai04/14/2022, 3:48 AM
Kevin Kho04/14/2022, 3:50 AM
Apoorva Desai04/14/2022, 3:53 AM
prefect backend server prefect register --project data -p flows/
flow.run_config = KubernetesRun(job_template=K8S_JOB_TEMPLATE, image = "******.<http://dkr.ecr.us-east-1.amazonaws.com/oh-data-utils:PR-1.16.b7ed902%22|dkr.ecr.us-east-1.amazonaws.com/oh-data-utils:PR-1.16.b7ed902">)
Kevin Kho04/14/2022, 3:56 AM
Apoorva Desai04/14/2022, 4:06 AM
So importing it in a task is causing the flow to not understand where it's coming from. How would you do this?
with Flow("everysundayweekly-flow", state_handlers=[statehandler.slack_failure_notification]) as flow:
Kevin Kho04/14/2022, 4:09 AM
Apoorva Desai04/14/2022, 4:10 AM
Kevin Kho04/14/2022, 4:20 AM
on your local machine so that it’s importable by the python installation. Or am I missing something?
pip install -e .
import src with Flow("everysundayweekly-flow", state_handlers=[src.statehandler.slack_failure_notification]) as flow:
Apoorva Desai04/14/2022, 4:38 AM
Kevin Kho04/14/2022, 4:40 AM
Apoorva Desai04/14/2022, 4:46 AM