Skip to content

About

A Julia job queue for shared machines over SSH.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

DistSSHQueue.jl

English | 日本語

Test Codecov docs-stable docs-dev Julia 1.13+ code style: runic License

DistSSHQueue leaves jobs on a queue host. They run one at a time. You can submit a job, check its status, fetch a finished leaf, and cancel. Most people install DistSSHKit, which bundles this package. pkg> add DistSSHQueue is for using the queue on its own. The longer guide is the DistSSHKit manual.

Supported on macOS, Linux, and WSL2 Ubuntu (not native Windows).

Even small labs and individuals can keep one always-on machine, add SSH hosts, and use them together as a small set of compute nodes. Julia 1.13+.

Install

From the Julia REPL, type ] to enter the Pkg REPL mode and run:

pkg> add DistSSHQueue

Or, equivalently, via the Pkg API:

julia> import Pkg; Pkg.add("DistSSHQueue")

The queue host needs ssh, rsync, and (only for git deploys) git. A client also needs ssh and rsync for qhost: submit and fetch. pkg> add does not install them. Full requirements: Requirements.

For everything else, see the Documentation.

Usage

julia -m DistSSHQueue help submit opens the submit page, and help client opens the client commands.

Basic terms

  • Queue host — the always-on macOS or Linux box that holds ~/.distsshqueue and runs serve (a VM is fine). A machine that sleeps is not this box. WSL2 is a client or worker, not this role.
  • Client — a dev machine that submits, lists, watches, fetches, or cancels. No cap. The run does not start on a client; it starts on the queue host.
  • serve — FIFO process on the queue host. It starts the job (execute!(…; detached=true)). Stopping serve during setup fails that job. After the job is detached, stopping serve leaves it running.
  • Workers — where the script runs. Host tokens: parent[:N] on the queue host, child:NAME[:N] on SSH machines.
  clients = dev machines (no cap)         one queue host (always on)
  -------------------------------         --------------------------
  yours / a colleague's / ...             FIFO     one job at a time
       |                                  table    ~/.distsshqueue
       |  julia -m DistSSHQueue           add-host / remove-host
       |    qhost:NAME                    serve    now, this terminal
       |    submit | status | list-host   enable   again after reboot
       |    watch | cancel | fetch | ...
       +--------------------------------> then go / ride / drive
                                          -> workers (host tokens)

