Daniel
06/05/2024, 1:55 PMimport asyncio
from prefect import get_client
from prefect.flow_runs import wait_for_flow_run
async def main():
async with get_client() as client:
flow_run = await client.create_flow_run_from_deployment(deployment_id="<DEPLOYMENT_ID>")
print("create flow run")
flow_run = await wait_for_flow_run(flow_run_id=flow_run.id)
print(flow_run.state)
if __name__ == "__main__":
asyncio.run(main())
I don’t understand how it is connecting to prefect cloud though? I don’t have any environment variables set. How would I enable this script to authenticate with my prefect cloud account on any machine e.g. in a cloud VM ? Could someone please explain how the python SDK authenticates to my prefect cloud environmentDylan
Dylan
prefect cloud login
stores a config file on the machine it's running on that contains your api key. By default this file is at ~/.prefect/profiles.toml
Daniel
06/05/2024, 2:40 PMcreate_flow_run_from_deployment
function using the API and python requests library. How would one authenticate using prefect cloud login
in order to use the python SDK in a google cloud function?Dylan
Dylan
PREFECT_API_KEY
but let me double checkDylan
Dylan
Dylan
Daniel
06/05/2024, 2:57 PMDylan