periodic-task

Python, Raspberry pi, call a task avery 10 milliseconds precisely

给你一囗甜甜゛ 提交于 2020-08-26 05:51:36
问题 I'm currently trying to have a function called every 10ms to acquire data from a sensor. Basically I was trigerring the callback from a gpio interupt but I changed my sensor and the one I'm currently using doesn't have a INT pin to drive the callback. So my goal is to have the same behaviour but with an internal interupt generated by a timer. I tried this from this topic import threading def work (): threading.Timer(0.25, work).start () print(time.time()) print "stackoverflow" work () But

asyncio - await coroutine more than once (periodic tasks)

喜你入骨 提交于 2020-08-08 05:23:05
问题 I am trying to create a periodic task for an asyncio event loop as shown below, however I am getting a "RuntimeError: cannot reuse already awaited coroutine" exception. Apparently, asyncio does not allow for the same awaitable function to be awaited as discussed in this bug thread. This is how I tried to implement it: import asyncio class AsyncEventLoop: def __init__(self): self._loop = asyncio.get_event_loop() def add_periodic_task(self, async_func, interval): async def wrapper(_async_func,

What's the best way to launch a periodic task in iOS camera to use frames data?

倾然丶 夕夏残阳落幕 提交于 2020-07-10 10:25:27
问题 I am building a cross-platform tool that uses frames from camera to do some work on them. I'm starting from this code-base, which is the camera Flutter plugin. My goal is to have a periodic task (running every 200ms or so) that does some work in parallel (so it does not interfere with frame-rate). For this, my goal is to store every frame that comes from camera and, when the task is triggered, last stored frame is used for some calculations. Below, I'll show what I've done, but I think this

How to configure CELERYBEAT_SCHEDULE in Django settings?

假如想象 提交于 2020-01-13 03:38:13
问题 I can get this to run as a standalone application, but I am having trouble getting it to work in Django. Here is the stand alone code: from celery import Celery from celery.schedules import crontab app = Celery('tasks') app.conf.update( CELERY_TASK_SERIALIZER='json', CELERY_RESULT_SERIALIZER='json', CELERY_ACCEPT_CONTENT=['json'], CELERY_TIMEZONE='US/Central', CELERY_ENABLE_UTC=True, CELERYBEAT_SCHEDULE = { 'test': { 'task': 'tasks.test', 'schedule': crontab(), }, } ) @app.task def test():

periodically send location updates using fusedLocation API

只谈情不闲聊 提交于 2020-01-05 08:46:09
问题 Android programming is a brand new thing to me, i've been playing with android's location and i have a same issue, im going to send a periodic location updates to a server in background and i'm using the AlarmManager/LocationManager approach, set an alarmManager with a defined Interval then when the alarmReceiver is triggered it will get device's current location (using locationManager) and send it to the server on its onReceive method. i found out this FusedLocation as a great replacement as

WebSocket Server sending messages periodically in python

元气小坏坏 提交于 2019-12-30 10:28:06
问题 I have a tornado web server in python: import tornado.httpserver import tornado.websocket import tornado.ioloop from tornado.ioloop import IOLoop import tornado.web import time import threading import sys from datetime import datetime from datetime import timedelta def sample(): print 'hiiiii' threading.Timer(10, sample).start() class WSHandler(tornado.websocket.WebSocketHandler): def open(self): print 'new connection' def on_message(self, message): self.write_message(message) self.msg(

WebSocket Server sending messages periodically in python

霸气de小男生 提交于 2019-12-30 10:28:03
问题 I have a tornado web server in python: import tornado.httpserver import tornado.websocket import tornado.ioloop from tornado.ioloop import IOLoop import tornado.web import time import threading import sys from datetime import datetime from datetime import timedelta def sample(): print 'hiiiii' threading.Timer(10, sample).start() class WSHandler(tornado.websocket.WebSocketHandler): def open(self): print 'new connection' def on_message(self, message): self.write_message(message) self.msg(

Calling spi_write periodically in a linux driver

自作多情 提交于 2019-12-25 07:48:58
问题 I am writing a driver for an LCD display. According to the application note, I need to write a dummy SPI write to the command periodically to maximize its contrast. To accomplish this, I set up a timer and attempt to write the contrast-maximizing 2-byte dummy command from the timer handler. However, something goes wrong because the spi_write function causes a complete kernel crash with the following error: BUG: scheduling while atomic: swapper/1/0/0x00000102 Based on the following post: How

Periodic task concurrency issue with foreground app

风格不统一 提交于 2019-12-25 07:17:16
问题 I am developing a Windows Phone 8 app that would have a live flip tile. I will be creating a scheduled agent (periodic task not resource intensive) which will update the live tile using local data. The whole app does not connect to the internet in any way, it uses only local data. So push notifications are out of the question. I need to update the live tile from the background agent and/or from the foreground app when it's launched whichever happens first. However how can I ensure the

Periodic task concurrency issue with foreground app

无人久伴 提交于 2019-12-25 07:16:20
问题 I am developing a Windows Phone 8 app that would have a live flip tile. I will be creating a scheduled agent (periodic task not resource intensive) which will update the live tile using local data. The whole app does not connect to the internet in any way, it uses only local data. So push notifications are out of the question. I need to update the live tile from the background agent and/or from the foreground app when it's launched whichever happens first. However how can I ensure the