def runflow(): try: data = request.get_json() print((json.dumps(data))) return jsonify(fbp.run_flow(data)) except Exception as e: return json.dumps({"error": str(e)}), 500
def test_run3(self): # A sample flow definition with failure command flow_spec = '''{"id":"flowbuilder.gen","name":"BuilderSample","nodes":[{"id":"node1419317316499","spec_id":"flow.cli","name":"cli","ports":[{"name":"command","value":"ls"}],"is_end":1}],"links":[]} ''' print json.dumps(run_flow(flow_spec)) print "\n"
def runflow(): try: data = request.get_json() print(json.dumps(data)) return jsonify(fbp.run_flow(data)) except Exception as e: return json.dumps({"error": str(e)}), 500
def run_pyflow(flow_name, repo_path): # Load Pyflow repository json file repository = fbp.repository() repository.loads(repo_path) # Load flow spec with open(repo_path, 'r') as f: repo = json.loads(f.read()) flow_spec = repo["flow"][flow_name] # Run Pyflow with flow_spec return json.dumps(run_flow(flow_spec), indent=2)
def test_run1(self): # A sample flow definition flow_spec = ''' { "id": "my.test.spec", "name": "test flow", "nodes": [ { "spec_id": "flow.cli", "id": "myflow.cli", "name": "cli", "ports": [ { "name": "command", "value": "iostat" } ] }, { "spec_id": "flow.line_breaker", "id": "myflow.line_breaker", "name": "line_breaker", "ports": [], "is_end": 1 } ], "links": [ { "source": "myflow.cli:out", "target": "myflow.line_breaker:input" } ] } ''' print json.dumps(run_flow(flow_spec)) print "\n"
def runflow(): data = request.get_json() print(json.dumps(data)) return jsonify(fbp.run_flow(data))