Hi everyone, Iam deploying some flows at once us...
# ask-community
k
Hi everyone, Iam deploying some flows at once using asyncio module's gather(),run() methods and iam setting the cocurrency limit to 1, the flows are being excuted by the worker in a random manner, is it possible to run these flows in a sequential order one by one ? If yes, how to achieve that? My code part is :
Copy code
@flow(log_prints=True)
async def primedependency_triggering_flow():

      

    with open("calc_file.txt", "r") as file:
        expressions = [line.strip() for line in file.readlines()]

    flow_tasks = []
  
    for num  in expressions:
        
        flow_tasks.append(run_deployment(
            name="prime-master-flow/calculation-flow-deployment",  # Deployment Name
            parameters={"number": num},
            
        ))

    
    await asyncio.gather(*flow_tasks)

    print("All flows triggered successfully!")
UI :
n
hi @Kiran - if you want them to happen sequentially, you can just await each run_deployment in the for loop instead of passing them all to gather
k
hi @Nate, thanks for your input, I tried that already , here is my code -
Copy code
@flow(log_prints=True)
async def primedependency_triggering_flow():

      

    with open("calc_file.txt", "r") as file:
        expressions = [line.strip() for line in file.readlines()]

 
    for num  in expressions:
        print(f"triggering flow run {num} successfully")
        
        await  run_deployment(
            name="prime-master-flow/calculation-flow-deployment",  # Deployment Name
            parameters={"number": num},
            
            as_subflow=False
        )

    
    print("All flows triggered successfully!")
the issue with this approach is that I don't get to see all my deployed flows the way I am seeing when i am using the gathering of flows approach. Ideally, I want all my flows to be executed in the sequential manner and I should be able to see the upcoming flows of my deployment, is there a way to achieve this? Also, i don't see any advantage of using async/await here , even if i don't use async/await, the behaviour is the same, the sequence of execution and the way I see the flows in the UI is the same. please do clarify here. Thanks.