Ifeanyi Okwuchi
12/16/2021, 4:29 PMrepo_name/projects/npa_project/npa_project_module/npa_flow.py . The module is npa_project_module . When i run the following in the CLI prefect run -m npa_project_module.npa_flow I get an error from prefect saying: No module named "npa_project_module" . This happens both when I cd to the npa_project directory and the npa_project_module directory before running the cmd. Any ideas what could be wrong?Kevin Kho
Ifeanyi Okwuchi
12/16/2021, 4:33 PMKevin Kho
Ifeanyi Okwuchi
12/16/2021, 4:36 PMKevin Kho
pip install -e .Ifeanyi Okwuchi
12/16/2021, 4:51 PMpip install -e . Also in what directory should it be runKevin Kho
pip install -e . the . means currently directory and it uses the setup.py file to create the module.Kevin Kho
pip install -e . you can run after making the setup.pyIfeanyi Okwuchi
12/16/2021, 5:14 PMprefect run --module npa_project_module still gives the same errorKevin Kho
prefect run --module … --name …. Can I see what your setup.py looks like?Ifeanyi Okwuchi
12/16/2021, 5:21 PM#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" setup.py - Install this package but not any of its dependencies
This assumes that other tools will install the dependencies from the pipfile
"""
from setuptools import setup, find_packages
setup(
name="npa_segmentation",
version="0.1.0",
description="Pipeline that splits out NPA forecast",
long_description="",
author="****** ******",
packages=find_packages(),
include_package_data=True,
zip_safe=False,
)Kevin Kho
npa_segmentation then, not npa_project_moduleIfeanyi Okwuchi
12/16/2021, 5:22 PMIfeanyi Okwuchi
12/16/2021, 5:23 PMKevin Kho
import npa_segmentation
does it work?Ifeanyi Okwuchi
12/16/2021, 5:24 PMKevin Kho
Ifeanyi Okwuchi
12/16/2021, 5:54 PMpip install -e . again.Ifeanyi Okwuchi
12/16/2021, 5:54 PMIfeanyi Okwuchi
12/16/2021, 5:55 PMFound no flows at npa_segmentation.dags.npa_segmentation_predict.Ifeanyi Okwuchi
12/16/2021, 5:56 PMdef run_flow():
with Flow(
"npa-segmentation-predict-flow", storage=storage, executor=executor, schedule=dag_schedule
) as flow:
prediction_window = Parameter(name="pred_window", default=30, required=False)
pspd = pull_snowflake_data_pred(bucket_base, database, schema, prediction_window)
prepare_predictions_table(database, schema, bucket_base, bucket_base, upstream_tasks=[pspd])
if __name__ == "__main__":
run_flow()Kevin Kho
run_flow()Ifeanyi Okwuchi
12/16/2021, 6:10 PMdef run_flow():
with Flow(
"npa-segmentation-predict-flow", storage=storage, executor=executor, schedule=dag_schedule
) as flow:
prediction_window = Parameter(name="pred_window", default=30, required=False)
pspd = pull_snowflake_data_pred(bucket_base, database, schema, prediction_window)
prepare_predictions_table(database, schema, bucket_base, bucket_base, upstream_tasks=[pspd])
run_flow()Ifeanyi Okwuchi
12/16/2021, 6:10 PMKevin Kho
Ifeanyi Okwuchi
12/16/2021, 6:23 PMfrom prefect.storage import Docker
storage = Docker(
dockerfile="Dockerfile",
registry_url=f"<http://us.gcr.io/{PROJECT}|us.gcr.io/{PROJECT}>",
image_name="test_prefect_cloud",Kevin Kho
Kevin Kho
pip install -e .
to install. This installs a package named flows.
prefect run --module flows --name module_test2
will give:
Running flow locally...
└── 13:47:39 | INFO | Beginning Flow run for 'module_test2'
└── 13:47:39 | INFO | Task 'abc': Starting task run...
└── 13:47:39 | INFO | 2
└── 13:47:40 | INFO | Task 'abc': Finished task run for task with final state: 'Success'
└── 13:47:40 | INFO | Flow run SUCCESS: all reference tasks succeeded
Flow run succeeded!Kevin Kho
Ifeanyi Okwuchi
12/16/2021, 6:51 PMfrom prefect.storage import Module I don't the the imported Module being used in the flowsKevin Kho
Ifeanyi Okwuchi
12/16/2021, 7:46 PMIfeanyi Okwuchi
12/16/2021, 7:46 PMKevin Kho
Kevin Kho
Kevin Kho
Ifeanyi Okwuchi
12/16/2021, 7:50 PMIfeanyi Okwuchi
12/16/2021, 7:50 PMpip install -e . in my dockerfileKevin Kho
Kevin Kho
flow.storage=Module("mymodule.flows.flow1") or flow.storage=Module("flows.flow1") but I think it should be one of the two