hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
df0d953c7d46beec063613326818e024cd061fe2
kisuke95/ray
dashboard/state_aggregator.py
[ "Apache-2.0" ]
Python
list_nodes
dict
async def list_nodes(self, *, option: ListApiOptions) -> dict: """List all node information from the cluster. Returns: {node_id -> node_data_in_dict} node_data_in_dict's schema is in NodeState """ reply = await self._client.get_all_node_info(timeout=option.timeou...
List all node information from the cluster. Returns: {node_id -> node_data_in_dict} node_data_in_dict's schema is in NodeState
List all node information from the cluster.
[ "List", "all", "node", "information", "from", "the", "cluster", "." ]
async def list_nodes(self, *, option: ListApiOptions) -> dict: reply = await self._client.get_all_node_info(timeout=option.timeout) result = [] for message in reply.node_info_list: data = self._message_to_dict(message=message, fields_to_decode=["node_id"]) data = filter_f...
[ "async", "def", "list_nodes", "(", "self", ",", "*", ",", "option", ":", "ListApiOptions", ")", "->", "dict", ":", "reply", "=", "await", "self", ".", "_client", ".", "get_all_node_info", "(", "timeout", "=", "option", ".", "timeout", ")", "result", "=",...
List all node information from the cluster.
[ "List", "all", "node", "information", "from", "the", "cluster", "." ]
[ "\"\"\"List all node information from the cluster.\n\n Returns:\n {node_id -> node_data_in_dict}\n node_data_in_dict's schema is in NodeState\n \"\"\"", "# Sort to make the output deterministic." ]
[ { "param": "self", "type": null }, { "param": "option", "type": "ListApiOptions" } ]
{ "returns": [ { "docstring": "{node_id -> node_data_in_dict}\nnode_data_in_dict's schema is in NodeState", "docstring_tokens": [ "{", "node_id", "-", ">", "node_data_in_dict", "}", "node_data_in_dict", "'", "s", "schema",...
df0d953c7d46beec063613326818e024cd061fe2
kisuke95/ray
dashboard/state_aggregator.py
[ "Apache-2.0" ]
Python
list_workers
dict
async def list_workers(self, *, option: ListApiOptions) -> dict: """List all worker information from the cluster. Returns: {worker_id -> worker_data_in_dict} worker_data_in_dict's schema is in WorkerState """ reply = await self._client.get_all_worker_info(timeout...
List all worker information from the cluster. Returns: {worker_id -> worker_data_in_dict} worker_data_in_dict's schema is in WorkerState
List all worker information from the cluster.
[ "List", "all", "worker", "information", "from", "the", "cluster", "." ]
async def list_workers(self, *, option: ListApiOptions) -> dict: reply = await self._client.get_all_worker_info(timeout=option.timeout) result = [] for message in reply.worker_table_data: data = self._message_to_dict( message=message, fields_to_decode=["worker_id"] ...
[ "async", "def", "list_workers", "(", "self", ",", "*", ",", "option", ":", "ListApiOptions", ")", "->", "dict", ":", "reply", "=", "await", "self", ".", "_client", ".", "get_all_worker_info", "(", "timeout", "=", "option", ".", "timeout", ")", "result", ...
List all worker information from the cluster.
[ "List", "all", "worker", "information", "from", "the", "cluster", "." ]
[ "\"\"\"List all worker information from the cluster.\n\n Returns:\n {worker_id -> worker_data_in_dict}\n worker_data_in_dict's schema is in WorkerState\n \"\"\"", "# Sort to make the output deterministic." ]
[ { "param": "self", "type": null }, { "param": "option", "type": "ListApiOptions" } ]
{ "returns": [ { "docstring": "{worker_id -> worker_data_in_dict}\nworker_data_in_dict's schema is in WorkerState", "docstring_tokens": [ "{", "worker_id", "-", ">", "worker_data_in_dict", "}", "worker_data_in_dict", "'", "s", ...
df0d953c7d46beec063613326818e024cd061fe2
kisuke95/ray
dashboard/state_aggregator.py
[ "Apache-2.0" ]
Python
list_tasks
dict
async def list_tasks(self, *, option: ListApiOptions) -> dict: """List all task information from the cluster. Returns: {task_id -> task_data_in_dict} task_data_in_dict's schema is in TaskState """ replies = await asyncio.gather( *[ sel...
List all task information from the cluster. Returns: {task_id -> task_data_in_dict} task_data_in_dict's schema is in TaskState
List all task information from the cluster.
[ "List", "all", "task", "information", "from", "the", "cluster", "." ]
async def list_tasks(self, *, option: ListApiOptions) -> dict: replies = await asyncio.gather( *[ self._client.get_task_info(node_id, timeout=option.timeout) for node_id in self._client.get_all_registered_raylet_ids() ] ) result = [] ...
[ "async", "def", "list_tasks", "(", "self", ",", "*", ",", "option", ":", "ListApiOptions", ")", "->", "dict", ":", "replies", "=", "await", "asyncio", ".", "gather", "(", "*", "[", "self", ".", "_client", ".", "get_task_info", "(", "node_id", ",", "tim...
List all task information from the cluster.
[ "List", "all", "task", "information", "from", "the", "cluster", "." ]
[ "\"\"\"List all task information from the cluster.\n\n Returns:\n {task_id -> task_data_in_dict}\n task_data_in_dict's schema is in TaskState\n \"\"\"", "# Sort to make the output deterministic." ]
[ { "param": "self", "type": null }, { "param": "option", "type": "ListApiOptions" } ]
{ "returns": [ { "docstring": "{task_id -> task_data_in_dict}\ntask_data_in_dict's schema is in TaskState", "docstring_tokens": [ "{", "task_id", "-", ">", "task_data_in_dict", "}", "task_data_in_dict", "'", "s", "schema",...
df0d953c7d46beec063613326818e024cd061fe2
kisuke95/ray
dashboard/state_aggregator.py
[ "Apache-2.0" ]
Python
list_objects
dict
async def list_objects(self, *, option: ListApiOptions) -> dict: """List all object information from the cluster. Returns: {object_id -> object_data_in_dict} object_data_in_dict's schema is in ObjectState """ replies = await asyncio.gather( *[ ...
List all object information from the cluster. Returns: {object_id -> object_data_in_dict} object_data_in_dict's schema is in ObjectState
List all object information from the cluster.
[ "List", "all", "object", "information", "from", "the", "cluster", "." ]
async def list_objects(self, *, option: ListApiOptions) -> dict: replies = await asyncio.gather( *[ self._client.get_object_info(node_id, timeout=option.timeout) for node_id in self._client.get_all_registered_raylet_ids() ] ) worker_stats =...
[ "async", "def", "list_objects", "(", "self", ",", "*", ",", "option", ":", "ListApiOptions", ")", "->", "dict", ":", "replies", "=", "await", "asyncio", ".", "gather", "(", "*", "[", "self", ".", "_client", ".", "get_object_info", "(", "node_id", ",", ...
List all object information from the cluster.
[ "List", "all", "object", "information", "from", "the", "cluster", "." ]
[ "\"\"\"List all object information from the cluster.\n\n Returns:\n {object_id -> object_data_in_dict}\n object_data_in_dict's schema is in ObjectState\n \"\"\"", "# NOTE: Set preserving_proto_field_name=False here because", "# `construct_memory_table` requires a dictionary t...
[ { "param": "self", "type": null }, { "param": "option", "type": "ListApiOptions" } ]
{ "returns": [ { "docstring": "{object_id -> object_data_in_dict}\nobject_data_in_dict's schema is in ObjectState", "docstring_tokens": [ "{", "object_id", "-", ">", "object_data_in_dict", "}", "object_data_in_dict", "'", "s", ...
2fedbdeb776f5bdb8c778af1370f8c3b37bcb386
kisuke95/ray
rllib/utils/pre_checks/env.py
[ "Apache-2.0" ]
Python
check_env
None
def check_env(env: EnvType) -> None: """Run pre-checks on env that uncover common errors in environments. Args: env: Environment to be checked. Raises: ValueError: If env is not an instance of SUPPORTED_ENVIRONMENT_TYPES. ValueError: See check_gym_env docstring for details. """...
Run pre-checks on env that uncover common errors in environments. Args: env: Environment to be checked. Raises: ValueError: If env is not an instance of SUPPORTED_ENVIRONMENT_TYPES. ValueError: See check_gym_env docstring for details.
Run pre-checks on env that uncover common errors in environments.
[ "Run", "pre", "-", "checks", "on", "env", "that", "uncover", "common", "errors", "in", "environments", "." ]
def check_env(env: EnvType) -> None: from ray.rllib.env import ( BaseEnv, MultiAgentEnv, RemoteBaseEnv, VectorEnv, ExternalMultiAgentEnv, ExternalEnv, ) if hasattr(env, "_skip_env_checking") and env._skip_env_checking: logger.warning("Skipping env chec...
[ "def", "check_env", "(", "env", ":", "EnvType", ")", "->", "None", ":", "from", "ray", ".", "rllib", ".", "env", "import", "(", "BaseEnv", ",", "MultiAgentEnv", ",", "RemoteBaseEnv", ",", "VectorEnv", ",", "ExternalMultiAgentEnv", ",", "ExternalEnv", ",", ...
Run pre-checks on env that uncover common errors in environments.
[ "Run", "pre", "-", "checks", "on", "env", "that", "uncover", "common", "errors", "in", "environments", "." ]
[ "\"\"\"Run pre-checks on env that uncover common errors in environments.\n\n Args:\n env: Environment to be checked.\n\n Raises:\n ValueError: If env is not an instance of SUPPORTED_ENVIRONMENT_TYPES.\n ValueError: See check_gym_env docstring for details.\n \"\"\"", "# This is a work...
[ { "param": "env", "type": "EnvType" } ]
{ "returns": [], "raises": [ { "docstring": "If env is not an instance of SUPPORTED_ENVIRONMENT_TYPES.", "docstring_tokens": [ "If", "env", "is", "not", "an", "instance", "of", "SUPPORTED_ENVIRONMENT_TYPES", "." ], "...
2fedbdeb776f5bdb8c778af1370f8c3b37bcb386
kisuke95/ray
rllib/utils/pre_checks/env.py
[ "Apache-2.0" ]
Python
check_gym_environments
None
def check_gym_environments(env: gym.Env) -> None: """Checking for common errors in gym environments. Args: env: Environment to be checked. Warning: If env has no attribute spec with a sub attribute, max_episode_steps. Raises: AttributeError: If env has no observati...
Checking for common errors in gym environments. Args: env: Environment to be checked. Warning: If env has no attribute spec with a sub attribute, max_episode_steps. Raises: AttributeError: If env has no observation space. AttributeError: If env has no action sp...
Checking for common errors in gym environments.
[ "Checking", "for", "common", "errors", "in", "gym", "environments", "." ]
def check_gym_environments(env: gym.Env) -> None: if not hasattr(env, "observation_space"): raise AttributeError("Env must have observation_space.") if not hasattr(env, "action_space"): raise AttributeError("Env must have action_space.") if not isinstance(env.observation_space, gym.spaces.Sp...
[ "def", "check_gym_environments", "(", "env", ":", "gym", ".", "Env", ")", "->", "None", ":", "if", "not", "hasattr", "(", "env", ",", "\"observation_space\"", ")", ":", "raise", "AttributeError", "(", "\"Env must have observation_space.\"", ")", "if", "not", "...
Checking for common errors in gym environments.
[ "Checking", "for", "common", "errors", "in", "gym", "environments", "." ]
[ "\"\"\"Checking for common errors in gym environments.\n\n Args:\n env: Environment to be checked.\n\n Warning:\n If env has no attribute spec with a sub attribute,\n max_episode_steps.\n\n Raises:\n AttributeError: If env has no observation space.\n AttributeError: I...
[ { "param": "env", "type": "gym.Env" } ]
{ "returns": [], "raises": [ { "docstring": "If env has no observation space.", "docstring_tokens": [ "If", "env", "has", "no", "observation", "space", "." ], "type": "AttributeError" }, { "docstring": "If env has no a...
2fedbdeb776f5bdb8c778af1370f8c3b37bcb386
kisuke95/ray
rllib/utils/pre_checks/env.py
[ "Apache-2.0" ]
Python
check_multiagent_environments
None
def check_multiagent_environments(env: "MultiAgentEnv") -> None: """Checking for common errors in RLlib MultiAgentEnvs. Args: env: The env to be checked. """ from ray.rllib.env import MultiAgentEnv if not isinstance(env, MultiAgentEnv): raise ValueError("The passed env is not a Mu...
Checking for common errors in RLlib MultiAgentEnvs. Args: env: The env to be checked.
Checking for common errors in RLlib MultiAgentEnvs.
[ "Checking", "for", "common", "errors", "in", "RLlib", "MultiAgentEnvs", "." ]
def check_multiagent_environments(env: "MultiAgentEnv") -> None: from ray.rllib.env import MultiAgentEnv if not isinstance(env, MultiAgentEnv): raise ValueError("The passed env is not a MultiAgentEnv.") elif not ( hasattr(env, "observation_space") and hasattr(env, "action_space") ...
[ "def", "check_multiagent_environments", "(", "env", ":", "\"MultiAgentEnv\"", ")", "->", "None", ":", "from", "ray", ".", "rllib", ".", "env", "import", "MultiAgentEnv", "if", "not", "isinstance", "(", "env", ",", "MultiAgentEnv", ")", ":", "raise", "ValueErro...
Checking for common errors in RLlib MultiAgentEnvs.
[ "Checking", "for", "common", "errors", "in", "RLlib", "MultiAgentEnvs", "." ]
[ "\"\"\"Checking for common errors in RLlib MultiAgentEnvs.\n\n Args:\n env: The env to be checked.\n\n \"\"\"" ]
[ { "param": "env", "type": "\"MultiAgentEnv\"" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "env", "type": "\"MultiAgentEnv\"", "docstring": "The env to be checked.", "docstring_tokens": [ "The", "env", "to", "be", "checked", "." ], "default": null, "is...
2bc69bc14c68ef082809fc55640dd374c23cabef
kisuke95/ray
rllib/agents/ppo/ppo.py
[ "Apache-2.0" ]
Python
training
"PPOConfig"
def training( self, *, lr_schedule: Optional[List[List[Union[int, float]]]] = None, use_critic: Optional[bool] = None, use_gae: Optional[bool] = None, lambda_: Optional[float] = None, kl_coeff: Optional[float] = None, sgd_minibatch_size: Optional[int] = No...
Sets the training related configuration. Args: lr_schedule: Learning rate schedule. In the format of [[timestep, lr-value], [timestep, lr-value], ...] Intermediary timesteps will be assigned to interpolated learning rate values. A schedule should norm...
Sets the training related configuration.
[ "Sets", "the", "training", "related", "configuration", "." ]
def training( self, *, lr_schedule: Optional[List[List[Union[int, float]]]] = None, use_critic: Optional[bool] = None, use_gae: Optional[bool] = None, lambda_: Optional[float] = None, kl_coeff: Optional[float] = None, sgd_minibatch_size: Optional[int] = No...
[ "def", "training", "(", "self", ",", "*", ",", "lr_schedule", ":", "Optional", "[", "List", "[", "List", "[", "Union", "[", "int", ",", "float", "]", "]", "]", "]", "=", "None", ",", "use_critic", ":", "Optional", "[", "bool", "]", "=", "None", "...
Sets the training related configuration.
[ "Sets", "the", "training", "related", "configuration", "." ]
[ "\"\"\"Sets the training related configuration.\n\n Args:\n lr_schedule: Learning rate schedule. In the format of\n [[timestep, lr-value], [timestep, lr-value], ...]\n Intermediary timesteps will be assigned to interpolated learning rate\n values. A sch...
[ { "param": "self", "type": null }, { "param": "lr_schedule", "type": "Optional[List[List[Union[int, float]]]]" }, { "param": "use_critic", "type": "Optional[bool]" }, { "param": "use_gae", "type": "Optional[bool]" }, { "param": "lambda_", "type": "Optional[flo...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
2bc69bc14c68ef082809fc55640dd374c23cabef
kisuke95/ray
rllib/agents/ppo/ppo.py
[ "Apache-2.0" ]
Python
validate_config
None
def validate_config(self, config: TrainerConfigDict) -> None: """Validates the Trainer's config dict. Args: config (TrainerConfigDict): The Trainer's config to check. Raises: ValueError: In case something is wrong with the config. """ # Call super's vali...
Validates the Trainer's config dict. Args: config (TrainerConfigDict): The Trainer's config to check. Raises: ValueError: In case something is wrong with the config.
Validates the Trainer's config dict.
[ "Validates", "the", "Trainer", "'", "s", "config", "dict", "." ]
def validate_config(self, config: TrainerConfigDict) -> None: super().validate_config(config) if isinstance(config["entropy_coeff"], int): config["entropy_coeff"] = float(config["entropy_coeff"]) if config["entropy_coeff"] < 0.0: raise DeprecationWarning("entropy_coeff mu...
[ "def", "validate_config", "(", "self", ",", "config", ":", "TrainerConfigDict", ")", "->", "None", ":", "super", "(", ")", ".", "validate_config", "(", "config", ")", "if", "isinstance", "(", "config", "[", "\"entropy_coeff\"", "]", ",", "int", ")", ":", ...
Validates the Trainer's config dict.
[ "Validates", "the", "Trainer", "'", "s", "config", "dict", "." ]
[ "\"\"\"Validates the Trainer's config dict.\n\n Args:\n config (TrainerConfigDict): The Trainer's config to check.\n\n Raises:\n ValueError: In case something is wrong with the config.\n \"\"\"", "# Call super's validation method.", "# SGD minibatch size must be smalle...
[ { "param": "self", "type": null }, { "param": "config", "type": "TrainerConfigDict" } ]
{ "returns": [], "raises": [ { "docstring": "In case something is wrong with the config.", "docstring_tokens": [ "In", "case", "something", "is", "wrong", "with", "the", "config", "." ], "type": "ValueError" } ...
2be60c2044a73f6f41f2ef7277562b6cfbe2f72c
kisuke95/ray
rllib/contrib/maddpg/maddpg.py
[ "Apache-2.0" ]
Python
validate_config
None
def validate_config(self, config: TrainerConfigDict) -> None: """Adds the `before_learn_on_batch` hook to the config. This hook is called explicitly prior to TrainOneStep() in the execution setups for DQN and APEX. """ # Call super's validation method. super().validate_c...
Adds the `before_learn_on_batch` hook to the config. This hook is called explicitly prior to TrainOneStep() in the execution setups for DQN and APEX.
Adds the `before_learn_on_batch` hook to the config. This hook is called explicitly prior to TrainOneStep() in the execution setups for DQN and APEX.
[ "Adds", "the", "`", "before_learn_on_batch", "`", "hook", "to", "the", "config", ".", "This", "hook", "is", "called", "explicitly", "prior", "to", "TrainOneStep", "()", "in", "the", "execution", "setups", "for", "DQN", "and", "APEX", "." ]
def validate_config(self, config: TrainerConfigDict) -> None: super().validate_config(config) def f(batch, workers, config): policies = dict( workers.local_worker().foreach_policy_to_train(lambda p, i: (i, p)) ) return before_learn_on_batch(batch, poli...
[ "def", "validate_config", "(", "self", ",", "config", ":", "TrainerConfigDict", ")", "->", "None", ":", "super", "(", ")", ".", "validate_config", "(", "config", ")", "def", "f", "(", "batch", ",", "workers", ",", "config", ")", ":", "policies", "=", "...
Adds the `before_learn_on_batch` hook to the config.
[ "Adds", "the", "`", "before_learn_on_batch", "`", "hook", "to", "the", "config", "." ]
[ "\"\"\"Adds the `before_learn_on_batch` hook to the config.\n\n This hook is called explicitly prior to TrainOneStep() in the execution\n setups for DQN and APEX.\n \"\"\"", "# Call super's validation method." ]
[ { "param": "self", "type": null }, { "param": "config", "type": "TrainerConfigDict" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "config", "type": "TrainerConfigDict", "docstring": null, "doc...
b18ce11ce3762c3ac1015ab2fb82ee907fb589fd
kisuke95/ray
python/ray/serve/replica.py
[ "Apache-2.0" ]
Python
create_replica_wrapper
<not_specific>
def create_replica_wrapper( name: str, import_path: str = None, serialized_deployment_def: bytes = None ): """Creates a replica class wrapping the provided function or class. This approach is picked over inheritance to avoid conflict between user provided class and the RayServeReplica class. """ ...
Creates a replica class wrapping the provided function or class. This approach is picked over inheritance to avoid conflict between user provided class and the RayServeReplica class.
Creates a replica class wrapping the provided function or class. This approach is picked over inheritance to avoid conflict between user provided class and the RayServeReplica class.
[ "Creates", "a", "replica", "class", "wrapping", "the", "provided", "function", "or", "class", ".", "This", "approach", "is", "picked", "over", "inheritance", "to", "avoid", "conflict", "between", "user", "provided", "class", "and", "the", "RayServeReplica", "cla...
def create_replica_wrapper( name: str, import_path: str = None, serialized_deployment_def: bytes = None ): if (import_path is None) and (serialized_deployment_def is None): raise ValueError( "Either the import_name or the serialized_deployment_def must " "be specified, but both w...
[ "def", "create_replica_wrapper", "(", "name", ":", "str", ",", "import_path", ":", "str", "=", "None", ",", "serialized_deployment_def", ":", "bytes", "=", "None", ")", ":", "if", "(", "import_path", "is", "None", ")", "and", "(", "serialized_deployment_def", ...
Creates a replica class wrapping the provided function or class.
[ "Creates", "a", "replica", "class", "wrapping", "the", "provided", "function", "or", "class", "." ]
[ "\"\"\"Creates a replica class wrapping the provided function or class.\n\n This approach is picked over inheritance to avoid conflict between user\n provided class and the RayServeReplica class.\n \"\"\"", "# TODO(architkulkarni): Add type hints after upgrading cloudpickle", "# For ray or serve decora...
[ { "param": "name", "type": "str" }, { "param": "import_path", "type": "str" }, { "param": "serialized_deployment_def", "type": "bytes" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "import_path", "type": "str", "docstring": null, "docstring_t...
b18ce11ce3762c3ac1015ab2fb82ee907fb589fd
kisuke95/ray
python/ray/serve/replica.py
[ "Apache-2.0" ]
Python
invoke_single
Tuple[Any, bool]
async def invoke_single(self, request_item: Query) -> Tuple[Any, bool]: """Executes the provided request on this replica. Returns the user-provided output and a boolean indicating if the request succeeded (user code didn't raise an exception). """ logger.debug( "Repl...
Executes the provided request on this replica. Returns the user-provided output and a boolean indicating if the request succeeded (user code didn't raise an exception).
Executes the provided request on this replica. Returns the user-provided output and a boolean indicating if the request succeeded (user code didn't raise an exception).
[ "Executes", "the", "provided", "request", "on", "this", "replica", ".", "Returns", "the", "user", "-", "provided", "output", "and", "a", "boolean", "indicating", "if", "the", "request", "succeeded", "(", "user", "code", "didn", "'", "t", "raise", "an", "ex...
async def invoke_single(self, request_item: Query) -> Tuple[Any, bool]: logger.debug( "Replica {} started executing request {}".format( self.replica_tag, request_item.metadata.request_id ) ) args, kwargs = parse_request_item(request_item) method_to...
[ "async", "def", "invoke_single", "(", "self", ",", "request_item", ":", "Query", ")", "->", "Tuple", "[", "Any", ",", "bool", "]", ":", "logger", ".", "debug", "(", "\"Replica {} started executing request {}\"", ".", "format", "(", "self", ".", "replica_tag", ...
Executes the provided request on this replica.
[ "Executes", "the", "provided", "request", "on", "this", "replica", "." ]
[ "\"\"\"Executes the provided request on this replica.\n\n Returns the user-provided output and a boolean indicating if the\n request succeeded (user code didn't raise an exception).\n \"\"\"", "# The method doesn't take in anything, including the request", "# information, so we pass nothing...
[ { "param": "self", "type": null }, { "param": "request_item", "type": "Query" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request_item", "type": "Query", "docstring": null, "docstring...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_items
Dataset[Any]
def from_items(items: List[Any], *, parallelism: int = 200) -> Dataset[Any]: """Create a dataset from a list of local Python objects. Examples: >>> import ray >>> ray.data.from_items([1, 2, 3, 4, 5]) # doctest: +SKIP Args: items: List of local Python objects. parallelism: T...
Create a dataset from a list of local Python objects. Examples: >>> import ray >>> ray.data.from_items([1, 2, 3, 4, 5]) # doctest: +SKIP Args: items: List of local Python objects. parallelism: The amount of parallelism to use for the dataset. Parallelism may be limi...
Create a dataset from a list of local Python objects.
[ "Create", "a", "dataset", "from", "a", "list", "of", "local", "Python", "objects", "." ]
def from_items(items: List[Any], *, parallelism: int = 200) -> Dataset[Any]: block_size = max(1, len(items) // parallelism) blocks: List[ObjectRef[Block]] = [] metadata: List[BlockMetadata] = [] i = 0 while i < len(items): stats = BlockExecStats.builder() builder = DelegatingBlockBui...
[ "def", "from_items", "(", "items", ":", "List", "[", "Any", "]", ",", "*", ",", "parallelism", ":", "int", "=", "200", ")", "->", "Dataset", "[", "Any", "]", ":", "block_size", "=", "max", "(", "1", ",", "len", "(", "items", ")", "//", "paralleli...
Create a dataset from a list of local Python objects.
[ "Create", "a", "dataset", "from", "a", "list", "of", "local", "Python", "objects", "." ]
[ "\"\"\"Create a dataset from a list of local Python objects.\n\n Examples:\n >>> import ray\n >>> ray.data.from_items([1, 2, 3, 4, 5]) # doctest: +SKIP\n\n Args:\n items: List of local Python objects.\n parallelism: The amount of parallelism to use for the dataset.\n Par...
[ { "param": "items", "type": "List[Any]" }, { "param": "parallelism", "type": "int" } ]
{ "returns": [ { "docstring": "Dataset holding the items.", "docstring_tokens": [ "Dataset", "holding", "the", "items", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "items", "type": "List[Any]", "...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
read_datasource
Dataset[T]
def read_datasource( datasource: Datasource[T], *, parallelism: int = 200, ray_remote_args: Dict[str, Any] = None, **read_args, ) -> Dataset[T]: """Read a dataset from a custom data source. Args: datasource: The datasource to read data from. parallelism: The requested parall...
Read a dataset from a custom data source. Args: datasource: The datasource to read data from. parallelism: The requested parallelism of the read. Parallelism may be limited by the available partitioning of the datasource. read_args: Additional kwargs to pass to the datasource im...
Read a dataset from a custom data source.
[ "Read", "a", "dataset", "from", "a", "custom", "data", "source", "." ]
def read_datasource( datasource: Datasource[T], *, parallelism: int = 200, ray_remote_args: Dict[str, Any] = None, **read_args, ) -> Dataset[T]: force_local = "RAY_DATASET_FORCE_LOCAL_METADATA" in os.environ pa_ds = _lazy_import_pyarrow_dataset() if pa_ds: partitioning = read_arg...
[ "def", "read_datasource", "(", "datasource", ":", "Datasource", "[", "T", "]", ",", "*", ",", "parallelism", ":", "int", "=", "200", ",", "ray_remote_args", ":", "Dict", "[", "str", ",", "Any", "]", "=", "None", ",", "**", "read_args", ",", ")", "->"...
Read a dataset from a custom data source.
[ "Read", "a", "dataset", "from", "a", "custom", "data", "source", "." ]
[ "\"\"\"Read a dataset from a custom data source.\n\n Args:\n datasource: The datasource to read data from.\n parallelism: The requested parallelism of the read. Parallelism may be\n limited by the available partitioning of the datasource.\n read_args: Additional kwargs to pass to ...
[ { "param": "datasource", "type": "Datasource[T]" }, { "param": "parallelism", "type": "int" }, { "param": "ray_remote_args", "type": "Dict[str, Any]" } ]
{ "returns": [ { "docstring": "Dataset holding the data read from the datasource.", "docstring_tokens": [ "Dataset", "holding", "the", "data", "read", "from", "the", "datasource", "." ], "type": null } ], "rais...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
read_parquet
Dataset[ArrowRow]
def read_parquet( paths: Union[str, List[str]], *, filesystem: Optional["pyarrow.fs.FileSystem"] = None, columns: Optional[List[str]] = None, parallelism: int = 200, ray_remote_args: Dict[str, Any] = None, tensor_column_schema: Optional[Dict[str, Tuple[np.dtype, Tuple[int, ...]]]] = None, ...
Create an Arrow dataset from parquet files. Examples: >>> import ray >>> # Read a directory of files in remote storage. >>> ray.data.read_parquet("s3://bucket/path") # doctest: +SKIP >>> # Read multiple local files. >>> ray.data.read_parquet(["/path/to/file1", "/path/to/fil...
Create an Arrow dataset from parquet files.
[ "Create", "an", "Arrow", "dataset", "from", "parquet", "files", "." ]
def read_parquet( paths: Union[str, List[str]], *, filesystem: Optional["pyarrow.fs.FileSystem"] = None, columns: Optional[List[str]] = None, parallelism: int = 200, ray_remote_args: Dict[str, Any] = None, tensor_column_schema: Optional[Dict[str, Tuple[np.dtype, Tuple[int, ...]]]] = None, ...
[ "def", "read_parquet", "(", "paths", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ",", "*", ",", "filesystem", ":", "Optional", "[", "\"pyarrow.fs.FileSystem\"", "]", "=", "None", ",", "columns", ":", "Optional", "[", "List", "[", "str"...
Create an Arrow dataset from parquet files.
[ "Create", "an", "Arrow", "dataset", "from", "parquet", "files", "." ]
[ "\"\"\"Create an Arrow dataset from parquet files.\n\n Examples:\n >>> import ray\n >>> # Read a directory of files in remote storage.\n >>> ray.data.read_parquet(\"s3://bucket/path\") # doctest: +SKIP\n\n >>> # Read multiple local files.\n >>> ray.data.read_parquet([\"/path/to...
[ { "param": "paths", "type": "Union[str, List[str]]" }, { "param": "filesystem", "type": "Optional[\"pyarrow.fs.FileSystem\"]" }, { "param": "columns", "type": "Optional[List[str]]" }, { "param": "parallelism", "type": "int" }, { "param": "ray_remote_args", "ty...
{ "returns": [ { "docstring": "Dataset holding Arrow records read from the specified paths.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "read", "from", "the", "specified", "paths", "." ], ...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
read_json
Dataset[ArrowRow]
def read_json( paths: Union[str, List[str]], *, filesystem: Optional["pyarrow.fs.FileSystem"] = None, parallelism: int = 200, ray_remote_args: Dict[str, Any] = None, arrow_open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFileMetadataProvider = DefaultFileMetadataProvider...
Create an Arrow dataset from json files. Examples: >>> import ray >>> # Read a directory of files in remote storage. >>> ray.data.read_json("s3://bucket/path") # doctest: +SKIP >>> # Read multiple local files. >>> ray.data.read_json(["/path/to/file1", "/path/to/file2"]) # d...
Create an Arrow dataset from json files.
[ "Create", "an", "Arrow", "dataset", "from", "json", "files", "." ]
def read_json( paths: Union[str, List[str]], *, filesystem: Optional["pyarrow.fs.FileSystem"] = None, parallelism: int = 200, ray_remote_args: Dict[str, Any] = None, arrow_open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFileMetadataProvider = DefaultFileMetadataProvider...
[ "def", "read_json", "(", "paths", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ",", "*", ",", "filesystem", ":", "Optional", "[", "\"pyarrow.fs.FileSystem\"", "]", "=", "None", ",", "parallelism", ":", "int", "=", "200", ",", "ray_remot...
Create an Arrow dataset from json files.
[ "Create", "an", "Arrow", "dataset", "from", "json", "files", "." ]
[ "\"\"\"Create an Arrow dataset from json files.\n\n Examples:\n >>> import ray\n >>> # Read a directory of files in remote storage.\n >>> ray.data.read_json(\"s3://bucket/path\") # doctest: +SKIP\n\n >>> # Read multiple local files.\n >>> ray.data.read_json([\"/path/to/file1\",...
[ { "param": "paths", "type": "Union[str, List[str]]" }, { "param": "filesystem", "type": "Optional[\"pyarrow.fs.FileSystem\"]" }, { "param": "parallelism", "type": "int" }, { "param": "ray_remote_args", "type": "Dict[str, Any]" }, { "param": "arrow_open_stream_args...
{ "returns": [ { "docstring": "Dataset holding Arrow records read from the specified paths.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "read", "from", "the", "specified", "paths", "." ], ...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
read_csv
Dataset[ArrowRow]
def read_csv( paths: Union[str, List[str]], *, filesystem: Optional["pyarrow.fs.FileSystem"] = None, parallelism: int = 200, ray_remote_args: Dict[str, Any] = None, arrow_open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFileMetadataProvider = DefaultFileMetadataProvider(...
Create an Arrow dataset from csv files. Examples: >>> import ray >>> # Read a directory of files in remote storage. >>> ray.data.read_csv("s3://bucket/path") # doctest: +SKIP >>> # Read multiple local files. >>> ray.data.read_csv(["/path/to/file1", "/path/to/file2"]) # doct...
Create an Arrow dataset from csv files.
[ "Create", "an", "Arrow", "dataset", "from", "csv", "files", "." ]
def read_csv( paths: Union[str, List[str]], *, filesystem: Optional["pyarrow.fs.FileSystem"] = None, parallelism: int = 200, ray_remote_args: Dict[str, Any] = None, arrow_open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFileMetadataProvider = DefaultFileMetadataProvider(...
[ "def", "read_csv", "(", "paths", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ",", "*", ",", "filesystem", ":", "Optional", "[", "\"pyarrow.fs.FileSystem\"", "]", "=", "None", ",", "parallelism", ":", "int", "=", "200", ",", "ray_remote...
Create an Arrow dataset from csv files.
[ "Create", "an", "Arrow", "dataset", "from", "csv", "files", "." ]
[ "\"\"\"Create an Arrow dataset from csv files.\n\n Examples:\n >>> import ray\n >>> # Read a directory of files in remote storage.\n >>> ray.data.read_csv(\"s3://bucket/path\") # doctest: +SKIP\n\n >>> # Read multiple local files.\n >>> ray.data.read_csv([\"/path/to/file1\", \"...
[ { "param": "paths", "type": "Union[str, List[str]]" }, { "param": "filesystem", "type": "Optional[\"pyarrow.fs.FileSystem\"]" }, { "param": "parallelism", "type": "int" }, { "param": "ray_remote_args", "type": "Dict[str, Any]" }, { "param": "arrow_open_stream_args...
{ "returns": [ { "docstring": "Dataset holding Arrow records read from the specified paths.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "read", "from", "the", "specified", "paths", "." ], ...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
read_text
Dataset[str]
def read_text( paths: Union[str, List[str]], *, encoding: str = "utf-8", errors: str = "ignore", drop_empty_lines: bool = True, filesystem: Optional["pyarrow.fs.FileSystem"] = None, parallelism: int = 200, arrow_open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFi...
Create a dataset from lines stored in text files. Examples: >>> import ray >>> # Read a directory of files in remote storage. >>> ray.data.read_text("s3://bucket/path") # doctest: +SKIP >>> # Read multiple local files. >>> ray.data.read_text(["/path/to/file1", "/path/to/fil...
Create a dataset from lines stored in text files.
[ "Create", "a", "dataset", "from", "lines", "stored", "in", "text", "files", "." ]
def read_text( paths: Union[str, List[str]], *, encoding: str = "utf-8", errors: str = "ignore", drop_empty_lines: bool = True, filesystem: Optional["pyarrow.fs.FileSystem"] = None, parallelism: int = 200, arrow_open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFi...
[ "def", "read_text", "(", "paths", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ",", "*", ",", "encoding", ":", "str", "=", "\"utf-8\"", ",", "errors", ":", "str", "=", "\"ignore\"", ",", "drop_empty_lines", ":", "bool", "=", "True", ...
Create a dataset from lines stored in text files.
[ "Create", "a", "dataset", "from", "lines", "stored", "in", "text", "files", "." ]
[ "\"\"\"Create a dataset from lines stored in text files.\n\n Examples:\n >>> import ray\n >>> # Read a directory of files in remote storage.\n >>> ray.data.read_text(\"s3://bucket/path\") # doctest: +SKIP\n\n >>> # Read multiple local files.\n >>> ray.data.read_text([\"/path/to...
[ { "param": "paths", "type": "Union[str, List[str]]" }, { "param": "encoding", "type": "str" }, { "param": "errors", "type": "str" }, { "param": "drop_empty_lines", "type": "bool" }, { "param": "filesystem", "type": "Optional[\"pyarrow.fs.FileSystem\"]" }, ...
{ "returns": [ { "docstring": "Dataset holding lines of text read from the specified paths.", "docstring_tokens": [ "Dataset", "holding", "lines", "of", "text", "read", "from", "the", "specified", "paths", "." ...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
read_numpy
Dataset[ArrowRow]
def read_numpy( paths: Union[str, List[str]], *, filesystem: Optional["pyarrow.fs.FileSystem"] = None, parallelism: int = 200, arrow_open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFileMetadataProvider = DefaultFileMetadataProvider(), partition_filter: PathPartitionFilt...
Create an Arrow dataset from numpy files. Examples: >>> import ray >>> # Read a directory of files in remote storage. >>> ray.data.read_numpy("s3://bucket/path") # doctest: +SKIP >>> # Read multiple local files. >>> ray.data.read_numpy(["/path/to/file1", "/path/to/file2"]) ...
Create an Arrow dataset from numpy files.
[ "Create", "an", "Arrow", "dataset", "from", "numpy", "files", "." ]
def read_numpy( paths: Union[str, List[str]], *, filesystem: Optional["pyarrow.fs.FileSystem"] = None, parallelism: int = 200, arrow_open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFileMetadataProvider = DefaultFileMetadataProvider(), partition_filter: PathPartitionFilt...
[ "def", "read_numpy", "(", "paths", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ",", "*", ",", "filesystem", ":", "Optional", "[", "\"pyarrow.fs.FileSystem\"", "]", "=", "None", ",", "parallelism", ":", "int", "=", "200", ",", "arrow_op...
Create an Arrow dataset from numpy files.
[ "Create", "an", "Arrow", "dataset", "from", "numpy", "files", "." ]
[ "\"\"\"Create an Arrow dataset from numpy files.\n\n Examples:\n >>> import ray\n >>> # Read a directory of files in remote storage.\n >>> ray.data.read_numpy(\"s3://bucket/path\") # doctest: +SKIP\n\n >>> # Read multiple local files.\n >>> ray.data.read_numpy([\"/path/to/file1...
[ { "param": "paths", "type": "Union[str, List[str]]" }, { "param": "filesystem", "type": "Optional[\"pyarrow.fs.FileSystem\"]" }, { "param": "parallelism", "type": "int" }, { "param": "arrow_open_stream_args", "type": "Optional[Dict[str, Any]]" }, { "param": "meta_...
{ "returns": [ { "docstring": "Dataset holding Tensor records read from the specified paths.", "docstring_tokens": [ "Dataset", "holding", "Tensor", "records", "read", "from", "the", "specified", "paths", "." ], ...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
read_binary_files
Dataset[Union[Tuple[str, bytes], bytes]]
def read_binary_files( paths: Union[str, List[str]], *, include_paths: bool = False, filesystem: Optional["pyarrow.fs.FileSystem"] = None, parallelism: int = 200, ray_remote_args: Dict[str, Any] = None, arrow_open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFileMetad...
Create a dataset from binary files of arbitrary contents. Examples: >>> import ray >>> # Read a directory of files in remote storage. >>> ray.data.read_binary_files("s3://bucket/path") # doctest: +SKIP >>> # Read multiple local files. >>> ray.data.read_binary_files( # docte...
Create a dataset from binary files of arbitrary contents.
[ "Create", "a", "dataset", "from", "binary", "files", "of", "arbitrary", "contents", "." ]
def read_binary_files( paths: Union[str, List[str]], *, include_paths: bool = False, filesystem: Optional["pyarrow.fs.FileSystem"] = None, parallelism: int = 200, ray_remote_args: Dict[str, Any] = None, arrow_open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFileMetad...
[ "def", "read_binary_files", "(", "paths", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ",", "*", ",", "include_paths", ":", "bool", "=", "False", ",", "filesystem", ":", "Optional", "[", "\"pyarrow.fs.FileSystem\"", "]", "=", "None", ",",...
Create a dataset from binary files of arbitrary contents.
[ "Create", "a", "dataset", "from", "binary", "files", "of", "arbitrary", "contents", "." ]
[ "\"\"\"Create a dataset from binary files of arbitrary contents.\n\n Examples:\n >>> import ray\n >>> # Read a directory of files in remote storage.\n >>> ray.data.read_binary_files(\"s3://bucket/path\") # doctest: +SKIP\n\n >>> # Read multiple local files.\n >>> ray.data.read_...
[ { "param": "paths", "type": "Union[str, List[str]]" }, { "param": "include_paths", "type": "bool" }, { "param": "filesystem", "type": "Optional[\"pyarrow.fs.FileSystem\"]" }, { "param": "parallelism", "type": "int" }, { "param": "ray_remote_args", "type": "Dic...
{ "returns": [ { "docstring": "Dataset holding Arrow records read from the specified paths.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "read", "from", "the", "specified", "paths", "." ], ...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_dask
Dataset[ArrowRow]
def from_dask(df: "dask.DataFrame") -> Dataset[ArrowRow]: """Create a dataset from a Dask DataFrame. Args: df: A Dask DataFrame. Returns: Dataset holding Arrow records read from the DataFrame. """ import dask from ray.util.dask import ray_dask_get partitions = df.to_delaye...
Create a dataset from a Dask DataFrame. Args: df: A Dask DataFrame. Returns: Dataset holding Arrow records read from the DataFrame.
Create a dataset from a Dask DataFrame.
[ "Create", "a", "dataset", "from", "a", "Dask", "DataFrame", "." ]
def from_dask(df: "dask.DataFrame") -> Dataset[ArrowRow]: import dask from ray.util.dask import ray_dask_get partitions = df.to_delayed() persisted_partitions = dask.persist(*partitions, scheduler=ray_dask_get) import pandas def to_ref(df): if isinstance(df, pandas.DataFrame): ...
[ "def", "from_dask", "(", "df", ":", "\"dask.DataFrame\"", ")", "->", "Dataset", "[", "ArrowRow", "]", ":", "import", "dask", "from", "ray", ".", "util", ".", "dask", "import", "ray_dask_get", "partitions", "=", "df", ".", "to_delayed", "(", ")", "persisted...
Create a dataset from a Dask DataFrame.
[ "Create", "a", "dataset", "from", "a", "Dask", "DataFrame", "." ]
[ "\"\"\"Create a dataset from a Dask DataFrame.\n\n Args:\n df: A Dask DataFrame.\n\n Returns:\n Dataset holding Arrow records read from the DataFrame.\n \"\"\"" ]
[ { "param": "df", "type": "\"dask.DataFrame\"" } ]
{ "returns": [ { "docstring": "Dataset holding Arrow records read from the DataFrame.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "read", "from", "the", "DataFrame", "." ], "type": null } ],...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_mars
Dataset[ArrowRow]
def from_mars(df: "mars.DataFrame") -> Dataset[ArrowRow]: """Create a dataset from a MARS dataframe. Args: df: A MARS dataframe, which must be executed by MARS-on-Ray. Returns: Dataset holding Arrow records read from the dataframe. """ raise NotImplementedError
Create a dataset from a MARS dataframe. Args: df: A MARS dataframe, which must be executed by MARS-on-Ray. Returns: Dataset holding Arrow records read from the dataframe.
Create a dataset from a MARS dataframe.
[ "Create", "a", "dataset", "from", "a", "MARS", "dataframe", "." ]
def from_mars(df: "mars.DataFrame") -> Dataset[ArrowRow]: raise NotImplementedError
[ "def", "from_mars", "(", "df", ":", "\"mars.DataFrame\"", ")", "->", "Dataset", "[", "ArrowRow", "]", ":", "raise", "NotImplementedError" ]
Create a dataset from a MARS dataframe.
[ "Create", "a", "dataset", "from", "a", "MARS", "dataframe", "." ]
[ "\"\"\"Create a dataset from a MARS dataframe.\n\n Args:\n df: A MARS dataframe, which must be executed by MARS-on-Ray.\n\n Returns:\n Dataset holding Arrow records read from the dataframe.\n \"\"\"" ]
[ { "param": "df", "type": "\"mars.DataFrame\"" } ]
{ "returns": [ { "docstring": "Dataset holding Arrow records read from the dataframe.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "read", "from", "the", "dataframe", "." ], "type": null } ],...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_modin
Dataset[ArrowRow]
def from_modin(df: "modin.DataFrame") -> Dataset[ArrowRow]: """Create a dataset from a Modin dataframe. Args: df: A Modin dataframe, which must be using the Ray backend. Returns: Dataset holding Arrow records read from the dataframe. """ from modin.distributed.dataframe.pandas.part...
Create a dataset from a Modin dataframe. Args: df: A Modin dataframe, which must be using the Ray backend. Returns: Dataset holding Arrow records read from the dataframe.
Create a dataset from a Modin dataframe.
[ "Create", "a", "dataset", "from", "a", "Modin", "dataframe", "." ]
def from_modin(df: "modin.DataFrame") -> Dataset[ArrowRow]: from modin.distributed.dataframe.pandas.partitions import unwrap_partitions parts = unwrap_partitions(df, axis=0) return from_pandas_refs(parts)
[ "def", "from_modin", "(", "df", ":", "\"modin.DataFrame\"", ")", "->", "Dataset", "[", "ArrowRow", "]", ":", "from", "modin", ".", "distributed", ".", "dataframe", ".", "pandas", ".", "partitions", "import", "unwrap_partitions", "parts", "=", "unwrap_partitions"...
Create a dataset from a Modin dataframe.
[ "Create", "a", "dataset", "from", "a", "Modin", "dataframe", "." ]
[ "\"\"\"Create a dataset from a Modin dataframe.\n\n Args:\n df: A Modin dataframe, which must be using the Ray backend.\n\n Returns:\n Dataset holding Arrow records read from the dataframe.\n \"\"\"" ]
[ { "param": "df", "type": "\"modin.DataFrame\"" } ]
{ "returns": [ { "docstring": "Dataset holding Arrow records read from the dataframe.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "read", "from", "the", "dataframe", "." ], "type": null } ],...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_pandas
Dataset[ArrowRow]
def from_pandas( dfs: Union["pandas.DataFrame", List["pandas.DataFrame"]] ) -> Dataset[ArrowRow]: """Create a dataset from a list of Pandas dataframes. Args: dfs: A Pandas dataframe or a list of Pandas dataframes. Returns: Dataset holding Arrow records read from the dataframes. """...
Create a dataset from a list of Pandas dataframes. Args: dfs: A Pandas dataframe or a list of Pandas dataframes. Returns: Dataset holding Arrow records read from the dataframes.
Create a dataset from a list of Pandas dataframes.
[ "Create", "a", "dataset", "from", "a", "list", "of", "Pandas", "dataframes", "." ]
def from_pandas( dfs: Union["pandas.DataFrame", List["pandas.DataFrame"]] ) -> Dataset[ArrowRow]: import pandas as pd if isinstance(dfs, pd.DataFrame): dfs = [dfs] return from_pandas_refs([ray.put(df) for df in dfs])
[ "def", "from_pandas", "(", "dfs", ":", "Union", "[", "\"pandas.DataFrame\"", ",", "List", "[", "\"pandas.DataFrame\"", "]", "]", ")", "->", "Dataset", "[", "ArrowRow", "]", ":", "import", "pandas", "as", "pd", "if", "isinstance", "(", "dfs", ",", "pd", "...
Create a dataset from a list of Pandas dataframes.
[ "Create", "a", "dataset", "from", "a", "list", "of", "Pandas", "dataframes", "." ]
[ "\"\"\"Create a dataset from a list of Pandas dataframes.\n\n Args:\n dfs: A Pandas dataframe or a list of Pandas dataframes.\n\n Returns:\n Dataset holding Arrow records read from the dataframes.\n \"\"\"" ]
[ { "param": "dfs", "type": "Union[\"pandas.DataFrame\", List[\"pandas.DataFrame\"]]" } ]
{ "returns": [ { "docstring": "Dataset holding Arrow records read from the dataframes.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "read", "from", "the", "dataframes", "." ], "type": null } ...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_pandas_refs
Dataset[ArrowRow]
def from_pandas_refs( dfs: Union[ObjectRef["pandas.DataFrame"], List[ObjectRef["pandas.DataFrame"]]] ) -> Dataset[ArrowRow]: """Create a dataset from a list of Ray object references to Pandas dataframes. Args: dfs: A Ray object references to pandas dataframe, or a list of Ray objec...
Create a dataset from a list of Ray object references to Pandas dataframes. Args: dfs: A Ray object references to pandas dataframe, or a list of Ray object references to pandas dataframes. Returns: Dataset holding Arrow records read from the dataframes.
Create a dataset from a list of Ray object references to Pandas dataframes.
[ "Create", "a", "dataset", "from", "a", "list", "of", "Ray", "object", "references", "to", "Pandas", "dataframes", "." ]
def from_pandas_refs( dfs: Union[ObjectRef["pandas.DataFrame"], List[ObjectRef["pandas.DataFrame"]]] ) -> Dataset[ArrowRow]: if isinstance(dfs, ray.ObjectRef): dfs = [dfs] elif isinstance(dfs, list): for df in dfs: if not isinstance(df, ray.ObjectRef): raise Value...
[ "def", "from_pandas_refs", "(", "dfs", ":", "Union", "[", "ObjectRef", "[", "\"pandas.DataFrame\"", "]", ",", "List", "[", "ObjectRef", "[", "\"pandas.DataFrame\"", "]", "]", "]", ")", "->", "Dataset", "[", "ArrowRow", "]", ":", "if", "isinstance", "(", "d...
Create a dataset from a list of Ray object references to Pandas dataframes.
[ "Create", "a", "dataset", "from", "a", "list", "of", "Ray", "object", "references", "to", "Pandas", "dataframes", "." ]
[ "\"\"\"Create a dataset from a list of Ray object references to Pandas\n dataframes.\n\n Args:\n dfs: A Ray object references to pandas dataframe, or a list of\n Ray object references to pandas dataframes.\n\n Returns:\n Dataset holding Arrow records read from the dataframes.\n ...
[ { "param": "dfs", "type": "Union[ObjectRef[\"pandas.DataFrame\"], List[ObjectRef[\"pandas.DataFrame\"]]]" } ]
{ "returns": [ { "docstring": "Dataset holding Arrow records read from the dataframes.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "read", "from", "the", "dataframes", "." ], "type": null } ...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_numpy
Dataset[ArrowRow]
def from_numpy(ndarrays: Union[np.ndarray, List[np.ndarray]]) -> Dataset[ArrowRow]: """Create a dataset from a list of NumPy ndarrays. Args: ndarrays: A NumPy ndarray or a list of NumPy ndarrays. Returns: Dataset holding the given ndarrays. """ if isinstance(ndarrays, np.ndarray): ...
Create a dataset from a list of NumPy ndarrays. Args: ndarrays: A NumPy ndarray or a list of NumPy ndarrays. Returns: Dataset holding the given ndarrays.
Create a dataset from a list of NumPy ndarrays.
[ "Create", "a", "dataset", "from", "a", "list", "of", "NumPy", "ndarrays", "." ]
def from_numpy(ndarrays: Union[np.ndarray, List[np.ndarray]]) -> Dataset[ArrowRow]: if isinstance(ndarrays, np.ndarray): ndarrays = [ndarrays] return from_numpy_refs([ray.put(ndarray) for ndarray in ndarrays])
[ "def", "from_numpy", "(", "ndarrays", ":", "Union", "[", "np", ".", "ndarray", ",", "List", "[", "np", ".", "ndarray", "]", "]", ")", "->", "Dataset", "[", "ArrowRow", "]", ":", "if", "isinstance", "(", "ndarrays", ",", "np", ".", "ndarray", ")", "...
Create a dataset from a list of NumPy ndarrays.
[ "Create", "a", "dataset", "from", "a", "list", "of", "NumPy", "ndarrays", "." ]
[ "\"\"\"Create a dataset from a list of NumPy ndarrays.\n\n Args:\n ndarrays: A NumPy ndarray or a list of NumPy ndarrays.\n\n Returns:\n Dataset holding the given ndarrays.\n \"\"\"" ]
[ { "param": "ndarrays", "type": "Union[np.ndarray, List[np.ndarray]]" } ]
{ "returns": [ { "docstring": "Dataset holding the given ndarrays.", "docstring_tokens": [ "Dataset", "holding", "the", "given", "ndarrays", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "ndarrays", ...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_numpy_refs
Dataset[ArrowRow]
def from_numpy_refs( ndarrays: Union[ObjectRef[np.ndarray], List[ObjectRef[np.ndarray]]], ) -> Dataset[ArrowRow]: """Create a dataset from a list of NumPy ndarray futures. Args: ndarrays: A Ray object reference to a NumPy ndarray or a list of Ray object references to NumPy ndarrays. ...
Create a dataset from a list of NumPy ndarray futures. Args: ndarrays: A Ray object reference to a NumPy ndarray or a list of Ray object references to NumPy ndarrays. Returns: Dataset holding the given ndarrays.
Create a dataset from a list of NumPy ndarray futures.
[ "Create", "a", "dataset", "from", "a", "list", "of", "NumPy", "ndarray", "futures", "." ]
def from_numpy_refs( ndarrays: Union[ObjectRef[np.ndarray], List[ObjectRef[np.ndarray]]], ) -> Dataset[ArrowRow]: if isinstance(ndarrays, ray.ObjectRef): ndarrays = [ndarrays] elif isinstance(ndarrays, list): for ndarray in ndarrays: if not isinstance(ndarray, ray.ObjectRef): ...
[ "def", "from_numpy_refs", "(", "ndarrays", ":", "Union", "[", "ObjectRef", "[", "np", ".", "ndarray", "]", ",", "List", "[", "ObjectRef", "[", "np", ".", "ndarray", "]", "]", "]", ",", ")", "->", "Dataset", "[", "ArrowRow", "]", ":", "if", "isinstanc...
Create a dataset from a list of NumPy ndarray futures.
[ "Create", "a", "dataset", "from", "a", "list", "of", "NumPy", "ndarray", "futures", "." ]
[ "\"\"\"Create a dataset from a list of NumPy ndarray futures.\n\n Args:\n ndarrays: A Ray object reference to a NumPy ndarray or a list of Ray object\n references to NumPy ndarrays.\n\n Returns:\n Dataset holding the given ndarrays.\n \"\"\"" ]
[ { "param": "ndarrays", "type": "Union[ObjectRef[np.ndarray], List[ObjectRef[np.ndarray]]]" } ]
{ "returns": [ { "docstring": "Dataset holding the given ndarrays.", "docstring_tokens": [ "Dataset", "holding", "the", "given", "ndarrays", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "ndarrays", ...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_arrow
Dataset[ArrowRow]
def from_arrow( tables: Union["pyarrow.Table", bytes, List[Union["pyarrow.Table", bytes]]] ) -> Dataset[ArrowRow]: """Create a dataset from a list of Arrow tables. Args: tables: An Arrow table, or a list of Arrow tables, or its streaming format in bytes. Returns: Datase...
Create a dataset from a list of Arrow tables. Args: tables: An Arrow table, or a list of Arrow tables, or its streaming format in bytes. Returns: Dataset holding Arrow records from the tables.
Create a dataset from a list of Arrow tables.
[ "Create", "a", "dataset", "from", "a", "list", "of", "Arrow", "tables", "." ]
def from_arrow( tables: Union["pyarrow.Table", bytes, List[Union["pyarrow.Table", bytes]]] ) -> Dataset[ArrowRow]: import pyarrow as pa if isinstance(tables, (pa.Table, bytes)): tables = [tables] return from_arrow_refs([ray.put(t) for t in tables])
[ "def", "from_arrow", "(", "tables", ":", "Union", "[", "\"pyarrow.Table\"", ",", "bytes", ",", "List", "[", "Union", "[", "\"pyarrow.Table\"", ",", "bytes", "]", "]", "]", ")", "->", "Dataset", "[", "ArrowRow", "]", ":", "import", "pyarrow", "as", "pa", ...
Create a dataset from a list of Arrow tables.
[ "Create", "a", "dataset", "from", "a", "list", "of", "Arrow", "tables", "." ]
[ "\"\"\"Create a dataset from a list of Arrow tables.\n\n Args:\n tables: An Arrow table, or a list of Arrow tables,\n or its streaming format in bytes.\n\n Returns:\n Dataset holding Arrow records from the tables.\n \"\"\"" ]
[ { "param": "tables", "type": "Union[\"pyarrow.Table\", bytes, List[Union[\"pyarrow.Table\", bytes]]]" } ]
{ "returns": [ { "docstring": "Dataset holding Arrow records from the tables.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "from", "the", "tables", "." ], "type": null } ], "raises": [], "params"...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_arrow_refs
Dataset[ArrowRow]
def from_arrow_refs( tables: Union[ ObjectRef[Union["pyarrow.Table", bytes]], List[ObjectRef[Union["pyarrow.Table", bytes]]], ] ) -> Dataset[ArrowRow]: """Create a dataset from a set of Arrow tables. Args: tables: A Ray object reference to Arrow table, or list of Ray object ...
Create a dataset from a set of Arrow tables. Args: tables: A Ray object reference to Arrow table, or list of Ray object references to Arrow tables, or its streaming format in bytes. Returns: Dataset holding Arrow records from the tables.
Create a dataset from a set of Arrow tables.
[ "Create", "a", "dataset", "from", "a", "set", "of", "Arrow", "tables", "." ]
def from_arrow_refs( tables: Union[ ObjectRef[Union["pyarrow.Table", bytes]], List[ObjectRef[Union["pyarrow.Table", bytes]]], ] ) -> Dataset[ArrowRow]: if isinstance(tables, ray.ObjectRef): tables = [tables] get_metadata = cached_remote_fn(_get_metadata) metadata = [get_metad...
[ "def", "from_arrow_refs", "(", "tables", ":", "Union", "[", "ObjectRef", "[", "Union", "[", "\"pyarrow.Table\"", ",", "bytes", "]", "]", ",", "List", "[", "ObjectRef", "[", "Union", "[", "\"pyarrow.Table\"", ",", "bytes", "]", "]", "]", ",", "]", ")", ...
Create a dataset from a set of Arrow tables.
[ "Create", "a", "dataset", "from", "a", "set", "of", "Arrow", "tables", "." ]
[ "\"\"\"Create a dataset from a set of Arrow tables.\n\n Args:\n tables: A Ray object reference to Arrow table, or list of Ray object\n references to Arrow tables, or its streaming format in bytes.\n\n Returns:\n Dataset holding Arrow records from the tables.\n \"\"\"" ]
[ { "param": "tables", "type": "Union[\n ObjectRef[Union[\"pyarrow.Table\", bytes]],\n List[ObjectRef[Union[\"pyarrow.Table\", bytes]]],\n ]" } ]
{ "returns": [ { "docstring": "Dataset holding Arrow records from the tables.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "from", "the", "tables", "." ], "type": null } ], "raises": [], "params"...
be23fbf543b9738b7d6dd9750851b6592e53f67c
kisuke95/ray
python/ray/data/read_api.py
[ "Apache-2.0" ]
Python
from_spark
Dataset[ArrowRow]
def from_spark( df: "pyspark.sql.DataFrame", *, parallelism: Optional[int] = None ) -> Dataset[ArrowRow]: """Create a dataset from a Spark dataframe. Args: spark: A SparkSession, which must be created by RayDP (Spark-on-Ray). df: A Spark dataframe, which must be created by RayDP (Spark-on-R...
Create a dataset from a Spark dataframe. Args: spark: A SparkSession, which must be created by RayDP (Spark-on-Ray). df: A Spark dataframe, which must be created by RayDP (Spark-on-Ray). parallelism: The amount of parallelism to use for the dataset. If not provided, it will ...
Create a dataset from a Spark dataframe.
[ "Create", "a", "dataset", "from", "a", "Spark", "dataframe", "." ]
def from_spark( df: "pyspark.sql.DataFrame", *, parallelism: Optional[int] = None ) -> Dataset[ArrowRow]: import raydp return raydp.spark.spark_dataframe_to_ray_dataset(df, parallelism)
[ "def", "from_spark", "(", "df", ":", "\"pyspark.sql.DataFrame\"", ",", "*", ",", "parallelism", ":", "Optional", "[", "int", "]", "=", "None", ")", "->", "Dataset", "[", "ArrowRow", "]", ":", "import", "raydp", "return", "raydp", ".", "spark", ".", "spar...
Create a dataset from a Spark dataframe.
[ "Create", "a", "dataset", "from", "a", "Spark", "dataframe", "." ]
[ "\"\"\"Create a dataset from a Spark dataframe.\n\n Args:\n spark: A SparkSession, which must be created by RayDP (Spark-on-Ray).\n df: A Spark dataframe, which must be created by RayDP (Spark-on-Ray).\n parallelism: The amount of parallelism to use for the dataset.\n If not p...
[ { "param": "df", "type": "\"pyspark.sql.DataFrame\"" }, { "param": "parallelism", "type": "Optional[int]" } ]
{ "returns": [ { "docstring": "Dataset holding Arrow records read from the dataframe.", "docstring_tokens": [ "Dataset", "holding", "Arrow", "records", "read", "from", "the", "dataframe", "." ], "type": null } ],...
da13a0decbfbe4f96df0551dec402e0d943085e1
kisuke95/ray
python/ray/experimental/dag/dag_node.py
[ "Apache-2.0" ]
Python
_get_all_child_nodes
Set["DAGNode"]
def _get_all_child_nodes(self) -> Set["DAGNode"]: """Return the set of nodes referenced by the args, kwargs, and args_to_resolve in current node, even they're deeply nested. Examples: f.remote(a, [b]) -> set(a, b) f.remote(a, [b], key={"nested": [c]}) -> set(a, b, c) ...
Return the set of nodes referenced by the args, kwargs, and args_to_resolve in current node, even they're deeply nested. Examples: f.remote(a, [b]) -> set(a, b) f.remote(a, [b], key={"nested": [c]}) -> set(a, b, c)
Return the set of nodes referenced by the args, kwargs, and args_to_resolve in current node, even they're deeply nested.
[ "Return", "the", "set", "of", "nodes", "referenced", "by", "the", "args", "kwargs", "and", "args_to_resolve", "in", "current", "node", "even", "they", "'", "re", "deeply", "nested", "." ]
def _get_all_child_nodes(self) -> Set["DAGNode"]: scanner = _PyObjScanner() children = set() for n in scanner.find_nodes( [ self._bound_args, self._bound_kwargs, self._bound_other_args_to_resolve, ] ): ch...
[ "def", "_get_all_child_nodes", "(", "self", ")", "->", "Set", "[", "\"DAGNode\"", "]", ":", "scanner", "=", "_PyObjScanner", "(", ")", "children", "=", "set", "(", ")", "for", "n", "in", "scanner", ".", "find_nodes", "(", "[", "self", ".", "_bound_args",...
Return the set of nodes referenced by the args, kwargs, and args_to_resolve in current node, even they're deeply nested.
[ "Return", "the", "set", "of", "nodes", "referenced", "by", "the", "args", "kwargs", "and", "args_to_resolve", "in", "current", "node", "even", "they", "'", "re", "deeply", "nested", "." ]
[ "\"\"\"Return the set of nodes referenced by the args, kwargs, and\n args_to_resolve in current node, even they're deeply nested.\n\n Examples:\n f.remote(a, [b]) -> set(a, b)\n f.remote(a, [b], key={\"nested\": [c]}) -> set(a, b, c)\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [ { "identifier": "examples", "docstring": null, ...
da13a0decbfbe4f96df0551dec402e0d943085e1
kisuke95/ray
python/ray/experimental/dag/dag_node.py
[ "Apache-2.0" ]
Python
_apply_and_replace_all_child_nodes
"DAGNode"
def _apply_and_replace_all_child_nodes( self, fn: "Callable[[DAGNode], T]" ) -> "DAGNode": """Apply and replace all immediate child nodes using a given function. This is a shallow replacement only. To recursively transform nodes in the DAG, use ``apply_recursive()``. Args: ...
Apply and replace all immediate child nodes using a given function. This is a shallow replacement only. To recursively transform nodes in the DAG, use ``apply_recursive()``. Args: fn: Callable that will be applied once to each child of this node. Returns: New D...
Apply and replace all immediate child nodes using a given function. This is a shallow replacement only. To recursively transform nodes in the DAG, use ``apply_recursive()``.
[ "Apply", "and", "replace", "all", "immediate", "child", "nodes", "using", "a", "given", "function", ".", "This", "is", "a", "shallow", "replacement", "only", ".", "To", "recursively", "transform", "nodes", "in", "the", "DAG", "use", "`", "`", "apply_recursiv...
def _apply_and_replace_all_child_nodes( self, fn: "Callable[[DAGNode], T]" ) -> "DAGNode": replace_table = {} scanner = _PyObjScanner() for node in scanner.find_nodes( [ self._bound_args, self._bound_kwargs, self._bound_othe...
[ "def", "_apply_and_replace_all_child_nodes", "(", "self", ",", "fn", ":", "\"Callable[[DAGNode], T]\"", ")", "->", "\"DAGNode\"", ":", "replace_table", "=", "{", "}", "scanner", "=", "_PyObjScanner", "(", ")", "for", "node", "in", "scanner", ".", "find_nodes", "...
Apply and replace all immediate child nodes using a given function.
[ "Apply", "and", "replace", "all", "immediate", "child", "nodes", "using", "a", "given", "function", "." ]
[ "\"\"\"Apply and replace all immediate child nodes using a given function.\n\n This is a shallow replacement only. To recursively transform nodes in\n the DAG, use ``apply_recursive()``.\n\n Args:\n fn: Callable that will be applied once to each child of this node.\n\n Returns...
[ { "param": "self", "type": null }, { "param": "fn", "type": "\"Callable[[DAGNode], T]\"" } ]
{ "returns": [ { "docstring": "New DAGNode after replacing all child nodes.", "docstring_tokens": [ "New", "DAGNode", "after", "replacing", "all", "child", "nodes", "." ], "type": null } ], "raises": [], "params": [ ...
da13a0decbfbe4f96df0551dec402e0d943085e1
kisuke95/ray
python/ray/experimental/dag/dag_node.py
[ "Apache-2.0" ]
Python
apply_recursive
T
def apply_recursive(self, fn: "Callable[[DAGNode], T]") -> T: """Apply callable on each node in this DAG in a bottom-up tree walk. Args: fn: Callable that will be applied once to each node in the DAG. It will be applied recursively bottom-up, so nodes can ass...
Apply callable on each node in this DAG in a bottom-up tree walk. Args: fn: Callable that will be applied once to each node in the DAG. It will be applied recursively bottom-up, so nodes can assume the fn has been applied to their args already. Returns: ...
Apply callable on each node in this DAG in a bottom-up tree walk.
[ "Apply", "callable", "on", "each", "node", "in", "this", "DAG", "in", "a", "bottom", "-", "up", "tree", "walk", "." ]
def apply_recursive(self, fn: "Callable[[DAGNode], T]") -> T: class _CachingFn: def __init__(self, fn): self.cache = {} self.fn = fn self.input_node_uuid = None def __call__(self, node): if node._stable_uuid not in self.cach...
[ "def", "apply_recursive", "(", "self", ",", "fn", ":", "\"Callable[[DAGNode], T]\"", ")", "->", "T", ":", "class", "_CachingFn", ":", "def", "__init__", "(", "self", ",", "fn", ")", ":", "self", ".", "cache", "=", "{", "}", "self", ".", "fn", "=", "f...
Apply callable on each node in this DAG in a bottom-up tree walk.
[ "Apply", "callable", "on", "each", "node", "in", "this", "DAG", "in", "a", "bottom", "-", "up", "tree", "walk", "." ]
[ "\"\"\"Apply callable on each node in this DAG in a bottom-up tree walk.\n\n Args:\n fn: Callable that will be applied once to each node in the\n DAG. It will be applied recursively bottom-up, so nodes can\n assume the fn has been applied to their args already.\n\n ...
[ { "param": "self", "type": null }, { "param": "fn", "type": "\"Callable[[DAGNode], T]\"" } ]
{ "returns": [ { "docstring": "Return type of the fn after application to the tree.", "docstring_tokens": [ "Return", "type", "of", "the", "fn", "after", "application", "to", "the", "tree", "." ], "type...
da13a0decbfbe4f96df0551dec402e0d943085e1
kisuke95/ray
python/ray/experimental/dag/dag_node.py
[ "Apache-2.0" ]
Python
apply_functional
<not_specific>
def apply_functional( self, source_input_list: Any, predictate_fn: Callable, apply_fn: Callable, ): """ Apply a given function to DAGNodes in source_input_list, and return the replaced inputs without mutating or coping any DAGNode. Args: s...
Apply a given function to DAGNodes in source_input_list, and return the replaced inputs without mutating or coping any DAGNode. Args: source_input_list: Source inputs to extract and apply function on all children DAGNode instances. predictate_fn: Applied...
Apply a given function to DAGNodes in source_input_list, and return the replaced inputs without mutating or coping any DAGNode.
[ "Apply", "a", "given", "function", "to", "DAGNodes", "in", "source_input_list", "and", "return", "the", "replaced", "inputs", "without", "mutating", "or", "coping", "any", "DAGNode", "." ]
def apply_functional( self, source_input_list: Any, predictate_fn: Callable, apply_fn: Callable, ): replace_table = {} scanner = _PyObjScanner() for node in scanner.find_nodes(source_input_list): if predictate_fn(node) and node not in replace_table...
[ "def", "apply_functional", "(", "self", ",", "source_input_list", ":", "Any", ",", "predictate_fn", ":", "Callable", ",", "apply_fn", ":", "Callable", ",", ")", ":", "replace_table", "=", "{", "}", "scanner", "=", "_PyObjScanner", "(", ")", "for", "node", ...
Apply a given function to DAGNodes in source_input_list, and return the replaced inputs without mutating or coping any DAGNode.
[ "Apply", "a", "given", "function", "to", "DAGNodes", "in", "source_input_list", "and", "return", "the", "replaced", "inputs", "without", "mutating", "or", "coping", "any", "DAGNode", "." ]
[ "\"\"\"\n Apply a given function to DAGNodes in source_input_list, and return\n the replaced inputs without mutating or coping any DAGNode.\n\n Args:\n source_input_list: Source inputs to extract and apply function on\n all children DAGNode instances.\n pred...
[ { "param": "self", "type": null }, { "param": "source_input_list", "type": "Any" }, { "param": "predictate_fn", "type": "Callable" }, { "param": "apply_fn", "type": "Callable" } ]
{ "returns": [ { "docstring": "Outputs of apply_fn on DAGNodes in\nsource_input_list that passes predictate_fn.", "docstring_tokens": [ "Outputs", "of", "apply_fn", "on", "DAGNodes", "in", "source_input_list", "that", "passes", ...
da13a0decbfbe4f96df0551dec402e0d943085e1
kisuke95/ray
python/ray/experimental/dag/dag_node.py
[ "Apache-2.0" ]
Python
_copy_impl
"DAGNode"
def _copy_impl( self, new_args: List[Any], new_kwargs: Dict[str, Any], new_options: Dict[str, Any], new_other_args_to_resolve: Dict[str, Any], ) -> "DAGNode": """Return a copy of this node with the given new args.""" raise NotImplementedError
Return a copy of this node with the given new args.
Return a copy of this node with the given new args.
[ "Return", "a", "copy", "of", "this", "node", "with", "the", "given", "new", "args", "." ]
def _copy_impl( self, new_args: List[Any], new_kwargs: Dict[str, Any], new_options: Dict[str, Any], new_other_args_to_resolve: Dict[str, Any], ) -> "DAGNode": raise NotImplementedError
[ "def", "_copy_impl", "(", "self", ",", "new_args", ":", "List", "[", "Any", "]", ",", "new_kwargs", ":", "Dict", "[", "str", ",", "Any", "]", ",", "new_options", ":", "Dict", "[", "str", ",", "Any", "]", ",", "new_other_args_to_resolve", ":", "Dict", ...
Return a copy of this node with the given new args.
[ "Return", "a", "copy", "of", "this", "node", "with", "the", "given", "new", "args", "." ]
[ "\"\"\"Return a copy of this node with the given new args.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "new_args", "type": "List[Any]" }, { "param": "new_kwargs", "type": "Dict[str, Any]" }, { "param": "new_options", "type": "Dict[str, Any]" }, { "param": "new_other_args_to_resolve", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_args", "type": "List[Any]", "docstring": null, "docstring...
da13a0decbfbe4f96df0551dec402e0d943085e1
kisuke95/ray
python/ray/experimental/dag/dag_node.py
[ "Apache-2.0" ]
Python
_copy
"DAGNode"
def _copy( self, new_args: List[Any], new_kwargs: Dict[str, Any], new_options: Dict[str, Any], new_other_args_to_resolve: Dict[str, Any], ) -> "DAGNode": """Return a copy of this node with the given new args.""" instance = self._copy_impl( new_args...
Return a copy of this node with the given new args.
Return a copy of this node with the given new args.
[ "Return", "a", "copy", "of", "this", "node", "with", "the", "given", "new", "args", "." ]
def _copy( self, new_args: List[Any], new_kwargs: Dict[str, Any], new_options: Dict[str, Any], new_other_args_to_resolve: Dict[str, Any], ) -> "DAGNode": instance = self._copy_impl( new_args, new_kwargs, new_options, new_other_args_to_resolve ) ...
[ "def", "_copy", "(", "self", ",", "new_args", ":", "List", "[", "Any", "]", ",", "new_kwargs", ":", "Dict", "[", "str", ",", "Any", "]", ",", "new_options", ":", "Dict", "[", "str", ",", "Any", "]", ",", "new_other_args_to_resolve", ":", "Dict", "[",...
Return a copy of this node with the given new args.
[ "Return", "a", "copy", "of", "this", "node", "with", "the", "given", "new", "args", "." ]
[ "\"\"\"Return a copy of this node with the given new args.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "new_args", "type": "List[Any]" }, { "param": "new_kwargs", "type": "Dict[str, Any]" }, { "param": "new_options", "type": "Dict[str, Any]" }, { "param": "new_other_args_to_resolve", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "new_args", "type": "List[Any]", "docstring": null, "docstring...
15cefc645a1262a6fcd3d2103f8c81443d883607
kisuke95/ray
rllib/utils/debug/deterministic.py
[ "Apache-2.0" ]
Python
update_global_seed_if_necessary
None
def update_global_seed_if_necessary( framework: Optional[str] = None, seed: Optional[int] = None ) -> None: """Seed global modules such as random, numpy, torch, or tf. This is useful for debugging and testing. Args: framework: The framework specifier (may be None). seed: An optional in...
Seed global modules such as random, numpy, torch, or tf. This is useful for debugging and testing. Args: framework: The framework specifier (may be None). seed: An optional int seed. If None, will not do anything.
Seed global modules such as random, numpy, torch, or tf. This is useful for debugging and testing.
[ "Seed", "global", "modules", "such", "as", "random", "numpy", "torch", "or", "tf", ".", "This", "is", "useful", "for", "debugging", "and", "testing", "." ]
def update_global_seed_if_necessary( framework: Optional[str] = None, seed: Optional[int] = None ) -> None: if seed is None: return random.seed(seed) np.random.seed(seed) if framework == "torch": torch, _ = try_import_torch() torch.manual_seed(seed) cuda_version = tor...
[ "def", "update_global_seed_if_necessary", "(", "framework", ":", "Optional", "[", "str", "]", "=", "None", ",", "seed", ":", "Optional", "[", "int", "]", "=", "None", ")", "->", "None", ":", "if", "seed", "is", "None", ":", "return", "random", ".", "se...
Seed global modules such as random, numpy, torch, or tf.
[ "Seed", "global", "modules", "such", "as", "random", "numpy", "torch", "or", "tf", "." ]
[ "\"\"\"Seed global modules such as random, numpy, torch, or tf.\n\n This is useful for debugging and testing.\n\n Args:\n framework: The framework specifier (may be None).\n seed: An optional int seed. If None, will not do\n anything.\n \"\"\"", "# Python random module.", "# Nu...
[ { "param": "framework", "type": "Optional[str]" }, { "param": "seed", "type": "Optional[int]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "framework", "type": "Optional[str]", "docstring": "The framework specifier (may be None).", "docstring_tokens": [ "The", "framework", "specifier", "(", "may", "be", "None...
b10c912e0420f951d2c28fced6c05025668cfecf
kisuke95/ray
python/ray/ml/predictors/integrations/lightgbm/lightgbm_predictor.py
[ "Apache-2.0" ]
Python
from_checkpoint
"LightGBMPredictor"
def from_checkpoint(cls, checkpoint: Checkpoint) -> "LightGBMPredictor": """Instantiate the predictor from a Checkpoint. The checkpoint is expected to be a result of ``LightGBMTrainer``. Args: checkpoint (Checkpoint): The checkpoint to load the model and preprocesso...
Instantiate the predictor from a Checkpoint. The checkpoint is expected to be a result of ``LightGBMTrainer``. Args: checkpoint (Checkpoint): The checkpoint to load the model and preprocessor from. It is expected to be from the result of a ``LightGBMTrainer`...
Instantiate the predictor from a Checkpoint. The checkpoint is expected to be a result of ``LightGBMTrainer``.
[ "Instantiate", "the", "predictor", "from", "a", "Checkpoint", ".", "The", "checkpoint", "is", "expected", "to", "be", "a", "result", "of", "`", "`", "LightGBMTrainer", "`", "`", "." ]
def from_checkpoint(cls, checkpoint: Checkpoint) -> "LightGBMPredictor": with checkpoint.as_directory() as path: bst = lightgbm.Booster(model_file=os.path.join(path, MODEL_KEY)) preprocessor_path = os.path.join(path, PREPROCESSOR_KEY) if os.path.exists(preprocessor_path): ...
[ "def", "from_checkpoint", "(", "cls", ",", "checkpoint", ":", "Checkpoint", ")", "->", "\"LightGBMPredictor\"", ":", "with", "checkpoint", ".", "as_directory", "(", ")", "as", "path", ":", "bst", "=", "lightgbm", ".", "Booster", "(", "model_file", "=", "os",...
Instantiate the predictor from a Checkpoint.
[ "Instantiate", "the", "predictor", "from", "a", "Checkpoint", "." ]
[ "\"\"\"Instantiate the predictor from a Checkpoint.\n\n The checkpoint is expected to be a result of ``LightGBMTrainer``.\n\n Args:\n checkpoint (Checkpoint): The checkpoint to load the model and\n preprocessor from. It is expected to be from the result of a\n ...
[ { "param": "cls", "type": null }, { "param": "checkpoint", "type": "Checkpoint" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "checkpoint", "type": "Checkpoint", "docstring": "The checkpoint to l...
b10c912e0420f951d2c28fced6c05025668cfecf
kisuke95/ray
python/ray/ml/predictors/integrations/lightgbm/lightgbm_predictor.py
[ "Apache-2.0" ]
Python
predict
pd.DataFrame
def predict( self, data: DataBatchType, feature_columns: Optional[Union[List[str], List[int]]] = None, **predict_kwargs, ) -> pd.DataFrame: """Run inference on data batch. Args: data: A batch of input data. Either a pandas DataFrame or numpy ...
Run inference on data batch. Args: data: A batch of input data. Either a pandas DataFrame or numpy array. feature_columns: The names or indices of the columns in the data to use as features to predict on. If None, then use all columns in `...
Run inference on data batch.
[ "Run", "inference", "on", "data", "batch", "." ]
def predict( self, data: DataBatchType, feature_columns: Optional[Union[List[str], List[int]]] = None, **predict_kwargs, ) -> pd.DataFrame: if self.preprocessor: data = self.preprocessor.transform_batch(data) if feature_columns: if isinstance(d...
[ "def", "predict", "(", "self", ",", "data", ":", "DataBatchType", ",", "feature_columns", ":", "Optional", "[", "Union", "[", "List", "[", "str", "]", ",", "List", "[", "int", "]", "]", "]", "=", "None", ",", "**", "predict_kwargs", ",", ")", "->", ...
Run inference on data batch.
[ "Run", "inference", "on", "data", "batch", "." ]
[ "\"\"\"Run inference on data batch.\n\n Args:\n data: A batch of input data. Either a pandas DataFrame or numpy\n array.\n feature_columns: The names or indices of the columns in the\n data to use as features to predict on. If None, then use\n ...
[ { "param": "self", "type": null }, { "param": "data", "type": "DataBatchType" }, { "param": "feature_columns", "type": "Optional[Union[List[str], List[int]]]" } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "pd.DataFrame" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional...
68b9fd44a842bc7a7633e155076a0f3008e59e17
kisuke95/ray
rllib/env/vector_env.py
[ "Apache-2.0" ]
Python
vectorize_gym_envs
"_VectorizedGymEnv"
def vectorize_gym_envs( make_env: Optional[Callable[[int], EnvType]] = None, existing_envs: Optional[List[gym.Env]] = None, num_envs: int = 1, action_space: Optional[gym.Space] = None, observation_space: Optional[gym.Space] = None, # Deprecated. These seem to have never b...
Translates any given gym.Env(s) into a VectorizedEnv object. Args: make_env: Factory that produces a new gym.Env taking the sub-env's vector index as only arg. Must be defined if the number of `existing_envs` is less than `num_envs`. existing_envs: Option...
Translates any given gym.Env(s) into a VectorizedEnv object.
[ "Translates", "any", "given", "gym", ".", "Env", "(", "s", ")", "into", "a", "VectorizedEnv", "object", "." ]
def vectorize_gym_envs( make_env: Optional[Callable[[int], EnvType]] = None, existing_envs: Optional[List[gym.Env]] = None, num_envs: int = 1, action_space: Optional[gym.Space] = None, observation_space: Optional[gym.Space] = None, env_config=None, policy_config=N...
[ "def", "vectorize_gym_envs", "(", "make_env", ":", "Optional", "[", "Callable", "[", "[", "int", "]", ",", "EnvType", "]", "]", "=", "None", ",", "existing_envs", ":", "Optional", "[", "List", "[", "gym", ".", "Env", "]", "]", "=", "None", ",", "num_...
Translates any given gym.Env(s) into a VectorizedEnv object.
[ "Translates", "any", "given", "gym", ".", "Env", "(", "s", ")", "into", "a", "VectorizedEnv", "object", "." ]
[ "# Deprecated. These seem to have never been used.", "\"\"\"Translates any given gym.Env(s) into a VectorizedEnv object.\n\n Args:\n make_env: Factory that produces a new gym.Env taking the sub-env's\n vector index as only arg. Must be defined if the\n number of `ex...
[ { "param": "make_env", "type": "Optional[Callable[[int], EnvType]]" }, { "param": "existing_envs", "type": "Optional[List[gym.Env]]" }, { "param": "num_envs", "type": "int" }, { "param": "action_space", "type": "Optional[gym.Space]" }, { "param": "observation_spac...
{ "returns": [ { "docstring": "The resulting _VectorizedGymEnv object (subclass of VectorEnv).", "docstring_tokens": [ "The", "resulting", "_VectorizedGymEnv", "object", "(", "subclass", "of", "VectorEnv", ")", "." ]...
68b9fd44a842bc7a7633e155076a0f3008e59e17
kisuke95/ray
rllib/env/vector_env.py
[ "Apache-2.0" ]
Python
vector_step
Tuple[List[EnvObsType], List[float], List[bool], List[EnvInfoDict]]
def vector_step( self, actions: List[EnvActionType] ) -> Tuple[List[EnvObsType], List[float], List[bool], List[EnvInfoDict]]: """Performs a vectorized step on all sub environments using `actions`. Args: actions: List of actions (one for each sub-env). Returns: ...
Performs a vectorized step on all sub environments using `actions`. Args: actions: List of actions (one for each sub-env). Returns: A tuple consisting of 1) New observations for each sub-env. 2) Reward values for each sub-env. 3) Done values ...
Performs a vectorized step on all sub environments using `actions`.
[ "Performs", "a", "vectorized", "step", "on", "all", "sub", "environments", "using", "`", "actions", "`", "." ]
def vector_step( self, actions: List[EnvActionType] ) -> Tuple[List[EnvObsType], List[float], List[bool], List[EnvInfoDict]]: raise NotImplementedError
[ "def", "vector_step", "(", "self", ",", "actions", ":", "List", "[", "EnvActionType", "]", ")", "->", "Tuple", "[", "List", "[", "EnvObsType", "]", ",", "List", "[", "float", "]", ",", "List", "[", "bool", "]", ",", "List", "[", "EnvInfoDict", "]", ...
Performs a vectorized step on all sub environments using `actions`.
[ "Performs", "a", "vectorized", "step", "on", "all", "sub", "environments", "using", "`", "actions", "`", "." ]
[ "\"\"\"Performs a vectorized step on all sub environments using `actions`.\n\n Args:\n actions: List of actions (one for each sub-env).\n\n Returns:\n A tuple consisting of\n 1) New observations for each sub-env.\n 2) Reward values for each sub-env.\n ...
[ { "param": "self", "type": null }, { "param": "actions", "type": "List[EnvActionType]" } ]
{ "returns": [ { "docstring": "A tuple consisting of\n1) New observations for each sub-env.\n2) Reward values for each sub-env.\n3) Done values for each sub-env.\n4) Info values for each sub-env.", "docstring_tokens": [ "A", "tuple", "consisting", "of", "1", ...
4e20c85253eafadc9a62256ffc71d4576c5428dc
kisuke95/ray
python/ray/serve/pipeline/generate.py
[ "Apache-2.0" ]
Python
transform_ray_dag_to_serve_dag
<not_specific>
def transform_ray_dag_to_serve_dag( dag_node: DAGNode, deployment_name_generator: DeploymentNameGenerator ): """ Transform a Ray DAG to a Serve DAG. Map ClassNode to DeploymentNode with ray decorated body passed in, and ClassMethodNode to DeploymentMethodNode. """ if isinstance(dag_node, ClassNo...
Transform a Ray DAG to a Serve DAG. Map ClassNode to DeploymentNode with ray decorated body passed in, and ClassMethodNode to DeploymentMethodNode.
Transform a Ray DAG to a Serve DAG. Map ClassNode to DeploymentNode with ray decorated body passed in, and ClassMethodNode to DeploymentMethodNode.
[ "Transform", "a", "Ray", "DAG", "to", "a", "Serve", "DAG", ".", "Map", "ClassNode", "to", "DeploymentNode", "with", "ray", "decorated", "body", "passed", "in", "and", "ClassMethodNode", "to", "DeploymentMethodNode", "." ]
def transform_ray_dag_to_serve_dag( dag_node: DAGNode, deployment_name_generator: DeploymentNameGenerator ): if isinstance(dag_node, ClassNode): deployment_name = deployment_name_generator.get_deployment_name(dag_node) return DeploymentNode( dag_node._body, deployment_nam...
[ "def", "transform_ray_dag_to_serve_dag", "(", "dag_node", ":", "DAGNode", ",", "deployment_name_generator", ":", "DeploymentNameGenerator", ")", ":", "if", "isinstance", "(", "dag_node", ",", "ClassNode", ")", ":", "deployment_name", "=", "deployment_name_generator", "....
Transform a Ray DAG to a Serve DAG.
[ "Transform", "a", "Ray", "DAG", "to", "a", "Serve", "DAG", "." ]
[ "\"\"\"\n Transform a Ray DAG to a Serve DAG. Map ClassNode to DeploymentNode with\n ray decorated body passed in, and ClassMethodNode to DeploymentMethodNode.\n \"\"\"", "# TODO: (jiaodong) Support .options(metadata=xxx) for deployment", "# TODO: (jiaodong) Need to capture DAGNodes in the parent node"...
[ { "param": "dag_node", "type": "DAGNode" }, { "param": "deployment_name_generator", "type": "DeploymentNameGenerator" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dag_node", "type": "DAGNode", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deployment_name_generator", "type": "DeploymentNameGenerator", ...
4e20c85253eafadc9a62256ffc71d4576c5428dc
kisuke95/ray
python/ray/serve/pipeline/generate.py
[ "Apache-2.0" ]
Python
extract_deployments_from_serve_dag
List[Deployment]
def extract_deployments_from_serve_dag( serve_dag_root: DAGNode, ) -> List[Deployment]: """Extract deployment python objects from a transformed serve DAG. Should only be called after `transform_ray_dag_to_serve_dag`, otherwise nothing to return. Args: serve_dag_root (DAGNode): Transformed s...
Extract deployment python objects from a transformed serve DAG. Should only be called after `transform_ray_dag_to_serve_dag`, otherwise nothing to return. Args: serve_dag_root (DAGNode): Transformed serve dag root node. Returns: deployments (List[Deployment]): List of deployment python ...
Extract deployment python objects from a transformed serve DAG. Should only be called after `transform_ray_dag_to_serve_dag`, otherwise nothing to return.
[ "Extract", "deployment", "python", "objects", "from", "a", "transformed", "serve", "DAG", ".", "Should", "only", "be", "called", "after", "`", "transform_ray_dag_to_serve_dag", "`", "otherwise", "nothing", "to", "return", "." ]
def extract_deployments_from_serve_dag( serve_dag_root: DAGNode, ) -> List[Deployment]: deployments = OrderedDict() def extractor(dag_node): if isinstance(dag_node, (DeploymentNode, DeploymentFunctionNode)): deployment = dag_node._deployment deployments[deployment.name] = dep...
[ "def", "extract_deployments_from_serve_dag", "(", "serve_dag_root", ":", "DAGNode", ",", ")", "->", "List", "[", "Deployment", "]", ":", "deployments", "=", "OrderedDict", "(", ")", "def", "extractor", "(", "dag_node", ")", ":", "if", "isinstance", "(", "dag_n...
Extract deployment python objects from a transformed serve DAG.
[ "Extract", "deployment", "python", "objects", "from", "a", "transformed", "serve", "DAG", "." ]
[ "\"\"\"Extract deployment python objects from a transformed serve DAG. Should\n only be called after `transform_ray_dag_to_serve_dag`, otherwise nothing\n to return.\n\n Args:\n serve_dag_root (DAGNode): Transformed serve dag root node.\n Returns:\n deployments (List[Deployment]): List of ...
[ { "param": "serve_dag_root", "type": "DAGNode" } ]
{ "returns": [ { "docstring": "deployments (List[Deployment]): List of deployment python objects\nfetched from serve dag.", "docstring_tokens": [ "deployments", "(", "List", "[", "Deployment", "]", ")", ":", "List", "of", ...
4e20c85253eafadc9a62256ffc71d4576c5428dc
kisuke95/ray
python/ray/serve/pipeline/generate.py
[ "Apache-2.0" ]
Python
process_ingress_deployment_in_serve_dag
List[Deployment]
def process_ingress_deployment_in_serve_dag( deployments: List[Deployment], ) -> List[Deployment]: """Mark the last fetched deployment in a serve dag as exposed with default prefix. """ if len(deployments) == 0: return deployments # Last element of the list is the root deployment if it'...
Mark the last fetched deployment in a serve dag as exposed with default prefix.
Mark the last fetched deployment in a serve dag as exposed with default prefix.
[ "Mark", "the", "last", "fetched", "deployment", "in", "a", "serve", "dag", "as", "exposed", "with", "default", "prefix", "." ]
def process_ingress_deployment_in_serve_dag( deployments: List[Deployment], ) -> List[Deployment]: if len(deployments) == 0: return deployments ingress_deployment = deployments[-1] if ingress_deployment.route_prefix in [None, f"/{ingress_deployment.name}"]: new_ingress_deployment = ingre...
[ "def", "process_ingress_deployment_in_serve_dag", "(", "deployments", ":", "List", "[", "Deployment", "]", ",", ")", "->", "List", "[", "Deployment", "]", ":", "if", "len", "(", "deployments", ")", "==", "0", ":", "return", "deployments", "ingress_deployment", ...
Mark the last fetched deployment in a serve dag as exposed with default prefix.
[ "Mark", "the", "last", "fetched", "deployment", "in", "a", "serve", "dag", "as", "exposed", "with", "default", "prefix", "." ]
[ "\"\"\"Mark the last fetched deployment in a serve dag as exposed with default\n prefix.\n \"\"\"", "# Last element of the list is the root deployment if it's applicable type", "# that wraps an deployment, given Ray DAG traversal is done bottom-up.", "# Override default prefix to \"/\" on the ingress de...
[ { "param": "deployments", "type": "List[Deployment]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "deployments", "type": "List[Deployment]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c6d30c76ed5db463b43030b94d09fd35d393b3b3
kisuke95/ray
python/ray/__init__.py
[ "Apache-2.0" ]
Python
_configure_system
null
def _configure_system(): import os import platform import sys """Wraps system configuration to avoid 'leaking' variables into ray.""" # Sanity check pickle5 if it has been installed. if "pickle5" in sys.modules: if sys.version_info >= (3, 8): logger.warning( ...
Wraps system configuration to avoid 'leaking' variables into ray.
Wraps system configuration to avoid 'leaking' variables into ray.
[ "Wraps", "system", "configuration", "to", "avoid", "'", "leaking", "'", "variables", "into", "ray", "." ]
def _configure_system(): import os import platform import sys if "pickle5" in sys.modules: if sys.version_info >= (3, 8): logger.warning( "Package pickle5 becomes unnecessary in Python 3.8 and above. " "Its presence may confuse libraries including Ray....
[ "def", "_configure_system", "(", ")", ":", "import", "os", "import", "platform", "import", "sys", "if", "\"pickle5\"", "in", "sys", ".", "modules", ":", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "8", ")", ":", "logger", ".", "warning", "("...
Wraps system configuration to avoid 'leaking' variables into ray.
[ "Wraps", "system", "configuration", "to", "avoid", "'", "leaking", "'", "variables", "into", "ray", "." ]
[ "\"\"\"Wraps system configuration to avoid 'leaking' variables into ray.\"\"\"", "# Sanity check pickle5 if it has been installed.", "# MUST add pickle5 to the import path because it will be imported by some", "# raylet modules.", "#", "# When running Python version < 3.8, Ray needs to use pickle5 instead...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
0ff1ddb115c082f694f9ff214170fe1c8bda341c
kisuke95/ray
python/ray/tune/tests/test_experiment_analysis.py
[ "Apache-2.0" ]
Python
testGetBestCheckpointNan
null
def testGetBestCheckpointNan(self): """Tests if nan values are excluded from best checkpoint.""" metric = "loss" def train(config): for i in range(config["steps"]): if i == 0: value = float("nan") else: value = ...
Tests if nan values are excluded from best checkpoint.
Tests if nan values are excluded from best checkpoint.
[ "Tests", "if", "nan", "values", "are", "excluded", "from", "best", "checkpoint", "." ]
def testGetBestCheckpointNan(self): metric = "loss" def train(config): for i in range(config["steps"]): if i == 0: value = float("nan") else: value = i result = {metric: value} with tune.c...
[ "def", "testGetBestCheckpointNan", "(", "self", ")", ":", "metric", "=", "\"loss\"", "def", "train", "(", "config", ")", ":", "for", "i", "in", "range", "(", "config", "[", "\"steps\"", "]", ")", ":", "if", "i", "==", "0", ":", "value", "=", "float",...
Tests if nan values are excluded from best checkpoint.
[ "Tests", "if", "nan", "values", "are", "excluded", "from", "best", "checkpoint", "." ]
[ "\"\"\"Tests if nan values are excluded from best checkpoint.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
247585617b78f9f17afa44f9e20ea80debd8463a
kisuke95/ray
python/ray/experimental/dag/py_obj_scanner.py
[ "Apache-2.0" ]
Python
replace_nodes
Any
def replace_nodes(self, table: Dict["DAGNode", T]) -> Any: """Replace previously found DAGNodes per the given table.""" assert self._found is not None, "find_nodes must be called first" self._replace_table = table self._buf.seek(0) return pickle.load(self._buf)
Replace previously found DAGNodes per the given table.
Replace previously found DAGNodes per the given table.
[ "Replace", "previously", "found", "DAGNodes", "per", "the", "given", "table", "." ]
def replace_nodes(self, table: Dict["DAGNode", T]) -> Any: assert self._found is not None, "find_nodes must be called first" self._replace_table = table self._buf.seek(0) return pickle.load(self._buf)
[ "def", "replace_nodes", "(", "self", ",", "table", ":", "Dict", "[", "\"DAGNode\"", ",", "T", "]", ")", "->", "Any", ":", "assert", "self", ".", "_found", "is", "not", "None", ",", "\"find_nodes must be called first\"", "self", ".", "_replace_table", "=", ...
Replace previously found DAGNodes per the given table.
[ "Replace", "previously", "found", "DAGNodes", "per", "the", "given", "table", "." ]
[ "\"\"\"Replace previously found DAGNodes per the given table.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "table", "type": "Dict[\"DAGNode\", T]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "table", "type": "Dict[\"DAGNode\", T]", "docstring": null, "d...
d9c7f10d10ec8ad3f743be2d4fb009e76c156d08
kisuke95/ray
python/ray/serve/api.py
[ "Apache-2.0" ]
Python
start
ServeControllerClient
def start( detached: bool = False, http_options: Optional[Union[dict, HTTPOptions]] = None, dedicated_cpu: bool = False, _checkpoint_path: str = DEFAULT_CHECKPOINT_PATH, _override_controller_namespace: Optional[str] = None, **kwargs, ) -> ServeControllerClient: """Initialize a serve instance...
Initialize a serve instance. By default, the instance will be scoped to the lifetime of the returned Client object (or when the script exits). If detached is set to True, the instance will instead persist until serve.shutdown() is called. This is only relevant if connecting to a long-running Ray cluste...
Initialize a serve instance. By default, the instance will be scoped to the lifetime of the returned Client object (or when the script exits). If detached is set to True, the instance will instead persist until serve.shutdown() is called. This is only relevant if connecting to a long-running Ray cluster or ray.init("r...
[ "Initialize", "a", "serve", "instance", ".", "By", "default", "the", "instance", "will", "be", "scoped", "to", "the", "lifetime", "of", "the", "returned", "Client", "object", "(", "or", "when", "the", "script", "exits", ")", ".", "If", "detached", "is", ...
def start( detached: bool = False, http_options: Optional[Union[dict, HTTPOptions]] = None, dedicated_cpu: bool = False, _checkpoint_path: str = DEFAULT_CHECKPOINT_PATH, _override_controller_namespace: Optional[str] = None, **kwargs, ) -> ServeControllerClient: http_deprecated_args = ["http_...
[ "def", "start", "(", "detached", ":", "bool", "=", "False", ",", "http_options", ":", "Optional", "[", "Union", "[", "dict", ",", "HTTPOptions", "]", "]", "=", "None", ",", "dedicated_cpu", ":", "bool", "=", "False", ",", "_checkpoint_path", ":", "str", ...
Initialize a serve instance.
[ "Initialize", "a", "serve", "instance", "." ]
[ "\"\"\"Initialize a serve instance.\n\n By default, the instance will be scoped to the lifetime of the returned\n Client object (or when the script exits). If detached is set to True, the\n instance will instead persist until serve.shutdown() is called. This is\n only relevant if connecting to a long-ru...
[ { "param": "detached", "type": "bool" }, { "param": "http_options", "type": "Optional[Union[dict, HTTPOptions]]" }, { "param": "dedicated_cpu", "type": "bool" }, { "param": "_checkpoint_path", "type": "str" }, { "param": "_override_controller_namespace", "type...
{ "returns": [], "raises": [], "params": [ { "identifier": "detached", "type": "bool", "docstring": "Whether not the instance should be detached from this\nscript. If set, the instance will live on the Ray cluster until it is\nexplicitly stopped with serve.shutdown().", "docstring_toke...
d9c7f10d10ec8ad3f743be2d4fb009e76c156d08
kisuke95/ray
python/ray/serve/api.py
[ "Apache-2.0" ]
Python
shutdown
None
def shutdown() -> None: """Completely shut down the connected Serve instance. Shuts down all processes and deletes all state associated with the instance. """ try: client = get_global_client() except RayServeException: logger.info( "Nothing to shut down. There's no ...
Completely shut down the connected Serve instance. Shuts down all processes and deletes all state associated with the instance.
Completely shut down the connected Serve instance. Shuts down all processes and deletes all state associated with the instance.
[ "Completely", "shut", "down", "the", "connected", "Serve", "instance", ".", "Shuts", "down", "all", "processes", "and", "deletes", "all", "state", "associated", "with", "the", "instance", "." ]
def shutdown() -> None: try: client = get_global_client() except RayServeException: logger.info( "Nothing to shut down. There's no Serve application " "running on this Ray cluster." ) return client.shutdown() set_global_client(None)
[ "def", "shutdown", "(", ")", "->", "None", ":", "try", ":", "client", "=", "get_global_client", "(", ")", "except", "RayServeException", ":", "logger", ".", "info", "(", "\"Nothing to shut down. There's no Serve application \"", "\"running on this Ray cluster.\"", ")", ...
Completely shut down the connected Serve instance.
[ "Completely", "shut", "down", "the", "connected", "Serve", "instance", "." ]
[ "\"\"\"Completely shut down the connected Serve instance.\n\n Shuts down all processes and deletes all state associated with the\n instance.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
d9c7f10d10ec8ad3f743be2d4fb009e76c156d08
kisuke95/ray
python/ray/serve/api.py
[ "Apache-2.0" ]
Python
list_deployments
Dict[str, Deployment]
def list_deployments() -> Dict[str, Deployment]: """Returns a dictionary of all active deployments. Dictionary maps deployment name to Deployment objects. """ infos = get_global_client().list_deployments() deployments = {} for name, (deployment_info, route_prefix) in infos.items(): dep...
Returns a dictionary of all active deployments. Dictionary maps deployment name to Deployment objects.
Returns a dictionary of all active deployments. Dictionary maps deployment name to Deployment objects.
[ "Returns", "a", "dictionary", "of", "all", "active", "deployments", ".", "Dictionary", "maps", "deployment", "name", "to", "Deployment", "objects", "." ]
def list_deployments() -> Dict[str, Deployment]: infos = get_global_client().list_deployments() deployments = {} for name, (deployment_info, route_prefix) in infos.items(): deployments[name] = Deployment( cloudpickle.loads(deployment_info.replica_config.serialized_deployment_def), ...
[ "def", "list_deployments", "(", ")", "->", "Dict", "[", "str", ",", "Deployment", "]", ":", "infos", "=", "get_global_client", "(", ")", ".", "list_deployments", "(", ")", "deployments", "=", "{", "}", "for", "name", ",", "(", "deployment_info", ",", "ro...
Returns a dictionary of all active deployments.
[ "Returns", "a", "dictionary", "of", "all", "active", "deployments", "." ]
[ "\"\"\"Returns a dictionary of all active deployments.\n\n Dictionary maps deployment name to Deployment objects.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
d9c7f10d10ec8ad3f743be2d4fb009e76c156d08
kisuke95/ray
python/ray/serve/api.py
[ "Apache-2.0" ]
Python
run
Optional[RayServeHandle]
def run( target: Union[ClassNode, FunctionNode], _blocking: bool = True, *, host: str = DEFAULT_HTTP_HOST, port: int = DEFAULT_HTTP_PORT, ) -> Optional[RayServeHandle]: """Run a Serve application and return a ServeHandle to the ingress. Either a ClassNode, FunctionNode, or a pre-built appli...
Run a Serve application and return a ServeHandle to the ingress. Either a ClassNode, FunctionNode, or a pre-built application can be passed in. If a node is passed in, all of the deployments it depends on will be deployed. If there is an ingress, its handle will be returned. Args: target (Unio...
Run a Serve application and return a ServeHandle to the ingress. Either a ClassNode, FunctionNode, or a pre-built application can be passed in. If a node is passed in, all of the deployments it depends on will be deployed. If there is an ingress, its handle will be returned.
[ "Run", "a", "Serve", "application", "and", "return", "a", "ServeHandle", "to", "the", "ingress", ".", "Either", "a", "ClassNode", "FunctionNode", "or", "a", "pre", "-", "built", "application", "can", "be", "passed", "in", ".", "If", "a", "node", "is", "p...
def run( target: Union[ClassNode, FunctionNode], _blocking: bool = True, *, host: str = DEFAULT_HTTP_HOST, port: int = DEFAULT_HTTP_PORT, ) -> Optional[RayServeHandle]: from ray.serve.pipeline.api import build as pipeline_build from ray.serve.pipeline.api import get_and_validate_ingress_depl...
[ "def", "run", "(", "target", ":", "Union", "[", "ClassNode", ",", "FunctionNode", "]", ",", "_blocking", ":", "bool", "=", "True", ",", "*", ",", "host", ":", "str", "=", "DEFAULT_HTTP_HOST", ",", "port", ":", "int", "=", "DEFAULT_HTTP_PORT", ",", ")",...
Run a Serve application and return a ServeHandle to the ingress.
[ "Run", "a", "Serve", "application", "and", "return", "a", "ServeHandle", "to", "the", "ingress", "." ]
[ "\"\"\"Run a Serve application and return a ServeHandle to the ingress.\n\n Either a ClassNode, FunctionNode, or a pre-built application\n can be passed in. If a node is passed in, all of the deployments it depends\n on will be deployed. If there is an ingress, its handle will be returned.\n\n Args:\n ...
[ { "param": "target", "type": "Union[ClassNode, FunctionNode]" }, { "param": "_blocking", "type": "bool" }, { "param": "host", "type": "str" }, { "param": "port", "type": "int" } ]
{ "returns": [ { "docstring": "A regular ray serve handle that can be called by user\nto execute the serve DAG.", "docstring_tokens": [ "A", "regular", "ray", "serve", "handle", "that", "can", "be", "called", "by", ...
d9c7f10d10ec8ad3f743be2d4fb009e76c156d08
kisuke95/ray
python/ray/serve/api.py
[ "Apache-2.0" ]
Python
build
Application
def build(target: Union[ClassNode, FunctionNode]) -> Application: """Builds a Serve application into a static application. Takes in a ClassNode or FunctionNode and converts it to a Serve application consisting of one or more deployments. This is intended to be used for production scenarios and deployed...
Builds a Serve application into a static application. Takes in a ClassNode or FunctionNode and converts it to a Serve application consisting of one or more deployments. This is intended to be used for production scenarios and deployed via the Serve REST API or CLI, so there are some restrictions placed...
Builds a Serve application into a static application. Takes in a ClassNode or FunctionNode and converts it to a Serve application consisting of one or more deployments. This is intended to be used for production scenarios and deployed via the Serve REST API or CLI, so there are some restrictions placed on the deploymen...
[ "Builds", "a", "Serve", "application", "into", "a", "static", "application", ".", "Takes", "in", "a", "ClassNode", "or", "FunctionNode", "and", "converts", "it", "to", "a", "Serve", "application", "consisting", "of", "one", "or", "more", "deployments", ".", ...
def build(target: Union[ClassNode, FunctionNode]) -> Application: from ray.serve.pipeline.api import build as pipeline_build if in_interactive_shell(): raise RuntimeError( "build cannot be called from an interactive shell like " "IPython or Jupyter because it requires all deploym...
[ "def", "build", "(", "target", ":", "Union", "[", "ClassNode", ",", "FunctionNode", "]", ")", "->", "Application", ":", "from", "ray", ".", "serve", ".", "pipeline", ".", "api", "import", "build", "as", "pipeline_build", "if", "in_interactive_shell", "(", ...
Builds a Serve application into a static application.
[ "Builds", "a", "Serve", "application", "into", "a", "static", "application", "." ]
[ "\"\"\"Builds a Serve application into a static application.\n\n Takes in a ClassNode or FunctionNode and converts it to a\n Serve application consisting of one or more deployments. This is intended\n to be used for production scenarios and deployed via the Serve REST API or\n CLI, so there are some res...
[ { "param": "target", "type": "Union[ClassNode, FunctionNode]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "target", "type": "Union[ClassNode, FunctionNode]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ad735949c67f2e242f56acafc01ba9db8019298e
kisuke95/ray
python/ray/tune/utils/file_transfer.py
[ "Apache-2.0" ]
Python
sync_dir_between_nodes
Union[None, Tuple[ray.ObjectRef, ray.ActorID, ray.ObjectRef]]
def sync_dir_between_nodes( source_ip: str, source_path: str, target_ip: str, target_path: str, force_all: bool = False, chunk_size_bytes: int = _DEFAULT_CHUNK_SIZE_BYTES, max_size_bytes: Optional[int] = _DEFAULT_MAX_SIZE_BYTES, return_futures: bool = False, ) -> Union[None, Tuple[ray.Ob...
Synchronize directory on source node to directory on target node. Per default, this function will collect information about already existing files in the target directory. Only files that differ in either mtime or filesize will be transferred, unless ``force_all=True``. Args: source_ip: IP of ...
Synchronize directory on source node to directory on target node. Per default, this function will collect information about already existing files in the target directory. Only files that differ in either mtime or filesize will be transferred, unless ``force_all=True``.
[ "Synchronize", "directory", "on", "source", "node", "to", "directory", "on", "target", "node", ".", "Per", "default", "this", "function", "will", "collect", "information", "about", "already", "existing", "files", "in", "the", "target", "directory", ".", "Only", ...
def sync_dir_between_nodes( source_ip: str, source_path: str, target_ip: str, target_path: str, force_all: bool = False, chunk_size_bytes: int = _DEFAULT_CHUNK_SIZE_BYTES, max_size_bytes: Optional[int] = _DEFAULT_MAX_SIZE_BYTES, return_futures: bool = False, ) -> Union[None, Tuple[ray.Ob...
[ "def", "sync_dir_between_nodes", "(", "source_ip", ":", "str", ",", "source_path", ":", "str", ",", "target_ip", ":", "str", ",", "target_path", ":", "str", ",", "force_all", ":", "bool", "=", "False", ",", "chunk_size_bytes", ":", "int", "=", "_DEFAULT_CHUN...
Synchronize directory on source node to directory on target node.
[ "Synchronize", "directory", "on", "source", "node", "to", "directory", "on", "target", "node", "." ]
[ "\"\"\"Synchronize directory on source node to directory on target node.\n\n Per default, this function will collect information about already existing\n files in the target directory. Only files that differ in either mtime or\n filesize will be transferred, unless ``force_all=True``.\n\n Args:\n ...
[ { "param": "source_ip", "type": "str" }, { "param": "source_path", "type": "str" }, { "param": "target_ip", "type": "str" }, { "param": "target_path", "type": "str" }, { "param": "force_all", "type": "bool" }, { "param": "chunk_size_bytes", "type":...
{ "returns": [ { "docstring": "None, or Tuple of unpack future, pack actor, and files_stats future.", "docstring_tokens": [ "None", "or", "Tuple", "of", "unpack", "future", "pack", "actor", "and", "files_stats", "f...
ad735949c67f2e242f56acafc01ba9db8019298e
kisuke95/ray
python/ray/tune/utils/file_transfer.py
[ "Apache-2.0" ]
Python
_unpack_dir
None
def _unpack_dir(stream: io.BytesIO, target_dir: str) -> None: """Unpack tarfile stream into target directory.""" stream.seek(0) with tarfile.open(fileobj=stream) as tar: tar.extractall(target_dir)
Unpack tarfile stream into target directory.
Unpack tarfile stream into target directory.
[ "Unpack", "tarfile", "stream", "into", "target", "directory", "." ]
def _unpack_dir(stream: io.BytesIO, target_dir: str) -> None: stream.seek(0) with tarfile.open(fileobj=stream) as tar: tar.extractall(target_dir)
[ "def", "_unpack_dir", "(", "stream", ":", "io", ".", "BytesIO", ",", "target_dir", ":", "str", ")", "->", "None", ":", "stream", ".", "seek", "(", "0", ")", "with", "tarfile", ".", "open", "(", "fileobj", "=", "stream", ")", "as", "tar", ":", "tar"...
Unpack tarfile stream into target directory.
[ "Unpack", "tarfile", "stream", "into", "target", "directory", "." ]
[ "\"\"\"Unpack tarfile stream into target directory.\"\"\"" ]
[ { "param": "stream", "type": "io.BytesIO" }, { "param": "target_dir", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "stream", "type": "io.BytesIO", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target_dir", "type": "str", "docstring": null, "doc...
ad735949c67f2e242f56acafc01ba9db8019298e
kisuke95/ray
python/ray/tune/utils/file_transfer.py
[ "Apache-2.0" ]
Python
_delete_path
bool
def _delete_path(target_path: str) -> bool: """Delete path (files and directories)""" if os.path.exists(target_path): if os.path.isdir(target_path): shutil.rmtree(target_path) else: os.remove(target_path) return True return False
Delete path (files and directories)
Delete path (files and directories)
[ "Delete", "path", "(", "files", "and", "directories", ")" ]
def _delete_path(target_path: str) -> bool: if os.path.exists(target_path): if os.path.isdir(target_path): shutil.rmtree(target_path) else: os.remove(target_path) return True return False
[ "def", "_delete_path", "(", "target_path", ":", "str", ")", "->", "bool", ":", "if", "os", ".", "path", ".", "exists", "(", "target_path", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "target_path", ")", ":", "shutil", ".", "rmtree", "(", ...
Delete path (files and directories)
[ "Delete", "path", "(", "files", "and", "directories", ")" ]
[ "\"\"\"Delete path (files and directories)\"\"\"" ]
[ { "param": "target_path", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "target_path", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fe0c68c0eaba1c98430fd9a00e527893dccc9785
kisuke95/ray
python/ray/autoscaler/_private/kuberay/node_provider.py
[ "Apache-2.0" ]
Python
create_node
Dict[str, Dict[str, str]]
def create_node( self, node_config: Dict[str, Any], tags: Dict[str, str], count: int ) -> Dict[str, Dict[str, str]]: """Creates a number of nodes within the namespace.""" with self._lock: url = "rayclusters/{}".format(self.cluster_name) raycluster = self._get(url) ...
Creates a number of nodes within the namespace.
Creates a number of nodes within the namespace.
[ "Creates", "a", "number", "of", "nodes", "within", "the", "namespace", "." ]
def create_node( self, node_config: Dict[str, Any], tags: Dict[str, str], count: int ) -> Dict[str, Dict[str, str]]: with self._lock: url = "rayclusters/{}".format(self.cluster_name) raycluster = self._get(url) group_name = tags["ray-user-node-type"] g...
[ "def", "create_node", "(", "self", ",", "node_config", ":", "Dict", "[", "str", ",", "Any", "]", ",", "tags", ":", "Dict", "[", "str", ",", "str", "]", ",", "count", ":", "int", ")", "->", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "str"...
Creates a number of nodes within the namespace.
[ "Creates", "a", "number", "of", "nodes", "within", "the", "namespace", "." ]
[ "\"\"\"Creates a number of nodes within the namespace.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "node_config", "type": "Dict[str, Any]" }, { "param": "tags", "type": "Dict[str, str]" }, { "param": "count", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node_config", "type": "Dict[str, Any]", "docstring": null, "d...
fe0c68c0eaba1c98430fd9a00e527893dccc9785
kisuke95/ray
python/ray/autoscaler/_private/kuberay/node_provider.py
[ "Apache-2.0" ]
Python
non_terminated_nodes
List[str]
def non_terminated_nodes(self, tag_filters: Dict[str, str]) -> List[str]: """Return a list of node ids filtered by the specified tags dict.""" label_filters = to_label_selector( { "ray.io/cluster": self.cluster_name, } ) data = self._get("pods?labe...
Return a list of node ids filtered by the specified tags dict.
Return a list of node ids filtered by the specified tags dict.
[ "Return", "a", "list", "of", "node", "ids", "filtered", "by", "the", "specified", "tags", "dict", "." ]
def non_terminated_nodes(self, tag_filters: Dict[str, str]) -> List[str]: label_filters = to_label_selector( { "ray.io/cluster": self.cluster_name, } ) data = self._get("pods?labelSelector=" + requests.utils.quote(label_filters)) result = [] ...
[ "def", "non_terminated_nodes", "(", "self", ",", "tag_filters", ":", "Dict", "[", "str", ",", "str", "]", ")", "->", "List", "[", "str", "]", ":", "label_filters", "=", "to_label_selector", "(", "{", "\"ray.io/cluster\"", ":", "self", ".", "cluster_name", ...
Return a list of node ids filtered by the specified tags dict.
[ "Return", "a", "list", "of", "node", "ids", "filtered", "by", "the", "specified", "tags", "dict", "." ]
[ "\"\"\"Return a list of node ids filtered by the specified tags dict.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "tag_filters", "type": "Dict[str, str]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tag_filters", "type": "Dict[str, str]", "docstring": null, "d...
fe0c68c0eaba1c98430fd9a00e527893dccc9785
kisuke95/ray
python/ray/autoscaler/_private/kuberay/node_provider.py
[ "Apache-2.0" ]
Python
terminate_nodes
Dict[str, Dict[str, str]]
def terminate_nodes(self, node_ids: List[str]) -> Dict[str, Dict[str, str]]: """Batch terminates the specified nodes (= Kubernetes pods).""" with self._lock: # Split node_ids into groups according to node type and terminate # them individually. Note that in most cases, node_ids c...
Batch terminates the specified nodes (= Kubernetes pods).
Batch terminates the specified nodes (= Kubernetes pods).
[ "Batch", "terminates", "the", "specified", "nodes", "(", "=", "Kubernetes", "pods", ")", "." ]
def terminate_nodes(self, node_ids: List[str]) -> Dict[str, Dict[str, str]]: with self._lock: groups = {} current_replica_counts = {} label_filters = to_label_selector({"ray.io/cluster": self.cluster_name}) pods = self._get( "pods?labelSelector=" +...
[ "def", "terminate_nodes", "(", "self", ",", "node_ids", ":", "List", "[", "str", "]", ")", "->", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "str", "]", "]", ":", "with", "self", ".", "_lock", ":", "groups", "=", "{", "}", "current_replica_co...
Batch terminates the specified nodes (= Kubernetes pods).
[ "Batch", "terminates", "the", "specified", "nodes", "(", "=", "Kubernetes", "pods", ")", "." ]
[ "\"\"\"Batch terminates the specified nodes (= Kubernetes pods).\"\"\"", "# Split node_ids into groups according to node type and terminate", "# them individually. Note that in most cases, node_ids contains", "# a single element and therefore it is most likely not worth", "# optimizing this code to batch th...
[ { "param": "self", "type": null }, { "param": "node_ids", "type": "List[str]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node_ids", "type": "List[str]", "docstring": null, "docstring...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
iter_rows
Iterator[Union[T, TableRow]]
def iter_rows(self, *, prefetch_blocks: int = 0) -> Iterator[Union[T, TableRow]]: """Return a local row iterator over the data in the pipeline. If the dataset is a tabular dataset (Arrow/Pandas blocks), dict-like mappings :py:class:`~ray.data.row.TableRow` are yielded for each row by the iterat...
Return a local row iterator over the data in the pipeline. If the dataset is a tabular dataset (Arrow/Pandas blocks), dict-like mappings :py:class:`~ray.data.row.TableRow` are yielded for each row by the iterator. If the dataset is not tabular, the raw row is yielded. Examples: ...
Return a local row iterator over the data in the pipeline. If the dataset is a tabular dataset (Arrow/Pandas blocks), dict-like mappings :py:class:`~ray.data.row.TableRow` are yielded for each row by the iterator. If the dataset is not tabular, the raw row is yielded.
[ "Return", "a", "local", "row", "iterator", "over", "the", "data", "in", "the", "pipeline", ".", "If", "the", "dataset", "is", "a", "tabular", "dataset", "(", "Arrow", "/", "Pandas", "blocks", ")", "dict", "-", "like", "mappings", ":", "py", ":", "class...
def iter_rows(self, *, prefetch_blocks: int = 0) -> Iterator[Union[T, TableRow]]: def gen_rows() -> Iterator[Union[T, TableRow]]: time_start = time.perf_counter() for ds in self.iter_datasets(): wait_start = time.perf_counter() for row in ds.iter_rows(pref...
[ "def", "iter_rows", "(", "self", ",", "*", ",", "prefetch_blocks", ":", "int", "=", "0", ")", "->", "Iterator", "[", "Union", "[", "T", ",", "TableRow", "]", "]", ":", "def", "gen_rows", "(", ")", "->", "Iterator", "[", "Union", "[", "T", ",", "T...
Return a local row iterator over the data in the pipeline.
[ "Return", "a", "local", "row", "iterator", "over", "the", "data", "in", "the", "pipeline", "." ]
[ "\"\"\"Return a local row iterator over the data in the pipeline.\n\n If the dataset is a tabular dataset (Arrow/Pandas blocks), dict-like mappings\n :py:class:`~ray.data.row.TableRow` are yielded for each row by the iterator.\n If the dataset is not tabular, the raw row is yielded.\n\n ...
[ { "param": "self", "type": null }, { "param": "prefetch_blocks", "type": "int" } ]
{ "returns": [ { "docstring": "A local iterator over the records in the pipeline.", "docstring_tokens": [ "A", "local", "iterator", "over", "the", "records", "in", "the", "pipeline", "." ], "type": null } ...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
iter_batches
Iterator[BatchType]
def iter_batches( self, *, prefetch_blocks: int = 0, batch_size: int = None, batch_format: str = "native", drop_last: bool = False, ) -> Iterator[BatchType]: """Return a local batched iterator over the data in the pipeline. Examples: >>> i...
Return a local batched iterator over the data in the pipeline. Examples: >>> import ray >>> ds = ray.data.range(1000000).repeat(5) # doctest: +SKIP >>> for pandas_df in ds.iter_batches(): # doctest: +SKIP ... print(pandas_df) # doctest: +SKIP Time co...
Return a local batched iterator over the data in the pipeline.
[ "Return", "a", "local", "batched", "iterator", "over", "the", "data", "in", "the", "pipeline", "." ]
def iter_batches( self, *, prefetch_blocks: int = 0, batch_size: int = None, batch_format: str = "native", drop_last: bool = False, ) -> Iterator[BatchType]: time_start = time.perf_counter() yield from batch_blocks( self._iter_blocks(), ...
[ "def", "iter_batches", "(", "self", ",", "*", ",", "prefetch_blocks", ":", "int", "=", "0", ",", "batch_size", ":", "int", "=", "None", ",", "batch_format", ":", "str", "=", "\"native\"", ",", "drop_last", ":", "bool", "=", "False", ",", ")", "->", "...
Return a local batched iterator over the data in the pipeline.
[ "Return", "a", "local", "batched", "iterator", "over", "the", "data", "in", "the", "pipeline", "." ]
[ "\"\"\"Return a local batched iterator over the data in the pipeline.\n\n Examples:\n >>> import ray\n >>> ds = ray.data.range(1000000).repeat(5) # doctest: +SKIP\n >>> for pandas_df in ds.iter_batches(): # doctest: +SKIP\n ... print(pandas_df) # doctest: +SKIP...
[ { "param": "self", "type": null }, { "param": "prefetch_blocks", "type": "int" }, { "param": "batch_size", "type": "int" }, { "param": "batch_format", "type": "str" }, { "param": "drop_last", "type": "bool" } ]
{ "returns": [ { "docstring": "An iterator over record batches.", "docstring_tokens": [ "An", "iterator", "over", "record", "batches", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type"...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
split
List["DatasetPipeline[T]"]
def split( self, n: int, *, equal: bool = False, locality_hints: List[Any] = None ) -> List["DatasetPipeline[T]"]: """Split the pipeline into ``n`` disjoint pipeline shards. This returns a list of sub-pipelines that can be passed to Ray tasks and actors and used to read the pipeline...
Split the pipeline into ``n`` disjoint pipeline shards. This returns a list of sub-pipelines that can be passed to Ray tasks and actors and used to read the pipeline records in parallel. Examples: >>> import ray >>> pipe = ray.data.range(10).repeat(50) # doctest: +SKIP ...
Split the pipeline into ``n`` disjoint pipeline shards. This returns a list of sub-pipelines that can be passed to Ray tasks and actors and used to read the pipeline records in parallel.
[ "Split", "the", "pipeline", "into", "`", "`", "n", "`", "`", "disjoint", "pipeline", "shards", ".", "This", "returns", "a", "list", "of", "sub", "-", "pipelines", "that", "can", "be", "passed", "to", "Ray", "tasks", "and", "actors", "and", "used", "to"...
def split( self, n: int, *, equal: bool = False, locality_hints: List[Any] = None ) -> List["DatasetPipeline[T]"]: return self._split( n, lambda ds, equal=equal: ds.split( n, equal=equal, locality_hints=locality_hints ), )
[ "def", "split", "(", "self", ",", "n", ":", "int", ",", "*", ",", "equal", ":", "bool", "=", "False", ",", "locality_hints", ":", "List", "[", "Any", "]", "=", "None", ")", "->", "List", "[", "\"DatasetPipeline[T]\"", "]", ":", "return", "self", "....
Split the pipeline into ``n`` disjoint pipeline shards.
[ "Split", "the", "pipeline", "into", "`", "`", "n", "`", "`", "disjoint", "pipeline", "shards", "." ]
[ "\"\"\"Split the pipeline into ``n`` disjoint pipeline shards.\n\n This returns a list of sub-pipelines that can be passed to Ray tasks\n and actors and used to read the pipeline records in parallel.\n\n Examples:\n >>> import ray\n >>> pipe = ray.data.range(10).repeat(50)...
[ { "param": "self", "type": null }, { "param": "n", "type": "int" }, { "param": "equal", "type": "bool" }, { "param": "locality_hints", "type": "List[Any]" } ]
{ "returns": [ { "docstring": "A list of ``n`` disjoint pipeline splits.", "docstring_tokens": [ "A", "list", "of", "`", "`", "n", "`", "`", "disjoint", "pipeline", "splits", "." ], "type": null...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
rewindow
"DatasetPipeline[T]"
def rewindow( self, *, blocks_per_window: int, preserve_epoch: bool = True ) -> "DatasetPipeline[T]": """Change the windowing (blocks per dataset) of this pipeline. Changes the windowing of this pipeline to the specified size. For example, if the current pipeline has two blocks per ...
Change the windowing (blocks per dataset) of this pipeline. Changes the windowing of this pipeline to the specified size. For example, if the current pipeline has two blocks per dataset, and `.rewindow(blocks_per_window=4)` is requested, adjacent datasets will be merged until each datas...
Change the windowing (blocks per dataset) of this pipeline. Changes the windowing of this pipeline to the specified size. For example, if the current pipeline has two blocks per dataset, and `.rewindow(blocks_per_window=4)` is requested, adjacent datasets will be merged until each dataset is 4 blocks. If `.rewindow(blo...
[ "Change", "the", "windowing", "(", "blocks", "per", "dataset", ")", "of", "this", "pipeline", ".", "Changes", "the", "windowing", "of", "this", "pipeline", "to", "the", "specified", "size", ".", "For", "example", "if", "the", "current", "pipeline", "has", ...
def rewindow( self, *, blocks_per_window: int, preserve_epoch: bool = True ) -> "DatasetPipeline[T]": class WindowIterator: def __init__(self, original_iter): self._original_iter = original_iter self._buffer: Optional[Dataset[T]] = None def __n...
[ "def", "rewindow", "(", "self", ",", "*", ",", "blocks_per_window", ":", "int", ",", "preserve_epoch", ":", "bool", "=", "True", ")", "->", "\"DatasetPipeline[T]\"", ":", "class", "WindowIterator", ":", "def", "__init__", "(", "self", ",", "original_iter", "...
Change the windowing (blocks per dataset) of this pipeline.
[ "Change", "the", "windowing", "(", "blocks", "per", "dataset", ")", "of", "this", "pipeline", "." ]
[ "\"\"\"Change the windowing (blocks per dataset) of this pipeline.\n\n Changes the windowing of this pipeline to the specified size. For\n example, if the current pipeline has two blocks per dataset, and\n `.rewindow(blocks_per_window=4)` is requested, adjacent datasets will\n be merged ...
[ { "param": "self", "type": null }, { "param": "blocks_per_window", "type": "int" }, { "param": "preserve_epoch", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "blocks_per_window", "type": "int", "docstring": "The new target blo...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
repeat
"DatasetPipeline[T]"
def repeat(self, times: int = None) -> "DatasetPipeline[T]": """Repeat this pipeline a given number or times, or indefinitely. This operation is only allowed for pipelines of a finite length. An error will be raised for pipelines of infinite length. Note that every repeat of the pipeli...
Repeat this pipeline a given number or times, or indefinitely. This operation is only allowed for pipelines of a finite length. An error will be raised for pipelines of infinite length. Note that every repeat of the pipeline is considered an "epoch" for the purposes of ``iter_epochs()`...
Repeat this pipeline a given number or times, or indefinitely. This operation is only allowed for pipelines of a finite length. An error will be raised for pipelines of infinite length. Note that every repeat of the pipeline is considered an "epoch" for the purposes of ``iter_epochs()``. If there are multiple repeat c...
[ "Repeat", "this", "pipeline", "a", "given", "number", "or", "times", "or", "indefinitely", ".", "This", "operation", "is", "only", "allowed", "for", "pipelines", "of", "a", "finite", "length", ".", "An", "error", "will", "be", "raised", "for", "pipelines", ...
def repeat(self, times: int = None) -> "DatasetPipeline[T]": if self._length == float("inf"): raise ValueError("Cannot repeat a pipeline of infinite length.") class RepeatIterator: def __init__(self, original_iter): self._original_iter = original_iter ...
[ "def", "repeat", "(", "self", ",", "times", ":", "int", "=", "None", ")", "->", "\"DatasetPipeline[T]\"", ":", "if", "self", ".", "_length", "==", "float", "(", "\"inf\"", ")", ":", "raise", "ValueError", "(", "\"Cannot repeat a pipeline of infinite length.\"", ...
Repeat this pipeline a given number or times, or indefinitely.
[ "Repeat", "this", "pipeline", "a", "given", "number", "or", "times", "or", "indefinitely", "." ]
[ "\"\"\"Repeat this pipeline a given number or times, or indefinitely.\n\n This operation is only allowed for pipelines of a finite length. An\n error will be raised for pipelines of infinite length.\n\n Note that every repeat of the pipeline is considered an \"epoch\" for\n the purposes ...
[ { "param": "self", "type": null }, { "param": "times", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "times", "type": "int", "docstring": "The number of times to loop ov...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
schema
Union[type, "pyarrow.lib.Schema"]
def schema( self, fetch_if_missing: bool = False ) -> Union[type, "pyarrow.lib.Schema"]: """Return the schema of the dataset pipeline. For datasets of Arrow records, this will return the Arrow schema. For dataset of Python objects, this returns their Python type. Note: This...
Return the schema of the dataset pipeline. For datasets of Arrow records, this will return the Arrow schema. For dataset of Python objects, this returns their Python type. Note: This is intended to be a method for peeking schema before the execution of DatasetPipeline. If execution has...
Return the schema of the dataset pipeline. For datasets of Arrow records, this will return the Arrow schema. For dataset of Python objects, this returns their Python type. This is intended to be a method for peeking schema before the execution of DatasetPipeline. If execution has already started, it will simply return...
[ "Return", "the", "schema", "of", "the", "dataset", "pipeline", ".", "For", "datasets", "of", "Arrow", "records", "this", "will", "return", "the", "Arrow", "schema", ".", "For", "dataset", "of", "Python", "objects", "this", "returns", "their", "Python", "type...
def schema( self, fetch_if_missing: bool = False ) -> Union[type, "pyarrow.lib.Schema"]: if not self._executed[0]: self._schema = self._peek().schema(fetch_if_missing) return self._schema
[ "def", "schema", "(", "self", ",", "fetch_if_missing", ":", "bool", "=", "False", ")", "->", "Union", "[", "type", ",", "\"pyarrow.lib.Schema\"", "]", ":", "if", "not", "self", ".", "_executed", "[", "0", "]", ":", "self", ".", "_schema", "=", "self", ...
Return the schema of the dataset pipeline.
[ "Return", "the", "schema", "of", "the", "dataset", "pipeline", "." ]
[ "\"\"\"Return the schema of the dataset pipeline.\n\n For datasets of Arrow records, this will return the Arrow schema.\n For dataset of Python objects, this returns their Python type.\n\n Note: This is intended to be a method for peeking schema before\n the execution of DatasetPipeline....
[ { "param": "self", "type": null }, { "param": "fetch_if_missing", "type": "bool" } ]
{ "returns": [ { "docstring": "The Python type or Arrow schema of the records, or None if the\nschema is not known.", "docstring_tokens": [ "The", "Python", "type", "or", "Arrow", "schema", "of", "the", "records", "or", ...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
sum
int
def sum(self) -> int: """Sum the records in the dataset pipeline. This blocks until the entire pipeline is fully executed. Time complexity: O(dataset size / parallelism) Returns: The sum of the records in the dataset pipeline. """ if self._length == float("...
Sum the records in the dataset pipeline. This blocks until the entire pipeline is fully executed. Time complexity: O(dataset size / parallelism) Returns: The sum of the records in the dataset pipeline.
Sum the records in the dataset pipeline. This blocks until the entire pipeline is fully executed. Time complexity: O(dataset size / parallelism)
[ "Sum", "the", "records", "in", "the", "dataset", "pipeline", ".", "This", "blocks", "until", "the", "entire", "pipeline", "is", "fully", "executed", ".", "Time", "complexity", ":", "O", "(", "dataset", "size", "/", "parallelism", ")" ]
def sum(self) -> int: if self._length == float("inf"): raise ValueError("Cannot sum a pipeline of infinite length.") pipe = self.map_batches(lambda batch: [batch.sum()[0]], batch_format="pandas") total = 0 for elem in pipe.iter_rows(): total += elem return...
[ "def", "sum", "(", "self", ")", "->", "int", ":", "if", "self", ".", "_length", "==", "float", "(", "\"inf\"", ")", ":", "raise", "ValueError", "(", "\"Cannot sum a pipeline of infinite length.\"", ")", "pipe", "=", "self", ".", "map_batches", "(", "lambda",...
Sum the records in the dataset pipeline.
[ "Sum", "the", "records", "in", "the", "dataset", "pipeline", "." ]
[ "\"\"\"Sum the records in the dataset pipeline.\n\n This blocks until the entire pipeline is fully executed.\n\n Time complexity: O(dataset size / parallelism)\n\n Returns:\n The sum of the records in the dataset pipeline.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The sum of the records in the dataset pipeline.", "docstring_tokens": [ "The", "sum", "of", "the", "records", "in", "the", "dataset", "pipeline", "." ], "type": null } ], ...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
iter_epochs
Iterator["DatasetPipeline[T]"]
def iter_epochs(self) -> Iterator["DatasetPipeline[T]"]: """Split this pipeline up by epoch. This allows reading of data per-epoch for repeated Datasets, which is useful for ML training. For example, ``ray.data.range(10).repeat(50)`` generates a pipeline with 500 rows total split across...
Split this pipeline up by epoch. This allows reading of data per-epoch for repeated Datasets, which is useful for ML training. For example, ``ray.data.range(10).repeat(50)`` generates a pipeline with 500 rows total split across 50 epochs. This method allows iterating over the data indiv...
Split this pipeline up by epoch. This allows reading of data per-epoch for repeated Datasets, which is useful for ML training. For example, ``ray.data.range(10).repeat(50)`` generates a pipeline with 500 rows total split across 50 epochs. This method allows iterating over the data individually per epoch (repetition) of...
[ "Split", "this", "pipeline", "up", "by", "epoch", ".", "This", "allows", "reading", "of", "data", "per", "-", "epoch", "for", "repeated", "Datasets", "which", "is", "useful", "for", "ML", "training", ".", "For", "example", "`", "`", "ray", ".", "data", ...
def iter_epochs(self) -> Iterator["DatasetPipeline[T]"]: class Peekable: def __init__(self, base_iter: Iterator[T]): self._iter = base_iter self._buffer = None def _fill_buffer_if_possible(self): if self._buffer is None: ...
[ "def", "iter_epochs", "(", "self", ")", "->", "Iterator", "[", "\"DatasetPipeline[T]\"", "]", ":", "class", "Peekable", ":", "def", "__init__", "(", "self", ",", "base_iter", ":", "Iterator", "[", "T", "]", ")", ":", "self", ".", "_iter", "=", "base_iter...
Split this pipeline up by epoch.
[ "Split", "this", "pipeline", "up", "by", "epoch", "." ]
[ "\"\"\"Split this pipeline up by epoch.\n\n This allows reading of data per-epoch for repeated Datasets, which is\n useful for ML training. For example, ``ray.data.range(10).repeat(50)``\n generates a pipeline with 500 rows total split across 50 epochs. This\n method allows iterating ove...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Iterator over epoch objects, where each epoch is a DatasetPipeline\ncontaining data from that epoch only.", "docstring_tokens": [ "Iterator", "over", "epoch", "objects", "where", "each", "epoch", "is", ...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
iter_datasets
Iterator[Dataset[T]]
def iter_datasets(self) -> Iterator[Dataset[T]]: """Iterate over the output datasets of this pipeline. Returns: Iterator over the datasets outputted from this pipeline. """ if self._executed[0]: raise RuntimeError("Pipeline cannot be read multiple times.") ...
Iterate over the output datasets of this pipeline. Returns: Iterator over the datasets outputted from this pipeline.
Iterate over the output datasets of this pipeline.
[ "Iterate", "over", "the", "output", "datasets", "of", "this", "pipeline", "." ]
def iter_datasets(self) -> Iterator[Dataset[T]]: if self._executed[0]: raise RuntimeError("Pipeline cannot be read multiple times.") self._executed[0] = True if self._first_dataset is None: self._peek() iter = itertools.chain([self._first_dataset], self._dataset_i...
[ "def", "iter_datasets", "(", "self", ")", "->", "Iterator", "[", "Dataset", "[", "T", "]", "]", ":", "if", "self", ".", "_executed", "[", "0", "]", ":", "raise", "RuntimeError", "(", "\"Pipeline cannot be read multiple times.\"", ")", "self", ".", "_executed...
Iterate over the output datasets of this pipeline.
[ "Iterate", "over", "the", "output", "datasets", "of", "this", "pipeline", "." ]
[ "\"\"\"Iterate over the output datasets of this pipeline.\n\n Returns:\n Iterator over the datasets outputted from this pipeline.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Iterator over the datasets outputted from this pipeline.", "docstring_tokens": [ "Iterator", "over", "the", "datasets", "outputted", "from", "this", "pipeline", "." ], "type": null } ...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
foreach_window
"DatasetPipeline[U]"
def foreach_window( self, fn: Callable[[Dataset[T]], Dataset[U]] ) -> "DatasetPipeline[U]": """Apply a transform to each dataset/window in this pipeline. Args: fn: The function to transform each dataset with. Returns: The transformed DatasetPipeline. ...
Apply a transform to each dataset/window in this pipeline. Args: fn: The function to transform each dataset with. Returns: The transformed DatasetPipeline.
Apply a transform to each dataset/window in this pipeline.
[ "Apply", "a", "transform", "to", "each", "dataset", "/", "window", "in", "this", "pipeline", "." ]
def foreach_window( self, fn: Callable[[Dataset[T]], Dataset[U]] ) -> "DatasetPipeline[U]": if self._executed[0]: raise RuntimeError("Pipeline cannot be read multiple times.") return DatasetPipeline( self._base_iterable, self._stages + [fn], se...
[ "def", "foreach_window", "(", "self", ",", "fn", ":", "Callable", "[", "[", "Dataset", "[", "T", "]", "]", ",", "Dataset", "[", "U", "]", "]", ")", "->", "\"DatasetPipeline[U]\"", ":", "if", "self", ".", "_executed", "[", "0", "]", ":", "raise", "R...
Apply a transform to each dataset/window in this pipeline.
[ "Apply", "a", "transform", "to", "each", "dataset", "/", "window", "in", "this", "pipeline", "." ]
[ "\"\"\"Apply a transform to each dataset/window in this pipeline.\n\n Args:\n fn: The function to transform each dataset with.\n\n Returns:\n The transformed DatasetPipeline.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fn", "type": "Callable[[Dataset[T]], Dataset[U]]" } ]
{ "returns": [ { "docstring": "The transformed DatasetPipeline.", "docstring_tokens": [ "The", "transformed", "DatasetPipeline", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstri...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
stats
str
def stats(self, exclude_first_window: bool = True) -> str: """Returns a string containing execution timing information. Args: exclude_first_window: Whether to exclude the first window from the pipeline time breakdown. This is generally a good idea since there...
Returns a string containing execution timing information. Args: exclude_first_window: Whether to exclude the first window from the pipeline time breakdown. This is generally a good idea since there is always a stall waiting for the first window to be ...
Returns a string containing execution timing information.
[ "Returns", "a", "string", "containing", "execution", "timing", "information", "." ]
def stats(self, exclude_first_window: bool = True) -> str: return self._stats.summary_string(exclude_first_window)
[ "def", "stats", "(", "self", ",", "exclude_first_window", ":", "bool", "=", "True", ")", "->", "str", ":", "return", "self", ".", "_stats", ".", "summary_string", "(", "exclude_first_window", ")" ]
Returns a string containing execution timing information.
[ "Returns", "a", "string", "containing", "execution", "timing", "information", "." ]
[ "\"\"\"Returns a string containing execution timing information.\n\n Args:\n exclude_first_window: Whether to exclude the first window from\n the pipeline time breakdown. This is generally a good idea\n since there is always a stall waiting for the first window to\n ...
[ { "param": "self", "type": null }, { "param": "exclude_first_window", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exclude_first_window", "type": "bool", "docstring": "Whether to exc...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
from_iterable
"DatasetPipeline[T]"
def from_iterable( iterable: Iterable[Callable[[], Dataset[T]]], ) -> "DatasetPipeline[T]": """Create a pipeline from an sequence of Dataset producing functions. Args: iterable: A finite or infinite-length sequence of functions that each produce a Dataset when ca...
Create a pipeline from an sequence of Dataset producing functions. Args: iterable: A finite or infinite-length sequence of functions that each produce a Dataset when called.
Create a pipeline from an sequence of Dataset producing functions.
[ "Create", "a", "pipeline", "from", "an", "sequence", "of", "Dataset", "producing", "functions", "." ]
def from_iterable( iterable: Iterable[Callable[[], Dataset[T]]], ) -> "DatasetPipeline[T]": if hasattr(iterable, "__len__"): length = len(iterable) else: length = None return DatasetPipeline(iterable, length=length)
[ "def", "from_iterable", "(", "iterable", ":", "Iterable", "[", "Callable", "[", "[", "]", ",", "Dataset", "[", "T", "]", "]", "]", ",", ")", "->", "\"DatasetPipeline[T]\"", ":", "if", "hasattr", "(", "iterable", ",", "\"__len__\"", ")", ":", "length", ...
Create a pipeline from an sequence of Dataset producing functions.
[ "Create", "a", "pipeline", "from", "an", "sequence", "of", "Dataset", "producing", "functions", "." ]
[ "\"\"\"Create a pipeline from an sequence of Dataset producing functions.\n\n Args:\n iterable: A finite or infinite-length sequence of functions that\n each produce a Dataset when called.\n \"\"\"" ]
[ { "param": "iterable", "type": "Iterable[Callable[[], Dataset[T]]]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "iterable", "type": "Iterable[Callable[[], Dataset[T]]]", "docstring": "A finite or infinite-length sequence of functions that\neach produce a Dataset when called.", "docstring_tokens": [ "A", "finite", ...
f70f499b3938d65a8dec688ff8e18592b5f6b4c1
kisuke95/ray
python/ray/data/dataset_pipeline.py
[ "Apache-2.0" ]
Python
_optimize_stages
<not_specific>
def _optimize_stages(self): """Optimize this pipeline, fusing stages together as possible.""" context = DatasetContext.get_current() if not context.optimize_fuse_stages: self._optimized_stages = self._stages return # This dummy dataset will be used to get a set ...
Optimize this pipeline, fusing stages together as possible.
Optimize this pipeline, fusing stages together as possible.
[ "Optimize", "this", "pipeline", "fusing", "stages", "together", "as", "possible", "." ]
def _optimize_stages(self): context = DatasetContext.get_current() if not context.optimize_fuse_stages: self._optimized_stages = self._stages return dummy_ds = Dataset( ExecutionPlan(BlockList([], []), DatasetStats(stages={}, parent=None)), 0, ...
[ "def", "_optimize_stages", "(", "self", ")", ":", "context", "=", "DatasetContext", ".", "get_current", "(", ")", "if", "not", "context", ".", "optimize_fuse_stages", ":", "self", ".", "_optimized_stages", "=", "self", ".", "_stages", "return", "dummy_ds", "="...
Optimize this pipeline, fusing stages together as possible.
[ "Optimize", "this", "pipeline", "fusing", "stages", "together", "as", "possible", "." ]
[ "\"\"\"Optimize this pipeline, fusing stages together as possible.\"\"\"", "# This dummy dataset will be used to get a set of optimized stages.", "# Apply all pipeline operations to the dummy dataset.", "# Get the optimized stages.", "# Apply these optimized stages to the datasets underlying the pipeline.",...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
12bae7d64dfbe2b07326dde01e8f9080a08df391
kisuke95/ray
python/ray/_private/gcs_pubsub.py
[ "Apache-2.0" ]
Python
publish_error
None
def publish_error(self, key_id: bytes, error_info: ErrorTableData) -> None: """Publishes error info to GCS.""" msg = pubsub_pb2.PubMessage( channel_type=pubsub_pb2.RAY_ERROR_INFO_CHANNEL, key_id=key_id, error_info_message=error_info, ) req = gcs_servic...
Publishes error info to GCS.
Publishes error info to GCS.
[ "Publishes", "error", "info", "to", "GCS", "." ]
def publish_error(self, key_id: bytes, error_info: ErrorTableData) -> None: msg = pubsub_pb2.PubMessage( channel_type=pubsub_pb2.RAY_ERROR_INFO_CHANNEL, key_id=key_id, error_info_message=error_info, ) req = gcs_service_pb2.GcsPublishRequest(pub_messages=[msg])...
[ "def", "publish_error", "(", "self", ",", "key_id", ":", "bytes", ",", "error_info", ":", "ErrorTableData", ")", "->", "None", ":", "msg", "=", "pubsub_pb2", ".", "PubMessage", "(", "channel_type", "=", "pubsub_pb2", ".", "RAY_ERROR_INFO_CHANNEL", ",", "key_id...
Publishes error info to GCS.
[ "Publishes", "error", "info", "to", "GCS", "." ]
[ "\"\"\"Publishes error info to GCS.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "key_id", "type": "bytes" }, { "param": "error_info", "type": "ErrorTableData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "key_id", "type": "bytes", "docstring": null, "docstring_token...
12bae7d64dfbe2b07326dde01e8f9080a08df391
kisuke95/ray
python/ray/_private/gcs_pubsub.py
[ "Apache-2.0" ]
Python
poll
Optional[bytes]
def poll(self, timeout=None) -> Optional[bytes]: """Polls for new actor messages. Returns: A byte string of function key. None if polling times out or subscriber closed. """ with self._lock: self._poll_locked(timeout=timeout) return self._...
Polls for new actor messages. Returns: A byte string of function key. None if polling times out or subscriber closed.
Polls for new actor messages.
[ "Polls", "for", "new", "actor", "messages", "." ]
def poll(self, timeout=None) -> Optional[bytes]: with self._lock: self._poll_locked(timeout=timeout) return self._pop_actor(self._queue)
[ "def", "poll", "(", "self", ",", "timeout", "=", "None", ")", "->", "Optional", "[", "bytes", "]", ":", "with", "self", ".", "_lock", ":", "self", ".", "_poll_locked", "(", "timeout", "=", "timeout", ")", "return", "self", ".", "_pop_actor", "(", "se...
Polls for new actor messages.
[ "Polls", "for", "new", "actor", "messages", "." ]
[ "\"\"\"Polls for new actor messages.\n\n Returns:\n A byte string of function key.\n None if polling times out or subscriber closed.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "timeout", "type": null } ]
{ "returns": [ { "docstring": "A byte string of function key.\nNone if polling times out or subscriber closed.", "docstring_tokens": [ "A", "byte", "string", "of", "function", "key", ".", "None", "if", "polling", "...
12bae7d64dfbe2b07326dde01e8f9080a08df391
kisuke95/ray
python/ray/_private/gcs_pubsub.py
[ "Apache-2.0" ]
Python
publish_error
None
async def publish_error(self, key_id: bytes, error_info: ErrorTableData) -> None: """Publishes error info to GCS.""" msg = pubsub_pb2.PubMessage( channel_type=pubsub_pb2.RAY_ERROR_INFO_CHANNEL, key_id=key_id, error_info_message=error_info, ) req = gcs_...
Publishes error info to GCS.
Publishes error info to GCS.
[ "Publishes", "error", "info", "to", "GCS", "." ]
async def publish_error(self, key_id: bytes, error_info: ErrorTableData) -> None: msg = pubsub_pb2.PubMessage( channel_type=pubsub_pb2.RAY_ERROR_INFO_CHANNEL, key_id=key_id, error_info_message=error_info, ) req = gcs_service_pb2.GcsPublishRequest(pub_messages=...
[ "async", "def", "publish_error", "(", "self", ",", "key_id", ":", "bytes", ",", "error_info", ":", "ErrorTableData", ")", "->", "None", ":", "msg", "=", "pubsub_pb2", ".", "PubMessage", "(", "channel_type", "=", "pubsub_pb2", ".", "RAY_ERROR_INFO_CHANNEL", ","...
Publishes error info to GCS.
[ "Publishes", "error", "info", "to", "GCS", "." ]
[ "\"\"\"Publishes error info to GCS.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "key_id", "type": "bytes" }, { "param": "error_info", "type": "ErrorTableData" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "key_id", "type": "bytes", "docstring": null, "docstring_token...
dda38c6f1ddc4f1300d5e08e1df2a51fa2626db4
kisuke95/ray
rllib/agents/trainer.py
[ "Apache-2.0" ]
Python
with_common_config
TrainerConfigDict
def with_common_config(extra_config: PartialTrainerConfigDict) -> TrainerConfigDict: """Returns the given config dict merged with common agent confs. Args: extra_config (PartialTrainerConfigDict): A user defined partial config which will get merged with COMMON_CONFIG and returned. Retu...
Returns the given config dict merged with common agent confs. Args: extra_config (PartialTrainerConfigDict): A user defined partial config which will get merged with COMMON_CONFIG and returned. Returns: TrainerConfigDict: The merged config dict resulting of COMMON_CONFIG ...
Returns the given config dict merged with common agent confs.
[ "Returns", "the", "given", "config", "dict", "merged", "with", "common", "agent", "confs", "." ]
def with_common_config(extra_config: PartialTrainerConfigDict) -> TrainerConfigDict: return Trainer.merge_trainer_configs( COMMON_CONFIG, extra_config, _allow_unknown_configs=True )
[ "def", "with_common_config", "(", "extra_config", ":", "PartialTrainerConfigDict", ")", "->", "TrainerConfigDict", ":", "return", "Trainer", ".", "merge_trainer_configs", "(", "COMMON_CONFIG", ",", "extra_config", ",", "_allow_unknown_configs", "=", "True", ")" ]
Returns the given config dict merged with common agent confs.
[ "Returns", "the", "given", "config", "dict", "merged", "with", "common", "agent", "confs", "." ]
[ "\"\"\"Returns the given config dict merged with common agent confs.\n\n Args:\n extra_config (PartialTrainerConfigDict): A user defined partial config\n which will get merged with COMMON_CONFIG and returned.\n\n Returns:\n TrainerConfigDict: The merged config dict resulting of COMMON...
[ { "param": "extra_config", "type": "PartialTrainerConfigDict" } ]
{ "returns": [ { "docstring": "The merged config dict resulting of COMMON_CONFIG\nplus `extra_config`.", "docstring_tokens": [ "The", "merged", "config", "dict", "resulting", "of", "COMMON_CONFIG", "plus", "`", "extra_conf...
dda38c6f1ddc4f1300d5e08e1df2a51fa2626db4
kisuke95/ray
rllib/agents/trainer.py
[ "Apache-2.0" ]
Python
step
ResultDict
def step(self) -> ResultDict: """Implements the main `Trainer.train()` logic. Takes n attempts to perform a single training step. Thereby catches RayErrors resulting from worker failures. After n attempts, fails gracefully. Override this method in your Trainer sub-classes if yo...
Implements the main `Trainer.train()` logic. Takes n attempts to perform a single training step. Thereby catches RayErrors resulting from worker failures. After n attempts, fails gracefully. Override this method in your Trainer sub-classes if you would like to handle worker fai...
Implements the main `Trainer.train()` logic. Takes n attempts to perform a single training step. Thereby catches RayErrors resulting from worker failures. After n attempts, fails gracefully. Override this method in your Trainer sub-classes if you would like to handle worker failures yourself. Otherwise, override `self...
[ "Implements", "the", "main", "`", "Trainer", ".", "train", "()", "`", "logic", ".", "Takes", "n", "attempts", "to", "perform", "a", "single", "training", "step", ".", "Thereby", "catches", "RayErrors", "resulting", "from", "worker", "failures", ".", "After",...
def step(self) -> ResultDict: step_attempt_results = None with self._step_context() as step_ctx: while not step_ctx.should_stop(step_attempt_results): try: step_attempt_results = self.step_attempt() except RayError as e: ...
[ "def", "step", "(", "self", ")", "->", "ResultDict", ":", "step_attempt_results", "=", "None", "with", "self", ".", "_step_context", "(", ")", "as", "step_ctx", ":", "while", "not", "step_ctx", ".", "should_stop", "(", "step_attempt_results", ")", ":", "try"...
Implements the main `Trainer.train()` logic.
[ "Implements", "the", "main", "`", "Trainer", ".", "train", "()", "`", "logic", "." ]
[ "\"\"\"Implements the main `Trainer.train()` logic.\n\n Takes n attempts to perform a single training step. Thereby\n catches RayErrors resulting from worker failures. After n attempts,\n fails gracefully.\n\n Override this method in your Trainer sub-classes if you would like to\n ...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The results dict with stats/infos on sampling, training,\nand - if required - evaluation.", "docstring_tokens": [ "The", "results", "dict", "with", "stats", "/", "infos", "on", "sampling", "t...
dda38c6f1ddc4f1300d5e08e1df2a51fa2626db4
kisuke95/ray
rllib/agents/trainer.py
[ "Apache-2.0" ]
Python
training_iteration
ResultDict
def training_iteration(self) -> ResultDict: """Default single iteration logic of an algorithm. - Collect on-policy samples (SampleBatches) in parallel using the Trainer's RolloutWorkers (@ray.remote). - Concatenate collected SampleBatches into one train batch. - Note that we m...
Default single iteration logic of an algorithm. - Collect on-policy samples (SampleBatches) in parallel using the Trainer's RolloutWorkers (@ray.remote). - Concatenate collected SampleBatches into one train batch. - Note that we may have more than one policy in the multi-agent case: ...
Default single iteration logic of an algorithm. Collect on-policy samples (SampleBatches) in parallel using the Trainer's RolloutWorkers (@ray.remote). Concatenate collected SampleBatches into one train batch.
[ "Default", "single", "iteration", "logic", "of", "an", "algorithm", ".", "Collect", "on", "-", "policy", "samples", "(", "SampleBatches", ")", "in", "parallel", "using", "the", "Trainer", "'", "s", "RolloutWorkers", "(", "@ray", ".", "remote", ")", ".", "C...
def training_iteration(self) -> ResultDict: if self._by_agent_steps: train_batch = synchronous_parallel_sample( worker_set=self.workers, max_agent_steps=self.config["train_batch_size"] ) else: train_batch = synchronous_parallel_sample( ...
[ "def", "training_iteration", "(", "self", ")", "->", "ResultDict", ":", "if", "self", ".", "_by_agent_steps", ":", "train_batch", "=", "synchronous_parallel_sample", "(", "worker_set", "=", "self", ".", "workers", ",", "max_agent_steps", "=", "self", ".", "confi...
Default single iteration logic of an algorithm.
[ "Default", "single", "iteration", "logic", "of", "an", "algorithm", "." ]
[ "\"\"\"Default single iteration logic of an algorithm.\n\n - Collect on-policy samples (SampleBatches) in parallel using the\n Trainer's RolloutWorkers (@ray.remote).\n - Concatenate collected SampleBatches into one train batch.\n - Note that we may have more than one policy in the mul...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "The results dict from executing the training iteration.", "docstring_tokens": [ "The", "results", "dict", "from", "executing", "the", "training", "iteration", "." ], "type": null } ...
dda38c6f1ddc4f1300d5e08e1df2a51fa2626db4
kisuke95/ray
rllib/agents/trainer.py
[ "Apache-2.0" ]
Python
validate_config
None
def validate_config(self, config: TrainerConfigDict) -> None: """Validates a given config dict for this Trainer. Users should override this method to implement custom validation behavior. It is recommended to call `super().validate_config()` in this override. Args: ...
Validates a given config dict for this Trainer. Users should override this method to implement custom validation behavior. It is recommended to call `super().validate_config()` in this override. Args: config: The given config dict to check. Raises: Valu...
Validates a given config dict for this Trainer. Users should override this method to implement custom validation behavior. It is recommended to call `super().validate_config()` in this override.
[ "Validates", "a", "given", "config", "dict", "for", "this", "Trainer", ".", "Users", "should", "override", "this", "method", "to", "implement", "custom", "validation", "behavior", ".", "It", "is", "recommended", "to", "call", "`", "super", "()", ".", "valida...
def validate_config(self, config: TrainerConfigDict) -> None: model_config = config.get("model") if model_config is None: config["model"] = model_config = {} if config.get("monitor", DEPRECATED_VALUE) != DEPRECATED_VALUE: deprecation_warning("monitor", "record_env", error...
[ "def", "validate_config", "(", "self", ",", "config", ":", "TrainerConfigDict", ")", "->", "None", ":", "model_config", "=", "config", ".", "get", "(", "\"model\"", ")", "if", "model_config", "is", "None", ":", "config", "[", "\"model\"", "]", "=", "model_...
Validates a given config dict for this Trainer.
[ "Validates", "a", "given", "config", "dict", "for", "this", "Trainer", "." ]
[ "\"\"\"Validates a given config dict for this Trainer.\n\n Users should override this method to implement custom validation\n behavior. It is recommended to call `super().validate_config()` in\n this override.\n\n Args:\n config: The given config dict to check.\n\n Rais...
[ { "param": "self", "type": null }, { "param": "config", "type": "TrainerConfigDict" } ]
{ "returns": [], "raises": [ { "docstring": "If there is something wrong with the config.", "docstring_tokens": [ "If", "there", "is", "something", "wrong", "with", "the", "config", "." ], "type": "ValueError" } ...
dda38c6f1ddc4f1300d5e08e1df2a51fa2626db4
kisuke95/ray
rllib/agents/trainer.py
[ "Apache-2.0" ]
Python
try_recover_from_step_attempt
None
def try_recover_from_step_attempt(self) -> None: """Try to identify and remove any unhealthy workers. This method is called after an unexpected remote error is encountered from a worker during the call to `self.step_attempt()` (within `self.step()`). It issues check requests to all curr...
Try to identify and remove any unhealthy workers. This method is called after an unexpected remote error is encountered from a worker during the call to `self.step_attempt()` (within `self.step()`). It issues check requests to all current workers and removes any that respond with error....
Try to identify and remove any unhealthy workers. This method is called after an unexpected remote error is encountered from a worker during the call to `self.step_attempt()` (within `self.step()`). It issues check requests to all current workers and removes any that respond with error. If no healthy workers remain, an...
[ "Try", "to", "identify", "and", "remove", "any", "unhealthy", "workers", ".", "This", "method", "is", "called", "after", "an", "unexpected", "remote", "error", "is", "encountered", "from", "a", "worker", "during", "the", "call", "to", "`", "self", ".", "st...
def try_recover_from_step_attempt(self) -> None: workers = getattr(self, "workers", None) if not isinstance(workers, WorkerSet): return if self.config["recreate_failed_workers"] is True: workers.recreate_failed_workers() elif self.config["ignore_worker_failures"] ...
[ "def", "try_recover_from_step_attempt", "(", "self", ")", "->", "None", ":", "workers", "=", "getattr", "(", "self", ",", "\"workers\"", ",", "None", ")", "if", "not", "isinstance", "(", "workers", ",", "WorkerSet", ")", ":", "return", "if", "self", ".", ...
Try to identify and remove any unhealthy workers.
[ "Try", "to", "identify", "and", "remove", "any", "unhealthy", "workers", "." ]
[ "\"\"\"Try to identify and remove any unhealthy workers.\n\n This method is called after an unexpected remote error is encountered\n from a worker during the call to `self.step_attempt()` (within\n `self.step()`). It issues check requests to all current workers and\n removes any that res...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
dda38c6f1ddc4f1300d5e08e1df2a51fa2626db4
kisuke95/ray
rllib/agents/trainer.py
[ "Apache-2.0" ]
Python
_create_local_replay_buffer_if_necessary
Optional[Union[MultiAgentReplayBuffer, Legacy_MultiAgentReplayBuffer]]
def _create_local_replay_buffer_if_necessary( self, config: PartialTrainerConfigDict ) -> Optional[Union[MultiAgentReplayBuffer, Legacy_MultiAgentReplayBuffer]]: """Create a MultiAgentReplayBuffer instance if necessary. Args: config: Algorithm-specific configuration data. ...
Create a MultiAgentReplayBuffer instance if necessary. Args: config: Algorithm-specific configuration data. Returns: MultiAgentReplayBuffer instance based on trainer config. None, if local replay buffer is not needed.
Create a MultiAgentReplayBuffer instance if necessary.
[ "Create", "a", "MultiAgentReplayBuffer", "instance", "if", "necessary", "." ]
def _create_local_replay_buffer_if_necessary( self, config: PartialTrainerConfigDict ) -> Optional[Union[MultiAgentReplayBuffer, Legacy_MultiAgentReplayBuffer]]: if not config.get("replay_buffer_config") or config["replay_buffer_config"].get( "no_local_replay_buffer" or config.get("no_lo...
[ "def", "_create_local_replay_buffer_if_necessary", "(", "self", ",", "config", ":", "PartialTrainerConfigDict", ")", "->", "Optional", "[", "Union", "[", "MultiAgentReplayBuffer", ",", "Legacy_MultiAgentReplayBuffer", "]", "]", ":", "if", "not", "config", ".", "get", ...
Create a MultiAgentReplayBuffer instance if necessary.
[ "Create", "a", "MultiAgentReplayBuffer", "instance", "if", "necessary", "." ]
[ "\"\"\"Create a MultiAgentReplayBuffer instance if necessary.\n\n Args:\n config: Algorithm-specific configuration data.\n\n Returns:\n MultiAgentReplayBuffer instance based on trainer config.\n None, if local replay buffer is not needed.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "config", "type": "PartialTrainerConfigDict" } ]
{ "returns": [ { "docstring": "MultiAgentReplayBuffer instance based on trainer config.\nNone, if local replay buffer is not needed.", "docstring_tokens": [ "MultiAgentReplayBuffer", "instance", "based", "on", "trainer", "config", ".", "N...
5d7278a4a9e37cb656fb971b4f322f9bd5410455
kisuke95/ray
python/ray/tune/impl/tuner_internal.py
[ "Apache-2.0" ]
Python
_fit_internal
ExperimentAnalysis
def _fit_internal(self, trainable, param_space) -> ExperimentAnalysis: """Fitting for a fresh Tuner.""" analysis = run( trainable, config={**param_space}, mode=self._tune_config.mode, metric=self._tune_config.metric, num_samples=self._tune_conf...
Fitting for a fresh Tuner.
Fitting for a fresh Tuner.
[ "Fitting", "for", "a", "fresh", "Tuner", "." ]
def _fit_internal(self, trainable, param_space) -> ExperimentAnalysis: analysis = run( trainable, config={**param_space}, mode=self._tune_config.mode, metric=self._tune_config.metric, num_samples=self._tune_config.num_samples, search_alg=se...
[ "def", "_fit_internal", "(", "self", ",", "trainable", ",", "param_space", ")", "->", "ExperimentAnalysis", ":", "analysis", "=", "run", "(", "trainable", ",", "config", "=", "{", "**", "param_space", "}", ",", "mode", "=", "self", ".", "_tune_config", "."...
Fitting for a fresh Tuner.
[ "Fitting", "for", "a", "fresh", "Tuner", "." ]
[ "\"\"\"Fitting for a fresh Tuner.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "trainable", "type": null }, { "param": "param_space", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "trainable", "type": null, "docstring": null, "docstring_token...
5d7278a4a9e37cb656fb971b4f322f9bd5410455
kisuke95/ray
python/ray/tune/impl/tuner_internal.py
[ "Apache-2.0" ]
Python
_fit_resume
ExperimentAnalysis
def _fit_resume(self, trainable) -> ExperimentAnalysis: """Fitting for a restored Tuner.""" analysis = run( trainable, resume=True, mode=self._tune_config.mode, metric=self._tune_config.metric, callbacks=self._run_config.callbacks, ...
Fitting for a restored Tuner.
Fitting for a restored Tuner.
[ "Fitting", "for", "a", "restored", "Tuner", "." ]
def _fit_resume(self, trainable) -> ExperimentAnalysis: analysis = run( trainable, resume=True, mode=self._tune_config.mode, metric=self._tune_config.metric, callbacks=self._run_config.callbacks, sync_config=self._run_config.sync_config, ...
[ "def", "_fit_resume", "(", "self", ",", "trainable", ")", "->", "ExperimentAnalysis", ":", "analysis", "=", "run", "(", "trainable", ",", "resume", "=", "True", ",", "mode", "=", "self", ".", "_tune_config", ".", "mode", ",", "metric", "=", "self", ".", ...
Fitting for a restored Tuner.
[ "Fitting", "for", "a", "restored", "Tuner", "." ]
[ "\"\"\"Fitting for a restored Tuner.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "trainable", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "trainable", "type": null, "docstring": null, "docstring_token...
530072e3d8a446f688bb91f33323639894d1e997
kisuke95/ray
python/ray/serve/controller.py
[ "Apache-2.0" ]
Python
autoscale
None
def autoscale(self) -> None: """Updates autoscaling deployments with calculated num_replicas.""" for deployment_name, ( deployment_info, route_prefix, ) in self.list_deployments_internal().items(): deployment_config = deployment_info.deployment_config ...
Updates autoscaling deployments with calculated num_replicas.
Updates autoscaling deployments with calculated num_replicas.
[ "Updates", "autoscaling", "deployments", "with", "calculated", "num_replicas", "." ]
def autoscale(self) -> None: for deployment_name, ( deployment_info, route_prefix, ) in self.list_deployments_internal().items(): deployment_config = deployment_info.deployment_config autoscaling_policy = deployment_info.autoscaling_policy if a...
[ "def", "autoscale", "(", "self", ")", "->", "None", ":", "for", "deployment_name", ",", "(", "deployment_info", ",", "route_prefix", ",", ")", "in", "self", ".", "list_deployments_internal", "(", ")", ".", "items", "(", ")", ":", "deployment_config", "=", ...
Updates autoscaling deployments with calculated num_replicas.
[ "Updates", "autoscaling", "deployments", "with", "calculated", "num_replicas", "." ]
[ "\"\"\"Updates autoscaling deployments with calculated num_replicas.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f7a4ef2c750a0c6a8f48d1ec7cca2fd3b8ff72f4
kisuke95/ray
python/ray/ml/predictors/integrations/sklearn/sklearn_predictor.py
[ "Apache-2.0" ]
Python
from_checkpoint
"SklearnPredictor"
def from_checkpoint(cls, checkpoint: Checkpoint) -> "SklearnPredictor": """Instantiate the predictor from a Checkpoint. The checkpoint is expected to be a result of ``SklearnTrainer``. Args: checkpoint (Checkpoint): The checkpoint to load the model and preprocessor ...
Instantiate the predictor from a Checkpoint. The checkpoint is expected to be a result of ``SklearnTrainer``. Args: checkpoint (Checkpoint): The checkpoint to load the model and preprocessor from. It is expected to be from the result of a ``SklearnTrainer`` ...
Instantiate the predictor from a Checkpoint. The checkpoint is expected to be a result of ``SklearnTrainer``.
[ "Instantiate", "the", "predictor", "from", "a", "Checkpoint", ".", "The", "checkpoint", "is", "expected", "to", "be", "a", "result", "of", "`", "`", "SklearnTrainer", "`", "`", "." ]
def from_checkpoint(cls, checkpoint: Checkpoint) -> "SklearnPredictor": with checkpoint.as_directory() as path: estimator_path = os.path.join(path, MODEL_KEY) with open(estimator_path, "rb") as f: estimator = cpickle.load(f) preprocessor_path = os.path.join(pa...
[ "def", "from_checkpoint", "(", "cls", ",", "checkpoint", ":", "Checkpoint", ")", "->", "\"SklearnPredictor\"", ":", "with", "checkpoint", ".", "as_directory", "(", ")", "as", "path", ":", "estimator_path", "=", "os", ".", "path", ".", "join", "(", "path", ...
Instantiate the predictor from a Checkpoint.
[ "Instantiate", "the", "predictor", "from", "a", "Checkpoint", "." ]
[ "\"\"\"Instantiate the predictor from a Checkpoint.\n\n The checkpoint is expected to be a result of ``SklearnTrainer``.\n\n Args:\n checkpoint (Checkpoint): The checkpoint to load the model and\n preprocessor from. It is expected to be from the result of a\n `...
[ { "param": "cls", "type": null }, { "param": "checkpoint", "type": "Checkpoint" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "checkpoint", "type": "Checkpoint", "docstring": "The checkpoint to l...
f7a4ef2c750a0c6a8f48d1ec7cca2fd3b8ff72f4
kisuke95/ray
python/ray/ml/predictors/integrations/sklearn/sklearn_predictor.py
[ "Apache-2.0" ]
Python
predict
pd.DataFrame
def predict( self, data: DataBatchType, feature_columns: Optional[Union[List[str], List[int]]] = None, num_estimator_cpus: Optional[int] = 1, **predict_kwargs, ) -> pd.DataFrame: """Run inference on data batch. Args: data: A batch of input data. E...
Run inference on data batch. Args: data: A batch of input data. Either a pandas DataFrame or numpy array. feature_columns: The names or indices of the columns in the data to use as features to predict on. If None, then use all columns in `...
Run inference on data batch.
[ "Run", "inference", "on", "data", "batch", "." ]
def predict( self, data: DataBatchType, feature_columns: Optional[Union[List[str], List[int]]] = None, num_estimator_cpus: Optional[int] = 1, **predict_kwargs, ) -> pd.DataFrame: register_ray() if self.preprocessor: data = self.preprocessor.transfo...
[ "def", "predict", "(", "self", ",", "data", ":", "DataBatchType", ",", "feature_columns", ":", "Optional", "[", "Union", "[", "List", "[", "str", "]", ",", "List", "[", "int", "]", "]", "]", "=", "None", ",", "num_estimator_cpus", ":", "Optional", "[",...
Run inference on data batch.
[ "Run", "inference", "on", "data", "batch", "." ]
[ "\"\"\"Run inference on data batch.\n\n Args:\n data: A batch of input data. Either a pandas DataFrame or numpy\n array.\n feature_columns: The names or indices of the columns in the\n data to use as features to predict on. If None, then use\n ...
[ { "param": "self", "type": null }, { "param": "data", "type": "DataBatchType" }, { "param": "feature_columns", "type": "Optional[Union[List[str], List[int]]]" }, { "param": "num_estimator_cpus", "type": "Optional[int]" } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "pd.DataFrame" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional...
679f2111cfa480f017404128b5e1750785de79b0
kisuke95/ray
python/ray/serve/pipeline/tests/test_generate.py
[ "Apache-2.0" ]
Python
_validate_consistent_python_output
null
def _validate_consistent_python_output( deployment, dag, handle_by_name, input=None, output=None ): """Assert same input lead to same outputs across the following: 1) Deployment handle returned from Deployment instance get_handle() 2) Original executable Ray DAG 3) Deployment handle return from serv...
Assert same input lead to same outputs across the following: 1) Deployment handle returned from Deployment instance get_handle() 2) Original executable Ray DAG 3) Deployment handle return from serve public API get_deployment()
Assert same input lead to same outputs across the following: 1) Deployment handle returned from Deployment instance get_handle() 2) Original executable Ray DAG 3) Deployment handle return from serve public API get_deployment()
[ "Assert", "same", "input", "lead", "to", "same", "outputs", "across", "the", "following", ":", "1", ")", "Deployment", "handle", "returned", "from", "Deployment", "instance", "get_handle", "()", "2", ")", "Original", "executable", "Ray", "DAG", "3", ")", "De...
def _validate_consistent_python_output( deployment, dag, handle_by_name, input=None, output=None ): deployment_handle = deployment.get_handle() assert ray.get(deployment_handle.remote(input)) == output assert ray.get(dag.execute(input)) == output handle_by_name = serve.get_deployment(handle_by_name)...
[ "def", "_validate_consistent_python_output", "(", "deployment", ",", "dag", ",", "handle_by_name", ",", "input", "=", "None", ",", "output", "=", "None", ")", ":", "deployment_handle", "=", "deployment", ".", "get_handle", "(", ")", "assert", "ray", ".", "get"...
Assert same input lead to same outputs across the following: 1) Deployment handle returned from Deployment instance get_handle() 2) Original executable Ray DAG 3) Deployment handle return from serve public API get_deployment()
[ "Assert", "same", "input", "lead", "to", "same", "outputs", "across", "the", "following", ":", "1", ")", "Deployment", "handle", "returned", "from", "Deployment", "instance", "get_handle", "()", "2", ")", "Original", "executable", "Ray", "DAG", "3", ")", "De...
[ "\"\"\"Assert same input lead to same outputs across the following:\n 1) Deployment handle returned from Deployment instance get_handle()\n 2) Original executable Ray DAG\n 3) Deployment handle return from serve public API get_deployment()\n \"\"\"" ]
[ { "param": "deployment", "type": null }, { "param": "dag", "type": null }, { "param": "handle_by_name", "type": null }, { "param": "input", "type": null }, { "param": "output", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "deployment", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dag", "type": null, "docstring": null, "docstring_token...
3633bc92661c7a1ade7a994a14d0ad8aa98eb7d4
kisuke95/ray
python/ray/tune/suggest/variant_generator.py
[ "Apache-2.0" ]
Python
generate_variants
Generator[Tuple[Dict, Dict], None, None]
def generate_variants( unresolved_spec: Dict, constant_grid_search: bool = False, random_state: "RandomState" = None, ) -> Generator[Tuple[Dict, Dict], None, None]: """Generates variants from a spec (dict) with unresolved values. There are two types of unresolved values: Grid search: These...
Generates variants from a spec (dict) with unresolved values. There are two types of unresolved values: Grid search: These define a grid search over values. For example, the following grid search values in a spec will produce six distinct variants in combination: "activation":...
Generates variants from a spec (dict) with unresolved values. There are two types of unresolved values. Grid search: These define a grid search over values. For example, the following grid search values in a spec will produce six distinct variants in combination. Lambda functions: These are evaluated to produce a c...
[ "Generates", "variants", "from", "a", "spec", "(", "dict", ")", "with", "unresolved", "values", ".", "There", "are", "two", "types", "of", "unresolved", "values", ".", "Grid", "search", ":", "These", "define", "a", "grid", "search", "over", "values", ".", ...
def generate_variants( unresolved_spec: Dict, constant_grid_search: bool = False, random_state: "RandomState" = None, ) -> Generator[Tuple[Dict, Dict], None, None]: for resolved_vars, spec in _generate_variants( unresolved_spec, constant_grid_search=constant_grid_search, random_s...
[ "def", "generate_variants", "(", "unresolved_spec", ":", "Dict", ",", "constant_grid_search", ":", "bool", "=", "False", ",", "random_state", ":", "\"RandomState\"", "=", "None", ",", ")", "->", "Generator", "[", "Tuple", "[", "Dict", ",", "Dict", "]", ",", ...
Generates variants from a spec (dict) with unresolved values.
[ "Generates", "variants", "from", "a", "spec", "(", "dict", ")", "with", "unresolved", "values", "." ]
[ "\"\"\"Generates variants from a spec (dict) with unresolved values.\n\n There are two types of unresolved values:\n\n Grid search: These define a grid search over values. For example, the\n following grid search values in a spec will produce six distinct\n variants in combination:\n\n ...
[ { "param": "unresolved_spec", "type": "Dict" }, { "param": "constant_grid_search", "type": "bool" }, { "param": "random_state", "type": "\"RandomState\"" } ]
{ "returns": [ { "docstring": "(Dict of resolved variables, Spec object)", "docstring_tokens": [ "(", "Dict", "of", "resolved", "variables", "Spec", "object", ")" ], "type": null } ], "raises": [], "params": [ { ...
3633bc92661c7a1ade7a994a14d0ad8aa98eb7d4
kisuke95/ray
python/ray/tune/suggest/variant_generator.py
[ "Apache-2.0" ]
Python
format_vars
str
def format_vars(resolved_vars: Dict) -> str: """Format variables to be used as experiment tags. Experiment tags are used in directory names, so this method makes sure the resulting tags can be legally used in directory names on all systems. The input to this function is a dict of the form ``{("nes...
Format variables to be used as experiment tags. Experiment tags are used in directory names, so this method makes sure the resulting tags can be legally used in directory names on all systems. The input to this function is a dict of the form ``{("nested", "config", "path"): "value"}``. The output will...
Format variables to be used as experiment tags. Experiment tags are used in directory names, so this method makes sure the resulting tags can be legally used in directory names on all systems. Note that the sanitizing implies that empty strings are possible return values. This is expected and acceptable, as it is no...
[ "Format", "variables", "to", "be", "used", "as", "experiment", "tags", ".", "Experiment", "tags", "are", "used", "in", "directory", "names", "so", "this", "method", "makes", "sure", "the", "resulting", "tags", "can", "be", "legally", "used", "in", "directory...
def format_vars(resolved_vars: Dict) -> str: vars = resolved_vars.copy() for v in ["run", "env", "resources_per_trial"]: vars.pop(v, None) return ",".join( f"{_clean_value(k[-1])}={_clean_value(v)}" for k, v in sorted(vars.items()) )
[ "def", "format_vars", "(", "resolved_vars", ":", "Dict", ")", "->", "str", ":", "vars", "=", "resolved_vars", ".", "copy", "(", ")", "for", "v", "in", "[", "\"run\"", ",", "\"env\"", ",", "\"resources_per_trial\"", "]", ":", "vars", ".", "pop", "(", "v...
Format variables to be used as experiment tags.
[ "Format", "variables", "to", "be", "used", "as", "experiment", "tags", "." ]
[ "\"\"\"Format variables to be used as experiment tags.\n\n Experiment tags are used in directory names, so this method makes sure\n the resulting tags can be legally used in directory names on all systems.\n\n The input to this function is a dict of the form\n ``{(\"nested\", \"config\", \"path\"): \"va...
[ { "param": "resolved_vars", "type": "Dict" } ]
{ "returns": [ { "docstring": "Comma-separated key=value string.", "docstring_tokens": [ "Comma", "-", "separated", "key", "=", "value", "string", "." ], "type": null } ], "raises": [], "params": [ { "ident...
67c8d4f060fc20f7208accab4610e3a07ef1fb96
kisuke95/ray
python/ray/tune/tests/test_integration_wandb.py
[ "Apache-2.0" ]
Python
testWandbMixinRLlib
<not_specific>
def testWandbMixinRLlib(self): """Test compatibility with RLlib configuration dicts""" # Local import to avoid tune dependency on rllib try: from ray.rllib.agents.ppo import PPOTrainer except ImportError: self.skipTest("ray[rllib] not available") retur...
Test compatibility with RLlib configuration dicts
Test compatibility with RLlib configuration dicts
[ "Test", "compatibility", "with", "RLlib", "configuration", "dicts" ]
def testWandbMixinRLlib(self): try: from ray.rllib.agents.ppo import PPOTrainer except ImportError: self.skipTest("ray[rllib] not available") return class WandbPPOTrainer(_MockWandbTrainableMixin, PPOTrainer): pass config = { "e...
[ "def", "testWandbMixinRLlib", "(", "self", ")", ":", "try", ":", "from", "ray", ".", "rllib", ".", "agents", ".", "ppo", "import", "PPOTrainer", "except", "ImportError", ":", "self", ".", "skipTest", "(", "\"ray[rllib] not available\"", ")", "return", "class",...
Test compatibility with RLlib configuration dicts
[ "Test", "compatibility", "with", "RLlib", "configuration", "dicts" ]
[ "\"\"\"Test compatibility with RLlib configuration dicts\"\"\"", "# Local import to avoid tune dependency on rllib", "# Test that trainer object can be initialized" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
af0d88567471ffbd77ed31dda24f6c4e81c2c8df
kisuke95/ray
rllib/execution/train_ops.py
[ "Apache-2.0" ]
Python
train_one_step
Dict
def train_one_step(trainer, train_batch, policies_to_train=None) -> Dict: """Function that improves the all policies in `train_batch` on the local worker. Examples: >>> from ray.rllib.execution.rollout_ops import synchronous_parallel_sample >>> trainer = [...] # doctest: +SKIP >>> train...
Function that improves the all policies in `train_batch` on the local worker. Examples: >>> from ray.rllib.execution.rollout_ops import synchronous_parallel_sample >>> trainer = [...] # doctest: +SKIP >>> train_batch = synchronous_parallel_sample(trainer.workers) # doctest: +SKIP >>...
Function that improves the all policies in `train_batch` on the local worker.
[ "Function", "that", "improves", "the", "all", "policies", "in", "`", "train_batch", "`", "on", "the", "local", "worker", "." ]
def train_one_step(trainer, train_batch, policies_to_train=None) -> Dict: config = trainer.config workers = trainer.workers local_worker = workers.local_worker() num_sgd_iter = config.get("num_sgd_iter", 1) sgd_minibatch_size = config.get("sgd_minibatch_size", 0) learn_timer = trainer._timers[LE...
[ "def", "train_one_step", "(", "trainer", ",", "train_batch", ",", "policies_to_train", "=", "None", ")", "->", "Dict", ":", "config", "=", "trainer", ".", "config", "workers", "=", "trainer", ".", "workers", "local_worker", "=", "workers", ".", "local_worker",...
Function that improves the all policies in `train_batch` on the local worker.
[ "Function", "that", "improves", "the", "all", "policies", "in", "`", "train_batch", "`", "on", "the", "local", "worker", "." ]
[ "\"\"\"Function that improves the all policies in `train_batch` on the local worker.\n\n Examples:\n >>> from ray.rllib.execution.rollout_ops import synchronous_parallel_sample\n >>> trainer = [...] # doctest: +SKIP\n >>> train_batch = synchronous_parallel_sample(trainer.workers) # doctest: ...
[ { "param": "trainer", "type": null }, { "param": "train_batch", "type": null }, { "param": "policies_to_train", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "trainer", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "train_batch", "type": null, "docstring": null, "docstring_...
6feff83268e5b4cbfe73bd82a8e5106b8e5ec0f0
kisuke95/ray
python/ray/data/impl/plan.py
[ "Apache-2.0" ]
Python
clear
None
def clear(self) -> None: """Clear all cached block references of this plan, including input blocks. This will render the plan un-executable unless the root is a LazyBlockList.""" self._in_blocks.clear() self._snapshot_blocks = None self._snapshot_stats = None # We're era...
Clear all cached block references of this plan, including input blocks. This will render the plan un-executable unless the root is a LazyBlockList.
Clear all cached block references of this plan, including input blocks. This will render the plan un-executable unless the root is a LazyBlockList.
[ "Clear", "all", "cached", "block", "references", "of", "this", "plan", "including", "input", "blocks", ".", "This", "will", "render", "the", "plan", "un", "-", "executable", "unless", "the", "root", "is", "a", "LazyBlockList", "." ]
def clear(self) -> None: self._in_blocks.clear() self._snapshot_blocks = None self._snapshot_stats = None self._stages_after_snapshot = ( self._stages_before_snapshot + self._stages_after_snapshot ) self._stages_before_snapshot = []
[ "def", "clear", "(", "self", ")", "->", "None", ":", "self", ".", "_in_blocks", ".", "clear", "(", ")", "self", ".", "_snapshot_blocks", "=", "None", "self", ".", "_snapshot_stats", "=", "None", "self", ".", "_stages_after_snapshot", "=", "(", "self", "....
Clear all cached block references of this plan, including input blocks.
[ "Clear", "all", "cached", "block", "references", "of", "this", "plan", "including", "input", "blocks", "." ]
[ "\"\"\"Clear all cached block references of this plan, including input blocks.\n\n This will render the plan un-executable unless the root is a LazyBlockList.\"\"\"", "# We're erasing the snapshot, so put all stages into the \"after snapshot\"", "# bucket." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6feff83268e5b4cbfe73bd82a8e5106b8e5ec0f0
kisuke95/ray
python/ray/data/impl/plan.py
[ "Apache-2.0" ]
Python
_optimize
Tuple[BlockList, DatasetStats, List[Stage]]
def _optimize(self) -> Tuple[BlockList, DatasetStats, List[Stage]]: """Apply stage fusion optimizations, returning an updated source block list and associated stats, and a set of optimized stages. """ context = DatasetContext.get_current() blocks, stats = self._get_source_blocks(...
Apply stage fusion optimizations, returning an updated source block list and associated stats, and a set of optimized stages.
Apply stage fusion optimizations, returning an updated source block list and associated stats, and a set of optimized stages.
[ "Apply", "stage", "fusion", "optimizations", "returning", "an", "updated", "source", "block", "list", "and", "associated", "stats", "and", "a", "set", "of", "optimized", "stages", "." ]
def _optimize(self) -> Tuple[BlockList, DatasetStats, List[Stage]]: context = DatasetContext.get_current() blocks, stats = self._get_source_blocks() stages = self._stages_after_snapshot.copy() if context.optimize_fuse_stages: if context.optimize_fuse_read_stages: ...
[ "def", "_optimize", "(", "self", ")", "->", "Tuple", "[", "BlockList", ",", "DatasetStats", ",", "List", "[", "Stage", "]", "]", ":", "context", "=", "DatasetContext", ".", "get_current", "(", ")", "blocks", ",", "stats", "=", "self", ".", "_get_source_b...
Apply stage fusion optimizations, returning an updated source block list and associated stats, and a set of optimized stages.
[ "Apply", "stage", "fusion", "optimizations", "returning", "an", "updated", "source", "block", "list", "and", "associated", "stats", "and", "a", "set", "of", "optimized", "stages", "." ]
[ "\"\"\"Apply stage fusion optimizations, returning an updated source block list and\n associated stats, and a set of optimized stages.\n \"\"\"", "# If using a lazy datasource, rewrite read stage into one-to-one stage", "# so it can be fused into downstream stages." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6feff83268e5b4cbfe73bd82a8e5106b8e5ec0f0
kisuke95/ray
python/ray/data/impl/plan.py
[ "Apache-2.0" ]
Python
_get_source_blocks
Tuple[BlockList, DatasetStats]
def _get_source_blocks(self) -> Tuple[BlockList, DatasetStats]: """Get the source blocks (and corresponding stats) for plan execution. If a computed snapshot exists, return the snapshot blocks and stats; otherwise, return the input blocks and stats that the plan was created with. """ ...
Get the source blocks (and corresponding stats) for plan execution. If a computed snapshot exists, return the snapshot blocks and stats; otherwise, return the input blocks and stats that the plan was created with.
Get the source blocks (and corresponding stats) for plan execution. If a computed snapshot exists, return the snapshot blocks and stats; otherwise, return the input blocks and stats that the plan was created with.
[ "Get", "the", "source", "blocks", "(", "and", "corresponding", "stats", ")", "for", "plan", "execution", ".", "If", "a", "computed", "snapshot", "exists", "return", "the", "snapshot", "blocks", "and", "stats", ";", "otherwise", "return", "the", "input", "blo...
def _get_source_blocks(self) -> Tuple[BlockList, DatasetStats]: if self._snapshot_blocks is not None: blocks = self._snapshot_blocks stats = self._snapshot_stats self._snapshot_blocks = None else: blocks = self._in_blocks stats = self._in_stats...
[ "def", "_get_source_blocks", "(", "self", ")", "->", "Tuple", "[", "BlockList", ",", "DatasetStats", "]", ":", "if", "self", ".", "_snapshot_blocks", "is", "not", "None", ":", "blocks", "=", "self", ".", "_snapshot_blocks", "stats", "=", "self", ".", "_sna...
Get the source blocks (and corresponding stats) for plan execution.
[ "Get", "the", "source", "blocks", "(", "and", "corresponding", "stats", ")", "for", "plan", "execution", "." ]
[ "\"\"\"Get the source blocks (and corresponding stats) for plan execution.\n\n If a computed snapshot exists, return the snapshot blocks and stats; otherwise,\n return the input blocks and stats that the plan was created with.\n \"\"\"", "# If snapshot exists, we only have to execute the plan...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6feff83268e5b4cbfe73bd82a8e5106b8e5ec0f0
kisuke95/ray
python/ray/data/impl/plan.py
[ "Apache-2.0" ]
Python
has_computed_output
bool
def has_computed_output(self) -> bool: """Whether this plan has a computed snapshot for the final stage, i.e. for the output of this plan. """ return self._snapshot_blocks is not None and not self._stages_after_snapshot
Whether this plan has a computed snapshot for the final stage, i.e. for the output of this plan.
Whether this plan has a computed snapshot for the final stage, i.e. for the output of this plan.
[ "Whether", "this", "plan", "has", "a", "computed", "snapshot", "for", "the", "final", "stage", "i", ".", "e", ".", "for", "the", "output", "of", "this", "plan", "." ]
def has_computed_output(self) -> bool: return self._snapshot_blocks is not None and not self._stages_after_snapshot
[ "def", "has_computed_output", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_snapshot_blocks", "is", "not", "None", "and", "not", "self", ".", "_stages_after_snapshot" ]
Whether this plan has a computed snapshot for the final stage, i.e.
[ "Whether", "this", "plan", "has", "a", "computed", "snapshot", "for", "the", "final", "stage", "i", ".", "e", "." ]
[ "\"\"\"Whether this plan has a computed snapshot for the final stage, i.e. for the\n output of this plan.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7a593d1f555052a3d2cc55b92c250736ed3acc0c
kisuke95/ray
python/ray/ml/config.py
[ "Apache-2.0" ]
Python
additional_resources_per_worker
<not_specific>
def additional_resources_per_worker(self): """Resources per worker, not including CPU or GPU resources.""" return { k: v for k, v in self.resources_per_worker.items() if k not in ["CPU", "GPU"] }
Resources per worker, not including CPU or GPU resources.
Resources per worker, not including CPU or GPU resources.
[ "Resources", "per", "worker", "not", "including", "CPU", "or", "GPU", "resources", "." ]
def additional_resources_per_worker(self): return { k: v for k, v in self.resources_per_worker.items() if k not in ["CPU", "GPU"] }
[ "def", "additional_resources_per_worker", "(", "self", ")", ":", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "self", ".", "resources_per_worker", ".", "items", "(", ")", "if", "k", "not", "in", "[", "\"CPU\"", ",", "\"GPU\"", "]", "}" ]
Resources per worker, not including CPU or GPU resources.
[ "Resources", "per", "worker", "not", "including", "CPU", "or", "GPU", "resources", "." ]
[ "\"\"\"Resources per worker, not including CPU or GPU resources.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7a593d1f555052a3d2cc55b92c250736ed3acc0c
kisuke95/ray
python/ray/ml/config.py
[ "Apache-2.0" ]
Python
as_placement_group_factory
"PlacementGroupFactory"
def as_placement_group_factory(self) -> "PlacementGroupFactory": """Returns a PlacementGroupFactory to specify resources for Tune.""" from ray.tune.trainable import PlacementGroupFactory trainer_resources = ( self.trainer_resources if self.trainer_resources else {"CPU": 1} )...
Returns a PlacementGroupFactory to specify resources for Tune.
Returns a PlacementGroupFactory to specify resources for Tune.
[ "Returns", "a", "PlacementGroupFactory", "to", "specify", "resources", "for", "Tune", "." ]
def as_placement_group_factory(self) -> "PlacementGroupFactory": from ray.tune.trainable import PlacementGroupFactory trainer_resources = ( self.trainer_resources if self.trainer_resources else {"CPU": 1} ) trainer_bundle = [trainer_resources] worker_resources = { ...
[ "def", "as_placement_group_factory", "(", "self", ")", "->", "\"PlacementGroupFactory\"", ":", "from", "ray", ".", "tune", ".", "trainable", "import", "PlacementGroupFactory", "trainer_resources", "=", "(", "self", ".", "trainer_resources", "if", "self", ".", "train...
Returns a PlacementGroupFactory to specify resources for Tune.
[ "Returns", "a", "PlacementGroupFactory", "to", "specify", "resources", "for", "Tune", "." ]
[ "\"\"\"Returns a PlacementGroupFactory to specify resources for Tune.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
5a1528bc2645bafa6f51f4b69fb8b9ba6935ed4e
kisuke95/ray
python/ray/data/impl/stats.py
[ "Apache-2.0" ]
Python
summary_string
str
def summary_string(self, already_printed: Set[str] = None) -> str: """Return a human-readable summary of this Dataset's stats.""" if already_printed is None: already_printed = set() if self.needs_stats_actor: # XXX this is a super hack, clean it up. stats_map...
Return a human-readable summary of this Dataset's stats.
Return a human-readable summary of this Dataset's stats.
[ "Return", "a", "human", "-", "readable", "summary", "of", "this", "Dataset", "'", "s", "stats", "." ]
def summary_string(self, already_printed: Set[str] = None) -> str: if already_printed is None: already_printed = set() if self.needs_stats_actor: stats_map, self.time_total_s = ray.get( self.stats_actor.get.remote(self.stats_uuid) ) for i, ...
[ "def", "summary_string", "(", "self", ",", "already_printed", ":", "Set", "[", "str", "]", "=", "None", ")", "->", "str", ":", "if", "already_printed", "is", "None", ":", "already_printed", "=", "set", "(", ")", "if", "self", ".", "needs_stats_actor", ":...
Return a human-readable summary of this Dataset's stats.
[ "Return", "a", "human", "-", "readable", "summary", "of", "this", "Dataset", "'", "s", "stats", "." ]
[ "\"\"\"Return a human-readable summary of this Dataset's stats.\"\"\"", "# XXX this is a super hack, clean it up.", "# Handle -0.0 case." ]
[ { "param": "self", "type": null }, { "param": "already_printed", "type": "Set[str]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "already_printed", "type": "Set[str]", "docstring": null, "doc...
5a1528bc2645bafa6f51f4b69fb8b9ba6935ed4e
kisuke95/ray
python/ray/data/impl/stats.py
[ "Apache-2.0" ]
Python
add
None
def add(self, stats: DatasetStats) -> None: """Called to add stats for a newly computed window.""" self.history_buffer.append((self.count, stats)) if len(self.history_buffer) > self.max_history: self.history_buffer.pop(0) self.count += 1
Called to add stats for a newly computed window.
Called to add stats for a newly computed window.
[ "Called", "to", "add", "stats", "for", "a", "newly", "computed", "window", "." ]
def add(self, stats: DatasetStats) -> None: self.history_buffer.append((self.count, stats)) if len(self.history_buffer) > self.max_history: self.history_buffer.pop(0) self.count += 1
[ "def", "add", "(", "self", ",", "stats", ":", "DatasetStats", ")", "->", "None", ":", "self", ".", "history_buffer", ".", "append", "(", "(", "self", ".", "count", ",", "stats", ")", ")", "if", "len", "(", "self", ".", "history_buffer", ")", ">", "...
Called to add stats for a newly computed window.
[ "Called", "to", "add", "stats", "for", "a", "newly", "computed", "window", "." ]
[ "\"\"\"Called to add stats for a newly computed window.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "stats", "type": "DatasetStats" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stats", "type": "DatasetStats", "docstring": null, "docstring...
5a1528bc2645bafa6f51f4b69fb8b9ba6935ed4e
kisuke95/ray
python/ray/data/impl/stats.py
[ "Apache-2.0" ]
Python
summary_string
str
def summary_string(self, exclude_first_window: bool = True) -> str: """Return a human-readable summary of this pipeline's stats.""" already_printed = set() out = "" for i, stats in self.history_buffer: out += "== Pipeline Window {} ==\n".format(i) out += stats.sum...
Return a human-readable summary of this pipeline's stats.
Return a human-readable summary of this pipeline's stats.
[ "Return", "a", "human", "-", "readable", "summary", "of", "this", "pipeline", "'", "s", "stats", "." ]
def summary_string(self, exclude_first_window: bool = True) -> str: already_printed = set() out = "" for i, stats in self.history_buffer: out += "== Pipeline Window {} ==\n".format(i) out += stats.summary_string(already_printed) out += "\n" out += "###...
[ "def", "summary_string", "(", "self", ",", "exclude_first_window", ":", "bool", "=", "True", ")", "->", "str", ":", "already_printed", "=", "set", "(", ")", "out", "=", "\"\"", "for", "i", ",", "stats", "in", "self", ".", "history_buffer", ":", "out", ...
Return a human-readable summary of this pipeline's stats.
[ "Return", "a", "human", "-", "readable", "summary", "of", "this", "pipeline", "'", "s", "stats", "." ]
[ "\"\"\"Return a human-readable summary of this pipeline's stats.\"\"\"", "# Drop the first sample since there's no pipelining there." ]
[ { "param": "self", "type": null }, { "param": "exclude_first_window", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exclude_first_window", "type": "bool", "docstring": null, "do...
171dd131c08deb5bb39f2be4e6a794a24cd7ca4b
kisuke95/ray
python/ray/serve/http_proxy.py
[ "Apache-2.0" ]
Python
match_route
Tuple[Optional[str], Optional[RayServeHandle]]
def match_route( self, target_route: str ) -> Tuple[Optional[str], Optional[RayServeHandle]]: """Return the longest prefix match among existing routes for the route. Args: target_route (str): route to match against. Returns: (matched_route (str), serve_handl...
Return the longest prefix match among existing routes for the route. Args: target_route (str): route to match against. Returns: (matched_route (str), serve_handle (RayServeHandle)) if found, else (None, None).
Return the longest prefix match among existing routes for the route.
[ "Return", "the", "longest", "prefix", "match", "among", "existing", "routes", "for", "the", "route", "." ]
def match_route( self, target_route: str ) -> Tuple[Optional[str], Optional[RayServeHandle]]: for route in self.sorted_routes: if target_route.startswith(route): matched = False if route.endswith("/"): matched = True eli...
[ "def", "match_route", "(", "self", ",", "target_route", ":", "str", ")", "->", "Tuple", "[", "Optional", "[", "str", "]", ",", "Optional", "[", "RayServeHandle", "]", "]", ":", "for", "route", "in", "self", ".", "sorted_routes", ":", "if", "target_route"...
Return the longest prefix match among existing routes for the route.
[ "Return", "the", "longest", "prefix", "match", "among", "existing", "routes", "for", "the", "route", "." ]
[ "\"\"\"Return the longest prefix match among existing routes for the route.\n\n Args:\n target_route (str): route to match against.\n\n Returns:\n (matched_route (str), serve_handle (RayServeHandle)) if found,\n else (None, None).\n \"\"\"", "# If the route we...
[ { "param": "self", "type": null }, { "param": "target_route", "type": "str" } ]
{ "returns": [ { "docstring": "(matched_route (str), serve_handle (RayServeHandle)) if found,\nelse (None, None).", "docstring_tokens": [ "(", "matched_route", "(", "str", ")", "serve_handle", "(", "RayServeHandle", "))", ...