https://prefect.io logo
#prefect-community
Title
# prefect-community
j

Jason

05/17/2022, 7:06 PM
I can't seem to get the task_run_name callable to work with mapped tasks. I'm using a method near identical to the example: https://docs.prefect.io/core/concepts/templating.html#callable-name-generators, but running the mapped task uses the method name instead of the string that's returned?
j

James Sopkin

05/17/2022, 7:13 PM
Hi Jason, just wondering, did you deploy this flow?
I've used task_run_name to write templated task names to logs for mapped tasks, but I noticed that when I ran the flow locally, it would return the function name, however when viewing flow runs from cloud, the the task names were templated with the parameters I passed in
upvote 2
j

Jason

05/17/2022, 7:17 PM
Ah interesting - I was only testing locally
j

James Sopkin

05/17/2022, 7:18 PM
for local testing you could always try using the prefect logger and doing something like
Copy code
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(f"{task_run_name}")
3 Views