Extended positional variables to allow operation information to pass through to signal registry and dependency check at the action level for the new process registry (Working). Introduced track for operation
This commit is contained in:
@@ -1,46 +1,69 @@
|
||||
import logging
|
||||
import pprint
|
||||
from core.runtime.managefailure import manageFailure
|
||||
from core.execution.action.action import buildAction
|
||||
from core.runtime.stopsignals import checkDependency
|
||||
from core.execution.processregistry import registerProcess
|
||||
#from core.runtime.skipstep import skipStep
|
||||
#from core.runtime.recursive import recursiveSet
|
||||
#from tqdm import tqdm
|
||||
from rich.progress import track
|
||||
|
||||
outputs = {}
|
||||
|
||||
def buildOperation(definition, outputs):
|
||||
from core.execution.executioncontract import executeContract
|
||||
|
||||
actions = definition.actions
|
||||
outputs = registerProcess(definition, outputs)
|
||||
|
||||
responses = []
|
||||
outputs["stopsignals"] = []
|
||||
for action in actions:
|
||||
#if action.kind == "action":
|
||||
# outputs["processes"][definition.name][action.name] = {}
|
||||
stop = checkDependency(action, outputs)
|
||||
|
||||
#print(f"STOP SIGNAL DEBUGGING during {action.name}")
|
||||
#print(outputs["stopsignals"])
|
||||
#for action in tqdm(
|
||||
# actions,
|
||||
# desc=definition.name,
|
||||
# unit="action"
|
||||
#):
|
||||
|
||||
|
||||
if getattr(definition, "track", False):
|
||||
actions = track(
|
||||
actions,
|
||||
#description=definition.name
|
||||
description=f"[green]{definition.name}[/green]"
|
||||
)
|
||||
|
||||
for action in actions:
|
||||
|
||||
#Check if dependencies are in stop signal registry
|
||||
stop = checkDependency(action, outputs, definition)
|
||||
|
||||
if stop:
|
||||
outputs["processes"][definition.name]["stopsignals"].append(action.alias)
|
||||
continue
|
||||
|
||||
#Register action before its execution
|
||||
if action.kind == "action":
|
||||
outputs["processes"][definition.name][action.name] = {}
|
||||
|
||||
outputs, response = executeContract(action, outputs)
|
||||
|
||||
#if hasattr(action, recursive)
|
||||
#Pass the definition through to the action so it can be passed into buildPreRuntimeAttr
|
||||
#Definition should be passed through in order to give access to addStopSignal so it can write directly to the definition during buildPreRuntimeAttr
|
||||
#Stop signal can optionally be engaged by doing addStopSignal inside the action definition
|
||||
outputs, response = executeContract(action, outputs, definition)
|
||||
|
||||
responses.append(response)
|
||||
|
||||
#Register responses in process registry
|
||||
if action.kind == "action":
|
||||
outputs["processes"][definition.name][action.name]["response"] = response
|
||||
|
||||
outputs["processes"][definition.name]["completed"].append(action.alias)
|
||||
#print(outputs["processes"])
|
||||
|
||||
#Print completion status after runtime processes
|
||||
print(f"{action.name} completed")
|
||||
|
||||
##Append completed process to process registry
|
||||
outputs["processes"][definition.name]["completed"].append(action.alias)
|
||||
|
||||
#For debugging purposes only
|
||||
process_registry_logs = False
|
||||
if process_registry_logs:
|
||||
pprint.pprint(outputs["processes"])
|
||||
|
||||
#Temporarily disabled manageFailure functions
|
||||
#except Exception as error:
|
||||
#outputs = manageFailure(error, action, outputs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user