A Celery schedule corntab which is work with jalali calendar
Project description
JalaliCrontab is a Celery schedule that works with Jalali Calendar.
Getting Started
Install with pip:
pip install celery-jalalicrontab
You can use JalaliCrontab just like celery crontab. In the example bellow, task will be run every minutes in “30” of “dey” month:
@app.on_after_configure.connect
def setup_periodic_tasks(sender, **kwargs):
sender.add_periodic_task(
JalaliCrontab(day_of_month=30, month_of_year=10),
test.s('Happy my birthday!'),
)
And also you can use it alongside RedisBeater by extending JalaliCrontab and jalalidatetime then define encode_beater method for them:
class Myjalalidatetime(jalalidatetime):
def encode_beater(self):
if self.tzinfo is None:
timezone = 'UTC'
elif self.tzinfo.zone is None:
timezone = self.tzinfo.utcoffset(None).total_seconds()
else:
timezone = self.tzinfo.zone
datetime_obj = self.togregorian()
return {
'year': datetime_obj.year,
'month': datetime_obj.month,
'day': datetime_obj.day,
'hour': datetime_obj.hour,
'minute': datetime_obj.minute,
'second': datetime_obj.second,
'microsecond': datetime_obj.microsecond,
'timezone': timezone,
}
class MyJalaliCrontab(JalaliCrontab):
def encode_beater(self):
return {
'minute': self._orig_minute,
'hour': self._orig_hour,
'day_of_week': self._orig_day_of_week,
'day_of_month': self._orig_day_of_month,
'month_of_year': self._orig_month_of_year,
}
Development
JalaliCrontab is available on GitHub
Once you have the source you can run the tests with the following commands:
pip install -r requirements.dev.txt py.test tests
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file celery-jalalicrontab-1.0.3.tar.gz
.
File metadata
- Download URL: celery-jalalicrontab-1.0.3.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cdb0c63c4e7ce3a50f7eb45aa47e3f589ea2f02767bb2c47e1c61d899d54983 |
|
MD5 | aa43807bb72f6ce9734f24118be02532 |
|
BLAKE2b-256 | cc51cf244682cc1cfc7b7323b9c890beba9b54d892ad7554601f22194eacd7e7 |
File details
Details for the file celery_jalalicrontab-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: celery_jalalicrontab-1.0.3-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 852e8a65f3ae9c5e565b7aeeb5afe11468ef56211de0926e36f9d16d127382b6 |
|
MD5 | 8ff2331729a340532f608e4987334421 |
|
BLAKE2b-256 | c294a065b1df81ebfb8533c7e2361bef21d646b11d3ad3ed34d4bc7f21513222 |