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.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 macrostrat.task_runner 0.1.0
File Size Uploaded Provenance Actions
macrostrat_task_runner-0.1.0.tar.gz 7.7 kB Without provenance Details for macrostrat_task_runner-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 18.1 kB

Release files / macrostrat_task_runner-0.1.0.tar.gz

Download URL macrostrat_task_runner-0.1.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1b94070b67bc8c2c15a6ed1f2cbd59e507f91537aa9676599566cad0fdb96fd6
BLAKE2b-256 checksum
How to use checksums
e58145a6ddd439fff1ce193b871af8df47d41dc1f1b1ca68d7f6ab33bd1a3873
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.0-py3-none-any.whl

Download URL macrostrat_task_runner-0.1.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ea9e59d44cfc85abfa50a8dc741adc26d0a63800e25255fe8ee19ae383efd00
BLAKE2b-256 checksum
How to use checksums
b52e266af7f4281544945b50d2fef7c8706d7cc4746e9e518601e10c36ac1bf6
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.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

0.1.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