qhost:NAME is the SSH name of the queue host (same idea as child:NAME, but it names that machine, not a worker). Not already on that box: put qhost:HOST on the command line. DISTSSHQUEUE_HOST alone does not hop. Already logged in there? Omit qhost: (this box's cwd is the job tree; placement is still parent / child:). Local trial: DISTSSHQUEUE_LOCAL=1. --hosts / --julia stay on go / ride / drive.

Host tokens, go / ride / drive flags, and remote setup are in the DistSSHKit manual.

submit

One argv, four nested pieces. submit leaves the job on the queue host. After it, the line is go / ride / drive and the rest. The same argv, started on this machine now, is in the DistSSHKit manual.

julia --project=. -m DistSSHQueue  [qhost:HOST]  submit  drive  parent:4  SCRIPT.jl
#──────────── Julia ────────────┘  └─ qhost ──┘  submit  └── go / ride / drive ──┘
julia --project=. -m DistSSHQueue [qhost:HOST] submit drive parent:4 SCRIPT.jl

Break a long terminal line after submit with \:

julia --project=. -m DistSSHQueue [qhost:HOST] submit \
    drive parent:4 child:NAME:N SCRIPT.jl

Same argv, started on this machine now. This env needs DistSSHRun. If DistSSHKit is installed, julia -m DistSSHKit is the same command:

julia -m DistSSHRun drive parent:4 SCRIPT.jl

pool:N sits next to submit. It is not a host token. Full notes: submit.

Where files live

qhost: is an SSH name, not a storage prefix.

  • The queue and job results stay on the queue host.
  • qhost: submit stages the client tree at ~/.distsshqueue/stage/<uuid>.
  • The client keeps .distsshqueue/tickets/<uuid>.
  • The script owns result files.
  • The run owns the .distssh/ bundle on that machine (legacy .distsshkit/ is read-only).
  • The queue owns scheduling and the fetched .distsshqueue/ copy.

The stage excludes .git/, .distssh/, legacy .distsshkit/, and .distsshqueue/. Inside a git work tree the file list matches setup --rsync (negation, and a .gitignore above the project). Outside one, rsync still applies each directory's .gitignore. A name such as .distsshqueue-backup is sent. Files that qhost: put on that stage reach child: as well, except .git/ and local state dirs (.distssh/, legacy .distsshkit/). Details: Artifacts and paths.

Client

~/my-job/
  Project.toml          DistSSHQueue (CLI)
  Manifest.toml
  SCRIPT.jl             rsync'd on qhost: submit
  .distsshqueue/tickets/<uuid>  after each qhost: submit (kept)
  .distsshqueue/<kind>/<stem>_<id8>/  after fetch
    .distsshqueue-fetch-id
    ...                              primary artifact copy
    .distssh/logs/...
    .distssh/collect/...

Queue host

~/.distsshqueue holds the queue. Each qhost: job is a project under stage/<uuid>/. parent runs from that stage on this box. Leave DISTRIBUTED_REMOTE_PROJECT_ROOT unset in shared config so each child: copy stays ~/stage/<uuid>. The store is a local disk (APFS, ext4, or the WSL2 Linux filesystem). NFS and a WSL drvfs mount such as /mnt/c are not a store location.

~/.distsshqueue/
  config.toml
  jobs.toml             every row (no prune)
  jobs.toml.flock       cross-process lock (left in place)
  jobs.toml.log
  jobs.toml.pid         while serve is up
  jobs.toml.stopped     after stop, until serve
  run-toml/<job-id>/    byte copy of the controller run.toml
    run.toml
  env/                  qhost: default --project=; enable if present
    Project.toml
    Manifest.toml
  stage/<uuid>/         client tree after each qhost: submit
    Project.toml        compute deps
    SCRIPT.jl
    .distssh/runs/<kind>/<run>/  run.toml, kit.pid, kit.result
    .distssh/<kind>/SCRIPT_<UTC>_<id>/  result_path (run or script picks it)
    .distssh/setup/*.log         setup logs

A finished or cancelled job keeps a byte copy of the controller run.toml under that run-toml/<job-id>/ directory, with its SHA-256 on the job row. The ship hash is recorded when Run wrote provenance.selection.

enable (optional; skip if you only serve in a terminal):

  • macOS — ~/Library/LaunchAgents/org.distsshqueue.serve.plist
  • Linux / WSL2 — ~/.config/systemd/user/distsshqueue.serve.service

User units (no root). Same command: julia --project=<queue-env> -m DistSSHQueue serve.

Workers

parent is the queue host. It runs the staged tree in place (~/.distsshqueue/stage/<uuid>/). The queue's table stays next to it.

A child: host has no queue table. The job tree is rsynced there and instantiated before the run:

  • No ~/.distsshqueue, no jobs.toml.
  • After qhost: the copy is ~/stage/<uuid> (unique per job). Do not pin a shared DISTRIBUTED_REMOTE_PROJECT_ROOT in config.toml.
  • Artifacts do not stay here: results are collected back to the queue host. The default leaf is .distssh/<kind>/ shown above; a custom output_dir lands wherever it points, and that path is stored as result_path (fetch follows it, even outside the project).
~/stage/<uuid>/         child: copy after qhost: submit (this uuid only)
  Project.toml
  Manifest.toml
  SCRIPT.jl

Examples

From a client (job directory; this package must be loadable from that env):

julia --project=. -m DistSSHQueue qhost:HOST list-host
julia --project=. -m DistSSHQueue qhost:HOST pool
julia --project=. -m DistSSHQueue qhost:HOST submit go parent:1 child:host1:4 SCRIPT.jl
julia --project=. -m DistSSHQueue qhost:HOST submit go child:host1:4 SCRIPT.jl
julia --project=. -m DistSSHQueue qhost:HOST status
julia --project=. -m DistSSHQueue qhost:HOST watch
julia --project=. -m DistSSHQueue qhost:HOST cancel <id>
julia --project=. -m DistSSHQueue qhost:HOST fetch <id>
julia --project=. -m DistSSHQueue qhost:HOST fetch .distsshqueue/tickets/<uuid>

submit starts serve on the queue host if none is running. serve instantiates the job project there. That step fails when Manifest julia_version is missing, is not a Julia version, or its minor differs from the Julia running serve. serve runs setup! on child: hosts before each job (you do not hand-run setup on the stage tree). :check always runs there (a qhost: stage with no .git/ warns). Job ids are a bare stdout line; stderr shows Queued N unless DISTSSH_QUIET is set. fetch copies the finished result to .distsshqueue/<kind>/<stem>_<id8>/ in this job tree.

Typed path (prepare the machine → submit / fetch → teardown): Walkthrough.

On the queue host (once). setup writes config.toml, not env/. From the default Julia env (julia -m DistSSHQueue); from a checkout add --project=..

julia -m DistSSHQueue setup
julia -m DistSSHQueue add-host parent child:host1
julia -m DistSSHQueue serve

qhost: defaults to --project=~/.distsshqueue/env (--queue-env @ for the remote default env). enable uses that dir if present. setup / serve / enable / disable / add-host / remove-host refuse qhost:. Command reference: How it runs.

Documentation

DistSSHQueue 24254401-70d8-4a51-8ea4-cfab19f5bc73

Contributing

Bugs and feature requests: Issues. See CONTRIBUTING.md. Versioning and releases: DistSSHKit manual, Releasing.

License

Source code is MIT.

DistSSHQueue.jl logo

About

A Julia job queue for shared machines over SSH.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages