Liking cljdoc? Tell your friends :D

volley.shell.pool

Worker processes. Starts them, feeds them assignments, and pumps what they print into ONE LinkedBlockingQueue the caller owns.

Everything put on the queue is a flat event map (see volley.protocol/->event): worker events with :worker and :at added, stray output as {:event :output :text ... :stream :stdout|:stderr}, and a final {:event :worker/exit :worker id :code n} once the process has exited and both streams hit EOF, or 500ms after the exit when something else (a process the test left running) still holds them open. The scheduler decides when to start and stop workers; this namespace has no policy of its own.

Worker processes. Starts them, feeds them assignments, and pumps what they
print into ONE `LinkedBlockingQueue` the caller owns.

Everything put on the queue is a flat event map (see `volley.protocol/->event`):
worker events with `:worker` and `:at` added, stray output as
`{:event :output :text ... :stream :stdout|:stderr}`, and a final
`{:event :worker/exit :worker id :code n}` once the process has exited
and both streams hit EOF, or 500ms after the exit when something else
(a process the test left running) still holds them open.
The scheduler decides when to start and stop workers; this namespace has
no policy of its own.
raw docstring

bb-commandclj

(bb-command)
(bb-command classpath)

Command line for a babashka worker with classpath classpath (default: the parent's).

Command line for a babashka worker with classpath `classpath` (default:
the parent's).
sourceraw docstring

kill!clj

(kill! {:keys [proc] kill-fn :kill!})

Forcibly kill a worker by its handle: its process, or for a worker in this process (volley.shell.in-process) its :kill! function.

Forcibly kill a worker by its handle: its process, or for a worker in
this process (`volley.shell.in-process`) its `:kill!` function.
sourceraw docstring

kill-all!clj

(kill-all! workers)

Kill every worker handle in workers (a seq of handles).

Kill every worker handle in `workers` (a seq of handles).
sourceraw docstring

kill-descendants!clj

(kill-descendants!)

Forcibly kill every process this one started, directly or not: the workers and whatever they started. Used when the run ends and in a shutdown hook, where no worker handle is at hand.

Forcibly kill every process this one started, directly or not: the
workers and whatever they started. Used when the run ends and in a
shutdown hook, where no worker handle is at hand.
sourceraw docstring

new-nonceclj

(new-nonce)

A fresh random token for one worker's protocol prefix.

A fresh random token for one worker's protocol prefix.
sourceraw docstring

new-queueclj

(new-queue)

The one event queue for a run.

The one event queue for a run.
sourceraw docstring

put-line!clj

(put-line! queue id stream decode line)

Put each message decode makes of line, which worker id wrote on stream (:stdout or :stderr), on queue as an event.

Put each message `decode` makes of `line`, which worker `id` wrote on
`stream` (`:stdout` or `:stderr`), on `queue` as an event.
sourceraw docstring

send!clj

(send! {:keys [in]} message)

Send a parent-to-worker message map. Returns true, or false when the worker's stdin is already closed (it has died or been shut down).

Send a parent-to-worker message map. Returns true, or false when the
worker's stdin is already closed (it has died or been shut down).
sourceraw docstring

start-worker!clj

(start-worker! {:keys [queue command dir env]} id)

Start worker id. opts:

  • :queue the shared LinkedBlockingQueue (required)
  • :command argv vector (default (bb-command))
  • :dir, :env passed to the process The worker gets a fresh nonce as its last argument and prefixes its protocol lines with it (volley.protocol/prefix-for), so a child process of a test that writes to the inherited stdout can never forge an event. Returns a handle {:id :proc :in} for send!, stop! and kill!.
Start worker `id`. opts:
* `:queue`   the shared `LinkedBlockingQueue` (required)
* `:command` argv vector (default `(bb-command)`)
* `:dir`, `:env`  passed to the process
The worker gets a fresh nonce as its last argument and prefixes its
protocol lines with it (`volley.protocol/prefix-for`), so a child process
of a test that writes to the inherited stdout can never forge an event.
Returns a handle `{:id :proc :in}` for `send!`, `stop!` and `kill!`.
sourceraw docstring

stop!clj

(stop! {:keys [in] :as worker})

Ask a worker to shut down cleanly and close its stdin.

Ask a worker to shut down cleanly and close its stdin.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close