def get_mock_inputs(pipeline_spec, destdir): pipeline_spec.isroot=True builder=PydronGraphBuilder(pipeline_spec) builder.build() inputs={} for source,dest in builder.graph.get_out_connections(START_TICK): if source.port==CONTEXT: continue if source.port not in inputs.keys(): inputs[source.port]=[] nodepath=builder.graph.get_task_properties(dest.tick)['path'] inputs[source.port].append((dest.port,nodepath)) for inputname, consumers in inputs.iteritems(): inputs[inputname]=create_mock_data(inputname, consumers, destdir) return inputs
def get_mock_inputs(pipeline_spec, destdir): pipeline_spec.isroot = True builder = PydronGraphBuilder(pipeline_spec) builder.build() inputs = {} for source, dest in builder.graph.get_out_connections(START_TICK): if source.port == CONTEXT: continue if source.port not in inputs.keys(): inputs[source.port] = [] nodepath = builder.graph.get_task_properties(dest.tick)['path'] inputs[source.port].append((dest.port, nodepath)) for inputname, consumers in inputs.iteritems(): inputs[inputname] = create_mock_data(inputname, consumers, destdir) return inputs
def test_unsupported_invocation_type(self): def testpipe(x,y): u,v=test_exec(a=x, b=y) return u,v class FakeInvocation(Invocation): def __init__(self, name): Invocation.__init__(self, name) builder=PydronGraphBuilder(testpipe) builder.build() ticks=sorted(builder.graph.get_all_ticks()) last_tick=ticks[-1] try: builder.add_task(last_tick, FakeInvocation('fake')) self.fail("Unsupported Invocations should be caught.") except PipelineGraphError: pass