Sikron Job runtime SDK (env, progress file, session crypto) — aligns with pkg/job
Project description
sikron-job(Python SDK)
与仓库 pkg/job 契约对齐的薄客户端:环境变量、进度 JSON 文件、Runner 会话加解密。不包含 Go executor 的跑批编排。
安装
业务 Job / 示例(在仓库外或其它目录 import sikron)需要安装:
cd sdk/python
python -m venv .venv
.venv\Scripts\activate # Linux/macOS: source .venv/bin/activate
pip install -e ".[dev]"
框架开发(只改 sdk/python/sikron/ 内源码):包内已用 相对导入(from .env import …),IDE 打开 sdk/python 即可跳转,不必先 pip install 才能编辑 job.py 等文件。跑测试在 sdk/python 下执行 pytest(pyproject.toml 已配置 pythonpath = ["."])。
| 场景 | 是否要 pip install |
|---|---|
改 sikron/job.py 等框架源码 |
否(相对导入 + IDE 识别包目录) |
examples/python-job 里 from sikron import … |
是 |
pytest(在 sdk/python) |
否(已配 pythonpath) |
用法概要
高层封装(推荐,由 Runner 启动)
from sikron import SikronJob
# RunnerContext 仅来自 load_runner_context(bootstrap 内部调用)
with SikronJob.bootstrap() as job:
job.progress.running(50, message="half")
x = job.env("MY_VAR", decrypt=True)
本地无 Runner 时 不要 在框架里开 demo 开关;在示例/测试里 try: SikronJob.bootstrap() / except IncompleteRunnerEnvError 后手写 RunnerContext,再 SikronJob.from_context(ctx)。
底层 API
from sikron import RunnerContext, load_runner_context, init_runner_session_from_env, get_env
from sikron import ProgressSnapshot, write_progress, ProgressReporter, SikronJob
ctx = load_runner_context()
job = SikronJob.from_context(ctx)
# 或
rep = ProgressReporter(ctx.progress_file, ctx.task_id)
rep.running(10, message="…")
rep.success()
示例 Job:examples/python-job/。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sikron_job-0.1.0.tar.gz.
File metadata
- Download URL: sikron_job-0.1.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3963f05b03b9cbf9032bfe1b1599fa28c2298500cd4d3f9d65e1cc8178dfdeeb
|
|
| MD5 |
560538d357c99acdefa0afe6deffb986
|
|
| BLAKE2b-256 |
da4e4960fc51957b467cf412092f02ad6e439f5f4f30f36fc96431fa5ba63b71
|
File details
Details for the file sikron_job-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sikron_job-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab86d488510ce9f1c0e6fbb192e6c2613209505eb2c23a8040b330edf8973e59
|
|
| MD5 |
4734e0db9468bfb1994a14a41cbc820c
|
|
| BLAKE2b-256 |
f040a0c33da2652225249b919284a4f9f6b0dd6a0a000d60a3432696639b21a7
|