def test_get_runnable_steps_many_upstream_dependencies(pipeline_steps): upstream_dep = PipelineStep(uid='upstream_dep', url='http://null', params={}, requires=[]) upstream_dep.state = 'completed' pipeline_steps[1].requires.append(upstream_dep.uid) pipeline_steps.append(upstream_dep) runnables = get_runnable_steps(pipeline_steps) assert [r.uid for r in runnables] == ['signoff1'] pipeline_steps[0].state = 'completed' runnables = get_runnable_steps(pipeline_steps) assert [r.uid for r in runnables] == ['signoff2']
def create_pipeline(uid, pipeline): log.info('creating pipeline %s', uid) pipeline_steps = [ PipelineStep.from_dict(step) for step in pipeline['parameters']['steps'] ] PIPELINES[uid] = ['running', pipeline_steps]
def test_get_runnable_steps_many_many_downstream_deps_run(pipeline_steps): downstream_dep = PipelineStep(uid='another_downstream_dep', url='http://null', params={}, requires=[]) pipeline_steps.append(downstream_dep) pipeline_steps[0].state = 'completed' runnables = get_runnable_steps(pipeline_steps) assert [r.uid for r in runnables] == ['signoff2', 'another_downstream_dep']
def pipeline_steps(): pipeline_steps_ = [ { "api_url": "http://localhost:5001/signoff1", "description": "signoff 1", "parameters": { }, "parameters_schema": "https://null", "requires": [ ], "uid": "signoff1" }, { "api_url": "http://localhost:5001/signoff2", "description": "signoff 2 - relman gatekeeps all the things", "parameters": { }, "parameters_schema": "https://null", "requires": [ "signoff1" ], "uid": "signoff2" }, { "api_url": "http://localhost:5001/publish1", "description": "final publish", "parameters": { }, "parameters_schema": "https://null", "requires": [ "signoff2" ], "uid": "publish1" } ] return [PipelineStep.from_dict(step) for step in pipeline_steps_]
def pipeline_steps(): pipeline_steps_ = [ { 'api_url': 'http://localhost:5001/signoff1', 'description': 'signoff 1', 'parameters': { }, 'parameters_schema': 'https://null', 'requires': [ ], 'uid': 'signoff1' }, { 'api_url': 'http://localhost:5001/signoff2', 'description': 'signoff 2 - relman gatekeeps all the things', 'parameters': { }, 'parameters_schema': 'https://null', 'requires': [ 'signoff1' ], 'uid': 'signoff2' }, { 'api_url': 'http://localhost:5001/publish1', 'description': 'final publish', 'parameters': { }, 'parameters_schema': 'https://null', 'requires': [ 'signoff2' ], 'uid': 'publish1' } ] return [PipelineStep.from_dict(step) for step in pipeline_steps_]
def test_get_runnable_steps_many_can_run_at_the_beginning(pipeline_steps): another_first_step = PipelineStep(uid='parallel_action_to_signoff1', url='http://null', params={}, requires=[]) pipeline_steps.append(another_first_step) runnables = get_runnable_steps(pipeline_steps) assert [r.uid for r in runnables] == ['signoff1', 'parallel_action_to_signoff1']
def create_pipeline(uid, pipeline): log.info("creating pipeline %s", uid) pipeline_steps = [PipelineStep.from_dict(step) for step in pipeline["parameters"]["steps"]] PIPELINES[uid] = ["running", pipeline_steps]