Hello. When using mapped tasks, is it possible pro...
# prefect-community
n
Hello. When using mapped tasks, is it possible provide a custom name to each child so that in prefect server instead of showing e.g.
table_copy 0....table_copy n
would show
table_copy table_name_1....table_copy table_name_n
? Thank you
n
Hi @Nuno Silva ! This is a really good question, and something we'll support in the very near future. @josh has a draft PR open for this but ran into some issues; that said, we recently released a new API for setting task run names (
set_task_run_name
mutation) which enables this in a manual way. The UI doesn't pull the task run name yet but will very soon!
j
Yeah we now have a path forward with this using the run name API! Haven’t gotten around to implementing it yet but it’s on the list 🙂
🙌 1
p
What's the recommended pattern to populate the names? I suppose this has to be done at run time. Also, can this API be used to rename the flow runs that are generated by the scheduler to have deterministic names based on clock parameters?
j
Currently the implementation of templating run names has been proposed and I encourage you to voice your use case here https://github.com/PrefectHQ/prefect/issues/3010 🙂 Yeah at runtime is when the names need to be populated because users want to base the task run names on the task inputs and now that the API is exposed we can safely do it
n
Sounds good, like @Pedro Machado says, it would be easier in the gant and schematic views to have this. When the UI starts to pull this, how exactly can I use
set_task_run_name
to set the desired name:
set_task_run_name=lambda **kwargs: kwargs["val"]
? Thanks
j
Yeah something like that! I’m thinking we’ll expose a kwarg on the task where you can provide a callable and grab information like that on run
p
Hi Josh, I am curious, if we contribute a PR for templating flow run names, would that be eventually available on cloud or just on server?
j
Yes! It will eventually be promoted to both services