Skip to content

list-modify-while-iterate #90

@obenshaindw

Description

@obenshaindw

This bit of code is iterating over a list, and modifying the list it is iterating over.

https://github.com/awslabs/amazon-omics-tools/blob/main/omics/cli/run_analyzer/batch.py#L37-L45

A safer approach might be:

    task_names = set()
    for run_resources in run_resources_list:
        filtered_resources = [res for res in run_resources if "task" in res["arn"]]
        for res in filtered_resources:
            main.add_metrics(res, filtered_resources, pricing, headroom)
            task_names.add(utils.task_base_name(res["name"], engine))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions