Skip to main content

An executor of Cron Job

Project description

Starfall

原生 python3 定时调度执行器(适配 xxl-job)

环境

  • python: 支持 python 3.9 +
  • OS: windows、MacOS、Linux

安装

pip install starfall

使用

安装依赖后,需要在工程目录下提供一个配置文件 conf.ini, 并在其中设置以下参数:

[Executor]
PORT = 9002
NAME = demo-py-executor
ADMIN_URI = http://192.168.0.96:8088/job-admin
ACCESS_TOKEN =

参数根据实际填写

调用入口方法,启动服务:

from starfall import init, start_serve
import os

PROJ_ROOT = os.path.dirname(os.path.abspath(__file__))
print(f'root: {PROJ_ROOT}')

init(PROJ_ROOT)
start_serve()

查看控制台输出,看到 server started... 表示服务启动成功

任务代码编写

  • 在工程目录下新建 jobs 文件夹 (文件夹名称必须固定)

  • jobs目录下新建任务代码

  • 一个job示例:

from starfall.helper import get_logger

def add(x, y):
    logger = get_logger('demo.add')
    logger.info(x+y)
    return x+y

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

starfall-0.0.7.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

starfall-0.0.7-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file starfall-0.0.7.tar.gz.

File metadata

  • Download URL: starfall-0.0.7.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for starfall-0.0.7.tar.gz
Algorithm Hash digest
SHA256 938108d684d967b946c91520517d452fa86124faa4981c54a3a81b59cad4370e
MD5 03dc8a9255ca3839c53f7ec4a9790fff
BLAKE2b-256 fb361a0fa6fddb646201103d14412a104ae7b33877acc571ec012a165292007d

See more details on using hashes here.

File details

Details for the file starfall-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: starfall-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for starfall-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 7cd074a3c4cf3d870ef074ef5186ab686f16243805278f6bdafd6e92f4836398
MD5 7ece038039039deb7f3a2820fc5a5cd0
BLAKE2b-256 403d7e54ed4df33d5e56a512e30fa77f6e30cebc246ed3b6c9009ce3ae3c5859

See more details on using hashes here.

Supported by

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