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
Release files for celery-jalalicrontab 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| celery-jalalicrontab-1.0.3.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| celery_jalalicrontab-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / celery-jalalicrontab-1.0.3.tar.gz
| Download URL | celery-jalalicrontab-1.0.3.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0cdb0c63c4e7ce3a50f7eb45aa47e3f589ea2f02767bb2c47e1c61d899d54983
|
|
BLAKE2b-256 checksum How to use checksums |
cc51cf244682cc1cfc7b7323b9c890beba9b54d892ad7554601f22194eacd7e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / celery_jalalicrontab-1.0.3-py3-none-any.whl
| Download URL | celery_jalalicrontab-1.0.3-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
852e8a65f3ae9c5e565b7aeeb5afe11468ef56211de0926e36f9d16d127382b6
|
|
BLAKE2b-256 checksum How to use checksums |
c294a065b1df81ebfb8533c7e2361bef21d646b11d3ad3ed34d4bc7f21513222
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|