コード例 #1
0
ファイル: process.py プロジェクト: liusheng/labkeeper-1
    def run(self):
        self.zk_client.connect()
        self.cluster_config = ClusterConfig(self.zk_client)
        self.github = github.GithubAction(self.cluster_config)

        job_scheduler = blocking.BlockingScheduler()
        job_scheduler.add_job(self._action, 'interval', seconds=120)
        job_scheduler.start()
コード例 #2
0
def run():
    """Run scheduler and run data fetching to power dashboard."""
    s = blocking.BlockingScheduler()
    s.add_job(_run, 'interval', minutes=10)
    s.start()
コード例 #3
0
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.schedulers import blocking


def test():
    print('Great')


# schedule = BlockingScheduler()
# schedule.add_job(test, minutes=1)
# schedule.start()
# schedule.shutdown()

s = blocking.BlockingScheduler()
s.add_job(test, 'interval', seconds=3)
s.start()
s.shutdown()
コード例 #4
0
hassio_topic = "homeassistant"
host_sensor = "sensor"
host_device_class = "connectivity"
hostname = socket.gethostname()
host_uniqueid = "{}_{:x}".format(mqttproxy.__package__, uuid.getnode())
host_status_uniqueid = "{}_status".format(host_uniqueid)
manufacturer = "jmservera"

mqtt_client = mqtt.Client()
config = get_config()
logger = logging.getLogger(__package__)
coloredlogs.install()
sdnotifier = sdnotify.SystemdNotifier()

__refresh_interval = 30
__main_sched = blocking.BlockingScheduler()
__exit = threading.Event()

basetopic = "{}/{}/".format(hostname, "tele")
hoststatetopic = "{}state".format(basetopic)
hostavailabilitytopic = "{}LWT".format(basetopic)
hostcommandtopic = "{}/cmnd".format(hostname)
hostconfigtopic = "{}/{}/{}/config".format(hassio_topic, host_sensor,
                                           host_status_uniqueid)


# Eclipse Paho callbacks - http://www.eclipse.org/paho/clients/python/docs/#callbacks
def on_connect(client, userdata, flags, rc):
    if rc == 0:
        logger.info('MQTT connection established.')
    else: