mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-30 02:46:23 +02:00
Add missing files (#347)
This commit is contained in:
parent
3b021720c5
commit
76e85d895b
4 changed files with 132 additions and 0 deletions
|
|
@ -17,6 +17,10 @@ def show_flow_classes(url):
|
||||||
|
|
||||||
class_names = api.flow_list_classes()
|
class_names = api.flow_list_classes()
|
||||||
|
|
||||||
|
if len(class_names) == 0:
|
||||||
|
print("No flows.")
|
||||||
|
return
|
||||||
|
|
||||||
classes = []
|
classes = []
|
||||||
|
|
||||||
for class_name in class_names:
|
for class_name in class_names:
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,10 @@ def show_flows(url):
|
||||||
|
|
||||||
flow_ids = api.flow_list()
|
flow_ids = api.flow_list()
|
||||||
|
|
||||||
|
if len(flow_ids) == 0:
|
||||||
|
print("No flows.")
|
||||||
|
return
|
||||||
|
|
||||||
print(flow_ids)
|
print(flow_ids)
|
||||||
|
|
||||||
flows = []
|
flows = []
|
||||||
|
|
|
||||||
71
trustgraph-cli/scripts/tg-start-flow
Executable file
71
trustgraph-cli/scripts/tg-start-flow
Executable file
|
|
@ -0,0 +1,71 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import tabulate
|
||||||
|
from trustgraph.api import Api
|
||||||
|
import json
|
||||||
|
|
||||||
|
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
|
||||||
|
|
||||||
|
def start_flow(url, class_name, flow_id, description):
|
||||||
|
|
||||||
|
api = Api(url)
|
||||||
|
|
||||||
|
api.flow_start(
|
||||||
|
class_name = class_name,
|
||||||
|
id = flow_id,
|
||||||
|
description = description,
|
||||||
|
)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
prog='tg-start-flow',
|
||||||
|
description=__doc__,
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-u', '--api-url',
|
||||||
|
default=default_url,
|
||||||
|
help=f'API URL (default: {default_url})',
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-n', '--class-name',
|
||||||
|
required=True,
|
||||||
|
help=f'Flow class name',
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-i', '--flow-id',
|
||||||
|
required=True,
|
||||||
|
help=f'Flow ID',
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-d', '--description',
|
||||||
|
required=True,
|
||||||
|
help=f'Flow description',
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
start_flow(
|
||||||
|
url = args.api_url,
|
||||||
|
class_name = args.class_name,
|
||||||
|
flow_id = args.flow_id,
|
||||||
|
description = args.description,
|
||||||
|
)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
|
||||||
|
print("Exception:", e, flush=True)
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
53
trustgraph-cli/scripts/tg-stop-flow
Executable file
53
trustgraph-cli/scripts/tg-stop-flow
Executable file
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import tabulate
|
||||||
|
from trustgraph.api import Api
|
||||||
|
import json
|
||||||
|
|
||||||
|
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
|
||||||
|
|
||||||
|
def stop_flow(url, flow_id):
|
||||||
|
|
||||||
|
api = Api(url)
|
||||||
|
|
||||||
|
api.flow_stop(id = flow_id)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
prog='tg-stop-flow',
|
||||||
|
description=__doc__,
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-u', '--api-url',
|
||||||
|
default=default_url,
|
||||||
|
help=f'API URL (default: {default_url})',
|
||||||
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'-i', '--flow-id',
|
||||||
|
required=True,
|
||||||
|
help=f'Flow ID',
|
||||||
|
)
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
stop_flow(
|
||||||
|
url=args.api_url,
|
||||||
|
flow_id=args.flow_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
|
||||||
|
print("Exception:", e, flush=True)
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue