Added stopsignal module with checkDependency and addStopSignal definitions
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from core.apirequest import executeRequest
|
||||
from core.runtime.runtimecontract import buildRuntimeAttr, buildPreRuntimeAttr
|
||||
from core.runtime.stopsignals import addStopSignal
|
||||
|
||||
|
||||
def buildAction (action, outputs):
|
||||
@@ -11,8 +12,6 @@ def buildAction (action, outputs):
|
||||
return outputs, None
|
||||
|
||||
if match:
|
||||
if hasattr(action, "depends"):
|
||||
outputs["stopsignals"].append(action.alias)
|
||||
return outputs, None
|
||||
|
||||
response, outputs = executeRequest(action, outputs, resolved)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import logging
|
||||
from core.runtime.managefailure import manageFailure
|
||||
from core.execution.action.action import buildAction
|
||||
from core.runtime.stopsignals import checkDependency
|
||||
#from core.runtime.skipstep import skipStep
|
||||
#from core.runtime.recursive import recursiveSet
|
||||
|
||||
@@ -11,16 +12,10 @@ def buildOperation(definition, outputs):
|
||||
responses = []
|
||||
outputs["stopsignals"] = []
|
||||
for action in actions:
|
||||
if hasattr(action, "depends"):
|
||||
stop =any(
|
||||
dependency in outputs["stopsignals"]
|
||||
for dependency in action.depends
|
||||
)
|
||||
stop = checkDependency(action, outputs)
|
||||
|
||||
#print(f"STOP SIGNAL DEBUGGING during {action.name}")
|
||||
#print(outputs["stopsignals"])
|
||||
#stop = True
|
||||
#break
|
||||
|
||||
if stop:
|
||||
continue
|
||||
|
||||
@@ -2,6 +2,7 @@ from core.execution import action
|
||||
from core.execution.action.action import buildAction
|
||||
from core.runtime.runtimecontract import buildPreRuntimeAttr, buildRuntimeAttr
|
||||
from core.apirequest import executeRequest
|
||||
from core.runtime.stopsignals import checkDependency
|
||||
|
||||
def buildRecursive(definition, outputs):
|
||||
responses = []
|
||||
@@ -29,14 +30,11 @@ def buildRecursive(definition, outputs):
|
||||
|
||||
outputs["stopsignals"] = []
|
||||
for job in recursiveset:
|
||||
if hasattr(job, "depends"):
|
||||
stop =any(
|
||||
dependency in outputs["stopsignals"]
|
||||
for dependency in job.depends
|
||||
)
|
||||
stop = checkDependency(job, outputs)
|
||||
|
||||
#print(f"STOP SIGNAL DEBUGGING during {job.name}")
|
||||
#print(outputs["stopsignals"])
|
||||
#print(stop)
|
||||
|
||||
if stop:
|
||||
#print("STOP SIGNAL DETECTED")
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from core.execution.action import action
|
||||
from core.runtime import buildSelect, buildOutput, buildSave, loadSave, saveRow, readRow, buildLog
|
||||
from core.runtime.image import buildImage
|
||||
#from core.runtime.select import buildSelect3
|
||||
from core.runtime.resolver import resolveItem, extractItem
|
||||
from core.runtime.applyconditions import applyConditions
|
||||
from core.runtime.responsepolicy import responsePolicy
|
||||
from core.runtime.stopsignals import addStopSignal
|
||||
|
||||
def buildPreRuntimeAttr(action, outputs):
|
||||
outputs = loadSave(action, outputs)
|
||||
@@ -14,19 +16,21 @@ def buildPreRuntimeAttr(action, outputs):
|
||||
|
||||
match, filter = applyConditions(action, resolved, outputs)
|
||||
|
||||
if match:
|
||||
outputs = addStopSignal(action, outputs)
|
||||
|
||||
return outputs, resolved, match, filter
|
||||
|
||||
|
||||
def buildRuntimeAttr(action, outputs, resolved, response):
|
||||
outputs, resolved = responsePolicy(response, action, outputs, resolved)
|
||||
|
||||
if not response.ok:
|
||||
if hasattr(action, "depends"):
|
||||
outputs["stopsignals"].append(action.alias)
|
||||
return outputs, response
|
||||
|
||||
outputs = buildOutput(response, action, outputs)
|
||||
|
||||
if not response.ok:
|
||||
outputs = addStopSignal(action, outputs)
|
||||
return outputs, response
|
||||
|
||||
resolved = extractItem(action, outputs, resolved)
|
||||
|
||||
outputs = buildImage(response, action, outputs)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
def checkDependency(action, outputs):
|
||||
if hasattr(action, "depends"):
|
||||
stop = any(
|
||||
dependency in outputs["stopsignals"]
|
||||
for dependency in action.depends
|
||||
)
|
||||
|
||||
if stop:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def addStopSignal(action, outputs):
|
||||
if hasattr(action, "depends"):
|
||||
outputs["stopsignals"].append(action.alias)
|
||||
|
||||
return outputs
|
||||
@@ -8,6 +8,7 @@ alias = "rmassmessagepush"
|
||||
|
||||
depends = [
|
||||
"synapsegetroomalias",
|
||||
"synapsegetlastmessage",
|
||||
]
|
||||
|
||||
kind = "action"
|
||||
|
||||
@@ -8,6 +8,7 @@ alias = "synapsegetattachment"
|
||||
|
||||
depends = [
|
||||
"synapsegetroomalias",
|
||||
"synapsegetlastmessage",
|
||||
]
|
||||
|
||||
## PRE-RUNTIME ACTIONS
|
||||
|
||||
@@ -47,18 +47,18 @@ outputs = {
|
||||
}
|
||||
|
||||
filters = [
|
||||
{
|
||||
"filterkey": "rmass_sent_status",
|
||||
"operator": "==",
|
||||
"filtervalue": "fail",
|
||||
"print": f"Failed to send message to RMASS. Bypassing save during {name}...",
|
||||
},
|
||||
{
|
||||
"filterkey": "rmass_sent_status",
|
||||
"operator": "==",
|
||||
"filtervalue": "error",
|
||||
"print": f"Failed to send message to RMASS. Bypassing save during {name}...",
|
||||
},
|
||||
# {
|
||||
# "filterkey": "rmass_sent_status",
|
||||
# "operator": "==",
|
||||
# "filtervalue": "fail",
|
||||
# "print": f"Failed to send message to RMASS. Bypassing {name}...",
|
||||
# },
|
||||
# {
|
||||
# "filterkey": "rmass_sent_status",
|
||||
# "operator": "==",
|
||||
# "filtervalue": "error",
|
||||
# "print": f"Failed to send message to RMASS. Bypassing {name}...",
|
||||
# },
|
||||
{
|
||||
"filterkey": "event_id",
|
||||
"operator": "==",
|
||||
|
||||
@@ -11,15 +11,9 @@ recursiveset = {
|
||||
"outputlabel": "outmessageitem",
|
||||
"actions": [
|
||||
synapsegetroomalias,
|
||||
rmassmessagepush,
|
||||
synapsegetlastmessage,
|
||||
#synapsegetattachment,
|
||||
#getrmassattachmenturl,
|
||||
#synapseattachmenttormass,
|
||||
#getrmassattachmentid,
|
||||
#rmassattachmentpush,
|
||||
rmassmessagepush,
|
||||
rmassattachmentpushflow,
|
||||
#synapsegetlastmessage,
|
||||
savermassmessageid,
|
||||
],
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTMwNTE5ODUsIm5iZiI6MTc5MzA1MTgwNSwic3ViIjoiMjM4MzAyIiwidXNlcm5hbWUiOiJYeHhvdGlxIiwidXNlclR5cGUiOjEsInN0YWdlTmFtZSI6Ilh4eG90aXEiLCJhcHByb3ZlZCI6MSwibG9jYXRpb25JZCI6NDcyLCJzZWFyY2hDaXR5IjoiYXRsYW50YSIsImNvdW50cnlTaG9ydCI6IlVTIiwic2Vzc2lvbkNvdW50cnlDb250aW5lbnQiOiJOQSIsImlzRnJvemVuIjowLCJsb2NhdGlvbkxhYmVsIjoiQXRsYW50YSwgR0EiLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MzA1MTg2NX0.pMPPsvgYfsRhTj7NJFc0hj3N-8gP1Th3oX9NQce9e2-NJw7ANxFv-7sdmeDE71_B71He7cych-kW5RFuJpc2ZA", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTU2NDM4NjUsIm5iZiI6MTc5MzA1MTgwNSwianRpIjoiU1BJbnZpSXBmTE5WY1NVQ1ZOQ0VvRUdGUWEwOVIrN3dKOHJuNGZqYU5ZMD0iLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MzA1MTg2NSwic3ViIjoiMjM4MzAyIn0.2N1mzB9BYKgd5tMK10ZuBxW0zqNDDmhN8JtVoQAoeKHcm9JtNzdRa4LfsNPiJ1MOzkXBkTBuktmUI8AiDq78YQ"}
|
||||
Reference in New Issue
Block a user