Base

class mosaic.core.base.CMDBase(*args, **kwargs)[source]

Bases: Base

Base class for objects that accept remote commands, such as tesserae and tasks, and their proxies.

add_event(event_name, **kwargs)[source]
add_profile(profile, **kwargs)[source]
cmd(method, *args, **kwargs)[source]

Send command to remote counterparts.

Parameters:
  • method (str) – Method of the command.

  • args (tuple, optional) – Arguments for the command.

  • kwargs (optional) – Keyword arguments for the command.

Return type:

concurrent.futures.Future

async cmd_async(method, *args, **kwargs)[source]

Send async command to remote counterparts.

Parameters:
  • method (str) – Method of the command.

  • args (tuple, optional) – Arguments for the command.

  • kwargs (optional) – Keyword arguments for the command.

Return type:

asyncio.Future

cmd_recv(method, *args, **kwargs)[source]

Send command to remote counterparts and await reply.

Parameters:
  • method (str) – Method of the command.

  • args (tuple, optional) – Arguments for the command.

  • kwargs (optional) – Keyword arguments for the command.

Return type:

reply

async cmd_recv_async(method, *args, **kwargs)[source]

Send async command to remote counterparts and await reply.

Parameters:
  • method (str) – Method of the command.

  • args (tuple, optional) – Arguments for the command.

  • kwargs (optional) – Keyword arguments for the command.

Return type:

asyncio.Future

property collectable

Whether the object is ready for collection.

async deregister()[source]
deregister_runtime(uid)[source]
async init(*args, **kwargs)[source]
property init_future

Init state of the object.

is_proxy = False
is_remote = False
proxy(uid)[source]

Generate proxy for specific UID.

Parameters:

uid (str) –

Return type:

ProxyBase

classmethod remote_cls()[source]

Class of the remote.

property remote_runtime

Proxy to runtime where remote counterpart(s) is(are).

classmethod remote_type()[source]

Type of the remote.

property runtime_id

Runtime ID where remote object resides.

async start_trace()[source]
property state

Object state.

state_changed(state)[source]

Signal state changed.

Parameters:

state (str) – New state.

async stop_trace()[source]
type = 'none'
property uid

Object UID.

class mosaic.core.base.RemoteBase(uid, *args, **kwargs)[source]

Bases: CMDBase

Base class for CMD objects that live in a remote runtime (e.g. tesserae and tasks).

dec_ref()[source]

Decrease reference count and deregister from runtime if needed.

deregister_proxy(uid)[source]

Deregister proxy pointing to this remote.

Parameters:

uid (str) –

inc_ref()[source]

Increase reference count.

is_proxy = False
is_remote = True
property proxies

Set of proxies that keep references to this remote.

register_proxy(uid)[source]

Register a new proxy pointing to this remote.

Parameters:

uid (str) –

property remote_runtime

Proxy to runtime where remote counterpart(s) is(are).

classmethod remote_type()[source]

Type of the remote.

property runtime_id

Runtime ID where remote object resides.

class mosaic.core.base.ProxyBase(*args, **kwargs)[source]

Bases: CMDBase

Base class for CMD objects that represent proxies to remote objects (e.g. tessera proxies and task proxies).

async deregister()[source]
is_proxy = True
is_remote = False
property remote_runtime

Proxy to runtime where remote counterpart(s) is(are).

classmethod remote_type()[source]

Type of the remote.

property runtime_id

Runtime ID where remote object resides.