Comments (5)
You added new Periodic Tasks by database tool, or by PeriodicTask Model?
you can read example code 1 for more detail.
>>> import json
>>> from celery_sqlalchemy_scheduler.models import PeriodicTask, IntervalSchedule
>>> from celery_sqlalchemy_scheduler.session import SessionManager
>>> beat_dburi = 'sqlite:///schedule.db'
>>> session_manager = SessionManager()
>>> engine, Session = session_manager.create_session(beat_dburi)
>>> session = Session()
# Disable 'echo-every-3-seconds' task
>>> task = session.query(PeriodicTask).filter_by(name='echo-every-3-seconds').first()
>>> task.enabled = False
>>> session.add(task)
>>> session.commit()
>>> schedule = session.query(IntervalSchedule).filter_by(every=10, period=IntervalSchedule.SECONDS).first()
>>> if not schedule:
... schedule = IntervalSchedule(every=10, period=IntervalSchedule.SECONDS)
... session.add(schedule)
... session.commit()
# Add 'add-every-10s' task
>>> task = PeriodicTask(
... interval=schedule,
... name='add-every-10s',
... task='tasks.add', # name of task.
... args=json.dumps([1, 5])
... )
>>> session.add(task)
>>> session.commit()
>>> print('Add ' + task.name)
Add add-every-10s
>>> task.args=json.dumps([10, 2])
>>> session.add(task)
>>> session.commit()
from celery-sqlalchemy-scheduler.
@AngelLiang, I added periodic task PeriodicTask Model.
from celery-sqlalchemy-scheduler.
self.total_run_count = model.total_run_count
self.enabled = model.enabled
if not model.last_run_at:
model.last_run_at = self._default_now()
self.last_run_at = model.last_run_at
# 因为从数据库读取的 last_run_at 可能没有时区信息,所以这里必须加上时区信息
# self.last_run_at = self.last_run_at.replace(tzinfo=self.app.timezone)
If I remove above commented line then it's working fine.
It seems time not converted to localized timezone not done because of commented line.
from celery-sqlalchemy-scheduler.
Maybe a bug. you can read this PR for detail.
Some bugs are related to timezones, but I can't fix they well. So welcome PR if you like.
from celery-sqlalchemy-scheduler.
I rollback the commented line and release v0.2.6.
Maybe some database don't save timezone throught sa.DateTime(timezone=True)
.
from celery-sqlalchemy-scheduler.
Related Issues (20)
- Crontab Error HOT 1
- Dynamic update of the celery_crontab_schedule table? HOT 4
- Interval task 恢复enabled无法send task HOT 1
- 是否可以动态的添加修改定时任务 HOT 3
- Recursion error on repr for IntervalSchedule object HOT 1
- crontab 任务不发送 HOT 2
- Deleted schedule isn't removed from DatabaseScheduler.schedule in memory HOT 3
- celery-sqlalchemy-scheduler not working with ver 5.0.1 of Celery HOT 6
- Periodic tasks are being deleted. HOT 3
- Updating the celery_periodic_task_changed triggers ALL the existing tasks now. HOT 1
- Beat
- Future date periodic task blocking other tasks
- Beat was unable to find crontab task in the database HOT 1
- 新增任务或者修改状态,beat会报错并中止进程 HOT 1
- `celery_sqlalchemy_scheduler` does not run att all.
- "Connection is busy" error with SQL Server connection HOT 1
- CrontabSchedule addition in PeriodicTask gives error
- 更改了start_time以后会暂停所有任务的调度
- 疑似expires字段不生效 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from celery-sqlalchemy-scheduler.