Liking cljdoc? Tell your friends :D

boot.parallel


*parallel-hooks*clj

Bind this to a map of functions if you want to modify the so-called sync map, shared data among threads of execution, at various phases of the parallel computation.

All the functions will receive a mutable java.util.HashMap in input that will be passed down in boot.pod/data. The values will be probably modified so be sure that they are either thread safe or immutable.

No Clojure should be put in here, not even HashMap keys. The functions should return THE SAME object in output. This is a necessary devil to face for correct concurrent execution and it is due to the fact that Clojure data structures cannot be passed around in pods.

There are six hooks, below are the keys, the default is identity:

{:init ;; called before running the whole parallel computation :batch-init ;; called before running a batch in parallel :task-init ;; called before running a task}

Bind this to a map of functions if you want to modify the
       so-called sync map, shared data among threads of execution, at various
       phases of the parallel computation.

All the functions will receive a mutable java.util.HashMap in input that will
be passed down in boot.pod/data. The values will be probably modified so be
sure that they are either thread safe or immutable.

No Clojure should be put in here, not even HashMap keys. The functions should
return THE SAME object in output. This is a necessary devil to face for correct
concurrent execution and it is due to the fact that Clojure data structures
cannot be passed around in pods.

There are six hooks, below are the keys, the default is identity:

{:init          ;; called before running the whole parallel computation
 :batch-init    ;; called before running a batch in parallel
 :task-init     ;; called before running a task}
sourceraw docstring

*parallel-timeout*clj

Parallel task execution timeout.

It follows CountDownLatch.await(long timeout, TimeUnit unit): https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CountDownLatch.html#await%28long,%20java.util.concurrent.TimeUnit%29

The first item of the vector is timeout, the second unit

Parallel task execution timeout.

It follows CountDownLatch.await(long timeout, TimeUnit unit):
https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CountDownLatch.html#await%28long,%20java.util.concurrent.TimeUnit%29

The first item of the vector is timeout, the second unit
sourceraw docstring

await-doneclj

(await-done & {:as *opts* :keys [help data]})

No description provided.

Keyword Args: :help bool Print this help info. :data ^:! code The data for this task

No description provided.

Keyword Args:
  :help      bool  Print this help info.
  :data  ^:! code  The data for this task
sourceraw docstring

batch-sync-mapclj

(batch-sync-map sync-map task-number)

Add batch-specific keys to the input sync map.

This function currently clones, adds keys and returns a HashMap whose values will be modified during the parallel computation. Make sure they are all either immutable or thread safe.

The (String) keys added here:

  • start-latch - CountDownLatch - for starting the computation
  • done-latch - CountDownLatch - for waiting if it is done
  • task-number - Long - for counting the executed tasks
Add batch-specific keys to the input sync map.

This function currently clones, adds keys and returns a HashMap whose
values will be modified during the parallel computation. Make sure
they are all either immutable or thread safe.

The (String) keys added here:
- start-latch - CountDownLatch - for starting the computation
- done-latch  - CountDownLatch - for waiting if it is done
- task-number - Long           - for counting the executed tasks
sourceraw docstring

command-seqclj

(command-seq command-str)

The dual of boot.parallel/command-str. Return a command is the form: ["task" "param1" "param2"].

The dual of boot.parallel/command-str. Return a command is the
form: ["task" "param1" "param2"].
sourceraw docstring

command-strclj

(command-str command-seq)

Given a seq of command segments, the input to the runboot task, return its string representation. Useful for Java interop, for example it can be key in a HashMap.

Given a seq of command segments, the input to the runboot task,
return its string representation. Useful for Java interop, for example
it can be key in a HashMap.
sourceraw docstring

empty-sync-mapclj

(empty-sync-map)

Create an empty sync-map (a HashMap).

This is a necessary devil to face for correct concurrent execution and it is due to the fact that Clojure data structures cannot be passed around from pod to pod.

Create an empty sync-map (a HashMap).

This is a necessary devil to face for correct concurrent execution and
it is due to the fact that Clojure data structures cannot be passed
around from pod to pod.
sourceraw docstring

parallel-startclj

(parallel-start & {:as *opts* :keys [help data]})

No description provided.

Keyword Args: :help bool Print this help info. :data ^:! code The data for this task

No description provided.

Keyword Args:
  :help      bool  Print this help info.
  :data  ^:! code  The data for this task
sourceraw docstring

runbootclj

(runboot & {:as *opts* :keys [help args data]})

Run boot in boot.

The args parameter is exactly the same kind of string you would write on the command line (split in a vector). Runboot will execute the tasks in a brand new pod every time it is invoked, isolating from the boot instance it is launched from.

Data will be passed to the new pod (found in boot.pod/data). It has to be a Java object (pods might not share the same Clojure version and therefore Clojure objects won't work).

Keyword Args: :help bool Print this help info. :args [str] The boot cli arguments. :data ^:! code The data to pass the (new) boot environment

Run boot in boot.

The args parameter is exactly the same kind of string you would write on the
command line (split in a vector). Runboot will execute the tasks in a brand
new pod every time it is invoked, isolating from the boot instance it is
launched from.

Data will be passed to the new pod (found in boot.pod/data). It has to be a
Java object (pods might not share the same Clojure version and therefore
Clojure objects won't work).

Keyword Args:
  :help      bool   Print this help info.
  :args      [str]  The boot cli arguments.
  :data  ^:! code   The data to pass the (new) boot environment
sourceraw docstring

runcommandsclj

(runcommands & {:as *opts* :keys [help commands batches]})

Run commands using boot in boot, but in parallel.

A command is the string you would use on the command line for running the task (after having it required in build.boot).

If no batches number is specified, it spawns one thread per command (which can be quite system demanding, so be careful).

Usage example at the command line:

$ boot runcommands -c "foo-task --param --int 5" -c "bar"

Or in build.boot: (runcommands :commands #{"foo-task :param true :int 5" "bar-task"})

Last but not least, :batches is an integer that defines the size of the task batch to run in parallel, therefore limiting the number of spawned threads, defaulting to the canonical (-> (number of processors) inc inc).

Keyword Args: :help bool Print this help info. :commands ^:! #{str} The boot task cli calls + arguments (a set of strings). :batches int The commands will be executed in parallel batch-number per time.

Run commands using boot in boot, but in parallel.

A command is the string you would use on the command line for running the
task (after having it required in build.boot).

If no batches number is specified, it spawns one thread per command (which
can be quite system demanding, so be careful).

Usage example at the command line:

    $ boot runcommands -c "foo-task --param --int 5" -c "bar"

Or in build.boot:
    (runcommands :commands #{"foo-task :param true :int 5"
                             "bar-task"})

Last but not least, :batches is an integer that defines the size of the task
batch to run in parallel, therefore limiting the number of spawned threads,
defaulting to the canonical (-> (number of processors) inc inc).

Keyword Args:
  :help          bool    Print this help info.
  :commands  ^:! #{str}  The boot task cli calls + arguments (a set of strings).
  :batches       int     The commands will be executed in parallel batch-number per time.
sourceraw docstring

task-sync-mapclj

(task-sync-map sync-map command-seq)

Add task-specific keys to the input sync map.

This function currently clones, adds keys and returns a HashMap whose values will be modified during the parallel computation. Make sure they are all either immutable or thread safe.

The (String) keys added here:

  • command-str - String - the command to be executed
Add task-specific keys to the input sync map.

This function currently clones, adds keys and returns a HashMap whose
values will be modified during the parallel computation. Make sure
they are all either immutable or thread safe.

The (String) keys added here:
- command-str - String - the command to be executed
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close