Download the PHP package citomni/jobrunner without Composer

On this page you can find all versions of the php package citomni/jobrunner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package jobrunner

CitOmni JobRunner

DB-backed long-running job execution for CitOmni.

citomni/jobrunner is a small provider package for explicit long-running jobs with durable state, registered handlers, structured logs, progress, heartbeat, cancellation, and terminal result/error persistence.

JobRunner supports two execution ownership models:

Both modes execute the actual application handler in a fresh PHP process.

The package is deliberately scoped. It is not a generic message queue, scheduler, retry framework, distributed worker farm, arbitrary command runner, or general daemon framework.


Highlights


Documentation

Start here:

Long-form documentation lives in the separate citomni/docs repository.

This README stays focused on package purpose, installation, runtime shape, and the main public surface.


Requirements

citomni/jobrunner must be installed as a Composer dependency. Do not copy package source into an application.


Installation

Install the database schema from:

The schema creates:


What this package provides

Durable lifecycle

JobRunner persists:

Current statuses:

Current claim modes:

Execution

JobRunner provides:

Observability

JobRunner provides:

Cancellation

JobRunner supports cooperative cancellation:

Handlers observe cancellation through JobContext::isCancellationRequested().

Provider integration

The package contributes:


Execution modes

Token / push

Use token/push when the producer should immediately launch the dedicated worker and that child will inherit the intended execution environment.

Public operation:

Example:

Runtime:

StartJob mints a cryptographically random worker token, persists only its SHA-256 hash, and passes the raw token only to the fixed worker command.

Possible StartJob result statuses:

Trusted / pull

Use trusted/pull when queue production and final execution must be separated and a pre-established trusted supervisor should own dispatch.

Public operation:

Example:

Runtime:

Possible EnqueueTrustedJob result statuses:

A trusted job may remain queued while no trusted supervisor is running. There is no implicit fallback to token/push execution.


Persistent trusted supervisor

Start the trusted supervisor with:

The supervisor:

Default idle sleep:

configured through:

The intended V1 operating model is one trusted supervisor processing one trusted child at a time.

The supervisor does not execute application handlers in-process.


Fresh process per job

Both execution modes preserve fresh-process isolation.

Token/push:

Trusted/pull:

The persistent supervisor therefore does not retain application handler state between jobs.

Each actual job receives a fresh:


Worker ownership

Both modes require the concrete child process to prove ownership before handler execution.

Token-mode claim

The child must match:

Trusted-mode claim

The child must match:

Only the successful claim changes:

and records:

This keeps dispatch attempts separate from actual execution attempts.

For the full ownership and race model, see the execution ownership architecture.


Shared execution lifecycle

After a successful claim, both worker types converge on the same execution path.

Conceptually:

The shared execution lifecycle owns:

Token/push and trusted/pull therefore differ in ownership acquisition, not handler semantics.


Public operations

StartJob

Creates a token-mode queued job and launches its detached worker.

Use when immediate push execution is appropriate.

EnqueueTrustedJob

Creates a trusted-mode queued job without launching a worker.

Use when a separately running job:work supervisor should dispatch the job.

GetJobStatus

Reads one job, a bounded log slice, result data, and error data.

Use last_log_seq as the next incremental polling cursor.

CancelJob

Cancels queued jobs immediately or requests cooperative cancellation for running jobs.


Internal and operational CLI commands

job:run

Internal token/push worker entrypoint:

Normal application code should use StartJob, not construct this command.

job:run-trusted

Internal trusted child entrypoint:

Normal application code should not construct this command. job:work owns trusted dispatch.

job:work

Operational trusted supervisor:

Run it under the process identity and environment intended to execute trusted jobs.

JobRunner does not switch operating-system users or install/manage host services.


Registering job handlers

Register explicit job types in CitOmni config:

Handlers must implement:

Example:

Handlers are currently instantiated without constructor arguments.

Use:

when the handler needs application services, repositories, or config.


JobContext

Handlers use JobContext for job-aware execution.

Identity and payload:

Logging:

Progress:

Heartbeat:

Cancellation:

Cancellation is cooperative. Check between bounded work units.


Active locks

A job may use a logical lock key to prevent duplicate active work.

Active statuses:

Terminal statuses:

Example:

The generated active_lock_key and its unique index provide the authoritative duplicate guard.

The application-level pre-check exists as a friendly fast path, not as the final race guard.

Both execution modes share the same active-lock behavior.


Status and incremental logs

Use:

Example:

For incremental polling:

Do not add one manually.

The underlying query already uses:

