Choenden Kyirong
10/13/2023, 12:08 AMflow.py
file and not the whole repository when executing it in a container? Would this mean that if i have dependencies in other folders within the repo i’d have to bake that into the image im using in google cloud run? I’m getting a Module Not Found error when trying to import my own modules within the same repo and it seems like this might be the reason?Kevin Grismore
10/13/2023, 1:36 AMgit clone
is run, so your entire repo is copied into the running container. There may be something going on with relative imports based on how you're running the flow when testing it locally. I would make sure when testing that you're in the root of your repo when executing the script, writing out the path to your flow file the same way you would specify in the entrypoint
field of your deployment.Choenden Kyirong
10/13/2023, 8:00 PMPipelines/
|
|-- src/
| |-- flows/
| | |--- flow_1/
| | |------- flow_1.py, flow_1.deployment.py
| | |--- flow_2/
| | |------- flow_2.py, flow_2.deployment.py
| | |...
| |-- helpers/
| |---- helper.py ..
|-- requirements
|-- setup.py
|-- README
when testing locally, does it matter where you run the deployment from? For example, running prefect deploy
from src/
vs running prefect deploy
from src/flows/flow_<num>
or running the deployment.py
files inside the respective flow folders?Kevin Grismore
10/13/2023, 8:07 PMflow_1.py
and flow_1.deployment.py
is. When you create a deployment, you specify an entrypoint
, so if we were in the root of your repo, it'd look like src/flows/flow_1/flow_1.py:<your_flow_function>
, assuming flow_1.py
is the script that has the flow you want to deploy in it.Kevin Grismore
10/13/2023, 8:08 PMpython src/flows/flow_1/flow_1.py
Choenden Kyirong
10/13/2023, 8:10 PMfrom prefect.deployments import Deployment
from flow import flow_function
deployment = Deployment.build_from_flow(
flow=flow_function,
name="ad-hoc",
description=description,
infra_overrides={"env": {"PREFECT_LOGGING_LEVEL": "DEBUG"}},
version="1.0",
work_queue_name="dev",
parameters={...},
tags=["dev"],
)
if __name__ == "__main__":
deployment.apply()
I now run prefect deploy
in the root of the repo with the entrypoint like you showed above.Kevin Grismore
10/13/2023, 8:10 PMKevin Grismore
10/13/2023, 8:11 PMpython src/flows/flow_1/flow_1.py
to run your flow locally from the root of your repo and see if you're getting the same import errorsChoenden Kyirong
10/13/2023, 8:18 PMKevin Grismore
10/13/2023, 8:19 PMChoenden Kyirong
10/13/2023, 8:19 PMKevin Grismore
10/13/2023, 8:19 PMChoenden Kyirong
10/13/2023, 8:21 PMKevin Grismore
10/13/2023, 8:22 PMprefect-sqlalchemy
Kevin Grismore
10/13/2023, 8:23 PMKevin Grismore
10/13/2023, 8:24 PMKevin Grismore
10/13/2023, 8:25 PMChoenden Kyirong
10/13/2023, 8:27 PMKevin Grismore
10/13/2023, 8:29 PMKevin Grismore
10/13/2023, 8:31 PMChoenden Kyirong
10/13/2023, 8:31 PMKevin Grismore
10/13/2023, 8:31 PMChoenden Kyirong
10/13/2023, 8:31 PMChoenden Kyirong
10/13/2023, 10:25 PMvpc connector name
attribute in the cloud run pool. It seems like it may no longer be a supported feature?
Annotation '<http://run.googleapis.com/vpc-access-connector|run.googleapis.com/vpc-access-connector>' is not supported on resources of kind 'Service'. Supported kinds are: Revision, Execution
https://stackoverflow.com/questions/66098691/deploying-cloud-run-service-fails-because-of-vpc-connector-annotationKevin Grismore
10/13/2023, 10:29 PMChoenden Kyirong
10/13/2023, 10:58 PMChoenden Kyirong
10/16/2023, 4:27 AMvpc-access-connector
annotation in the wrong location. It needed to be moved to template’s metadata. I’ve followed here as a comment: https://github.com/PrefectHQ/prefect-gcp/pull/172#issuecomment-1763689322 and submitted an issue: https://github.com/PrefectHQ/prefect-gcp/issues/218Kevin Grismore
10/16/2023, 12:30 PMChoenden Kyirong
10/16/2023, 4:16 PM