Added os env conrolled logging
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
from core.execution import action
|
||||
from core.execution.action.action import buildAction
|
||||
from core.runtime.runtimecontract import buildPreRuntimeAttr, buildRuntimeAttr
|
||||
from core.apirequest import executeRequest
|
||||
import logging
|
||||
import os
|
||||
|
||||
from core.runtime.stopsignals import checkDependency
|
||||
from core.execution.processregistry import registerProcess
|
||||
from rich.progress import track
|
||||
|
||||
def buildRecursive(definition, outputs):
|
||||
recursive_log = False
|
||||
process_log = True
|
||||
recursive_log = os.environ.get("LOGS_RECURSIVE", "false").lower() == "true"
|
||||
|
||||
#print(outputs[definition.recursiveset["source"]])
|
||||
|
||||
@@ -77,6 +77,8 @@ def buildRecursive(definition, outputs):
|
||||
|
||||
outputs["processes"][definition.name]["completed"].append(job.alias)
|
||||
|
||||
if process_log:
|
||||
logging.info(f"{definition.name} completed")
|
||||
|
||||
retain = definition.recursiveset.get("retain", True)
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import os
|
||||
|
||||
from core.runtime.applyconditions import applyConditions
|
||||
|
||||
def buildFirewall(listener, outputs):
|
||||
firewall_log = os.environ.get("LOGS_FIREWALL", "false").lower() == "true"
|
||||
|
||||
status_code = 200
|
||||
outputs["firewall_allowed"] = []
|
||||
for item in outputs[listener.recursive["source"]]:
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import os
|
||||
|
||||
def resolveItem(action, item):
|
||||
resolver_log = os.environ.get("LOGS_RESOLVER", "false").lower() == "true"
|
||||
|
||||
resolved = {}
|
||||
if hasattr(action, "resolve"):
|
||||
for label, keys in action.resolve["get"].items():
|
||||
@@ -8,7 +12,8 @@ def resolveItem(action, item):
|
||||
target = target[key]
|
||||
|
||||
except (KeyError, IndexError) as error:
|
||||
print(f"Resolver target key/index {error} not found during {action.name}")
|
||||
if resolver_log:
|
||||
print(f"Resolver target key/index {error} not found during {action.name}")
|
||||
target = None
|
||||
|
||||
resolved[label] = target
|
||||
|
||||
@@ -2,6 +2,8 @@ import json
|
||||
import os
|
||||
|
||||
def buildSave(action, outputs):
|
||||
savedata_log = os.environ.get("LOGS_SAVE_DATA_ACCESS", "false").lower() == "true"
|
||||
|
||||
import tempfile
|
||||
|
||||
if hasattr(action, "savedata"):
|
||||
@@ -36,10 +38,13 @@ def buildSave(action, outputs):
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
#print(f"Data saved by {action.name} to {action.savepath}")
|
||||
if savedata_log:
|
||||
print(f"Data saved by {action.name} to {action.savepath}")
|
||||
return outputs
|
||||
|
||||
def loadSave(action, outputs):
|
||||
savedata_log = os.environ.get("LOGS_SAVE_DATA_ACCESS", "false").lower() == "true"
|
||||
|
||||
if hasattr(action, "loaddata"):
|
||||
with open(f"{action.savepath}", "r") as save_file:
|
||||
load_data = json.load(save_file)
|
||||
@@ -47,7 +52,8 @@ def loadSave(action, outputs):
|
||||
for load_name in action.loaddata:
|
||||
outputs[load_name] = load_data[load_name]
|
||||
|
||||
#print(f"Data loaded by {action.name} from {action.savepath}")
|
||||
if savedata_log:
|
||||
print(f"Data loaded by {action.name} from {action.savepath}")
|
||||
return outputs
|
||||
|
||||
def saveRow(action, outputs, resolved):
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import os
|
||||
|
||||
def buildSelect(action, outputs):
|
||||
#***THIS IS THE CANONICAL BUILD***
|
||||
select_log = False
|
||||
|
||||
select_log = savedata_log = os.environ.get("LOGS_SELECT", "false").lower() == "true"
|
||||
|
||||
select_data = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user