The public status read model includes lifecycle state, progress, timestamps, logs, result, and errors without exposing worker ownership material.


Cancellation

Use:

Current behavior:

A running job is not hard-killed by CancelJob.

The handler cooperates by checking:

between meaningful work units.


Database model

jobrun_jobs contains lifecycle and ownership state.

Important fields include:

The database enforces claim mode values:

and token-mode jobs must carry a worker-token hash.

Trusted jobs are enqueued without one and receive a temporary handoff hash during trusted dispatch preparation.

jobrun_logs provides deterministic per-job sequence ordering.


Runtime configuration

Default package configuration includes:

Applications normally override handler registration and only change launcher/runtime settings when their environment requires it.


Security guidance

Registered intent, not arbitrary commands

Expose bounded registered job types.

Good:

Do not make JobRunner a generic transport for arbitrary command strings.

Keep payloads narrow

Prefer intent:

over arbitrary execution details.

Handlers should resolve authoritative hosts, paths, credentials, and options from application-owned data.

Do not persist secrets in JobRunner

Do not place raw secrets in:

Prefer stable references or identifiers and resolve the real credential inside the intended execution context.

Treat trusted queue writers as privileged action producers

Trusted/pull separates queue production from execution, but a caller that can enqueue a trusted registered job can request the action represented by that job type.

Authentication, authorization, and payload validation remain application responsibilities.


What this package owns

citomni/jobrunner owns:


What this package does not own

JobRunner does not own:

The host environment decides how job:work is started and kept alive.

Consumer packages decide what registered jobs actually do.


Operational notes

Token/push

A successful StartJob normally launches the fresh worker immediately.

If the environment cannot submit the detached process, JobRunner returns or surfaces launch failure. It does not silently run the job inline.

Trusted/pull

A trusted job may remain queued until job:work is available.

This is normal trusted/pull behavior.

The supervisor should run in the execution environment intended for trusted jobs.

One trusted supervisor

The current V1 model is one trusted supervisor and one trusted child at a time.

The atomic child claim still protects against duplicate execution ownership, but deliberately running several supervisors is outside the intended V1 operating model.

Failed trusted child

A handler failure may cause job:run-trusted to exit non-zero after correctly persisting the job as failed.

job:work continues to later jobs.

Cleanup and retention

Cleanup and retention policy remain outside the core lifecycle.

Applications may define retention rules appropriate to their operational needs.


Troubleshooting

Token job stays queued

Check:

Token/push expects the dedicated child to be submitted immediately.

Trusted job stays queued

First verify:

is running.

Then check:

Do not manually mark the row running. The child must win the guarded claim.

Job fails immediately

Inspect through GetJobStatus:

Common causes include invalid payload, missing handler, handler contract mismatch, handler exception, or non-encodable result.

Cancellation is slow

The handler is probably not checking:

frequently enough.

Incremental logs repeat or skip

Use:

exactly as returned.


Smoke testing

For the existing app-local end-to-end smoke-test guide, see:

CitOmni JobRunner - End-to-End Smoke Test

For current practical usage of both execution modes, see:

CitOmni JobRunner - Usage, Execution Modes, Handlers, Status, and Cancellation

For the detailed trusted/pull ownership model, capability handoff, fencing, race handling, and fresh-process rationale, see:

JobRunner Execution Ownership Architecture


Architecture rules

citomni/jobrunner follows normal CitOmni boundaries:

In particular:


Performance notes


Contributing

Shared conventions:

CitOmni Coding and Documentation Conventions


License

CitOmni JobRunner is open-source under the MIT License.

See LICENSE.

Trademark notice: "CitOmni" and the CitOmni logo are trademarks of Lars Grove Mortensen. Usage of the name or logo must follow the policy in NOTICE. Do not imply endorsement or affiliation without prior written permission.


Trademarks

"CitOmni" and the CitOmni logo are trademarks of Lars Grove Mortensen.

You may make factual references to "CitOmni", but do not modify the marks, create confusingly similar logos, or imply sponsorship, endorsement, or affiliation without prior written permission.

Do not register or use "citomni" (or confusingly similar terms) in company names, domains, social handles, or top-level vendor/package names.

For details, see TRADEMARKS.md.


Author

Developed by Lars Grove Mortensen © 2012-present.


CitOmni - low overhead, high performance, ready for anything.


All versions of jobrunner with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
citomni/kernel Version ^1.0
citomni/cli Version ^1.0
citomni/infrastructure Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package citomni/jobrunner contains the following files

Loading the files please wait ...