mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-22 03:31:02 +02:00
Start/stop of processing is working
This commit is contained in:
parent
573f14e67b
commit
466e020e53
3 changed files with 20 additions and 11 deletions
|
|
@ -196,14 +196,14 @@ class Library:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def start_processing(
|
def start_processing(
|
||||||
self, document_id, processing_id, flow="0000",
|
self, id, document_id, flow="0000",
|
||||||
user="trustgraph", collection="default", tags=[],
|
user="trustgraph", collection="default", tags=[],
|
||||||
):
|
):
|
||||||
|
|
||||||
input = {
|
input = {
|
||||||
"operation": "add-processing",
|
"operation": "add-processing",
|
||||||
"processing-metadata": {
|
"processing-metadata": {
|
||||||
"id": processing_id,
|
"id": id,
|
||||||
"document-id": document_id,
|
"document-id": document_id,
|
||||||
"time": int(time.time()),
|
"time": int(time.time()),
|
||||||
"flow": flow,
|
"flow": flow,
|
||||||
|
|
@ -218,12 +218,12 @@ class Library:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def stop_processing(
|
def stop_processing(
|
||||||
self, processing_id, user="trustgraph"
|
self, id, user="trustgraph",
|
||||||
):
|
):
|
||||||
|
|
||||||
input = {
|
input = {
|
||||||
"operation": "remove-processing",
|
"operation": "remove-processing",
|
||||||
"processing-id": processing_id,
|
"processing-id": id,
|
||||||
"user": user,
|
"user": user,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,24 @@ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
|
||||||
default_user = "trustgraph"
|
default_user = "trustgraph"
|
||||||
|
|
||||||
def start_processing(
|
def start_processing(
|
||||||
url, user, document_id, processing_id, flow, collection, tags
|
url, user, document_id, id, flow, collection, tags
|
||||||
):
|
):
|
||||||
|
|
||||||
api = Api(url).library()
|
api = Api(url).library()
|
||||||
|
|
||||||
|
if tags:
|
||||||
tags = tags.split(",")
|
tags = tags.split(",")
|
||||||
|
else:
|
||||||
|
tags = []
|
||||||
|
|
||||||
api.start_processing(document_id, processing_id, flow, user,
|
api.start_processing(
|
||||||
collection, tags)
|
id = id,
|
||||||
|
document_id = document_id,
|
||||||
|
flow = flow,
|
||||||
|
user = user,
|
||||||
|
collection = collection,
|
||||||
|
tags = tags
|
||||||
|
)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
|
@ -49,7 +58,7 @@ def main():
|
||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-d', '--did', '--document-id',
|
'-d', '--document-id',
|
||||||
required=True,
|
required=True,
|
||||||
help=f'Document ID',
|
help=f'Document ID',
|
||||||
)
|
)
|
||||||
|
|
@ -79,7 +88,7 @@ def main():
|
||||||
url = args.api_url,
|
url = args.api_url,
|
||||||
user = args.user,
|
user = args.user,
|
||||||
document_id = args.document_id,
|
document_id = args.document_id,
|
||||||
processing_id = args.id,
|
id = args.id,
|
||||||
flow = args.flow_id,
|
flow = args.flow_id,
|
||||||
collection = args.collection,
|
collection = args.collection,
|
||||||
tags = args.tags
|
tags = args.tags
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ def stop_processing(
|
||||||
|
|
||||||
api = Api(url).library()
|
api = Api(url).library()
|
||||||
|
|
||||||
api.stop_processing(user, id)
|
api.stop_processing(user = user, id = id)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue