-
Notifications
You must be signed in to change notification settings - Fork 214
Open
Description
from pprint import pprint
from durable.lang import *
with ruleset('metrics'):
@when_all( # distinct(True),
c.first << (m.metric == 'met-A') & (m.amount > 10),
c.second << (m.metric == 'met-B') & (m.amount > c.first.amount)
)
def detected(c):
pprint(vars(c))
print('detected--1 -> {0}'.format(c.first.amount))
print(' -> {0}'.format(c.second.amount))
@when_all( # distinct(True),
c.first << (m.metric == 'met-A') & (m.amount > 50),
c.second << (m.metric == 'met-B') & (m.amount < c.first.amount)
)
def detected2(c):
pprint(vars(c))
print('detected--2 -> {0}'.format(c.first.amount))
print(' -> {0}'.format(c.second.amount))
# Works: Calls detected2() and print detected --2. No errors.
# post('metrics', { 'sid': 1, 'metric': 'met-A', 'amount': 250})
# post('metrics', { 'sid': 1, 'metric': 'met-B', 'amount': 200})
# Crash: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
# Expected to run detected()
post('metrics', { 'metric': 'met-A', 'amount': 100})
post('metrics', { 'metric': 'met-B', 'amount': 200})
Metadata
Metadata
Assignees
Labels
No labels