Skip to main content

Thư viên Schedule trên ngôn ngữ Python để chạy service background.

Copyright: MobioVN

CHANGE LOG:

v0.6.7

  • Sửa lỗi key "last_run"

Cài đặt:

$ pip3 install m-schedule

Sử dụng:

  1. Tạo class thực thi scheduler kế thừa từ class BaseScheduler

    class TestScheduler(BaseScheduler):
        def owner_do(self):
            # TODO
            pass
    
        def get_schedule(self):
            """
            hàm xác định thời điểm chạy của scheduler, bằng cách xử dụng thư viện schedule
            Các ví dụ hướng dẫn cách xác định thời gian chạy
            1. scheduler chỉ thực hiện công việc một lần duy nhất.
                return None
            2. scheduler sẽ thực hiện mỗi 10 phút một lần.
                return schedule.every(10).minutes
            3. scheduler sẽ thực hiện hàng ngày vào lúc 10h 30 phút.
                return schedule.every().day.at("10:30")
            4. scheduler sẽ thực hiện sau mỗi giờ.
                return schedule.every().hour
            5. scheduler sẽ thực hiện vào mỗi thứ 2 hàng tuần.
                return schedule.every().monday
            6. scheduler sẽ thực hiện vào mỗi thứ 5 hàng tuần và vào lúc 13h 15'.
                return schedule.every().wednesday.at("13:15")
            """
        return schedule.every(10).minutes
    
  2. Đăng ký scheduler với factory

    factory = SchedulerFactory()
    factory.add(TestScheduler(name="MyScheduler", redis_uri="redis://redis-server:6379/0"))
    factory.run()
    

Release files for m-schedule 0.6.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for m-schedule 0.6.7
File Size Uploaded
m-schedule-0.6.7.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for m-schedule 0.6.7
File Interpreter ABI Platform
m_schedule-0.6.7-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / m-schedule-0.6.7.tar.gz

Download URL m-schedule-0.6.7.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6957c0647e37d8818cb7ff7745472d93214335d5c35cfbf47684c4f630627b20
BLAKE2b-256 checksum
How to use checksums
9e40a5219a082ef25fce951c5aab7e91183f0e3d84a432c08ecf2ceccf87fad5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8

Release files / m_schedule-0.6.7-py3-none-any.whl

Download URL m_schedule-0.6.7-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3de713da223b675550bf8e12e72c9389725fe93b9b0bd0ae2f1e896af0eb8b75
BLAKE2b-256 checksum
How to use checksums
31f2b7b82561c7deaed1b7c60d144da0a34d15493071f08bcff3b3c88761e8d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8

Release history Release notifications | RSS feed

1.0.1

2 release files

This release

0.6.7 This release

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page