Skip to content

Access Result in a MultiResult by job name and not index #1000

@cdtomkins

Description

@cdtomkins

This was originally proposed by @gbieli, @ubaumann as an outcome of discussions at AutoCon1 - see point 8 here (#911).

I would like to pick this up.

However, it's already possible to access Results in a MultiResult by job name using a generator, e.g.:

    print("Using a generator to pick out a result with a specific job name:")
    wanted = "Subtask NAME 2"
    subresult = next((r for r in v if r.name == wanted), None)
    if subresult:
        print(f"Found '{wanted}': {subresult.result}")
    else:
        print(f"'{wanted}' not found in results.")

So, can I confirm the acceptance criteria for this - would it be:

result["host1"].get_results_by_task_name("my_task")

aka:

def get_results_by_task_name(self, name: str) -> MultiResult:
    ...

My definition proposed about returns a MultiResult so it can handle multiple results with the same task name.

If we can confirm that is correct, I'll try to work up the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions