Skip to main content

Lupro Scheduler

Lupro Scheduler 是一个任务链同步调度器(支持协程,线程,进程同步通讯)

安装 Lupro_Scheduler

使用 PyPi 安装 Lupro

  • pip Find, install and publish Python packages with the Python Package Index
  • pip install lupro_scheduler

开始使用

  1. 导入 from lupro_scheduler import Scheduler

调度任务Task

from lupro_scheduler import Task
from lupro_scheduler.typing import RunIOintensive
import asyncio

async def main(a, b):
    await asyncio.sleep(2)
    return a+b

task = Task(main, range(10), kwargs = [{'b': i} for i in range(10)], method = RunIOintensive. RunAsync_CREATETASK)
print(task.run())

这样即可使用RunTask调用不同的执行方法

调用方法 RunTask

class RunTask(enum.Enum):
    '''RunTask method'''
    APPLY = 0
    APPLYASYNC = 1
    MAP = 2
    MAPASYNC = 3
    EXECUTOR = 4
    RunAsync_CREATETASK = 10
    RunAsync_GATHER = 11
    RunAsync_ASCOMPLETED = 12
    RunAsync_RUNFOREVER = 13
    RunThreadMap_MAP = 20
    RunTreadPool_POOL = 30
    RunGevent_GEVENT = 40
    RunGevent_MAP = 41

任务链调度 Scheduler

from lupro_scheduler import Scheduler
from lupro_scheduler.typing import RunIOintensive
import random
import asyncio
import time

async def main(a, b):
    await asyncio.sleep(random.randint(4,8))
    print(f'IOintensive task {a} {b}!')
    return a+b

def main1(a):
    print(f'Calintensive task {a}!')
    time.sleep(random.randint(1,4))
    return a**a

if __name__ == '__main__':
    task = Scheduler()
    # 添加IO密集型任务
    task.addIO(main, range(10), kwargs = [{'b': i} for i in range(10)], method = 10)
    # 添加计算密集型任务
    task.addCal(main1)
    # 大概12s左右完成
    print(task.run())

特性

  • 协程接口
  • 线程接口
  • 进程接口
  • 任务链异步调度
  • 任务链同步调度
  • Scheduler(IO) 可等待

api 文档

完善中

Metadata

Release files for lupro-scheduler 1.0.0

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

Source distribution (sdist)

Source distribution for lupro-scheduler 1.0.0
File Size Uploaded Provenance Actions
lupro_scheduler-1.0.0.tar.gz 11.0 kB Without provenance Details for lupro_scheduler-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lupro-scheduler 1.0.0
File Interpreter ABI Platform Actions
lupro_scheduler-1.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for lupro_scheduler-1.0.0-py2.py3-none-any.whl

Total release size: 24.5 kB

Release files / lupro_scheduler-1.0.0.tar.gz

Download URL lupro_scheduler-1.0.0.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
95de1944e5fb8ac05b5e350c8f139de371d612e146a7ba8acdfc504426d01cb6
BLAKE2b-256 checksum
How to use checksums
d2ec2c5620944f1ff91b11bbf6cd5ebc724613770cbb1b95fb983df33f9f3d86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

Release files / lupro_scheduler-1.0.0-py2.py3-none-any.whl

Download URL lupro_scheduler-1.0.0-py2.py3-none-any.whl
Size 13.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b2e1cbc10c5d09e69ab0cd49932668f06e8827d89317282afd6c862eaa1fb06c
BLAKE2b-256 checksum
How to use checksums
f4187f8e8cbe85911339fbcdc86e02ccad2848986aa741d1c61e6f02c23fac88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

Security for lupro-scheduler 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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