code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
async def send(self, message: Any): """ Send data to dest. There should be only one send for one recv, otherwise recv messages may overlap. Parameters ---------- message: data that sent to dest. """
Send data to dest. There should be only one send for one recv, otherwise recv messages may overlap. Parameters ---------- message: data that sent to dest.
send
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
async def recv(self): """ Receive data that sent from dest. """
Receive data that sent from dest.
recv
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
def closed(self) -> bool: """ This channel is closed or not. Returns ------- closed: If the channel is closed. """
This channel is closed or not. Returns ------- closed: If the channel is closed.
closed
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
def type(self) -> ChannelType: """ Channel is used for, can be dummy, ipc or remote. Returns ------- channel_type: ChannelType type that can be dummy, ipc or remote. """
Channel is used for, can be dummy, ipc or remote. Returns ------- channel_type: ChannelType type that can be dummy, ipc or remote.
type
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
def client_type(self) -> Type["Client"]: """ Return the corresponding client type. Returns ------- client_type: type client type. """
Return the corresponding client type. Returns ------- client_type: type client type.
client_type
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
def channel_type(self) -> ChannelType: """ Channel type, can be dummy, ipc or remote. Returns ------- channel_type: ChannelType type that can be dummy, ipc or remote. """
Channel type, can be dummy, ipc or remote. Returns ------- channel_type: ChannelType type that can be dummy, ipc or remote.
channel_type
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
async def create(config: Dict) -> "Server": """ Create a server instance according to configuration. Parameters ---------- config: dict configuration about creating a channel. Returns ------- server: Server a server that waiting f...
Create a server instance according to configuration. Parameters ---------- config: dict configuration about creating a channel. Returns ------- server: Server a server that waiting for connections from clients.
create
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
async def start(self): """ Used for listening to port or similar stuff. """
Used for listening to port or similar stuff.
start
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
async def on_connected(self, *args, **kwargs): """ Return a channel when new client connected. Returns ------- channel: Channel channel for communication """
Return a channel when new client connected. Returns ------- channel: Channel channel for communication
on_connected
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
def stopped(self) -> bool: """ If this server is stopped or not. Returns ------- if_stopped: bool This server is stopped or not. """
If this server is stopped or not. Returns ------- if_stopped: bool This server is stopped or not.
stopped
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
async def connect( dest_address: str, local_address: str = None, **kwargs ) -> "Client": """ Create a client that is able to connect to some server. Parameters ---------- dest_address: str Destination server address that to connect to. local_addre...
Create a client that is able to connect to some server. Parameters ---------- dest_address: str Destination server address that to connect to. local_address: str local address. Returns ------- client: Client Client th...
connect
python
mars-project/mars
mars/oscar/backends/communication/base.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/communication/base.py
Apache-2.0
def get_external_addresses( cls, address: str, n_process: int = None, ports: List[int] = None ): """Get socket address for every process""" if ":" in address: host, port = address.split(":", 1) port = int(port) if ports: if len(ports) != n_...
Get socket address for every process
get_external_addresses
python
mars-project/mars
mars/oscar/backends/mars/pool.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/mars/pool.py
Apache-2.0
def msg_to_simple_str(msg): # pragma: no cover """An helper that prints message structure without generate a big str.""" from ..message import SendMessage, _MessageBase if type(msg) == _ArgWrapper: msg = msg.message if isinstance(msg, SendMessage): return f"{str(type(msg).__name__)}(ac...
An helper that prints message structure without generate a big str.
msg_to_simple_str
python
mars-project/mars
mars/oscar/backends/ray/communication.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/ray/communication.py
Apache-2.0
async def __on_ray_recv__(self, message_wrapper): """This method will be invoked when current process is a ray actor rather than a ray driver""" self._msg_recv_counter += 1 await self._in_queue.put(message_wrapper.message) result_message = await self._out_queue.get() if self._clo...
This method will be invoked when current process is a ray actor rather than a ray driver
__on_ray_recv__
python
mars-project/mars
mars/oscar/backends/ray/communication.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/ray/communication.py
Apache-2.0
async def start(self): """Start actor pool in ray actor"""
Start actor pool in ray actor
start
python
mars-project/mars
mars/oscar/backends/ray/pool.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/ray/pool.py
Apache-2.0
async def __on_ray_recv__(self, channel_id: ChannelID, message): """Method for communication based on ray actors""" try: if self._ray_server is None: raise ServerClosed(f"Remote server {channel_id.dest_address} closed") return await self._ray_server.__on_ray_recv_...
Method for communication based on ray actors
__on_ray_recv__
python
mars-project/mars
mars/oscar/backends/ray/pool.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/ray/pool.py
Apache-2.0
def process_address_to_placement(address): """ Parameters ---------- address: str The address of an actor pool which running in a ray actor. It's also the name of the ray actor. address ex: ray://${pg_name}/${bundle_index}/${process_index} Returns ------- tuple A tup...
Parameters ---------- address: str The address of an actor pool which running in a ray actor. It's also the name of the ray actor. address ex: ray://${pg_name}/${bundle_index}/${process_index} Returns ------- tuple A tuple consisting of placement group name, bundle inde...
process_address_to_placement
python
mars-project/mars
mars/oscar/backends/ray/utils.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/ray/utils.py
Apache-2.0
def node_address_to_placement(address): """ Parameters ---------- address : str The address of a node. ex: ray://${pg_name}/${bundle_index} Returns ------- tuple A tuple consisting of placement group name, bundle index. """ name, parts = _address_to_placement(address...
Parameters ---------- address : str The address of a node. ex: ray://${pg_name}/${bundle_index} Returns ------- tuple A tuple consisting of placement group name, bundle index.
node_address_to_placement
python
mars-project/mars
mars/oscar/backends/ray/utils.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/ray/utils.py
Apache-2.0
def _address_to_placement(address): """ Parameters ---------- address : str The address of a node or an actor pool which running in a ray actor. Returns ------- tuple A tuple consisting of placement group name, bundle index, process index. """ parsed_url = urlparse(...
Parameters ---------- address : str The address of a node or an actor pool which running in a ray actor. Returns ------- tuple A tuple consisting of placement group name, bundle index, process index.
_address_to_placement
python
mars-project/mars
mars/oscar/backends/ray/utils.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/ray/utils.py
Apache-2.0
async def __on_ray_recv__(self, channel_id: ChannelID, message): """Method for communication based on ray actors""" return await self.server.__on_ray_recv__(channel_id, message)
Method for communication based on ray actors
__on_ray_recv__
python
mars-project/mars
mars/oscar/backends/ray/tests/test_communication.py
https://github.com/mars-project/mars/blob/master/mars/oscar/backends/ray/tests/test_communication.py
Apache-2.0
def spawn( func, args=(), kwargs=None, retry_when_fail=False, resolve_tileable_input=False, n_output=None, **kw, ): """ Spawn a function and return a Mars Object which can be executed later. Parameters ---------- func : function Function to spawn. args: tuple...
Spawn a function and return a Mars Object which can be executed later. Parameters ---------- func : function Function to spawn. args: tuple Args to pass to function kwargs: dict Kwargs to pass to function retry_when_fail: bool, default False If True, retry when...
spawn
python
mars-project/mars
mars/remote/core.py
https://github.com/mars-project/mars/blob/master/mars/remote/core.py
Apache-2.0
def run_script( script: Union[bytes, str, BinaryIO, TextIO], data: Dict[str, TileableType] = None, n_workers: int = 1, command_argv: List[str] = None, session: SessionType = None, retry_when_fail: bool = False, run_kwargs: Dict[str, Any] = None, ): """ Run script in Mars cluster. ...
Run script in Mars cluster. Parameters ---------- script: str or file-like object Script to run. data: dict Variable name to data. n_workers: int number of workers to run the script command_argv: list extra command args for script session: Mars session ...
run_script
python
mars-project/mars
mars/remote/run_script.py
https://github.com/mars-project/mars/blob/master/mars/remote/run_script.py
Apache-2.0
def field_type(self) -> AbstractFieldType: """ Field type. Returns ------- field_type : AbstractFieldType Field type. """
Field type. Returns ------- field_type : AbstractFieldType Field type.
field_type
python
mars-project/mars
mars/serialization/serializables/field.py
https://github.com/mars-project/mars/blob/master/mars/serialization/serializables/field.py
Apache-2.0
def valid_types(self) -> Tuple[Type, ...]: """ Valid types. Returns ------- valid_types: tuple Valid types. """
Valid types. Returns ------- valid_types: tuple Valid types.
valid_types
python
mars-project/mars
mars/serialization/serializables/field_type.py
https://github.com/mars-project/mars/blob/master/mars/serialization/serializables/field_type.py
Apache-2.0
async def get_supervisors(self, filter_ready: bool = True) -> List[str]: """ Get supervisor addresses Returns ------- out list of supervisors """
Get supervisor addresses Returns ------- out list of supervisors
get_supervisors
python
mars-project/mars
mars/services/cluster/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/core.py
Apache-2.0
async def watch_supervisors(self): """ Watch supervisor addresses Returns ------- out generator of list of supervisors """
Watch supervisor addresses Returns ------- out generator of list of supervisors
watch_supervisors
python
mars-project/mars
mars/services/cluster/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/core.py
Apache-2.0
async def watch_nodes( self, role: NodeRole, env: bool = False, resource: bool = False, detail: bool = False, statuses: Set[NodeStatus] = None, exclude_statuses: Set[NodeStatus] = None, ) -> List[Dict[str, Dict]]: """ Watch changes of workers ...
Watch changes of workers Returns ------- out: List[Dict[str, Dict]] dict of worker resources by addresses and bands
watch_nodes
python
mars-project/mars
mars/services/cluster/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/core.py
Apache-2.0
async def get_nodes_info( self, nodes: List[str] = None, role: NodeRole = None, env: bool = False, resource: bool = False, detail: bool = False, statuses: Set[NodeStatus] = None, exclude_statuses: Set[NodeStatus] = None, ): """ Get work...
Get worker info Parameters ---------- nodes address of nodes role roles of nodes env receive env info resource receive resource info detail receive detail info Returns ------- ...
get_nodes_info
python
mars-project/mars
mars/services/cluster/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/core.py
Apache-2.0
async def get_all_bands( self, role: NodeRole = None, statuses: Set[NodeStatus] = None, exclude_statuses: Set[NodeStatus] = None, ) -> Dict[BandType, Resource]: """ Get all bands that can be used for computation. Returns ------- band_to_resour...
Get all bands that can be used for computation. Returns ------- band_to_resource : dict Band to resource.
get_all_bands
python
mars-project/mars
mars/services/cluster/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/core.py
Apache-2.0
async def watch_all_bands( self, role: NodeRole = None, statuses: Set[NodeStatus] = None, exclude_statuses: Set[NodeStatus] = None, ): """ Watch all bands that can be used for computation. Returns ------- band_to_resource : dict Ba...
Watch all bands that can be used for computation. Returns ------- band_to_resource : dict Band to resource.
watch_all_bands
python
mars-project/mars
mars/services/cluster/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/core.py
Apache-2.0
async def get_mars_versions(self) -> List[str]: """ Get versions used in current Mars cluster Returns ------- version_list : list List of versions """
Get versions used in current Mars cluster Returns ------- version_list : list List of versions
get_mars_versions
python
mars-project/mars
mars/services/cluster/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/core.py
Apache-2.0
async def get_node_pool_configs(self, address: str) -> List[Dict]: """ Get pool configs of a Mars node Returns ------- config_list : List[Dict] List of configs for all pool processes """
Get pool configs of a Mars node Returns ------- config_list : List[Dict] List of configs for all pool processes
get_node_pool_configs
python
mars-project/mars
mars/services/cluster/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/core.py
Apache-2.0
async def get_node_thread_stacks(self, address: str) -> List[Dict[int, List[str]]]: """ Get current thread pool stacks of a Mars node Parameters ---------- address Returns ------- """
Get current thread pool stacks of a Mars node Parameters ---------- address Returns -------
get_node_thread_stacks
python
mars-project/mars
mars/services/cluster/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/core.py
Apache-2.0
async def get_supervisors_by_keys(self, keys: List[str]) -> List[str]: """ Get supervisor address hosting the specified key Parameters ---------- keys key for a supervisor address Returns ------- out addresses of the supervisor ...
Get supervisor address hosting the specified key Parameters ---------- keys key for a supervisor address Returns ------- out addresses of the supervisor
get_supervisors_by_keys
python
mars-project/mars
mars/services/cluster/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/oscar.py
Apache-2.0
async def get_supervisor_refs(self, uids: List[str]) -> List[mo.ActorRef]: """ Get actor references hosting the specified actor uid Parameters ---------- uids uids for a supervisor address watch if True, will watch changes of supervisor changes ...
Get actor references hosting the specified actor uid Parameters ---------- uids uids for a supervisor address watch if True, will watch changes of supervisor changes Returns ------- out : List[mo.ActorRef] references ...
get_supervisor_refs
python
mars-project/mars
mars/services/cluster/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/oscar.py
Apache-2.0
async def set_node_status(self, node: str, role: NodeRole, status: NodeStatus): """ Set status of node Parameters ---------- node : str address of node role: NodeRole role of node status : NodeStatus status of node """ ...
Set status of node Parameters ---------- node : str address of node role: NodeRole role of node status : NodeStatus status of node
set_node_status
python
mars-project/mars
mars/services/cluster/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/oscar.py
Apache-2.0
async def get_bands(self) -> Dict: """ Get bands that can be used for computation on current node. Returns ------- band_to_resource : dict Band to resource. """ return await self._uploader_ref.get_bands()
Get bands that can be used for computation on current node. Returns ------- band_to_resource : dict Band to resource.
get_bands
python
mars-project/mars
mars/services/cluster/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/oscar.py
Apache-2.0
async def mark_node_ready(self): """ Mark current node ready for work loads """ await self._uploader_ref.mark_node_ready()
Mark current node ready for work loads
mark_node_ready
python
mars-project/mars
mars/services/cluster/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/oscar.py
Apache-2.0
async def wait_node_ready(self): """ Wait current node to be ready """ await self._uploader_ref.wait_node_ready()
Wait current node to be ready
wait_node_ready
python
mars-project/mars
mars/services/cluster/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/oscar.py
Apache-2.0
async def wait_all_supervisors_ready(self): """ Wait till all expected supervisors are ready """ await self._locator_ref.wait_all_supervisors_ready()
Wait till all expected supervisors are ready
wait_all_supervisors_ready
python
mars-project/mars
mars/services/cluster/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/api/oscar.py
Apache-2.0
async def watch_supervisors(self) -> AsyncGenerator[List[str], None]: """ Watch changes of supervisors Returns ------- out : AsyncGenerator[List[str]] Generator of list of schedulers """
Watch changes of supervisors Returns ------- out : AsyncGenerator[List[str]] Generator of list of schedulers
watch_supervisors
python
mars-project/mars
mars/services/cluster/backends/base.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/backends/base.py
Apache-2.0
async def get_supervisors(self, filter_ready: bool = True) -> List[str]: """ Get list of supervisors Parameters ---------- filter_ready : bool True if return ready nodes only, or return starting and ready nodes Returns ------- out : List[str]...
Get list of supervisors Parameters ---------- filter_ready : bool True if return ready nodes only, or return starting and ready nodes Returns ------- out : List[str] List of supervisors
get_supervisors
python
mars-project/mars
mars/services/cluster/backends/base.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/backends/base.py
Apache-2.0
async def request_worker( self, worker_cpu: int = None, worker_mem: int = None, timeout: int = None ) -> str: """ Create a new worker Returns ------- Address of the new created worker """
Create a new worker Returns ------- Address of the new created worker
request_worker
python
mars-project/mars
mars/services/cluster/backends/base.py
https://github.com/mars-project/mars/blob/master/mars/services/cluster/backends/base.py
Apache-2.0
async def decref_tileables( self, tileable_keys: List[str], counts: List[int] = None ): """ Decref tileables. Parameters ---------- tileable_keys : list List of tileable keys. counts: list List of ref count. """
Decref tileables. Parameters ---------- tileable_keys : list List of tileable keys. counts: list List of ref count.
decref_tileables
python
mars-project/mars
mars/services/lifecycle/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/core.py
Apache-2.0
async def get_all_chunk_ref_counts(self) -> Dict[str, int]: """ Get all chunk keys' ref counts. Returns ------- key_to_ref_counts: dict """
Get all chunk keys' ref counts. Returns ------- key_to_ref_counts: dict
get_all_chunk_ref_counts
python
mars-project/mars
mars/services/lifecycle/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/core.py
Apache-2.0
async def create(cls, session_id: str, address: str) -> "LifecycleAPI": """ Create Lifecycle API. Parameters ---------- session_id : str Session ID. address : str Supervisor address. Returns ------- lifecycle_api ...
Create Lifecycle API. Parameters ---------- session_id : str Session ID. address : str Supervisor address. Returns ------- lifecycle_api Lifecycle API.
create
python
mars-project/mars
mars/services/lifecycle/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/oscar.py
Apache-2.0
async def track(self, tileable_key: str, chunk_keys: List[str]): """ Track tileable. Parameters ---------- tileable_key : str Tileable key. chunk_keys : list List of chunk keys. """ return await self._lifecycle_tracker_ref.track(ti...
Track tileable. Parameters ---------- tileable_key : str Tileable key. chunk_keys : list List of chunk keys.
track
python
mars-project/mars
mars/services/lifecycle/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/oscar.py
Apache-2.0
async def incref_tileables( self, tileable_keys: List[str], counts: List[int] = None ): """ Incref tileables. Parameters ---------- tileable_keys : list List of tileable keys. counts: list List of ref count. """ return...
Incref tileables. Parameters ---------- tileable_keys : list List of tileable keys. counts: list List of ref count.
incref_tileables
python
mars-project/mars
mars/services/lifecycle/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/oscar.py
Apache-2.0
async def decref_tileables( self, tileable_keys: List[str], counts: List[int] = None ): """ Decref tileables. Parameters ---------- tileable_keys : list List of tileable keys. counts: list List of ref count. """ return ...
Decref tileables. Parameters ---------- tileable_keys : list List of tileable keys. counts: list List of ref count.
decref_tileables
python
mars-project/mars
mars/services/lifecycle/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/oscar.py
Apache-2.0
async def get_tileable_ref_counts(self, tileable_keys: List[str]) -> List[int]: """ Get ref counts of tileables. Parameters ---------- tileable_keys : list List of tileable keys. Returns ------- ref_counts : list List of ref count...
Get ref counts of tileables. Parameters ---------- tileable_keys : list List of tileable keys. Returns ------- ref_counts : list List of ref counts.
get_tileable_ref_counts
python
mars-project/mars
mars/services/lifecycle/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/oscar.py
Apache-2.0
async def incref_chunks(self, chunk_keys: List[str], counts: List[int] = None): """ Incref chunks. Parameters ---------- chunk_keys : list List of chunk keys. counts: list List of ref count. """ return await self._lifecycle_tracker...
Incref chunks. Parameters ---------- chunk_keys : list List of chunk keys. counts: list List of ref count.
incref_chunks
python
mars-project/mars
mars/services/lifecycle/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/oscar.py
Apache-2.0
async def decref_chunks(self, chunk_keys: List[str], counts: List[int] = None): """ Decref chunks Parameters ---------- chunk_keys : list List of chunk keys. counts: list List of ref count. """ return await self._lifecycle_tracker_...
Decref chunks Parameters ---------- chunk_keys : list List of chunk keys. counts: list List of ref count.
decref_chunks
python
mars-project/mars
mars/services/lifecycle/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/oscar.py
Apache-2.0
async def get_chunk_ref_counts(self, chunk_keys: List[str]) -> List[int]: """ Get ref counts of chunks. Parameters ---------- chunk_keys : list List of chunk keys. Returns ------- ref_counts : list List of ref counts. """ ...
Get ref counts of chunks. Parameters ---------- chunk_keys : list List of chunk keys. Returns ------- ref_counts : list List of ref counts.
get_chunk_ref_counts
python
mars-project/mars
mars/services/lifecycle/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/oscar.py
Apache-2.0
async def get_all_chunk_ref_counts(self) -> Dict[str, int]: """ Get all chunk keys' ref counts. Returns ------- key_to_ref_counts: dict """ return await self._lifecycle_tracker_ref.get_all_chunk_ref_counts()
Get all chunk keys' ref counts. Returns ------- key_to_ref_counts: dict
get_all_chunk_ref_counts
python
mars-project/mars
mars/services/lifecycle/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/lifecycle/api/oscar.py
Apache-2.0
async def get_chunk_meta( self, object_id: str, fields: List[str] = None, error: str = "raise" ) -> Optional[Dict]: """ Get chunk meta Parameters ---------- object_id Object ID fields Fields to obtain error Way to h...
Get chunk meta Parameters ---------- object_id Object ID fields Fields to obtain error Way to handle errors, 'raise' by default Returns ------- Dict with fields as keys
get_chunk_meta
python
mars-project/mars
mars/services/meta/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/meta/api/core.py
Apache-2.0
async def set_chunk_meta( self, chunk: ChunkType, memory_size: int = None, store_size: int = None, bands: List[BandType] = None, fields: List[str] = None, exclude_fields: List[str] = None, **extra ): """ Parameters ---------- ...
Parameters ---------- chunk: ChunkType chunk to set meta memory_size: int memory size for chunk data store_size: int serialized size for chunk data bands: chunk data bands fields: list fields to include ...
set_chunk_meta
python
mars-project/mars
mars/services/meta/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/meta/api/oscar.py
Apache-2.0
async def create(cls, session_id: str, address: str) -> "MetaAPI": """ Create Meta API. Parameters ---------- session_id : str Session ID. address : str Supervisor address. Returns ------- meta_api Meta api. ...
Create Meta API. Parameters ---------- session_id : str Session ID. address : str Supervisor address. Returns ------- meta_api Meta api.
create
python
mars-project/mars
mars/services/meta/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/meta/api/oscar.py
Apache-2.0
async def create(cls, session_id: str, address: str) -> "WorkerMetaAPI": """ Create worker meta API. Parameters ---------- session_id : str Session ID. address : str Worker address. Returns ------- meta_api Wor...
Create worker meta API. Parameters ---------- session_id : str Session ID. address : str Worker address. Returns ------- meta_api Worker meta api.
create
python
mars-project/mars
mars/services/meta/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/meta/api/oscar.py
Apache-2.0
async def create(cls, config) -> Dict: """ Create a meta store. Do some initialization work. For instance, for database backend, db files including tables may be created first. This should be done when service starting. Parameters ---------- config : dict...
Create a meta store. Do some initialization work. For instance, for database backend, db files including tables may be created first. This should be done when service starting. Parameters ---------- config : dict config. Returns ----...
create
python
mars-project/mars
mars/services/meta/store/base.py
https://github.com/mars-project/mars/blob/master/mars/services/meta/store/base.py
Apache-2.0
async def set_meta(self, object_id: str, meta: _CommonMeta): """ Set meta. Parameters ---------- object_id : str Object ID. meta : _CommonMeta Meta. """
Set meta. Parameters ---------- object_id : str Object ID. meta : _CommonMeta Meta.
set_meta
python
mars-project/mars
mars/services/meta/store/base.py
https://github.com/mars-project/mars/blob/master/mars/services/meta/store/base.py
Apache-2.0
async def get_meta( self, object_id: str, fields: List[str] = None, error="raise" ) -> Dict: """ Get meta. Parameters ---------- object_id : str Object ID. fields : list Fields to filter, if not provided, get all fields. error ...
Get meta. Parameters ---------- object_id : str Object ID. fields : list Fields to filter, if not provided, get all fields. error : str 'raise' or 'ignore' Returns ------- meta: dict Meta.
get_meta
python
mars-project/mars
mars/services/meta/store/base.py
https://github.com/mars-project/mars/blob/master/mars/services/meta/store/base.py
Apache-2.0
async def del_meta(self, object_id: str): """ Delete meta. Parameters ---------- object_id : str Object ID. """
Delete meta. Parameters ---------- object_id : str Object ID.
del_meta
python
mars-project/mars
mars/services/meta/store/base.py
https://github.com/mars-project/mars/blob/master/mars/services/meta/store/base.py
Apache-2.0
async def add_chunk_bands(self, object_id: str, bands: List[BandType]): """ Add band to chunk. Parameters ---------- object_id : str Object ID. bands : List[BandType] Band of chunk to add, shall be tuple of (worker, band). """
Add band to chunk. Parameters ---------- object_id : str Object ID. bands : List[BandType] Band of chunk to add, shall be tuple of (worker, band).
add_chunk_bands
python
mars-project/mars
mars/services/meta/store/base.py
https://github.com/mars-project/mars/blob/master/mars/services/meta/store/base.py
Apache-2.0
async def remove_chunk_bands(self, object_id: str, bands: List[BandType]): """ Remove bands from chunk. Parameters ---------- object_id : str Object ID. bands : List[BandType] Bands of chunk to remove, shall be tuple of (worker, band). """
Remove bands from chunk. Parameters ---------- object_id : str Object ID. bands : List[BandType] Bands of chunk to remove, shall be tuple of (worker, band).
remove_chunk_bands
python
mars-project/mars
mars/services/meta/store/base.py
https://github.com/mars-project/mars/blob/master/mars/services/meta/store/base.py
Apache-2.0
async def read(self, index, timestamp=None): """ Read value from mutable tensor. Parameters ---------- index: Index to read from the tensor. timestamp: optional Timestamp to read value that happened before then. """ return await s...
Read value from mutable tensor. Parameters ---------- index: Index to read from the tensor. timestamp: optional Timestamp to read value that happened before then.
read
python
mars-project/mars
mars/services/mutable/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/core.py
Apache-2.0
async def write(self, index, value, timestamp=None): """ Write value to mutable tensor. Parameters ---------- index: Index to write to the tensor. value: The value that will be filled into the mutable tensor according to `index`. timesta...
Write value to mutable tensor. Parameters ---------- index: Index to write to the tensor. value: The value that will be filled into the mutable tensor according to `index`. timestamp: optional Timestamp to associated with the newly ...
write
python
mars-project/mars
mars/services/mutable/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/core.py
Apache-2.0
def __getitem__(self, index): """ Read value from mutable tensor with a synchronous API. Parameters ---------- index: Index to read from the tensor. """ coro = self.read(index) fut = asyncio.run_coroutine_threadsafe(coro, self._loop) r...
Read value from mutable tensor with a synchronous API. Parameters ---------- index: Index to read from the tensor.
__getitem__
python
mars-project/mars
mars/services/mutable/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/core.py
Apache-2.0
def __setitem__(self, index, value): """ Write value to mutable tensor with a synchronous API. Parameters ---------- index: Index to write to the tensor. value: The value that will be filled into the mutable tensor according to `index`. "...
Write value to mutable tensor with a synchronous API. Parameters ---------- index: Index to write to the tensor. value: The value that will be filled into the mutable tensor according to `index`.
__setitem__
python
mars-project/mars
mars/services/mutable/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/core.py
Apache-2.0
async def seal(self, timestamp=None): """ Seal the mutable tensor by name. Parameters ---------- timestamp: optional Operations that happened before timestamp will be sealed, and later ones will be discard. Returns ------- object ...
Seal the mutable tensor by name. Parameters ---------- timestamp: optional Operations that happened before timestamp will be sealed, and later ones will be discard. Returns ------- object
seal
python
mars-project/mars
mars/services/mutable/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/core.py
Apache-2.0
def indexing_to_chunk_indices(output_chunk): """ Compute input_indices and value_indices when read from or write to a tensor chunk. Parameters ---------- output_chunk: A chunk in the output of the `__setitem__` op. Returns ------- The indices in the input chunk, and val...
Compute input_indices and value_indices when read from or write to a tensor chunk. Parameters ---------- output_chunk: A chunk in the output of the `__setitem__` op. Returns ------- The indices in the input chunk, and value_indices in the value block that will be a...
indexing_to_chunk_indices
python
mars-project/mars
mars/services/mutable/utils.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/utils.py
Apache-2.0
def compute_output_of_indexing(tensor, tensor_index): """ Compute the output information of `__{set,get}item__` on tensor for every chunk. """ from ...tensor.indexing.core import process_index, calc_shape from ...tensor.indexing.getitem import TensorIndex tensor_index = process_index(tensor.ndi...
Compute the output information of `__{set,get}item__` on tensor for every chunk.
compute_output_of_indexing
python
mars-project/mars
mars/services/mutable/utils.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/utils.py
Apache-2.0
def setitem_on_chunk_to_records(nsplits_acc, output_chunk, value, ts, is_scalar): """ Turns a `__setitem__` on chunk to a list of index-value records. Parameters ---------- nsplits_acc: Accumulate nsplits arrays of the output tensor chunks. Returns ------- A list of `(index...
Turns a `__setitem__` on chunk to a list of index-value records. Parameters ---------- nsplits_acc: Accumulate nsplits arrays of the output tensor chunks. Returns ------- A list of `(index, value, timestamp)`, where `index` is the in-chunk index.
setitem_on_chunk_to_records
python
mars-project/mars
mars/services/mutable/utils.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/utils.py
Apache-2.0
def setitem_to_records(tensor, tensor_index, value, timestamp): """ Compute the records of `__setitem__` on tensor for every chunk. Returns ------- dict, a dict of chunk index to records in that chunk. """ output_shape, output_chunks, nsplits_acc = compute_output_of_indexing( te...
Compute the records of `__setitem__` on tensor for every chunk. Returns ------- dict, a dict of chunk index to records in that chunk.
setitem_to_records
python
mars-project/mars
mars/services/mutable/utils.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/utils.py
Apache-2.0
def getitem_on_chunk_to_records(nsplits_acc, output_chunk): """ Turns a `__getitem__` on chunk to a list of index-value records. Parameters ---------- nsplits_acc: Accumulate nsplits arrays of the output tensor chunks. Returns ------- records: A list of `(index, value_index...
Turns a `__getitem__` on chunk to a list of index-value records. Parameters ---------- nsplits_acc: Accumulate nsplits arrays of the output tensor chunks. Returns ------- records: A list of `(index, value_index)`, where `index` is the in-chunk index, and `value_index` ...
getitem_on_chunk_to_records
python
mars-project/mars
mars/services/mutable/utils.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/utils.py
Apache-2.0
def getitem_to_records(tensor, tensor_index): """ Compute the records of `__getitem__` on tensor for every chunk. Returns ------- records and output_chunk dict, records is a dict of chunk index to records in that chunk. """ output_shape, output_chunks, nsplits_acc = compute_outp...
Compute the records of `__getitem__` on tensor for every chunk. Returns ------- records and output_chunk dict, records is a dict of chunk index to records in that chunk.
getitem_to_records
python
mars-project/mars
mars/services/mutable/utils.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/utils.py
Apache-2.0
async def create_mutable_tensor( self, shape: tuple, dtype: Union[np.dtype, str], name: str = None, default_value: Union[int, float] = 0, chunk_size: Union[int, Tuple] = None, ) -> MutableTensorInfo: """ Create a mutable tensor. Parameters ...
Create a mutable tensor. Parameters ---------- shape: tuple Shape of the mutable tensor. dtype: np.dtype or str Data type of the mutable tensor. chunk_size: int or tuple Chunk size of the mutable tensor. name: str, optional...
create_mutable_tensor
python
mars-project/mars
mars/services/mutable/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/api/core.py
Apache-2.0
async def get_mutable_tensor(self, name: str) -> MutableTensorInfo: """ Get the mutable tensor by name. Parameters ---------- name: str Name of the mutable tensor to get. Returns ------- MutableTensorInfo """
Get the mutable tensor by name. Parameters ---------- name: str Name of the mutable tensor to get. Returns ------- MutableTensorInfo
get_mutable_tensor
python
mars-project/mars
mars/services/mutable/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/api/core.py
Apache-2.0
async def seal_mutable_tensor(self, name: str, timestamp=None): """ Seal the mutable tensor by name. Parameters ---------- name: str Name of the mutable tensor to seal. timestamp: optional Operations that happened before timestamp will be sealed,...
Seal the mutable tensor by name. Parameters ---------- name: str Name of the mutable tensor to seal. timestamp: optional Operations that happened before timestamp will be sealed, and later ones will be discard. Returns ------- ...
seal_mutable_tensor
python
mars-project/mars
mars/services/mutable/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/api/core.py
Apache-2.0
async def read(self, name: str, index: object, timestamp=None): """ Read value from mutable tensor. Parameters ---------- name: str Name of mutable tensor to read. index: Index to read from the tensor. timestamp: optional Tim...
Read value from mutable tensor. Parameters ---------- name: str Name of mutable tensor to read. index: Index to read from the tensor. timestamp: optional Timestamp to read value that happened before then.
read
python
mars-project/mars
mars/services/mutable/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/api/core.py
Apache-2.0
async def write(self, name: str, index: object, value: object, timestamp=None): """ Write value to mutable tensor. Parameters ---------- name: str Name of the mutable tensor to write. index: Index to write to the tensor. value: ...
Write value to mutable tensor. Parameters ---------- name: str Name of the mutable tensor to write. index: Index to write to the tensor. value: The value that will be filled into the mutable tensor according to `index`. tim...
write
python
mars-project/mars
mars/services/mutable/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/api/core.py
Apache-2.0
async def read(self, index, timestamp=None): """ Read value from mutable tensor. Parameters ---------- index: Index to read from the tensor. timestamp: optional Timestamp to read value that happened before then. """ timestamp = no...
Read value from mutable tensor. Parameters ---------- index: Index to read from the tensor. timestamp: optional Timestamp to read value that happened before then.
read
python
mars-project/mars
mars/services/mutable/supervisor/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/supervisor/core.py
Apache-2.0
async def write(self, index, value, timestamp=None): """ Write value to mutable tensor. Parameters ---------- index: Index to write to the tensor. value: The value that will be filled into the mutable tensor according to `index`. timesta...
Write value to mutable tensor. Parameters ---------- index: Index to write to the tensor. value: The value that will be filled into the mutable tensor according to `index`. timestamp: optional Timestamp to associated with the newly ...
write
python
mars-project/mars
mars/services/mutable/supervisor/core.py
https://github.com/mars-project/mars/blob/master/mars/services/mutable/supervisor/core.py
Apache-2.0
def get_subtask_schedule_summaries( self, task_id: Optional[str] = None ) -> List[SubtaskScheduleSummary]: """ Get details of scheduling for tasks Parameters ---------- task_id Returns ------- details List of details for subtasks ...
Get details of scheduling for tasks Parameters ---------- task_id Returns ------- details List of details for subtasks
get_subtask_schedule_summaries
python
mars-project/mars
mars/services/scheduling/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/api/core.py
Apache-2.0
async def update_subtask_priority(self, subtask_id: str, priority: Tuple): """ Update priorities of subtasks Parameters ---------- subtask_id id of subtask to update priority priority list of priority of subtasks """ raise NotImple...
Update priorities of subtasks Parameters ---------- subtask_id id of subtask to update priority priority list of priority of subtasks
update_subtask_priority
python
mars-project/mars
mars/services/scheduling/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/api/oscar.py
Apache-2.0
async def cancel_subtasks( self, subtask_ids: List[str], kill_timeout: Union[float, int] = None ): """ Cancel pending and running subtasks. Parameters ---------- subtask_ids ids of subtasks to cancel kill_timeout timeout seconds to kil...
Cancel pending and running subtasks. Parameters ---------- subtask_ids ids of subtasks to cancel kill_timeout timeout seconds to kill actor process forcibly
cancel_subtasks
python
mars-project/mars
mars/services/scheduling/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/api/oscar.py
Apache-2.0
async def finish_subtasks( self, subtask_ids: List[str], bands: List[Tuple] = None, schedule_next: bool = True, ): """ Mark subtasks as finished, letting scheduling service to schedule next tasks in the ready queue Parameters ---------- ...
Mark subtasks as finished, letting scheduling service to schedule next tasks in the ready queue Parameters ---------- subtask_ids ids of subtasks to mark as finished bands bands of subtasks to mark as finished schedule_next wh...
finish_subtasks
python
mars-project/mars
mars/services/scheduling/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/api/oscar.py
Apache-2.0
async def try_enable_autoscale_in(self): """Try to enable autoscale in, the autoscale-in will be enabled only when last call corresponding `disable_autoscale_in` has been invoked.""" await self._autoscaler.try_enable_autoscale_in()
Try to enable autoscale in, the autoscale-in will be enabled only when last call corresponding `disable_autoscale_in` has been invoked.
try_enable_autoscale_in
python
mars-project/mars
mars/services/scheduling/api/oscar.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/api/oscar.py
Apache-2.0
async def release_workers(self, addresses: List[str]) -> List[str]: """ Release a group of worker nodes. Parameters ---------- addresses : List[str] The addresses of the specified node. """ if self._autoscale_in_disable_counter > 0: return ...
Release a group of worker nodes. Parameters ---------- addresses : List[str] The addresses of the specified node.
release_workers
python
mars-project/mars
mars/services/scheduling/supervisor/autoscale.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/supervisor/autoscale.py
Apache-2.0
async def _migrate_data_of_bands( self, bands: List[BandType], excluded_bands: Set[BandType] ): """Move data from `bands` to other available bands""" session_ids = list(self.queueing_refs.keys()) for session_id in session_ids: from ...meta import MetaAPI meta...
Move data from `bands` to other available bands
_migrate_data_of_bands
python
mars-project/mars
mars/services/scheduling/supervisor/autoscale.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/supervisor/autoscale.py
Apache-2.0
async def create(cls, autoscale_conf: Dict[str, Any], autoscaler): """Create a autoscale strategy which will decide when to scale in/.out"""
Create a autoscale strategy which will decide when to scale in/.out
create
python
mars-project/mars
mars/services/scheduling/supervisor/autoscale.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/supervisor/autoscale.py
Apache-2.0
async def get_idle_bands(self, idle_duration: int): """Return a band list which all bands has been idle for at least `idle_duration` seconds.""" now = time.time() idle_bands = [] for band in self._band_total_resources.keys(): idle_start_time = self._band_idle_start_time.get(b...
Return a band list which all bands has been idle for at least `idle_duration` seconds.
get_idle_bands
python
mars-project/mars
mars/services/scheduling/supervisor/globalresource.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/supervisor/globalresource.py
Apache-2.0
def _ensure_top_item_valid(self, task_queue): """Clean invalid subtask item from the queue to ensure that when the queue is not empty, there is always some subtasks waiting being scheduled.""" while ( task_queue and task_queue[0].subtask.subtask_id not in self._stid_to_items ...
Clean invalid subtask item from the queue to ensure that when the queue is not empty, there is always some subtasks waiting being scheduled.
_ensure_top_item_valid
python
mars-project/mars
mars/services/scheduling/supervisor/queueing.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/supervisor/queueing.py
Apache-2.0
async def request_batch_quota(self, batch: Dict): """ Request for resources in a batch :param batch: the request dict in form {request_key: request_size, ...} :return: if request is returned immediately, return True, otherwise False """ all_allocated = True # chec...
Request for resources in a batch :param batch: the request dict in form {request_key: request_size, ...} :return: if request is returned immediately, return True, otherwise False
request_batch_quota
python
mars-project/mars
mars/services/scheduling/worker/quota.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/worker/quota.py
Apache-2.0
def hold_quotas(self, keys: Tuple): """ Mark request quota as already been hold Parameters ---------- keys : Tuple request keys """ for key in keys: try: alloc_size = self._allocations[key] except KeyError: ...
Mark request quota as already been hold Parameters ---------- keys : Tuple request keys
hold_quotas
python
mars-project/mars
mars/services/scheduling/worker/quota.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/worker/quota.py
Apache-2.0
async def release_quotas(self, keys: Tuple): """ Release allocated quota in batch Parameters ---------- keys : Tuple request keys """ total_alloc_size = 0 for key in keys: try: alloc_size = self._allocations.pop(ke...
Release allocated quota in batch Parameters ---------- keys : Tuple request keys
release_quotas
python
mars-project/mars
mars/services/scheduling/worker/quota.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/worker/quota.py
Apache-2.0
async def alter_allocations( self, keys: Tuple, quota_sizes: Tuple, handle_shrink: bool = True, allocate: bool = False, ): """ Alter multiple requests Parameters ---------- keys : Tuple keys to update quota_sizes : ...
Alter multiple requests Parameters ---------- keys : Tuple keys to update quota_sizes : Tuple new quota sizes, if None, no changes will be made handle_shrink : bool if True and the quota size less than the original, process requests i...
alter_allocations
python
mars-project/mars
mars/services/scheduling/worker/quota.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/worker/quota.py
Apache-2.0
async def _process_requests(self): """ Process quota requests in the queue """ removed = [] for k, req in self._requests.items(): if await self._has_space(req.delta): await self.alter_allocations( k, req.req_size, handle_shrink=Fals...
Process quota requests in the queue
_process_requests
python
mars-project/mars
mars/services/scheduling/worker/quota.py
https://github.com/mars-project/mars/blob/master/mars/services/scheduling/worker/quota.py
Apache-2.0
async def get_sessions(self) -> List[SessionInfo]: """ Get information of all sessions Returns ------- session_infos : List[SessionInfo] List of session infos. """
Get information of all sessions Returns ------- session_infos : List[SessionInfo] List of session infos.
get_sessions
python
mars-project/mars
mars/services/session/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/session/api/core.py
Apache-2.0
async def create_session(self, session_id: str) -> str: """ Create session and return address. Parameters ---------- session_id : str Session ID Returns ------- address : str Session address. """
Create session and return address. Parameters ---------- session_id : str Session ID Returns ------- address : str Session address.
create_session
python
mars-project/mars
mars/services/session/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/session/api/core.py
Apache-2.0
async def delete_session(self, session_id: str): """ Delete session. Parameters ---------- session_id : str Session ID. """
Delete session. Parameters ---------- session_id : str Session ID.
delete_session
python
mars-project/mars
mars/services/session/api/core.py
https://github.com/mars-project/mars/blob/master/mars/services/session/api/core.py
Apache-2.0