Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add run forever suport
  • Loading branch information
nkansal96 committed Jun 25, 2018
commit 5d3931f27d4d1febd18c676a6e2586426da8d54d
18 changes: 11 additions & 7 deletions auroraapi/dialog/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
from auroraapi.dialog.util import assert_callable, parse_date

class DialogProperties(object):
def __init__(self, id, name, desc, appId, dateCreated, dateModified, graph, **kwargs):
def __init__(self, id, name, desc, appId, runForever, dateCreated, dateModified, graph, **kwargs):
self.id = id
self.name = name
self.desc = desc
self.app_id = appId
self.run_forever = runForever
self.date_created = parse_date(dateCreated)
self.date_modified = parse_date(dateModified)
self.graph = Graph(graph)
Expand All @@ -27,9 +28,12 @@ def set_function(self, id, func):
self.context.udfs[id] = func

def run(self):
curr = self.dialog.graph.start
while curr != None and curr in self.dialog.graph.nodes:
step = self.dialog.graph.nodes[curr]
edge = self.dialog.graph.edges[curr]
self.context.set_current_step(step)
curr = step.execute(self.context, edge)
first_run = True
while first_run or self.run_forever:
curr = self.dialog.graph.start
while curr != None and curr in self.dialog.graph.nodes:
step = self.dialog.graph.nodes[curr]
edge = self.dialog.graph.edges[curr]
self.context.set_current_step(step)
curr = step.execute(self.context, edge)
first_run = False