swh.scheduler.cli.task module

class swh.scheduler.cli.task.DateTimeType[source]

Bases: click.types.ParamType

name = 'time and date'
convert(value, param, ctx)[source]

Converts the value. This is not invoked for values that are None (the missing value).

swh.scheduler.cli.task.format_dict(d)[source]
swh.scheduler.cli.task.pretty_print_list(list, indent=0)[source]

Pretty-print a list

swh.scheduler.cli.task.pretty_print_dict(dict, indent=0)[source]

Pretty-print a list

swh.scheduler.cli.task.pretty_print_run(run, indent=4)[source]
swh.scheduler.cli.task.pretty_print_task(task, full=False)[source]

Pretty-print a task

If ‘full’ is True, also print the status and priority fields.

>>> task = {
...     'id': 1234,
...     'arguments': {
...         'args': ['foo', 'bar', True],
...         'kwargs': {'key': 'value', 'key2': 42},
...     },
...     'current_interval': datetime.timedelta(hours=1),
...     'next_run': datetime.datetime(2019, 2, 21, 13, 52, 35, 407818),
...     'policy': 'oneshot',
...     'priority': None,
...     'status': 'next_run_not_scheduled',
...     'type': 'test_task',
... }
>>> print(click.unstyle(pretty_print_task(task)))
Task 1234
  Next run: ... (2019-02-21 13:52:35+00:00)
  Interval: 1:00:00
  Type: test_task
  Policy: oneshot
  Args:
    'foo'
    'bar'
    True
  Keyword args:
    key: 'value'
    key2: 42

>>> print(click.unstyle(pretty_print_task(task, full=True)))
Task 1234
  Next run: ... (2019-02-21 13:52:35+00:00)
  Interval: 1:00:00
  Type: test_task
  Policy: oneshot
  Status: next_run_not_scheduled
  Priority:
  Args:
    'foo'
    'bar'
    True
  Keyword args:
    key: 'value'
    key2: 42