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