Package osh :: Package command :: Module fork
[frames] | no frames]

Module fork

source code

For API usage only, (for CLI use osh @FORK [ ... ] syntax instead.)

Classes
  FunctionReference
  FunctionStore
Functions
 
fork(threadgen, command, merge_key=None)
Creates threads and executes command on each.
source code
Function Details

fork(threadgen, command, merge_key=None)

source code 

Creates threads and executes command on each. The number of threads is determined by threadgen. If threadgen is an integer, then the specified number of threads is created, and each thread has an integer label, from 0 through threadgen - 1. If threadgen is a sequence, then for each element in the sequence, a thread is created, labelled with that element. If threadgen is a function, then it is evaluated, and is expected to yield an integer or sequence, which is then handled as already described. If threadgen is a cluster specification, then the command is executed on each specified host; the thread label identifies the host, (whose type is osh.cluster.Host). If merge_key is specified, then the inputs of each thread are expected to be ordered by the merge_key. The sequences from the threads are then merged into a single sequence using the merge_key.