question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to include item string in mapped task name

See original GitHub issue

Use Case

Minor, non-urgent feature request: mapped tasks are currently referenced in logs and the Cloud UI using their numeric index, e.g. my_task[0], my_task[1]. These numeric values aren’t particularly meaningful and, in some cases, the string value of the mapped item would be more useful during log examination or when viewing Flow runs in the Cloud UI.

Solution

Having an opt-in way to enable use of the string version of a mapped item in the task name would be helpful, e.g.

    @task(mapped_item_in_task_name=True)
    def my_task(item):
        ...

    my_task.map(["apple", "banana", "orange"])

Which would yield task names of my_task[apple], my_task[banana], and my_task[orange] rather than my_task[0], my_task[1]. and my_task[2]

For tasks mapping over multiple parameters, this option could simply choose to use the first parameter. Elements with long string representations could be truncated to a reasonable size for display purposes. This should definitely be opt-in to avoid logging sensitive data.

A better implementation might be to pass an iterable/list to be used for the task names (as a specific kwarg) which might or might not match the parameter to map over (but would need to have the same length):

    fruit = {
        0: "apple",
        1: "banana",
        15: "orange"
    }
    my_task.map(fruit.keys(), mapped_task_names=fruit.values())`

This would also yield task names of my_task[apple], my_task[banana], and my_task[orange].

Alternatives

None available currently.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
tothandorcommented, Oct 2, 2020

Hurray!

0reactions
joshmeekcommented, Jul 17, 2020

Update in this comment I posted on the draft PR https://github.com/PrefectHQ/prefect/pull/2974#issuecomment-660339280

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set name for flow run and (mapped) task runs
Most of the time, I have to process collection of items (queries, files, urls, etc.), which are dynamically generated. I guess mapping was...
Read more >
Dynamic Task Mapping — Airflow Documentation
Dynamic Task Mapping allows a way for a workflow to create a number of tasks at runtime based upon current data, rather than...
Read more >
Defining a mapping task - Informatica Documentation
To create a. mapping. task, click. New. Tasks. and then complete one of the following steps: To create a. mapping · Configure the...
Read more >
How to create, map and configure fields in a work item/task ...
Select “+ Add field setup” (Azure DevOps)or “+ Add work item ... In this article, we explain the options available to map fields...
Read more >
How to perform item fields mapping - FluentPro Support
Monday.com default item field name, Monday.com item field type, Planner task field name, Planner task field type ; Name, Name type, Title, String...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found