Skip to content

Instantly share code, notes, and snippets.

@m4rklar
Created February 4, 2025 10:11
Show Gist options
  • Save m4rklar/c3f26c06898abbe526d77a7546c4f24e to your computer and use it in GitHub Desktop.
Save m4rklar/c3f26c06898abbe526d77a7546c4f24e to your computer and use it in GitHub Desktop.
Update workflow
from getpass import getpass
import qmenta.client
from qmenta.core import platform
print("=== LOGIN INFORMATION ===")
user = input("Username: ")
password = getpass()
auth = platform.Auth.login(
username=user,
password=password,
base_url='https://platform.qmenta.com'
)
account = qmenta.client.Account(user, password)
print("=== You have been logged in! ===")
# Get information from the advanced options file.
with open("settings.json") as fr:
advanced_options = fr.read()
# Get information from the results configuration file.
with open("results_config.json") as fr:
results_configuration = fr.read()
# Get information from the model file.
with open("model.flow") as fr:
model = fr.read()
# Get information from the description file.
with open("description.html") as fr:
description = fr.read()
data_to_send = {
"name": ..., # Set with the name of the tool
"short_name": ..., # slug tool name
"code": ..., # id of the tool, can't be modified afterwards.
"version": ..., # version number of the tool, only change when significant changes after releasing.
"average_time": "1", # in minutes, duration of the tool.
"description": description,
"advanced_options": advanced_options,
"deprecated": "0",
"model": model,
"start_condition_code": "output={'OK': True, 'code': 1}",
"results_configuration": results_configuration,
"tags": "dev"
}
# After creating the workflow, the ID of the workflow must be requested and added to the previous dictionary
# otherwise it will keep creating new workflows on the platform creating conflicts.
res = platform.post(
auth, 'a_administrator/upsert_analysis_tool',
data=data_to_send
)
if res.json()["success"] == 1:
print("Workflow updated successfully!")
else:
print("ERROR setting the workflow")
print(res.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment