Zack
03/09/2023, 10:53 PMdef handler(event: dict, context: LambdaContext):
"""This function is the entry point for the Lambda function"""
<http://log.info|log.info>("starting lambda function for artist ranking")
<http://log.info|log.info>(f"event: {event},context: {context}")
start = time.time()
deployment = Deployment.build_from_flow(
flow=artist_ranker_etl,
name="artist-ranker-deployment"
)
deployment.apply()
run_deployment(name="artist_ranker_staging/artist-ranker-deployment",tags=["staging","ranker"])
end = time.time()
print(f"Time to execute: {end - start}")
Taylor Curran
03/10/2023, 9:37 PMrun_deployment(name="artist_ranker_staging/artist-ranker-deployment",tags=["staging","ranker"])
The flow executes successfully?Zack
03/10/2023, 10:17 PMTaylor Curran
03/11/2023, 2:07 AMZack
03/11/2023, 5:10 AMBianca Hoch
03/14/2023, 6:52 PMprefect agent start -p "work-pool-name"
command. Then, you can trigger the bash script to run from within the lambda function. The bash script would look something like:
#!/bin/sh
prefect agent start -p "work-pool-name"
run_deployment
would be to use the create_flow_run
API endpoint (if you'd like to take a look at that as well). The latter is used for ad-hoc runs, which seems like what you're trying to accomplish here with the lambda function.run_deployment
is good for creating flow runs to be executed by a remote agent.