Running mosaic
- mosaic.run(main, *args, **kwargs)[source]
Initialise the runtime and then run the
main
in it.- Parameters:
main (callable) – Entry point for mosaic.
args (tuple, optional) – Arguments to mosaic.init.
kwargs (optional) – Keyword arguments to mosaic.init.
- mosaic.init(runtime_type='head', runtime_indices=(), address=None, port=None, parent_id=None, parent_address=None, parent_port=None, monitor_address=None, monitor_port=None, pubsub_port=None, num_workers=1, num_threads=None, mode='local', reuse_head=False, monitor_strategy='round-robin', log_level='perf', profile=False, node_list=None, asyncio_loop=None, dump_init=False, wait=False, **kwargs)[source]
Starts the global mosaic runtime.
- Parameters:
runtime_type (str, optional) – Type of runtime to instantiate, defaults to
head
.runtime_indices (tuple, optional) – Indices associated with the runtime, defaults to None.
address (str, optional) – Address to use for the runtime, defaults to None. If None, the comms will try to guess the address.
port (int, optional) – Port to use for the runtime, defaults to None. If None, the comms will test ports until one becomes available.
parent_id (str, optional) – UID of the parent runtime, if any.
parent_address (str, optional) – Address of the parent runtime, if any.
parent_port (int, optional) – Port of the parent runtime, if any.
monitor_address (str, optional) – Address of the monitor to connect to.
monitor_port (int, optional) – Port of the monitor to connect to.
pubsub_port (int, optional) – Publishing port of the monitor to connect to.
num_workers (int, optional) – Number of workers to instantiate in each node, defaults to 1.
num_threads (int, optional) – Number of threads to assign to each worker, defaults to the number of available cores over
num_workers
.mode (str, optional) – Mode of the runtime, defaults to
local
.reuse_head (bool, optional) – Whether to set up workers in the head node, defaults to False.
monitor_strategy (str, optional) – Strategy used by the monitor to allocate tessera, defaults to round robin.
log_level (str, optional) – Log level, defaults to
perf
.profile (bool, optional) – Whether to start the profiler, defaults to False.
node_list (list, optional) – List of available node addresses to connect to.
asyncio_loop (object, optional) – Async loop to use in our mosaic event loop, defaults to new loop.
dump_init (bool, optional) – Whether to dump initialisation file.
wait (bool, optional) – Whether or not to return control to calling frame, defaults to False.
kwargs (optional) – Extra keyword arguments.