Jelle Vegter
10/06/2021, 7:41 AMAnna Geller
prefect diagnostics
and check "prefect_backend"?
If it turns out you use Server, you can then switch the backend using: prefect backend cloud
Jelle Vegter
10/06/2021, 9:29 AMJelle Vegter
10/06/2021, 9:51 AMAnna Geller
Jelle Vegter
10/06/2021, 10:37 AMJelle Vegter
10/06/2021, 10:42 AMAnna Geller
Ruben Sik
10/06/2021, 12:04 PMAnna Geller
Ruben Sik
10/06/2021, 12:17 PMRuben Sik
10/06/2021, 12:24 PMAnna Geller
from prefect import task, Flow
@task
def hello_world():
return "hello world"
with Flow("test-flow") as flow:
hello_world()
if __name__ == "__main__":
flow.register()
Otherwise, since prefect
is the only module you import, can you check if prefect is installed in the environment where you run this?Ruben Sik
10/06/2021, 12:52 PMAnna Geller
Ruben Sik
10/06/2021, 1:06 PMAnna Geller
prefect agent local start --label "data-gateway"
. Then I registered this flow by explicitly specifying LocalRun with your label, and it seems to work:
from prefect import task, Flow
from prefect.run_configs import LocalRun
@task
def hello_world():
return "hello from local agent"
with Flow("test-flow", run_config=LocalRun(labels=["data-gateway"])) as flow:
hello_world()
if __name__ == "__main__":
flow.register("DataScience")
so I believe there is some mismatch in the run configuration or Agent environment. Could you check that and try again?Kevin Kho
ModuleNotFoundError("No module named 'C'")".
happens when you use the default Local storage when you register, and then try to run the Flow in a different machine.
When you register, Prefect saves the Flow in storage. When you run the flow, Prefect loads it from storage and executes it. For the default Local storage, this is saved in the .prefect
folder when you register.
So when Prefect executes the content of the Flow, it imports it from Storage. The No module named 'C'
is because you’re using Windows, and that is the default drive and the import on the Prefect end will look something like “from C..prefect.flows import myflow” (this is not super accurate). This specific error is just saying it can’t find the file to load in. This happens when you register with local on one machine then run it in another because the file is not there.Ruben Sik
10/06/2021, 2:12 PMKevin Kho
Ruben Sik
10/06/2021, 3:16 PMKevin Kho
Ruben Sik
10/07/2021, 8:55 AMKevin Kho