Skip to main content

Create asynchronous and asynchronous task

Project description

QMate

Create asynchronous and asynchronous task queues that run on a schedule... symantically.

Examples

Full Example

Run the function PrintSomething every quarter of every minute:

from qmate import Queue, Task
import time


def PrintSomething(text):
    print(text)


queue = Queue(True)
queue.schedule(
    Task(
        func=PrintSomething,
        name='Print Something',
        at=["00", "15", "30", "45"],
        args=["Working"]
    )
)

while True:
    time.sleep(0.001)

Queue.schedule takes a single task or a list of tasks.

queue.schedule(
    [
        Task(
            func=PrintSomething,
            name='Quarterly Print',
            at=["00", "15", "30", "45"],
            args=["Working"]
        ),
        Task(
            func=PrintSomething,
            name='10PM Print',
            at=["22:00:00"],
            args=["It's 10PM."]
        )
    ]
)

Task Time Parameters

Every cannot be combined with other time parameters. At, On, and During can be combined. At is required, unless using Every.

On

Run tasks on specific days. If empty, run everyday.

on=["Sunday", "Monday"] # on Sundays and Mondays
on=["everyday"] # on everyday of the week

At

Run tasks at certain times.

at=["17:30:00"] # at 5:30 PM
at=["30:00"] # at 30 minutes past every hour
at=["15", "45"] # at a quarter past and a quarter till every hour

During

Run tasks during specfic months. If empty, run every month.

during=["May", "July"] # during the months of may and july

Every

Run tasks on certain intervals. Max time: 23:59:59

every=["3:30:00"] # every 3 hours, 30 minutes
every=["03:00"] # every 3 minutes
every=["30"] # every 30 seconds

Examples

Create a task to PrintSomething everyday of the week at 10AM and 10PM, during the month of September:

Task(
    func=PrintSomething,
    name='Print Something',
    on=["Everyday"],
    at=["10:00:00", "22:00:00"],
    during=["September"],
    args=["Working"]
)

Create a task to PrintSomething on Saturday and Sunday ten minutes past every hour:

Task(
    func=PrintSomething,
    name='Print Something',
    on=["Saturday", "Sunday"],
    at=["10:00"],
    during=["September"],
    args=["Working"]
)

Create a task to run every 10 seconds and pass it multiple arguments:

Acceptable formats: 23:59:59, 59:59, 59

Task(
    func=MultipleArgument,
    name='Run every 10 seconds',
    every=["10"],
    args=["Houston", 713]
)

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

qmate-0.0.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qmate-0.0.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file qmate-0.0.2.tar.gz.

File metadata

  • Download URL: qmate-0.0.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qmate-0.0.2.tar.gz
Algorithm Hash digest
SHA256 ddd127f546ccdb6c19be275898c41cad646e21bf3d272bf26ecc8be04758c211
MD5 182efefa009b90c229ef74d0e563e2ba
BLAKE2b-256 265d34507ebf188666ce0e77a930d89084fbf6f3f2520c1e6c9ac511c9d19a22

See more details on using hashes here.

Provenance

The following attestation bundles were made for qmate-0.0.2.tar.gz:

Publisher: publish.yml on digitalkelvin/qmate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qmate-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: qmate-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qmate-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 15bc6ac4bebc7f1f84d70339d03e334e2a638d6c750ced47e5a1c0e17ce15bda
MD5 a138f869c54cc2e5b9cd263d473bdd62
BLAKE2b-256 52fb506a26e141f7b5bcf5a01b8022ba895f6c14f58a3ca333779b3948f778ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for qmate-0.0.2-py3-none-any.whl:

Publisher: publish.yml on digitalkelvin/qmate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page