Is my pi sleeping or hanging up? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Is my pi sleeping or hanging up? (/thread-995.html) |
Is my pi sleeping or hanging up? - marciokoko - Nov-23-2016 I was getting a warning on my mac terminal
RE: Apscheduler warning - micseydel - Nov-23-2016 What is the context? RE: Apscheduler warning - marciokoko - Nov-23-2016 Im running it from an ssh terminal on my mac. At first I thought my mac going to sleep was causing the problem but I dont think so because even if the mac goes to sleep, the rpi2 shouldnt. The script is scheduled to fetch data from the web every hour indefinitely. Can anyone tell me if its wrong to make the rpi2 run a scheduled job indefinitely? Here is the code: # class to hold read and write #!/usr/bin/env python import serial import logging import time, datetime from firebase import firebase from firebase_token_generator import create_token from apscheduler.schedulers.blocking import BlockingScheduler class AIHome: def __init__(self, onTime, offTime): self.onTime=onTime self.offTime=offTime self.updateInterval = 6 self.webPush = False self.relayStatesA = [] self.relayStatesD = {} logging.basicConfig() print('initting AIHome...scheduling job') sched = BlockingScheduler() @sched.scheduled_job('interval', hours=1) def timed_job(): print('This job runs every 1 hrs. timed_job gets called or something else') self.fetchUpdate(); sched.configure() sched.start() def fetchUpdate(self): #Must separate credentials AIHome.authentication = firebase.FirebaseAuthentication('mykey', '[email protected]', extra={'id': 123}) AIHome.firebase = firebase.FirebaseApplication('https://myapp.firebaseio.com/', AIHome.authentication) print AIHome.authentication.extra AIHome.user = AIHome.authentication.get_user() print AIHome.user.firebase_auth_token AIHome.results = AIHome.firebase.get('/Relays', None)#, {'print': 'pretty'}) print AIHome.results print AIHome.results['Relay1ON'] print AIHome.results['Relay1OFF'] self.relayToggle() def relayToggle(self): timestring = AIHome.results['Relay1ON'] print timestring hours,minutes = timestring.split(":") print hours print minutes print(datetime.datetime.now()) ref_time = datetime.datetime.combine(datetime.datetime.now(), datetime.time(int(hours), int(minutes))) if ref_time > datetime.datetime.now(): print("ref_time>relay should be OFF") else: print("now>relay should be ON") x = AIHome(1,2)Thanks in advance! RE: Apscheduler warning - marciokoko - Nov-24-2016 I edited the post title and code above to help describe the issue more clearly. RE: Is my pi sleeping or hanging up? - nilamo - Dec-05-2016 So does apscheduler use the system scheduler? Or does your script continue to run forever, and just not do anything most of the time? RE: Is my pi sleeping or hanging up? - marciokoko - Jan-17-2017 What do you mean? |