Added more useful information to output

This commit is contained in:
EzFeDezy
2025-05-27 22:29:38 +02:00
parent 3bf1aae281
commit 7096f6591f

View File

@@ -2,6 +2,7 @@ import os
from tools import * from tools import *
import json import json
from dataclasses import asdict from dataclasses import asdict
import time
example_content = "./Scripts/example_content" example_content = "./Scripts/example_content"
example_searchdomain = "example" example_searchdomain = "example"
@@ -14,7 +15,10 @@ def init(toolset: Toolset):
print("This is the init function from the python example script") print("This is the init function from the python example script")
print(f"example_counter: {example_counter}") print(f"example_counter: {example_counter}")
searchdomainlist:SearchdomainListResults = toolset.client.SearchdomainListAsync().Result searchdomainlist:SearchdomainListResults = toolset.client.SearchdomainListAsync().Result
print("Currently these searchdomains exist") if example_searchdomain not in searchdomainlist.Searchdomains:
toolset.client.SearchdomainCreateAsync(example_searchdomain).Result
searchdomainlist = toolset.client.SearchdomainListAsync().Result
print("Currently these searchdomains exist:")
for searchdomain in searchdomainlist.Searchdomains: for searchdomain in searchdomainlist.Searchdomains:
print(f" - {searchdomain}") print(f" - {searchdomain}")
index_files(toolset) index_files(toolset)
@@ -47,5 +51,7 @@ def index_files(toolset: Toolset):
jsonEntity:dict = asdict(JSONEntity(qualified_filepath, "wavg", example_searchdomain, {}, datapoints)) jsonEntity:dict = asdict(JSONEntity(qualified_filepath, "wavg", example_searchdomain, {}, datapoints))
jsonEntities.append(jsonEntity) jsonEntities.append(jsonEntity)
jsonstring = json.dumps(jsonEntities) jsonstring = json.dumps(jsonEntities)
timer_start = time.time()
result:EntityIndexResult = toolset.client.EntityIndexAsync(jsonstring).Result result:EntityIndexResult = toolset.client.EntityIndexAsync(jsonstring).Result
print(f"Update was successful: {result.Success}") timer_end = time.time()
print(f"Update was successful: {result.Success} - and was done in {timer_end - timer_start} seconds.")