Accept: text/markdown.Worker protocol
JSON Lines worker protocol and standalone progress contract.
Start tomojax-worker serve --python /path/to/env/bin/python for a local worker or tomojax-worker connect NAME for the same protocol over a saved connection. Both commands come with the Studio wheel. The base Python package provides tomojax serve, the numerical executor. Its first ready reply contains the executor inventory. Clients that use native file, pixel, transfer or job commands start the worker. See remote session setup.
Protocol 1 uses UTF-8 JSON Lines. The client writes one request per line. The worker writes reply headers on stdout and reserves stderr for diagnostics. A block header for pixels or a file transfer has a binary body. All other replies end at the newline. The first line from tomojax-worker serve is ready. It identifies the host, home, working directory, job launcher, initial byte credit and native commands. A subsequent executor event reports starting, ready or gone with a generation number. The ready event's detail holds TomoJAX's capabilities, device IDs, versions, parameter-schema digest and session root. Use these device IDs in operation parameters. The versioned schemas and fixed conversations in protocol/ are the client contract. Resolve their absolute schema IDs to local files when validating offline.
A request has a unique string id, a tagged command and an optional channel. type selects the variant of a command, workflow, product or storage reference. Required fields and defaults are in the schemas. Omitting a defaulted field uses its declared default. An explicit null is valid only for a nullable field.
The describe response contains a JSON Schema in result.parameters. Its $defs describe the inputs to each operation. Form controls can read description for help, x-choices for canonical domain choices, and x-unit for the unit of a value. geometry_length uses the scan's length unit. native_pixel and working_pixel refer to the original and working detectors. The x-python table maps public Python arguments to wire fields. A worker-owned argument such as the reconstruction output buffer is allocated by the executor.
Each admitted request receives zero or more progress envelopes followed by one result or error. Match all three by request. Each echoes channel: null or the channel name and its monotonically increasing revision. When replacing work on a channel, drop progress and artifacts from older revisions, including records already in the pipe. A rejected line receives a separate protocol_error of kind invalid_request. Its request echoes every readable string ID, including an invalid ID on a rejected command. It is null when the worker cannot decode a string ID. A duplicate ID leaves the original request pending. Unexpected EOF before a terminal means the process or connection was lost.
Inputs and outputs
{"type":"path","path":"scan.h5"} opens a source on the execution queue. A handle member uses {"type":"member","handle":"h","member":"self"}. Every root has a self member. Named members are direct lookups in the owning result. For example, pass an alignment's scan member wherever a scan is accepted. The session pins every referenced member at admission, including refs in configs and correction steps. It also pins referenced session artifacts. Closing a handle prevents further admissions against it. Admitted work retains its inputs through completion.
Columns below name accepted input kinds in addition to the options defined by the indicated schema variant. A path used as a scan runs the normal scan loader. Raw calibration stays with a frames handle. Opening by kind explicitly selects the saved-data loader. Bulk inputs use storage references, including masks, exposure arrays and pose tables.
Command or run.operation | Input and principal parameters | Published result and ownership |
|---|---|---|
describe, devices, status | No input | Cached description, devices or status. Status includes request state, logical bytes by handle and sampled allocator counters. |
python | Trusted code and admitted aliases | python.images contains session npy references to display-scaled rasters from show(). Read each raster and release its artifact token. The encoded output must fit within 8 MiB before the worker publishes any registrations. |
inspect | Path | inspection.report, as in Python: a dataset's report with loading, or a checkpoint directory's checkpoint. |
open | Path and kind. Scan and frames accept loader geometry, calibration (flats and darks identify unlabeled counts in any storage dtype and accept another scan's file to take its flat or dark frames), dataset paths (on raw and saved HDF5 scans, plus data_path for Bliss sequences), and apply_poses (omitted by default; rejected on saved non-scan kinds). Saved results use their recorded metadata. | Session handle. Scan exposes projections, frames exposes counts. Reconstruction exposes volume, actual method and nullable scan. Alignment exposes scan, poses and nullable image. Simulation exposes scan and phantom. |
close, release | Handle ID or session-issued artifact ID, respectively | ack. Release accepts an ID issued by this session. |
validate | An open, workflow or interactive operation with its exact parameters | validated or typed error with the nested parameter path. |
plan | A reconstruct or align operation | reconstruction_plan, joint_plan, sinogram_focus_plan or opposite_views_plan. Placement is an estimate against the included snapshot. |
run.correct | Path, scan or frames, ordered corrections and batch size. Frames also take binning, epsilon and flat_weights ("views" default or "position"). | Scan handle with projections and the ordered correction records in info.summary.corrections. |
run.reconstruct | Path or scan, method, grid/region, config or public solver options, optional checkpoint directory | Reconstruction handle with registered volume, actual method and scan. Owner-managed storage supplies the Python output buffer. |
run.align | Path or scan, fit, method, grid/region, fit options (AlignConfig includes exclude_views, detector_columns, image_tv_weight) and optional checkpoint directory | Alignment handle with corrected scan, pose table and optional working image. fit: "center" on an unposed, unrolled, well-sampled axial parallel scan runs direct half-turn sinogram focus or full-turn opposing-ray overlap estimation (image: null) unless method: "joint", a grid/region or joint options are supplied; method: "opposite-views" selects pair-only estimation. Joint fits report disturbed_views (and fit_views when views are excluded) in info. |
run.feature | Registered array or saved volume and a shape, seeded region or band recipe | Feature handle with a registered mask, voxel count, bounds, and mean and standard deviation of finite source values in the mask. |
run.evaluate | Path or scan, candidate reconstruct/align settings, interleaved or angular split, optional per-partition corrections and reference solver | evaluation with split_fingerprint, reference settings and per-candidate held-out scores. |
run.simulate | Phantom, acquisition geometry, artifacts and seed | Simulation handle with scan and phantom. |
run.project, run.backproject | Scan or path for geometry, registered volume or projections by storage ref, optional grid/devices | projections.projections or volume.volume, session npy. The second operation applies the matched transpose. |
run.select, run.crop | Scan, frames or path (scan). Ordered view indices or half-open detector row/column intervals | New handle of the input kind. |
run.bin, run.poses | Scan or path, integer detector binning or six-column pose reference (null clears) | New scan handle. |
run.combine | Ordered paths or scan members, optional name | Combined cone scan. The manifest retains each input's own path and transformations in order. |
run.reconstruct_slabs | Raw path or frames, slab method, NeXus destination path, optional force, grid, corrections, config, warm start, epsilon, flat_weights ("views" default or "position") and checkpoint directory | files.paths contains the saved reconstruction. info.summary and the saved volume include whole-scan truncation, config, host_slabs, source, resolved backend (for Fourier), and iterative stopping diagnostics (including slab_stopping on independent planes). inspect returns the saved record in volume.reconstruction_info. Read the saved reconstruction with open or the registered volume at /entry/volume/data. |
run.save | Scan, reconstruction, alignment, simulation or feature member, path, include_scan, force | files.paths contains the saved dataset. Caller owns committed destinations. |
run.export | Scan projections, registered volume or mask, path, dtype, range, crop, binning, axis, compress, force | files.paths includes the exported array or file group. Caller owns committed destinations. |
fetch | NPY or HDF5 storage, registered shape, plane selection and encoding | Pixel blocks followed by a pixels result. See Fetching a plane. |
list, stored, peek | Path on the worker. For list, pass the previous page's after as after. Optional limit sets the page size (1–4096, default 4096). | A canonical path, its directory and writable flags and file entries, stored array descriptors, or a bounded inventory for inspection. |
project_results | action: "claim" takes the project ID in project, the project name, and the chosen parent. action: "verify" takes project and the recorded path. | The absolute results path. Verification reads the project marker. A claim creates the marker and the inputs, kept, and jobs directories. |
copy | New destination directory, sources with paths and relative names, optional JSON documents keyed by relative name | Published directory. A session-file source also requires its artifact token. |
download, upload | File path. Upload also declares byte count and SHA-256. | Binary blocks up to 64 KiB. Download returns its byte count and SHA-256. An uploader that sets notify_ready: true receives an upload_ready progress record after admission for a nonempty file. Upload acknowledges after publication. Each file is limited to 100 MiB. |
read | Storage ref or saved volume path, optional half-open roi, stride, metadata_only, or display mode/axis/index | array (registered hyperslab up to 16 MiB as session npy, or metadata only) or planes when mode is set. |
statistics | Storage ref or saved volume path, optional roi, stride, percentiles and histogram bins | statistics with finite count, non-finite count, mean, std, percentiles, histogram and unit. |
plane | Volume member (including phantom or alignment image), axis and index | plane.plane, session npy. Works with a saved volume that has no scan. |
slice | Reconstruct parameters, axis and index | plane.plane on the full method's grid, session npy. |
center_sweep | Slice parameters and ordered signed horizontal detector offsets in pixels, in the center report's sign convention | sweep.planes, session npy. Leading coordinate vector preserves duplicates. |
correction_preview | Raw path or frames, or a processed path or scan with line-integral corrections, correction settings (flat_weights on raw frames) and half-open binned row interval | correction_preview.before, after and retained original views, session npy. before holds counts for raw input and line integrals for a scan, which bins after its corrections. |
region_preview | Scan or path | Region handle for subsequent region parameters, physical XYZ bound pairs, selected grid and registered overlay arrays. |
control, shutdown | Request ID and pause/resume/cancel, or no input for shutdown | ack. A paused request holds the execution queue. Cancel it to run other work. |
An executor that advertises Inspect.previews in describe accepts previews: true on inspect. When reading a vendor stack or TIFF folder it publishes the first sample in logical detector order as a registered first_projection progress array before scanning the remaining frames. Studio can fetch and probe this plane while inspection runs. The inspection result retains its usual fields.
Products carrying a scan report its correction history in info.summary.corrections, in the same order as Python's scan.corrections. Each record contains name, settings, and found. A bulk numeric value appears as null with a matching JSON pointer in info.arrays.
Execution results include bounded info and an input manifest. Each manifest node identifies the operation, its parameters and its ordered inputs. File roots retain the source path. Include all contributing inputs even when two distinct members come from the same root. Save, export and slab reconstruction include this lineage in the file record's provenance. Raw, MetaImage and AmiraMesh exports write that record at <destination>.json. The reply's files.paths lists the published paths. The owner commits these paths together. Force permits replacement of an existing output. Opening an input records its physical files in the worker process. These include HDF5 external-link targets, virtual dataset sources, external raw storage, vendor metadata, individual frames and separate calibration files. Files stay protected while a running operation, open handle, unreleased artifact or reachable Python result depends on them. A dry run releases its inputs when it returns or raises. All durable destinations, sidecars and checkpoint directories are checked against the live inputs by name and filesystem identity, including symlinks, hard links and directories containing a protected file. A conflict identifies the input and calls for a different destination, even with force. The worker registers handles and publishes terminals. Its committer owns durable destinations. Session artifacts live until release, owning-handle close or shutdown. Input files and committed durable destinations belong to their caller.
A format-2 dataset includes the worker operation and its input lineage in the
JSON document at /entry/record. A slab reconstruction adds the resolved
solver settings when the final slab has been written. Saved array references
name the HDF5 signal. The scan signal has axes (view, v, u), and volumes,
working images and phantoms have axes (z, y, x).
For an NXtomo detector with interleaved sample and calibration frames, stored returns a counts array in physical file order. Its first axis is frame, in stored indices. The header report's flats_darks.first_sample identifies the first sample frame after image-key and control exclusions, or is null when none exists. The numerical loader still selects sample views for processing.
Fetching a plane
Give fetch the storage and shape from the array descriptor. It reads on the I/O threads while the executor works or waits. This request reads every second row and column of a stored plane.
{"id":"p1","channel":"axial","command":{"type":"fetch","storage":{"type":"npy","path":"slice.npy"},"shape":[1024,1024],"stride":[2,2],"encoding":"jpeg","window":[-2,2]}}For a volume with shape [100,1024,1024], set roi to [[7,8],[0,1024],[0,1024]] and stride to [1,2,2] to sample plane 7. Bounds are half-open and follow descriptor order. A stored line detector with shape (view,u) can use its registered shape (view,1,u). The result keeps the singleton axes. Use the descriptor for coordinates and units. The decoded plane can occupy up to 16 MiB.
For jpeg, the worker maps the two window limits to grey levels 0 and 255, clips outside values and encodes an 8-bit grayscale JPEG at quality 60. A null or omitted window selects the finite minimum and maximum. A zero-width window or a non-finite sample maps to level 0. The terminal reports the window in range. For float32, decompress the frame with zstd. The four consecutive byte planes hold byte 0 of every little-endian float, then byte 1, byte 2 and byte 3, in C sample order. For pco32, decode the standalone Pco stream as float32 in C sample order. Its sample count must equal the product of the reported dimensions. Both float32 encodings preserve the bits of the selected float32 values. For float64, the same layout uses eight byte planes. For a uint16 volume, two byte planes encode levels from 0 to 65,535 over the finite minimum and maximum reported in range.
When a header such as {"type":"block","request":"p1","bytes":65536} arrives, consume the newline, then read exactly that many bytes. The next header starts immediately afterward. Append the bytes to the named request and send {"credit":65536} on its own line to return the number consumed. Each block carries at most 65,536 bytes. The worker advertises the initial shared window of 262,144 bytes in the pixel_credit field of ready.
Send {"window":131072} to change the maximum outstanding bytes across all requests. The allowed range is 65,536 through 1,048,576 bytes. Shrinking below the bytes already in flight pauses new blocks until acknowledgments bring the outstanding count below the new window. Returning more credit than the bytes outstanding causes a protocol error. Both flow-control lines are bare JSON objects and successful updates have no reply.
The worker sends pending JSON replies first. For each block it selects the ready frame with the fewest bytes remaining. Decode a frame when its successful terminal reports its shape, encoding and total byte count. A newer request on the same channel drops unsent blocks of the earlier fetch. Discard any partial frame on a superseded error and return credit even for bytes you discard. Up to eight off-channel fetches may be active. A fetch ID becomes available again after its terminal and does not count toward the session ID limit.
Durable jobs
The peek result for a directory includes a boolean record. It reports whether the directory contains a checkpoint marker or a candidate export record. The executor can inspect those records.
The native worker accepts job commands as soon as it sends ready. Its jobs field selects the launcher. With process or slurm, a queued or running job survives loss of the submitting session. An inline job borrows the session's executor. A script containing only open, inspect or plan also runs inline.
| Command | Fields | Result |
|---|---|---|
submit | directory, script, optional options | The job state. Use a directory under ROOT/jobs/. The script is a JSON array of ordinary open, inspect, plan or run requests. Each request ID starts with the directory's basename and a dot. A later line can use a member of an earlier line. Slurm resource options are a shell-quoted argument string. |
jobs | root | A jobs result whose jobs array lists states under ROOT/jobs/. |
job | directory, optional byte offset (default 0) and limit (default 65,536) | The job state, complete reply records, next offset and current preview. A record larger than the limit is returned whole. An incomplete final line leaves the offset at its start. |
job_control | directory, action | The job state. cancel leaves a standing request. Inline jobs also accept pause and resume. Use abandon for an unknown job to leave a cancel in force if it is found later. |
Submit once for each user action. Submitting the identical script to the same directory returns its current state. On reconnect, call jobs, then read each job from its saved offset. An attempt record starts a new task tree. State includes directory, launcher, state, detail, cancel_requested, pause_requested, abandoned, checkpoint and receipt. An inline job can acknowledge a pause request before the executor reaches its next pause boundary. A queued or running job can still have a cancel pending. Polling carries the request to a matching allocation when the scheduler becomes reachable.
A job with a successful scheduler exit or runner end record stays running while its result directory is still invisible on the worker's host. Once the worker sees the receipt, it reports completed. The receipt describes the final line. A dataset receipt gives the NeXus path and registered arrays. An arrays receipt gives file-backed descriptors, a report carries the inspection or plan, a source carries its original frame-open parameters, and files lists output paths. Fetch all arrays of a live preview from the same generation. If one has expired, discard the partial frame and read the next preview. For an interrupted or canceled job with checkpoint.usable set, submit a new directory with the operation at the zero-based checkpoint.line using the reported checkpoint.path. When a script has several checkpointed operations, each gets its own default directory.
Progress and array registration
Feature bands reuse mask indices directly. The source and feature must have equal shapes, ordered axis names, frames, axis units and fixed-plane coordinates. Origins, signed pitches and all sample centers (including explicit coordinate vectors) must agree within an absolute 1e-6 in each axis's declared unit. A mismatch returns the differing field and a remedy, even for disjoint grids. Choose a feature on the target grid or resample it explicitly before submission. The same rule applies to registered support masks on the resolved reconstruction grid and registered inputs to projection and backprojection. A saved volume path supplies logical (z, y, x) order for projection. An explicit volume dataset keeps its stored axes. Bare numerical inputs to those operators take their registration from the operation.
A band selects voxel centers with inner < distance <= outer in Euclidean index units. Inside the feature, distance is one minus the distance to the nearest background center. Every voxel beyond the grid is background, so a face adjacent to the exterior has distance zero. Outside the feature, distance is measured to the nearest feature center. Both bands return only voxels within the source grid. An empty selection reports zero voxels and null mean and standard deviation.
A metadata-only read returns a layout with no pixel storage. Each nonuniform axis includes a session npy holding its complete coordinate vector. Release each coordinate artifact after use.
A center sweep resolves region once on the input scan. Every center uses that grid, its support and the same plane index. To reproduce a plane, shift the detector to the requested horizontal offset in input detector pixels and run a full reconstruction with the resolved grid=. Keep the resolved cylinder mask when requesting cylindrical support. All planes share one spatial registration, including repeated centers.
The Python functions in tomojax.interactive are reconstruct_slice, reconstruct_slices (several planes, sharing one full reconstruction when any needs it), center_sweep, correction_preview and region_preview. Correction previews express the requested row interval on the binned detector. At binning factor two, [1, 3) returns native rows 2 through 5 in before and binned rows 1 and 2 in after. Each array carries its own pixel-center coordinates and view angles. The views array gives the positions retained from the input acquisition. Region bounds are voxel edges in physical x, y, z order. Each overlay records the index and physical coordinate of its central plane.
The standalone v2 progress schema covers task start/end, completed work with nullable ETA, placement, notes, pause/resume, previews and CLI terminals. A note carries the innermost open task ID, or null for a watch-level message between operations; a log message repeated within one operation becomes one note. The worker's progress.record admits only nonterminal events. placed lists actual participating devices. Elapsed time and ETA use seconds. Error kinds are input, invalid_parameter, out_of_memory, canceled, superseded and internal; a canceled error from a checkpointed run carries checkpoint naming its directory. Worker admission errors have their own envelope. A failure path such as corrections[2].alpha starts at the operation's parameters.
Every descriptor carries shape, NumPy dtype, ordered axes, value unit/domain and storage. npy names a file, hdf5 names a file and dataset, and member names a session handle and member. Session-produced npy files carry a release token. Client-owned npy and HDF5 inputs stay caller-owned. Array values travel outside JSON. Each axis gives a name, frame, unit, and either uniform coordinates or a reference to a one-dimensional vector of its coordinates. Coordinate order equals stored index order, including for irregularly selected views.
Volume dimensions are (z, y, x). A uniform origin locates the center of the first voxel in that dimension. A removed axis records its source index and physical coordinate in fixed. Projection dimensions are (view, v, u). Poses are in the detector frame with columns (alpha, beta, phi, x, z, y), the first three in degrees and the last three in the scan's length unit. Lengths can be in pixels for uncalibrated data. Values distinguish counts, transmission, line integrals, attenuation and mixed-unit pose columns.
The compact UTF-8 encoding of info is limited to 65,536 bytes. Bulk members are externalized before scalar JSON conversion. Their positions in summary are null and their descriptors are in arrays, keyed by RFC 6901 JSON Pointer (including /disturbed_views/score and /disturbed_views/ranges or /disturbed_views/angles when longer than 64 entries). The scalar summary retains method selection details such as automatic, truncation diagnostics (truncation: edge_ratio, outside_fraction, interior_shift, radius, field_of_view_radius, plus outside_grid, data_model, and background_treatment for iterative methods) on run.reconstruct and run.reconstruct_slabs, solver stopping fields (termination, early_stop, effective_iterations, resolved_tv_weight, noise_score_rms, measurement_noise_rms, projection_error_rms, and slab_stopping on independent axial iterative slabs), alignment calibration, diagnostics, disturbed_views, and fit_views (when views are excluded), and reader statuses in geometry (detector_center_status, geometry_status, and frame_records). All seven method configs (FBPConfig, FourierConfig, CGLSConfig, FISTAConfig, SPDHGConfig, SIRTConfig, and MLEMConfig) accept exterior as "cylinder" (default) or "zero".
Python hand-off
The Python executor decodes forwarded requests as tomojax.cli.envelope.ExecutorRequest. For a queued command the adapter receives its typed ExecutionInput and an ExecutionContext. The owner resolves and pins the input references before queuing and supplies the leases, control, event sink, immutable allocator snapshot sink and private staging allocator. Adapters return Success or raise. They may only write to paths supplied by staging. An array reservation has distinct private and eventual public paths. Output reservations within one admission form a durable group, including any required format sidecars.
A returned NewHandle gives logical bytes, a pure bind(id) returning the published product and member map, and a disposal callback. The owner assigns the ID and checks the channel revision at commit. Losing the race discards staged files and unpublished resources. Disposal after successful registration waits for the last lease. The owner emits all worker terminal envelopes.
Driving the process
Start tomojax-worker serve --python /path/to/python with stdin and stdout pipes. Pixels and files are available at worker ready. Wait for executor ready before submitting numerical operations. The worker starts a new generation after executor loss. Each generation owns its own handles and session files. Read stdout concurrently with writing stdin. The worker samples the device inventory at startup and answers describe, devices and status from memory. Allocator samples come from the executor. An empty allocator list means no sample has arrived. The latest sample for each (device, scope) includes its own timestamp. Handle sizes are logical bytes.
Send at most 1 MiB of UTF-8 per request line, excluding its newline. Request and channel IDs are limited to 256 UTF-8 bytes. Up to 64 execution requests may be active or queued. A replacement that displaces a queued admission can enter a full queue. Immediate commands still work at the queue limit. Use a fresh process after 100,000 admitted IDs. Native reads with fetch, job and jobs count only while in flight. Shutdown remains available at the ID limit. An unknown member, mismatched artifact token and path, duplicate ID, unavailable command or exhausted admission limit yields protocol_error. A rejected replacement leaves the prior channel revision in effect.
Queued commands run in arrival order. A later admission on the same channel increments its revision, removes queued predecessors and wakes a running predecessor. Cancellation of queued work ends it immediately. Running work stops at a cooperative work boundary (an iteration, slab, or batch), or at publication if it returns first. Pause moves running work through pause-requested to paused at that boundary. Pausing holds the run in memory and does not write restartable state to disk. A run given checkpoint saves its state there: periodically, and at the boundary where a cancel, a superseding admission, shutdown or SIGTERM stops it. Its terminal is then a canceled error whose checkpoint names the directory; the same operation with that checkpoint resumes, and inspect on the directory reports what it holds and the operation and input provenance that started it. Resume withdraws a pending pause or wakes a paused request. A paused request holds its memory and the execution queue. Send control or status off-channel when observing existing work.
The writer preserves record order. Consecutive pending advanced events for one request and task may collapse to the newest event. Previews and their coordinate files are published before their record and stay available for release, including when a newer revision supersedes the job. The worker discards stale preview callbacks and disposes of their private reservations when the adapter exits. A partially written line always finishes before another begins.
On shutdown, stdin EOF, SIGTERM, or expiry of --idle-exit, tomojax-worker serve closes admission, cancels outstanding work and wakes paused requests. A pending run with operation.checkpoint (including an inline script line) or a pending python call may need a final save. The worker then gives the executor up to 120 seconds to reach a work boundary and commit the checkpoint. For an explicit shutdown, it signals this grace period with a progress note on the shutdown request. Other shutdowns allow 5 seconds for executor exit. The worker allows a further 2 seconds after the executor deadline to drain stdout.
MCP and Studio keep reading the local or named connection through EOF. Protocol clients should do the same. The shutdown acknowledgment follows the outstanding terminals. When driving the Python executor (tomojax serve) directly, SIGTERM cancels active work and waits for checkpointed jobs to save before exiting. Broken stdout, more than 16 MiB of queued JSON, or a stalled final drain means connection loss. The process exits with status 1 after cleanup. A draining client gets status 0. After an unexpected EOF, use the filesystem to check durable destinations whose terminals were lost.
Durable files
Save, export and slab reconstruction adapters reserve a private staging location on the destination filesystem for each file or directory, including format-specific sidecars. The session serializes admission and publication. Cancellation or a higher channel revision admitted before the commit check discards the entire group and preserves existing destinations even with force. Once the session enters commit, it finishes the group and queues its terminal before admitting another command. Sending bytes on stdin alone does not establish which command won.
Without force, an existing group member causes the commit to fail. With force, originals move to private backups while the group is installed. A missing staged file, failed rename or other install error rolls back earlier group members and returns an error. A failed restoration reports the location of the retained original for recovery. Use the successful terminal as the point to open all files. Other filesystem readers can observe individual renames during a group commit. Concurrent external writers and process or machine crashes have no multi-file transaction guarantee.
Release takes only the issued artifact token. A successful release or handle close rejects new references immediately. Earlier admissions retain their leased storage through their terminal. Normal shutdown removes remaining private and published session files. Committed outputs remain caller-owned.
Standalone commands
Set previews: true on a run request to receive completed work boundaries as preview records. Reconstruction and alignment images contain central z, y and x planes. Alignment also reports per-view pose increments in the acquisition convention. Correction previews carry before and after sinograms on their own detector grids. An axis coordinate vector is itself a session artifact. Release these files after displaying them. Intermediate frames are limited to one per active second. The last completed state is delivered at the end, including early stopping.
In Python, pass previews=True to progress.watch to receive small host arrays. To write a standalone JSON preview, pass the consumer directory to progress.to_json(event, directory=path).
An indeterminate prepare task brackets work on the calling thread that can include cache lookup, lowering, compilation or first execution. A warm run can report the same task.
Pass --progress json to inspect, correct, reconstruct, align, simulate or export. Read one JSON object per stdout line. A successful invocation ends with result. Its outputs list includes each written file, and its arrays reference the stored data. Export reports the source volume in disk axis order and lists the converted files and sidecar. Commands that write a scan-carrying product (correct, reconstruct, align, and simulate) return the scan's correction records in info.summary.corrections. Inspect returns its report in info.summary; with --preview-dir it adds preview_count and preview_listing, the path of inspect-previews.json, which lists every preview, the ordered slice requests and any center sweep. Auxiliary NumPy files for bulk diagnostics are caller-owned and live alongside the output. A scalar summary that exceeds the byte limit reports the number of omitted fields as _omitted_fields, giving automatic, placement, and disturbed_views priority over solver histories.
Errors end the stream with error (carrying checkpoint when a checkpointed run stops). An invalid command line exits 2, an operational failure exits 1 and cancellation exits 130. An internal error also produces a traceback on stderr. A process killed before delivery leaves EOF without a terminal. TomoJAX's own log messages and warnings arrive as note records. reconstruct --watch-dir and align --watch-dir write images and carry no preview records in the stream.
Planning a run
tomojax reconstruct --dry-run and tomojax align --dry-run print the resolved plan as text without writing an output. With --progress json the stream ends with a result record whose info.summary is the plan; an alignment's adds its input and output paths, fit, method, configuration and grid. tomojax correct --dry-run --progress json ends with the steps in run order, the output shape, its float32 bytes, upper_bound (true when view rejection can drop views) and full_rows (true when the preview reads every detector row). Reconstruction reports the selected inverse, its reasons, its voxel grid and the configured iteration limit for iterative methods. A joint fit lists the padded working grid, outer iteration limit and image iterations per solve at each level. The returned working image crops the padding. A sinogram focus plan reports the number of interior views, the detector binning for the Fourier slices, and the number of native opposing pairs on a half turn, or twice the opposing angular pair count, binning 1, and the pair count on a full turn. Opposite-views reports how many angular pairs the estimator will examine. Pairs with unusable measured data can subsequently be rejected.
The placement estimate includes the sample timestamp, device identifiers and available bytes. Host and device byte estimates describe the working arrays. CPU availability comes from host memory and its cgroup limit. When CuPy participates in iterative placement, the snapshot includes its reusable pool and free driver memory under the same device ID with scope cupy. A volume that stays on the device has strategy resident even when projections stream from the host. Compiled temporaries, allocator fragmentation and other processes can affect execution. Read the run's info.placement for the participating devices, actual storage strategy and the number of allocation retries by work unit.