Improved recursive handling by nesting operations in operations under then new buildRecursive. Also changed extract module to attach its findings to outputs for better resolver and recursiveSet targeting.
This commit is contained in:
@@ -23,6 +23,8 @@ def buildRecursive(definition, outputs):
|
||||
source = definition.recursiveset["source"]
|
||||
|
||||
items = outputs.get(source)
|
||||
#print(f"RECURSIVE DEBUG DURING {definition.name}")
|
||||
#print(items)
|
||||
|
||||
if items is None:
|
||||
print(f"No items available in {source} for {definition.name}")
|
||||
@@ -38,8 +40,15 @@ def buildRecursive(definition, outputs):
|
||||
outputs[definition.recursiveset["outputlabel"]] = item
|
||||
|
||||
for job in recursiveset:
|
||||
#print(f"RECURSIVE DEBUG DURING {job.name}")
|
||||
#print(item)
|
||||
#outputs, response = buildAction(job, outputs)
|
||||
outputs, response = executeContract(job, outputs)
|
||||
responses.append(response)
|
||||
|
||||
retain = definition.recursiveset.get("retain", True)
|
||||
|
||||
if not retain:
|
||||
outputs.pop(source, None)
|
||||
|
||||
return outputs, responses
|
||||
|
||||
@@ -2,6 +2,8 @@ def resolveItem(action, item):
|
||||
resolved = {}
|
||||
if hasattr(action, "resolve"):
|
||||
for label, keys in action.resolve["get"].items():
|
||||
#print("RESOLVER DEBUG")
|
||||
#print(item)
|
||||
target = item
|
||||
try:
|
||||
for key in keys:
|
||||
@@ -94,12 +96,6 @@ def extractItem(action, item, resolved):
|
||||
target = item
|
||||
try:
|
||||
for key in keys:
|
||||
#if isinstance(target, dict):
|
||||
#.get not compatible with resolving through lists
|
||||
#target = target.get(key)
|
||||
|
||||
#if isinstance(target, list):
|
||||
#regular key not compatible with resolving potentially unknown values like upload image
|
||||
target = target[key]
|
||||
|
||||
except (KeyError, IndexError) as error:
|
||||
@@ -108,7 +104,9 @@ def extractItem(action, item, resolved):
|
||||
|
||||
print("EXTRACT MODULE TEST")
|
||||
print(target)
|
||||
resolved[label] = target
|
||||
|
||||
item[label] = target
|
||||
|
||||
if "construct" in action.extract:
|
||||
for label2, piece in action.extract["construct"].items():
|
||||
constructed = ""
|
||||
|
||||
Reference in New Issue
Block a user