Exemple #1
0
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
Exemple #2
0
    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"
Exemple #3
0
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
Exemple #4
0
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)
Exemple #5
0
    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"
Exemple #6
0
def runflow():
    data = request.get_json()
    print(json.dumps(data))
    return jsonify(fbp.run_flow(data))