Udated runtime contract to stop doing unnecessary imports and introduced dedicated process registry. Confirmed working.
This commit is contained in:
@@ -5,7 +5,7 @@ from rich.console import Console
|
||||
|
||||
from core.runtime.managefailure import manageFailure
|
||||
from core.runtime.stopsignals import checkDependency
|
||||
from core.execution.processregistry import registerProcess
|
||||
from core.execution import processregistry
|
||||
from core.console import console
|
||||
|
||||
outputs = {}
|
||||
@@ -16,7 +16,8 @@ def buildOperation(definition, outputs):
|
||||
from core.execution.executioncontract import executeContract
|
||||
|
||||
actions = definition.actions
|
||||
registerProcess(definition, outputs)
|
||||
currentOp = processregistry.registerProcess(definition)
|
||||
|
||||
responses = []
|
||||
|
||||
if getattr(definition, "track", False):
|
||||
@@ -27,44 +28,44 @@ def buildOperation(definition, outputs):
|
||||
)
|
||||
|
||||
for action in actions:
|
||||
processregistry.registeredOp = currentOp
|
||||
|
||||
stop = checkDependency(action, outputs, definition)
|
||||
stop = checkDependency(action)
|
||||
|
||||
if stop:
|
||||
continue
|
||||
|
||||
if action.kind == "action":
|
||||
outputs["processes"][definition.name][action.name] = {}
|
||||
currentOp[action.name] = {}
|
||||
|
||||
response = executeContract(action, outputs, definition)
|
||||
response = executeContract(action, outputs)
|
||||
|
||||
responses.append(response)
|
||||
|
||||
if action.kind == "action":
|
||||
outputs["processes"][definition.name][action.name]["response"] = response
|
||||
currentOp[action.name]["response"] = response
|
||||
|
||||
##Append completed process to process registry
|
||||
outputs["processes"][definition.name]["completed"].append(action.alias)
|
||||
if action.alias in currentOp["stopsignals"]:
|
||||
continue
|
||||
currentOp["completed"].append(action.alias)
|
||||
|
||||
#Temporarily disabled manageFailure functions
|
||||
#except Exception as error:
|
||||
#outputs = manageFailure(error, action, outputs)
|
||||
|
||||
#Print completion status after runtime processes
|
||||
if process_log:
|
||||
stopsignal_count = len(outputs["processes"][definition.name]["stopsignals"])
|
||||
completed_count = len(outputs["processes"][definition.name]["completed"])
|
||||
completed_count = len(currentOp["completed"])
|
||||
|
||||
if completed_count == 1 and stopsignal_count == 1:
|
||||
if completed_count == 0:
|
||||
logging.info(f"{definition.name} bypassed")
|
||||
else:
|
||||
logging.info(f"{definition.name} completed")
|
||||
|
||||
#For debugging purposes only
|
||||
|
||||
process_registry_logs = False
|
||||
|
||||
if process_registry_logs:
|
||||
pprint.pprint(outputs["processes"])
|
||||
|
||||
|
||||
import pprint
|
||||
pprint.pprint(processregistry.processes)
|
||||
|
||||
return responses
|
||||
|
||||
Reference in New Issue
Block a user