Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding all possible options in move_rule #4995

Closed
dchristidis opened this issue Nov 11, 2021 · 1 comment · Fixed by #5017
Closed

Allow overriding all possible options in move_rule #4995

dchristidis opened this issue Nov 11, 2021 · 1 comment · Fixed by #5017
Assignees
Milestone

Comments

@dchristidis
Copy link
Contributor

dchristidis commented Nov 11, 2021

Motivation

With #4855, it is now possible to override the activity and source replica expression when moving a rule. Client-side this looks great, but in the core the implementation could be improved (note that it’s still not possible to remove the source replica expression, which was one of the original intentions).

I would argue that there’s no need to have a fixed set of parameters. There could be a valid reason to override any of them (at the core for the needs of operations; there’s no need to expose it through the CLI yet).

Modification

Could something like the following work?

@transactional_session
def move_rule(rule_id: str, rse_expression: str, override: Dict[str, Any] = {}, session: Session = None):
    rule = session.query(models.ReplicationRule).filter_by(id=rule_id).one()

    …

    options = {dids=[{'scope': rule.scope, 'name': rule.name}],
               account=rule.account,
               …
    }

    for key in override:
        if key in ['dids']:
            raise Exception(f'Not allowed to override option {key!r}')
        elif key not in options:
            raise Exception(f'Non-valid override option {key!r}')
        else:
            options[key] = override[key]

    new_rule_id = add_rule(**options)

    …
@bari12
Copy link
Member

bari12 commented Nov 12, 2021

Yes, that should be fine (similar to update_rule)

joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Nov 16, 2021
Before the commit `move_rule` could only override two attributes of the new
rule. After the commit `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Nov 16, 2021
Before the commit `move_rule` could only override two attributes of the new
rule. After the commit `move_rule` can override every field of the new rule with
the argument `override`.
@joeldierkes joeldierkes linked a pull request Nov 16, 2021 that will close this issue
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Nov 17, 2021
Before the commit `move_rule` could only override two attributes of the new
rule. After the commit `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Nov 19, 2021
Before the commit `move_rule` could only override two attributes of the new
rule. After the commit `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Jan 7, 2022
Before the commit `move_rule` could only override two attributes of the new
rule. After the commit `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Jan 13, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Jan 13, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Jan 13, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Jan 13, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Jan 13, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Jan 20, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Jan 21, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Jan 27, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Jan 27, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Mar 10, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Mar 10, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Mar 15, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Mar 15, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
joeldierkes pushed a commit to joeldierkes/rucio that referenced this issue Mar 15, 2022
Before this commit, `move_rule` could only override two attributes of the new
rule. After the commit, `move_rule` can override every field of the new rule with
the argument `override`.
bari12 added a commit that referenced this issue Mar 15, 2022
…ng_all_possible_options_in_move_rule

Core: allow `move_rule` to override all options Fix #4995
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants