Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrl-alt-lulz committed Feb 27, 2024
1 parent 490f2c6 commit fc631be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
2 changes: 0 additions & 2 deletions examples/mockingbird/python/api_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
}

api_v1_path = "https://api.zeus.fyi/v1"


# api_v1_path = "http://localhost:9001/v1"


Expand Down
32 changes: 24 additions & 8 deletions examples/mockingbird/python/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def start_or_schedule_wf(wf_exec_params):
response = requests.post(url, json=wf_exec_params, headers=headers)
# Check the response status
if response.status_code == 200:
print(response.json())
print("Workflow created successfully!")
else:
print(response.json())
Expand All @@ -23,18 +24,33 @@ def create_wf(wf):
response = requests.post(url, json=wf, headers=headers)
# Check the response status
if response.status_code == 200:
print(response.json())
print("Workflow created successfully!")
else:
print(response.json())
print("Failed to create workflow. Status Code:", response.status_code)


wf_exec_template = {
"action": "start",
"unixStartTime": 0,
"duration": 1,
"durationUnit": "cycles",
"customBasePeriod": True,
"customBasePeriodStepSize": 30,
"customBasePeriodStepSizeUnit": "minutes",
"workflows": []
}

wf_item_details = {
"workflowName": "",
}

if __name__ == '__main__':
with open('templates/exec_wf.json', 'r') as file:
payload = json.load(file)

payload['workflows'] = {
"workflowName": "wf-name-example",
"workflowGroup": "demo"
}
start_or_schedule_wf(payload)
# Starts a workflow
wf_item_details['workflowName'] = 'demo-analysis-only-workflow'
wf_exec_template['workflows'] = [wf_item_details]

pretty_data = json.dumps(wf_exec_template, indent=4)
print(pretty_data)
start_or_schedule_wf(wf_exec_template)

0 comments on commit fc631be

Please sign in to comment.