https://prefect.io logo
h

Horatiu Bota

05/31/2022, 10:20 AM
hi community! is there a way to look-up a flow's id using the flow name/project name via the client? this suggests you can via the cli
a

Anna Geller

05/31/2022, 10:38 AM
what are you trying to do?
h

Horatiu Bota

05/31/2022, 10:39 AM
hi Anna! i'm trying to start multiple runs for a flow that's been previously registered
(i.e., runs with different parameters)
but to start multiple runs you don't necessarily have to know the flow ID
usually, you only need to know the flow name and project name
so while the above links answer your direct questions, I think this one will address your actual problem: https://discourse.prefect.io/t/how-to-map-over-flows-with-various-parameter-values/365
h

Horatiu Bota

05/31/2022, 10:43 AM
thank you! i'm using
create_flow_run
which seems to require a flow_id
a

Anna Geller

05/31/2022, 10:43 AM
Copy code
create_flow_run.map(
        flow_name=unmapped("yourflow"),
        project_name=unmapped("yourproject"),
        parameters=your_list_of_dicts
    )
h

Horatiu Bota

05/31/2022, 10:44 AM
oh, nice, this is what i need! šŸ˜„
šŸ‘ 1
thank you!
šŸ™Œ 1
is this for orion?
a

Anna Geller

05/31/2022, 10:45 AM
no, for Prefect 1.0
for Orion, you could do a for loop with subflows
h

Horatiu Bota

05/31/2022, 10:46 AM
hm, the method signature in client.py seems different:
Copy code
def create_flow_run(
        self,
        flow_id: str = None,
        context: dict = None,
        parameters: dict = None,
        run_config: RunConfig = None,
        labels: List[str] = None,
        scheduled_start_time: datetime.datetime = None,
        idempotency_key: str = None,
        run_name: str = None,
        version_group_id: str = None,
    ) -> str:
should i be importing it from somewhere else? i'm using prefect 1.1
a

Anna Geller

05/31/2022, 10:47 AM
*prefect.tasks.prefect.flow_run.create_flow_run*(flow_id=None, flow_name=None, project_name="", parameters=None, context=None, labels=None, run_name=None, run_config=None, scheduled_start_time=None, idempotency_key=None)
both id and name are valid
h

Horatiu Bota

05/31/2022, 10:48 AM
ah, ok, i was calling the method on a prefect client
thank you again!
šŸ™Œ 1
3 Views