Hi everyone! I have a flow which I want to deploy ...
# ask-community
g
Hi everyone! I have a flow which I want to deploy multiple times with different parameters. The only problem is that I want some parameters to be not modifiable when a user does a custom run. How can I achieve this?
1
f
not sure it's possible
you could retreive their parameters from a database instead
hard to give more advise without knowledge of the usecase & minimal code of example
😅
g
it could be also a python dictionary, the only problem is
how to identify the deployment which triggered the flow?
If I know if I could implement the logic and even avoid to present these parameters in the ui
f
never tried by you could use the context
g
yeah, I will look at it
f
Copy code
from prefect import flow
from prefect.context import get_run_context


@flow
def main():
    ctx = get_run_context()
    print(ctx.flow_run.deployment_id)
🙌 1
it should do the tricks
g
Copy code
get_run_logger().info(get_client().read_deployment(FlowRunContext.get().flow_run.deployment_id).name)
I found it! Thanks!
f
else pernaps you can store some args as infra args ?
(I never used infra args so idk)
g
they are not sensitive, they can be also in the code. Anyway, there are also variables in Prefect which can be used to store parameters that every deployment can read
f
it could be a solution, or not 😅
only you know the needs and constraints :
g
ahah yeah 😉