MCPcopy Create free account
hub / github.com/diffgram/diffgram / api_workflow_update

Function api_workflow_update

default/methods/action/workflow_update.py:15–66  ·  view source on GitHub ↗

Updates the given workflow. :param project_string_id: :return:

(project_string_id)

Source from the content-addressed store, hash-verified

13@limiter.limit("2000 per day")
14@swag_from('../../docs/actions/workflow_update.yml')
15def api_workflow_update(project_string_id):
16 """
17 Updates the given workflow.
18 :param project_string_id:
19 :return:
20 """
21
22 spec_list = [
23 {'workflow_id': int},
24 {'name': str},
25 {'mode': str},
26 {'active': bool}
27
28 ]
29
30 log, input, untrusted_input = regular_input.master(request = request,
31 spec_list = spec_list)
32 if len(log["error"].keys()) >= 1:
33 return jsonify(log = log), 400
34
35 with sessionMaker.session_scope() as session:
36
37 user = User.get(session = session)
38 project = Project.get(session, project_string_id)
39
40 workflow = Workflow.get_by_id(
41 session = session,
42 id = input['workflow_id'],
43 project_id = project.id)
44
45 if workflow is None:
46 log['error']['flow'] = "No Flow found"
47 return jsonify(log = log), 400
48
49 log = flow_update_core(
50 session = session,
51 project = project,
52 workflow = workflow,
53 name = input['name'],
54 time_window = input.get('time_window', None),
55 active = input['active'],
56 mode = input['mode'],
57 log = log,
58 member = user.member)
59
60 if len(log["error"].keys()) >= 1:
61 return jsonify(log = log), 400
62
63 log['success'] = True
64 return jsonify(
65 workflow = workflow.serialize_with_actions(session = session),
66 log = log), 200
67
68
69def flow_update_core(

Callers

nothing calls this directly

Calls 4

flow_update_coreFunction · 0.85
getMethod · 0.45
get_by_idMethod · 0.45

Tested by

no test coverage detected