|
|
@@ -6,8 +6,10 @@ db-controller, and millisecond time helpers.
|
|
|
|
|
|
|
|
|
|
|
|
## Availability
|
|
|
|
## Availability
|
|
|
|
|
|
|
|
|
|
|
|
Inside a job container the library is already importable — the scheduler mounts the SDK
|
|
|
|
Inside a job container the library is already importable: it is installed in the job's image,
|
|
|
|
folder and sets `PYTHONPATH`. Outside one, install the wheel published to your gitea PyPI
|
|
|
|
built from the `python-base` repository, whose `local-requirements.txt` names the `i7lib`
|
|
|
|
|
|
|
|
version. Nothing is mounted from the gateway, so a new `i7lib` version reaches a script only
|
|
|
|
|
|
|
|
through a new image tag. Outside a job, install the wheel published to this org's gitea PyPI
|
|
|
|
index. The only hard dependency is `requests`; `python-dotenv` is optional and loaded if
|
|
|
|
index. The only hard dependency is `requests`; `python-dotenv` is optional and loaded if
|
|
|
|
present, so a local `.env` can supply the two environment variables below.
|
|
|
|
present, so a local `.env` can supply the two environment variables below.
|
|
|
|
|
|
|
|
|
|
|
@@ -44,8 +46,8 @@ other submodule paths work equally well.
|
|
|
|
## Signals
|
|
|
|
## Signals
|
|
|
|
|
|
|
|
|
|
|
|
Not every signal is available to every job. `plant.state` holds only the signals the job's
|
|
|
|
Not every signal is available to every job. `plant.state` holds only the signals the job's
|
|
|
|
sidecar exposes to it, keyed by both id and name. Which those are is configured for the job;
|
|
|
|
sidecar exposes to it, keyed by both id and name. Which those are is configured for the job
|
|
|
|
a script does not declare them.
|
|
|
|
in its `signals.yml`; the names used as keys are the ones written there.
|
|
|
|
|
|
|
|
|
|
|
|
A signal that is not exposed is simply absent from `plant.state` — reading it does not raise.
|
|
|
|
A signal that is not exposed is simply absent from `plant.state` — reading it does not raise.
|
|
|
|
Guard with `in` or `.get()` rather than assuming a key is there.
|
|
|
|
Guard with `in` or `.get()` rather than assuming a key is there.
|
|
|
@@ -124,6 +126,28 @@ fast `interval_ms` loop.
|
|
|
|
|
|
|
|
|
|
|
|
**`to_datetime(unix_milli)`** — converts back to a local `datetime`, for logging.
|
|
|
|
**`to_datetime(unix_milli)`** — converts back to a local `datetime`, for logging.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Versioning and the pyproject template
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
There is no `pyproject.toml` in this repository — it is generated from
|
|
|
|
|
|
|
|
`pyproject.toml.tmpl`, whose version line reads `version = "{{vless .TagName}}"`.
|
|
|
|
|
|
|
|
gitea-sidecar renders every `*.tmpl` in the source to its name minus the suffix before
|
|
|
|
|
|
|
|
building the wheel, so a tag of `v0.1.5` publishes version `0.1.5`; `vless` strips the
|
|
|
|
|
|
|
|
leading `v` that git wants and PEP 440 forbids. The tag is the only place a version is
|
|
|
|
|
|
|
|
written, and the published wheel cannot disagree with the tag that produced it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Do not put a hardcoded version back into the template: the build would keep producing that
|
|
|
|
|
|
|
|
one version, and the next tag would fail with a 409 because the package file already
|
|
|
|
|
|
|
|
exists.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Building locally** needs the same render step, since the file the build tools look for is
|
|
|
|
|
|
|
|
not in the repository:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
|
|
sed 's/{{vless .TagName}}/0.0.0.dev0/' pyproject.toml.tmpl > pyproject.toml
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`pyproject.toml` is gitignored, so a local copy never reaches a build.
|
|
|
|
|
|
|
|
|
|
|
|
## Error handling
|
|
|
|
## Error handling
|
|
|
|
|
|
|
|
|
|
|
|
Every method in this library catches its own exceptions, prints a line, and returns an empty
|
|
|
|
Every method in this library catches its own exceptions, prints a line, and returns an empty
|
|
|
|