Gated recursive logging behind a boolean. Included none type handling for source so the buildRecursive returns early. Introduced track for progress tracking
This commit is contained in:
@@ -4,8 +4,18 @@ from core.runtime.runtimecontract import buildPreRuntimeAttr, buildRuntimeAttr
|
|||||||
from core.apirequest import executeRequest
|
from core.apirequest import executeRequest
|
||||||
from core.runtime.stopsignals import checkDependency
|
from core.runtime.stopsignals import checkDependency
|
||||||
from core.execution.processregistry import registerProcess
|
from core.execution.processregistry import registerProcess
|
||||||
|
from rich.progress import track
|
||||||
|
|
||||||
def buildRecursive(definition, outputs):
|
def buildRecursive(definition, outputs):
|
||||||
|
recursive_log = False
|
||||||
|
|
||||||
|
#print(outputs[definition.recursiveset["source"]])
|
||||||
|
|
||||||
|
source = outputs.get(definition.recursiveset["source"])
|
||||||
|
|
||||||
|
if source is None or source == []:
|
||||||
|
return outputs, []
|
||||||
|
|
||||||
outputs = registerProcess(definition, outputs)
|
outputs = registerProcess(definition, outputs)
|
||||||
|
|
||||||
responses = []
|
responses = []
|
||||||
@@ -18,9 +28,12 @@ def buildRecursive(definition, outputs):
|
|||||||
#print(f"RECURSIVE DEBUG DURING {definition.name}")
|
#print(f"RECURSIVE DEBUG DURING {definition.name}")
|
||||||
#print(items)
|
#print(items)
|
||||||
|
|
||||||
if items is None:
|
#if items is None:
|
||||||
print(f"No items available in {source} for {definition.name}")
|
|
||||||
return outputs, None
|
# if recursive_log:
|
||||||
|
# print(f"No items available in {source} for {definition.name}")
|
||||||
|
#
|
||||||
|
# return outputs, None
|
||||||
|
|
||||||
reverse = definition.recursiveset.get("reverse", False)
|
reverse = definition.recursiveset.get("reverse", False)
|
||||||
|
|
||||||
@@ -28,20 +41,25 @@ def buildRecursive(definition, outputs):
|
|||||||
#print("reversing")
|
#print("reversing")
|
||||||
items = reversed(items)
|
items = reversed(items)
|
||||||
|
|
||||||
for item in items:
|
for item in track(
|
||||||
|
items,
|
||||||
|
description=f"[green]{definition.name}[/green]"
|
||||||
|
):
|
||||||
|
|
||||||
|
#for item in items:
|
||||||
outputs[definition.recursiveset["outputlabel"]] = item
|
outputs[definition.recursiveset["outputlabel"]] = item
|
||||||
|
|
||||||
outputs["stopsignals"] = []
|
outputs["stopsignals"] = []
|
||||||
for job in recursiveset:
|
for job in recursiveset:
|
||||||
|
|
||||||
stop = checkDependency(job, outputs)
|
stop = checkDependency(job, outputs, definition)
|
||||||
|
|
||||||
#print(f"STOP SIGNAL DEBUGGING during {job.name}")
|
#print(f"STOP SIGNAL DEBUGGING during {job.name}")
|
||||||
#print(outputs["stopsignals"])
|
#print(outputs["stopsignals"])
|
||||||
#print(stop)
|
#print(stop)
|
||||||
|
|
||||||
if stop:
|
if stop:
|
||||||
outputs["processes"][definition.name]["stopsignals"].append(job.alias)
|
#outputs["processes"][definition.name]["stopsignals"].append(job.alias)
|
||||||
#print("STOP SIGNAL DETECTED")
|
#print("STOP SIGNAL DETECTED")
|
||||||
#print(f"Stopping {job.name} due to stop signal")
|
#print(f"Stopping {job.name} due to stop signal")
|
||||||
continue
|
continue
|
||||||
@@ -52,7 +70,7 @@ def buildRecursive(definition, outputs):
|
|||||||
if job.kind == "action":
|
if job.kind == "action":
|
||||||
outputs["processes"][definition.name][job.name] = {}
|
outputs["processes"][definition.name][job.name] = {}
|
||||||
|
|
||||||
outputs, response = executeContract(job, outputs)
|
outputs, response = executeContract(job, outputs, definition)
|
||||||
responses.append(response)
|
responses.append(response)
|
||||||
if job.kind == "action":
|
if job.kind == "action":
|
||||||
outputs["processes"][definition.name][job.name]["response"] = response
|
outputs["processes"][definition.name][job.name]["response"] = response
|
||||||
|
|||||||
Reference in New Issue
Block a user