https://prefect.io logo
Title
z

Zack

03/09/2023, 5:29 PM
Should I be seeing a flow produced in the cloud ui for each run? using this block of code:
deployment = Deployment.build_from_flow(
flow=artist_ranker_etl,
name="artist-ranker-deployment",
entrypoint="artist_ranker.main.handler",
)
deployment.apply()
I'm only seeing it once in the ui for the initial run.
r

redsquare

03/09/2023, 5:39 PM
it should, how are you triggering the run
z

Zack

03/09/2023, 5:45 PM
The lambda is being trigger from another lambda currently. This the handler logic,
def 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}")
    
    os.environ['PREFECT_HOME'] = '/tmp/prefect'


    start = time.time()

    # Case 2:
    deployment = Deployment.build_from_flow(
    flow=artist_ranker_etl,
    name="artist-ranker-deployment"    
    )
    deployment.apply()
    
    end = time.time()
    
    print(f"Time to execute: {end - start}")
r

redsquare

03/09/2023, 6:19 PM
thats deployment not invoking the flow
it will just be deploying over the top
z

Zack

03/09/2023, 6:27 PM
hm, what am I missing to invoke the flow?
r

redsquare

03/09/2023, 6:29 PM
a schedule or a call to create a flow run
so a deployment has a flow, a flow has flow runs
z

Zack

03/09/2023, 6:36 PM
So currently my cloud UI shows one flow run, but not any of the others. I'd image this script can invoke the flow when the lambda its in is triggered by another lambda. Is that true?
r

redsquare

03/09/2023, 6:39 PM
after deployment yes you can invoke it
z

Zack

03/09/2023, 7:16 PM
hm, added this run_deployment(name="artist_ranker_staging/artist-ranker-deployment",tags=["staging","ranker"]) Several flow runs are being kicked off now for each lambda run, I was only expecting one. Nevertheless it doesn't seem like any of the tasks are being run.
@Taylor Curran