View Source Skitter.Remote (Skitter v0.7.1)
Facilities to interact with remote Skitter runtimes.
This module offers facilities to query Skitter about the available remote Skitter runtimes and their properties. It also defines various functions which can be used to spawn Skitter workers on remote Skitter nodes.
Summary
Functions
Attempt to connect to remote
.
Check if the local runtime is connected to the specified remote runtime.
Get the name of the master node of the cluster.
Execute a function n times on every worker runtime.
Execute fun
on remote
, block until a result is available.
Execute mod.func(args)
on remote
, block until a result is available.
Execute a function on every core on every worker runtime.
Execute a function on every worker runtime.
Execute a function on every worker runtime.
Execute fun
on every specified remote runtime, obtain results in a list.
Execute mod.func(args)
on every specified remote runtime, obtain results in a list.
Execute a function n times, distributed over the available workers.
Execute a function on every core on every worker runtime tagged with tag
.
Execute a function on every worker runtime tagged with tag
.
Get the name of the current Skitter runtime.
Get a list of all the tags of node()
.
Get a list of all the worker runtimes tagged with a given tag/0
.
Get a list of the names of all the worker runtimes in the cluster.
Types
@type tag() :: atom()
Worker tag.
A worker may be started with a tag, which indicates properties of the node. For instance, a
:gpu
tag could be added to a node which has a gpu. Various functions in this module can be
used to only spawn workers on nodes with given tags.
Functions
Attempt to connect to remote
.
This function verifies if remote
is a valid Skitter node and tries to connect to it. If the
connection is successful, this functions tries to find a bound handler for the local mode. If
this works, {:ok, mode}
is returned, where mode
is the mode of the remote runtime.
If the expected_mode
argument is passed, connect/2
only connects to the remote runtime if
its mode is equal to expected_mode
.
The following errors may be returned if the connection does not succeed:
{:error, :not_distributed}
: the local node is not alive according toNode.alive?/0
{:error, :not_connected}
: it was not possible to connect to the remote runtime{:error, :not_skitter}
: the remote node is not a Skitter remote{:error, :incompatible}
: the remote node is running an incompatible version of Skitter{:error, :mode_mismatch}
: the mode of the remote runtime is not equal toexpected_mode
{:error, :unknown_mode}
: the remote or local runtime does not have a handler for the mode of the other runtime.- The handler of the local mode may return a custom
{:error, reason}
tuple.
Check if the local runtime is connected to the specified remote runtime.
@spec master() :: node()
Get the name of the master node of the cluster.
@spec n_times_on_all_workers(pos_integer(), (-> any())) :: [{node(), [any()]}]
Execute a function n times on every worker runtime.
A list of results will be returned for each worker node. These results will be returned in a
keyword list of {worker, result}
pairs.
Execute fun
on remote
, block until a result is available.
Execute mod.func(args)
on remote
, block until a result is available.
Execute a function on every core on every worker runtime.
A list of results will be returned for each worker node. These results will be returned in a
keyword list of {worker, result}
pairs.
Execute a function on every worker runtime.
The result of each worker will be returned in a keyword list of {worker, result}
pairs.
Execute a function on every worker runtime.
The result of each worker will be returned in a keyword list of {worker, result}
pairs.
Execute fun
on every specified remote runtime, obtain results in a list.
Execute mod.func(args)
on every specified remote runtime, obtain results in a list.
@spec on_n(pos_integer(), (-> any())) :: [[any()]]
Execute a function n times, distributed over the available workers.
This is handy when you wish to create n workers distributed over the cluster. The work to be done will be divided over the worker nodes in a round robin fashion. This behaviour may change in the future.
Execute a function on every core on every worker runtime tagged with tag
.
The result of each worker will be returned in a keyword list of {worker, result}
pairs.
Execute a function on every worker runtime tagged with tag
.
The result of each worker will be returned in a keyword list of {worker, result}
pairs.
@spec self() :: node()
Get the name of the current Skitter runtime.
Get a list of all the tags of node()
.
Get a list of all the worker runtimes tagged with a given tag/0
.
@spec workers() :: [node()]
Get a list of the names of all the worker runtimes in the cluster.