I have some code and information about the sessions being lost...
This method is called every two seconds.
The printout is what I get.  Notice... ON then OFF and repeated.
I am the only user on the system, I have only one browser tab open,
and I know that the file data it is pulling from is correct and
accurate. You can see that with the ticker value.  That is what it
should be.
Told you it was weird.
if not session.time_left:
    session.time_left = 0
if not session.last_response:
    session.last_response = "poop"

#...
def system_state():
    import shelve
    overall_state = "good"
    write_file = shelve.open('/dev/shm/from_machine_server.status')
    #Get all the data into the session first.
    session.devices = write_file['devices']
    session.sensors = write_file['sensors']
    session.at_door = write_file['at_door']
    print sorted(session.keys())
    print "auth   :", session.auth
    import time
    print time.time()
    if write_file['debug']:
        session.last_response =  write_file['debug']
    #This is to get the overall state of the machine...
    if session.machine_ticker == write_file["ticker"]:
        overall_state = 'bad'
        print "no new ticker found...", session.machine_ticker, write_file["ticker"]
        return dict(overall_state = overall_state)
    else:
        print "new ticker found...", session.machine_ticker, write_file["ticker"]
        session.machine_ticker = write_file["ticker"]
    write_file.close()
    return dict(overall_state = overall_state)

These are the outputs...

['at_door', 'auth', 'devices', 'last_response', 'machine_ticker', 'sensors', 'time_left']
auth   : None
1285153785.58
no new ticker found... 306 306
['at_door', 'auth', 'devices', 'last_response', 'sensors', 'time_left']
auth   : None
1285153787.57
new ticker found... None 306
['at_door', 'auth', 'devices', 'last_response', 'machine_ticker', 'sensors', 'time_left']
auth   : None
1285153789.59
no new ticker found... 306 306
['at_door', 'auth', 'devices', 'last_response', 'sensors', 'time_left']
auth   : None
1285153791.57
new ticker found... None 306

Reply via email to