Skip to content

Commit

Permalink
Issue 253: improve reset (#254)
Browse files Browse the repository at this point in the history
* add encode()

* add parameter

---------

Co-authored-by: Al Niessner <[email protected]>
  • Loading branch information
al-niessner and Al Niessner authored Dec 15, 2024
1 parent ee4d0d5 commit 8d9eab0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Python/dawgie/fe/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,16 @@ def schedule_events():
def schedule_failure():
return json.dumps (dawgie.pl.schedule.view_failure()).encode()

def schedule_reset():
def schedule_reset(archive:str='false'):
archive = archive.lower() in ['true','tru','tr','t','1','y','ye','yes','on']
msg = {'alert_status':'danger',
'alert_message':'Could not reset because the FSM is not defined.'}
if 'fsm' in dir(dawgie.context):
msg = {'alert_status':'success',
'alert_message':'Triggered updating then load.'}
if archive: dawgie.context.fsm.archive()
dawgie.context.fsm.wait_for_nothing()
return json.dumps (msg)
return json.dumps (msg).encode()

def schedule_run (tasks:[str], targets:[str]):
log.debug ('schedule_run: targets %s', str(targets))
Expand Down

0 comments on commit 8d9eab0

Please sign in to comment.