Skip to content

Keep active brackets in a dictionary #35

Description

@Bronzila

Changing the list of active brackets to a dictionary with the bracket_id as keys would make the code on some occasions more readable. For example this:

# pass information of job submission to Bracket Manager
for bracket in self.active_brackets:
    if bracket.bracket_id == job_info['bracket_id']:
        # registering is IMPORTANT for Bracket Manager to perform SH
        bracket.register_job(job_info['budget'])
        break

Could then be rewritten as:

bracket_id = job_info['bracket_id']
self.active_brackets[bracket_id].register_job(job_info['budget'])

This would also have runtime advantages, however these are rather small, given that our active_brackets list is mostly small.

To clean up the dictionary we can then simlpy iterate over the key-value pairs and delete the brackets, that are already done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions