def test_multiple_double_result(): mr = MultipleOutputs(Output('value_one', 'output_one'), Output('value_two', 'output_two')) assert mr.results == [ Output('value_one', 'output_one'), Output('value_two', 'output_two') ]
def test_multiple_dict(): mr = MultipleOutputs.from_dict({ 'output_one': 'value_one', 'output_two': 'value_two' }) assert set(mr.results) == set( [Output('value_one', 'output_one'), Output('value_two', 'output_two')])
def hello_world(_context): return MultipleOutputs.from_dict({ 'left': { 'foo': 'left' }, 'right': { 'foo': 'right' } })
def solid_fn(context, **_kwargs): for i in range(200): time.sleep(0.02) if i % 1000 == 420: context.log.error('Error message seq={i} from solid {name}'.format(i=i, name=name)) elif i % 100 == 0: context.log.warning( 'Warning message seq={i} from solid {name}'.format(i=i, name=name) ) elif i % 10 == 0: context.log.info('Info message seq={i} from solid {name}'.format(i=i, name=name)) else: context.log.debug('Debug message seq={i} from solid {name}'.format(i=i, name=name)) return MultipleOutputs.from_dict({'output_{}'.format(i): 'foo' for i in range(n_outputs)})
def test_multiple_single_result(): mr = MultipleOutputs(Output('value', 'output_one')) assert mr.results == [Output('value', 'output_one')]
def hello_world(_context): return MultipleOutputs( Output(value={'foo': 'left'}, output_name='left'), Output(value={'foo': 'right'}, output_name='right'), )
def return_dict_results(_context): return MultipleOutputs.from_dict({'out_one': 23, 'out_two': 45})