Skip to main content

macrostrat.task_runner

Long-running tasks run on a Celery worker with their terminal output streamed live to a browser, and a cancel that behaves like Ctrl-C. Used by Macrostrat's management tasks and Mapboard's topology rebuilds.

The application keeps its own record of runs (a table with an id and a state) and its own routes; this package supplies the parts in between:

  • Worker: execute(run_id, task, db_url=, redis_url=) calls task(db, ctx) with stdout and stderr sent, ANSI intact, to the Redis stream task-run:<id>:out, and returns an Outcome (state, result, error, the whole log). It must run in a main thread, as under Celery's prefork pool with one task per child.
  • Cancel: request_cancel(redis, run_id) publishes on the run's control channel. The worker interrupts the task's main thread with TaskCancelled, a BaseException no library except Exception swallows, and cancels the statements of every Postgres session named task-run:<id>.
  • API: output_events(redis, run_id, state=, archived_log=) yields Server-Sent Events: the stream replayed from the start (or Last-Event-ID), then followed until the run ends, or the archived log once the stream has expired. Return it with SSE_HEADERS as text/event-stream.
  • Catalog: TaskSpec and load_registry(group), for applications that register tasks through entry points.

A browser draws the stream with xterm.js at 120 columns, matching the COLUMNS the worker sets. A process that will not stop is killed through Celery (revoke(terminate=True)), and the application records that itself.

Metadata

Release files for macrostrat.task_runner 0.1.1

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

Source distribution (sdist)

Source distribution for macrostrat.task_runner 0.1.1
File Size Uploaded Provenance Actions
macrostrat_task_runner-0.1.1.tar.gz 7.7 kB Without provenance Details for macrostrat_task_runner-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for macrostrat.task_runner 0.1.1
File Interpreter ABI Platform Actions
macrostrat_task_runner-0.1.1-py3-none-any.whl Python 3 none any Details for macrostrat_task_runner-0.1.1-py3-none-any.whl

Total release size: 18.1 kB

Release files / macrostrat_task_runner-0.1.1.tar.gz

Download URL macrostrat_task_runner-0.1.1.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
359da9fc615447e7802a6f2de494e7604b9bfeb9c3d731e199a38aff2305c636
BLAKE2b-256 checksum
How to use checksums
605e9d1e7091e41e8ac2c911f562b976ffa59a9113adf1371f4d7e582ac8e52a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / macrostrat_task_runner-0.1.1-py3-none-any.whl

Download URL macrostrat_task_runner-0.1.1-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6b0615ae2a76ef494f50e9a3ac55468b025322e3c5d458fdd94960d60f305c6
BLAKE2b-256 checksum
How to use checksums
4e85148500d8cfa2b7751b723886d54fcb5443b9857b7980190a163442fd6d6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for macrostrat.task_runner 0.1.1

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

0.1.1 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