Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/cli.py
Show First 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | |||||
@click.argument('options', nargs=-1) | @click.argument('options', nargs=-1) | ||||
@click.pass_context | @click.pass_context | ||||
def run(ctx, lister, priority, options): | def run(ctx, lister, priority, options): | ||||
from swh.scheduler.cli.utils import parse_options | from swh.scheduler.cli.utils import parse_options | ||||
config = deepcopy(ctx.obj['config']) | config = deepcopy(ctx.obj['config']) | ||||
if options: | if options: | ||||
config.update(parse_options(options)[1]) | _, kw = parse_options(options) | ||||
config.update(kw) | |||||
config['priority'] = priority | config['priority'] = priority | ||||
config['policy'] = 'oneshot' | config['policy'] = 'oneshot' | ||||
get_lister(lister, **config).run() | get_lister(lister, **config).run() | ||||
douardda: this is weird, now you pass the kw to both the lister constructor and the run() method. Is it… | |||||
Done Inline Actions
Yes, it is weird but i kept that because that was the original behavior.
Yes and it will.
Indeed. mmm Like i just said, only the debian lister is taking parameter... ardumont: > this is weird, now you pass the kw to both the lister constructor and the run() method. Is it… | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
lister() | lister() |
this is weird, now you pass the kw to both the lister constructor and the run() method. Is it expected to work?
This reminds me of the discussion we had about the fact we want the run() method to never take arguments so we do not have this kind of argument dispatching between init() and run() to do...