Declare the job
computeReceiver from @bijectionhq/pack-compute declares the launcher, a
worker pool slot of worker@1, and computeRuns the
subtree that keeps the runs, places the launcher at <runs>.receiver and
serves the worker’s callback route. job(runs, spec) declares a typed target
over them. Code never names the launcher’s address: the installation’s
bindings file does.
bijection/app.ts
worker@1 today, so bind the pool to your launcher in the installation’s bindings file, with workerPool.aws, workerPool.gcp or
placement.endpoint:
bindings.ts
PlacementUnavailable
(NotOffered).
Declare every job before app(tree) places the runs subtree, and place each
job beside it (here under compute): an open task is answered only by a
function in the subtree that holds the target’s path. The worker route serves
POST /compute/worker under that subtree by default (path changes it).
Submit it and receive the result
A job is a target performed by its own mutation. It checks the arguments (arguments that do not fit, or awithin above maxDeadline, one day by
default, refuse Invalid), launches the run, and leaves the task open until
the worker answers. Submitting the same once again returns the same task and
never launches a second run. The task settles RunFailed (the launcher
refused, the worker failed or the result was refused) or RunUnknown (the
launch’s answer was lost), with the reason in the message.
Expired ends your app’s acceptance window: the remote process can still be
running. cancel(ctx, task) from the runs subtree answers the task
Withdrawn and asks the launcher to stop the attempt; inspect(ctx, task)
reports progress and the current candidate; replace(ctx, task, generation)
fences the old attempt and launches again with the same inputs and task.
A launcher that answers inline within its timeout (up to 15 minutes) can also
be submitted to directly, as ctx.submit(pool.launcher.run, launch, { once, then }).
Match the worker contract
The app and worker agree on abijection.interface/v1 function contract.
contractDigest(forecast) answers the app’s pin; give the worker the same
digest when registering its handler, and the worker refuses a mismatch before
calling it. Change the program revision when the implementation or acceptance
policy changes. See Implement a Python worker and
launchers.
If the worker already has a resolved interface document, scaffold a source
file from it:
createJobs(runs, revision) when declaring the runs subtree, and commit the
reviewed file with the app.
Pass large inputs and outputs by reference through
Pipelines. The Datasets app owns exact versions,
output labels and lineage. A successful worker reply is not a publication.
A job’s program names a worker handler and its revision; Bijection never
sees its code. A pipeline run target is different: its programs are typed
relations, native SQL or program files (program(path, { run, runtime, inputs }))
that bijection check digests and deploy installs in the target, which runs
only installed digests.