Пример #1
0
#: callable: Decorator that combines all Click options from :ref:`opts_mapping`
mapping_decorations = functools.partial(_combined_decorations,
                                        optargs=opts_mapping)

# SEGMENT HANDLING

# Use segment after DATE
opt_after = click.option('--after',
                         is_flag=True,
                         help='Use time segment after DATE if needed')

# Use segment before DATE
opt_before = click.option('--before',
                          is_flag=True,
                          help='Use time segment before DATE if needed')

# Output QA/QC band?
opt_qa_band = click.option('--qa',
                           is_flag=True,
                           help='Add QA band identifying segment type')

# EXECUTOR
opt_executor = click.option(
    '--executor',
    default=(EXECUTOR_TYPES[0], None),
    show_default=True,
    type=(click.Choice(EXECUTOR_TYPES), str),
    help='Pipeline executor (e.g., {})'.format(', '.join(
        ['"%s %s"' % (k, v) for k, v in EXECUTOR_DEFAULTS.items()])),
    callback=lambda ctx, param, value: get_executor(*value))
Пример #2
0
def test_get_executor_unknown(cluster):
    with pytest.raises(KeyError, message="Unknown executor") as err:
        result = executor.get_executor('asdf', None)
    assert 'Unknown executor' in str(err.value)
Пример #3
0
def test_get_executor_distributed(cluster):
    result = executor.get_executor('distributed', cluster.scheduler_address)
    assert isinstance(result, executor.DistributedExecutor)
Пример #4
0
def test_get_executor_process():
    result = executor.get_executor('process', 1)
    assert isinstance(result, executor.ConcurrentExecutor)
Пример #5
0
def test_get_executor_thread():
    result = executor.get_executor('thread', 1)
    assert isinstance(result, executor.ConcurrentExecutor)
Пример #6
0
def test_get_executor_sync():
    result = executor.get_executor('sync', None)
    assert isinstance(result, executor.SyncExecutor)
    future = result.submit(*maths['q'])
    assert isinstance(future, Future)
    assert future.result() == maths['a']