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
171dd131c08deb5bb39f2be4e6a794a24cd7ca4b
kisuke95/ray
python/ray/serve/http_proxy.py
[ "Apache-2.0" ]
Python
ready
<not_specific>
async def ready(self): """Returns when HTTP proxy is ready to serve traffic. Or throw exception when it is not able to serve traffic. """ done_set, _ = await asyncio.wait( [ # Either the HTTP setup has completed. # The event is set inside self....
Returns when HTTP proxy is ready to serve traffic. Or throw exception when it is not able to serve traffic.
Returns when HTTP proxy is ready to serve traffic. Or throw exception when it is not able to serve traffic.
[ "Returns", "when", "HTTP", "proxy", "is", "ready", "to", "serve", "traffic", ".", "Or", "throw", "exception", "when", "it", "is", "not", "able", "to", "serve", "traffic", "." ]
async def ready(self): done_set, _ = await asyncio.wait( [ self.setup_complete.wait(), self.running_task, ], return_when=asyncio.FIRST_COMPLETED, ) return await done_set.pop()
[ "async", "def", "ready", "(", "self", ")", ":", "done_set", ",", "_", "=", "await", "asyncio", ".", "wait", "(", "[", "self", ".", "setup_complete", ".", "wait", "(", ")", ",", "self", ".", "running_task", ",", "]", ",", "return_when", "=", "asyncio"...
Returns when HTTP proxy is ready to serve traffic.
[ "Returns", "when", "HTTP", "proxy", "is", "ready", "to", "serve", "traffic", "." ]
[ "\"\"\"Returns when HTTP proxy is ready to serve traffic.\n Or throw exception when it is not able to serve traffic.\n \"\"\"", "# Either the HTTP setup has completed.", "# The event is set inside self.run.", "# Or self.run errored.", "# Return None, or re-throw the exception from self.running...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fc8076c10d57023ffc869146d347cf95686c33c2
kisuke95/ray
python/ray/serve/tests/test_application.py
[ "Apache-2.0" ]
Python
deploy_and_check_responses
<not_specific>
def deploy_and_check_responses( self, deployments, responses, blocking=True, client=None ): """ Helper function that deploys the list of deployments, calls them with their handles, and checks whether they return the objects in responses. If blocking is False, this function us...
Helper function that deploys the list of deployments, calls them with their handles, and checks whether they return the objects in responses. If blocking is False, this function uses a non-blocking deploy and uses the client to wait until the deployments finish deploying.
Helper function that deploys the list of deployments, calls them with their handles, and checks whether they return the objects in responses. If blocking is False, this function uses a non-blocking deploy and uses the client to wait until the deployments finish deploying.
[ "Helper", "function", "that", "deploys", "the", "list", "of", "deployments", "calls", "them", "with", "their", "handles", "and", "checks", "whether", "they", "return", "the", "objects", "in", "responses", ".", "If", "blocking", "is", "False", "this", "function...
def deploy_and_check_responses( self, deployments, responses, blocking=True, client=None ): serve.run(Application(deployments), _blocking=blocking) def check_all_deployed(): try: for deployment, response in zip(deployments, responses): if ray.g...
[ "def", "deploy_and_check_responses", "(", "self", ",", "deployments", ",", "responses", ",", "blocking", "=", "True", ",", "client", "=", "None", ")", ":", "serve", ".", "run", "(", "Application", "(", "deployments", ")", ",", "_blocking", "=", "blocking", ...
Helper function that deploys the list of deployments, calls them with their handles, and checks whether they return the objects in responses.
[ "Helper", "function", "that", "deploys", "the", "list", "of", "deployments", "calls", "them", "with", "their", "handles", "and", "checks", "whether", "they", "return", "the", "objects", "in", "responses", "." ]
[ "\"\"\"\n Helper function that deploys the list of deployments, calls them with\n their handles, and checks whether they return the objects in responses.\n If blocking is False, this function uses a non-blocking deploy and uses\n the client to wait until the deployments finish deploying....
[ { "param": "self", "type": null }, { "param": "deployments", "type": null }, { "param": "responses", "type": null }, { "param": "blocking", "type": null }, { "param": "client", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deployments", "type": null, "docstring": null, "docstring_tok...
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
_check_connected
null
def _check_connected(self): """Ensure that the object has been initialized before it is used. This lazily initializes clients needed for state accessors. Raises: RuntimeError: An exception is raised if ray.init() has not been called yet. """ if self....
Ensure that the object has been initialized before it is used. This lazily initializes clients needed for state accessors. Raises: RuntimeError: An exception is raised if ray.init() has not been called yet.
Ensure that the object has been initialized before it is used. This lazily initializes clients needed for state accessors.
[ "Ensure", "that", "the", "object", "has", "been", "initialized", "before", "it", "is", "used", ".", "This", "lazily", "initializes", "clients", "needed", "for", "state", "accessors", "." ]
def _check_connected(self): if self.gcs_options is not None and self.global_state_accessor is None: self._really_init_global_state() if self.global_state_accessor is None: raise ray.exceptions.RaySystemError( "Ray has not been started yet. You can start Ray with '...
[ "def", "_check_connected", "(", "self", ")", ":", "if", "self", ".", "gcs_options", "is", "not", "None", "and", "self", ".", "global_state_accessor", "is", "None", ":", "self", ".", "_really_init_global_state", "(", ")", "if", "self", ".", "global_state_access...
Ensure that the object has been initialized before it is used.
[ "Ensure", "that", "the", "object", "has", "been", "initialized", "before", "it", "is", "used", "." ]
[ "\"\"\"Ensure that the object has been initialized before it is used.\n\n This lazily initializes clients needed for state accessors.\n\n Raises:\n RuntimeError: An exception is raised if ray.init() has not been\n called yet.\n \"\"\"", "# _really_init_global_state s...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [ { "docstring": "An exception is raised if ray.init() has not been\ncalled yet.", "docstring_tokens": [ "An", "exception", "is", "raised", "if", "ray", ".", "init", "()", "has", "not",...
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
disconnect
null
def disconnect(self): """Disconnect global state from GCS.""" self.gcs_options = None if self.global_state_accessor is not None: self.global_state_accessor.disconnect() self.global_state_accessor = None
Disconnect global state from GCS.
Disconnect global state from GCS.
[ "Disconnect", "global", "state", "from", "GCS", "." ]
def disconnect(self): self.gcs_options = None if self.global_state_accessor is not None: self.global_state_accessor.disconnect() self.global_state_accessor = None
[ "def", "disconnect", "(", "self", ")", ":", "self", ".", "gcs_options", "=", "None", "if", "self", ".", "global_state_accessor", "is", "not", "None", ":", "self", ".", "global_state_accessor", ".", "disconnect", "(", ")", "self", ".", "global_state_accessor", ...
Disconnect global state from GCS.
[ "Disconnect", "global", "state", "from", "GCS", "." ]
[ "\"\"\"Disconnect global state from GCS.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
_initialize_global_state
null
def _initialize_global_state(self, gcs_options): """Set args for lazily initialization of the GlobalState object. It's possible that certain keys in gcs kv may not have been fully populated yet. In this case, we will retry this method until they have been populated or we exceed a timeou...
Set args for lazily initialization of the GlobalState object. It's possible that certain keys in gcs kv may not have been fully populated yet. In this case, we will retry this method until they have been populated or we exceed a timeout. Args: gcs_options: The client option...
Set args for lazily initialization of the GlobalState object. It's possible that certain keys in gcs kv may not have been fully populated yet. In this case, we will retry this method until they have been populated or we exceed a timeout.
[ "Set", "args", "for", "lazily", "initialization", "of", "the", "GlobalState", "object", ".", "It", "'", "s", "possible", "that", "certain", "keys", "in", "gcs", "kv", "may", "not", "have", "been", "fully", "populated", "yet", ".", "In", "this", "case", "...
def _initialize_global_state(self, gcs_options): self.gcs_options = gcs_options
[ "def", "_initialize_global_state", "(", "self", ",", "gcs_options", ")", ":", "self", ".", "gcs_options", "=", "gcs_options" ]
Set args for lazily initialization of the GlobalState object.
[ "Set", "args", "for", "lazily", "initialization", "of", "the", "GlobalState", "object", "." ]
[ "\"\"\"Set args for lazily initialization of the GlobalState object.\n\n It's possible that certain keys in gcs kv may not have been fully\n populated yet. In this case, we will retry this method until they have\n been populated or we exceed a timeout.\n\n Args:\n gcs_options:...
[ { "param": "self", "type": null }, { "param": "gcs_options", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "gcs_options", "type": null, "docstring": "The client options for gc...
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
actor_table
<not_specific>
def actor_table(self, actor_id): """Fetch and parse the actor table information for a single actor ID. Args: actor_id: A hex string of the actor ID to fetch information about. If this is None, then the actor table is fetched. Returns: Information from th...
Fetch and parse the actor table information for a single actor ID. Args: actor_id: A hex string of the actor ID to fetch information about. If this is None, then the actor table is fetched. Returns: Information from the actor table.
Fetch and parse the actor table information for a single actor ID.
[ "Fetch", "and", "parse", "the", "actor", "table", "information", "for", "a", "single", "actor", "ID", "." ]
def actor_table(self, actor_id): self._check_connected() if actor_id is not None: actor_id = ray.ActorID(hex_to_binary(actor_id)) actor_info = self.global_state_accessor.get_actor_info(actor_id) if actor_info is None: return {} else: ...
[ "def", "actor_table", "(", "self", ",", "actor_id", ")", ":", "self", ".", "_check_connected", "(", ")", "if", "actor_id", "is", "not", "None", ":", "actor_id", "=", "ray", ".", "ActorID", "(", "hex_to_binary", "(", "actor_id", ")", ")", "actor_info", "=...
Fetch and parse the actor table information for a single actor ID.
[ "Fetch", "and", "parse", "the", "actor", "table", "information", "for", "a", "single", "actor", "ID", "." ]
[ "\"\"\"Fetch and parse the actor table information for a single actor ID.\n\n Args:\n actor_id: A hex string of the actor ID to fetch information about.\n If this is None, then the actor table is fetched.\n\n Returns:\n Information from the actor table.\n \"...
[ { "param": "self", "type": null }, { "param": "actor_id", "type": null } ]
{ "returns": [ { "docstring": "Information from the actor table.", "docstring_tokens": [ "Information", "from", "the", "actor", "table", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "typ...
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
node_resource_table
<not_specific>
def node_resource_table(self, node_id=None): """Fetch and parse the node resource table info for one. Args: node_id: An node ID to fetch information about. Returns: Information from the node resource table. """ self._check_connected() node_id = ...
Fetch and parse the node resource table info for one. Args: node_id: An node ID to fetch information about. Returns: Information from the node resource table.
Fetch and parse the node resource table info for one.
[ "Fetch", "and", "parse", "the", "node", "resource", "table", "info", "for", "one", "." ]
def node_resource_table(self, node_id=None): self._check_connected() node_id = ray.NodeID(hex_to_binary(node_id)) node_resource_bytes = self.global_state_accessor.get_node_resource_info(node_id) if node_resource_bytes is None: return {} else: node_resource...
[ "def", "node_resource_table", "(", "self", ",", "node_id", "=", "None", ")", ":", "self", ".", "_check_connected", "(", ")", "node_id", "=", "ray", ".", "NodeID", "(", "hex_to_binary", "(", "node_id", ")", ")", "node_resource_bytes", "=", "self", ".", "glo...
Fetch and parse the node resource table info for one.
[ "Fetch", "and", "parse", "the", "node", "resource", "table", "info", "for", "one", "." ]
[ "\"\"\"Fetch and parse the node resource table info for one.\n\n Args:\n node_id: An node ID to fetch information about.\n\n Returns:\n Information from the node resource table.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "node_id", "type": null } ]
{ "returns": [ { "docstring": "Information from the node resource table.", "docstring_tokens": [ "Information", "from", "the", "node", "resource", "table", "." ], "type": null } ], "raises": [], "params": [ { "iden...
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
node_table
<not_specific>
def node_table(self): """Fetch and parse the Gcs node info table. Returns: Information about the node in the cluster. """ self._check_connected() node_table = self.global_state_accessor.get_node_table() results = [] for node_info_item in node_table:...
Fetch and parse the Gcs node info table. Returns: Information about the node in the cluster.
Fetch and parse the Gcs node info table.
[ "Fetch", "and", "parse", "the", "Gcs", "node", "info", "table", "." ]
def node_table(self): self._check_connected() node_table = self.global_state_accessor.get_node_table() results = [] for node_info_item in node_table: item = gcs_utils.GcsNodeInfo.FromString(node_info_item) node_info = { "NodeID": ray._private.utils...
[ "def", "node_table", "(", "self", ")", ":", "self", ".", "_check_connected", "(", ")", "node_table", "=", "self", ".", "global_state_accessor", ".", "get_node_table", "(", ")", "results", "=", "[", "]", "for", "node_info_item", "in", "node_table", ":", "item...
Fetch and parse the Gcs node info table.
[ "Fetch", "and", "parse", "the", "Gcs", "node", "info", "table", "." ]
[ "\"\"\"Fetch and parse the Gcs node info table.\n\n Returns:\n Information about the node in the cluster.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Information about the node in the cluster.", "docstring_tokens": [ "Information", "about", "the", "node", "in", "the", "cluster", "." ], "type": null } ], "raises": [], "params": [ ...
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
chrome_tracing_dump
<not_specific>
def chrome_tracing_dump(self, filename=None): """Return a list of profiling events that can viewed as a timeline. To view this information as a timeline, simply dump it as a json file by passing in "filename" or using using json.dump, and then load go to chrome://tracing in the Chrome w...
Return a list of profiling events that can viewed as a timeline. To view this information as a timeline, simply dump it as a json file by passing in "filename" or using using json.dump, and then load go to chrome://tracing in the Chrome web browser and load the dumped file. Make sure to...
Return a list of profiling events that can viewed as a timeline. To view this information as a timeline, simply dump it as a json file by passing in "filename" or using using json.dump, and then load go to chrome://tracing in the Chrome web browser and load the dumped file. Make sure to enable "Flow events" in the "Vie...
[ "Return", "a", "list", "of", "profiling", "events", "that", "can", "viewed", "as", "a", "timeline", ".", "To", "view", "this", "information", "as", "a", "timeline", "simply", "dump", "it", "as", "a", "json", "file", "by", "passing", "in", "\"", "filename...
def chrome_tracing_dump(self, filename=None): self._check_connected() profile_table = self.profile_table() all_events = [] for component_id_hex, component_events in profile_table.items(): component_type = component_events[0]["component_type"] if component_type not...
[ "def", "chrome_tracing_dump", "(", "self", ",", "filename", "=", "None", ")", ":", "self", ".", "_check_connected", "(", ")", "profile_table", "=", "self", ".", "profile_table", "(", ")", "all_events", "=", "[", "]", "for", "component_id_hex", ",", "componen...
Return a list of profiling events that can viewed as a timeline.
[ "Return", "a", "list", "of", "profiling", "events", "that", "can", "viewed", "as", "a", "timeline", "." ]
[ "\"\"\"Return a list of profiling events that can viewed as a timeline.\n\n To view this information as a timeline, simply dump it as a json file\n by passing in \"filename\" or using using json.dump, and then load go to\n chrome://tracing in the Chrome web browser and load the dumped file.\n ...
[ { "param": "self", "type": null }, { "param": "filename", "type": null } ]
{ "returns": [ { "docstring": "If filename is not provided, this returns a list of profiling\nevents. Each profile event is a dictionary.", "docstring_tokens": [ "If", "filename", "is", "not", "provided", "this", "returns", "a", "...
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
chrome_tracing_object_transfer_dump
<not_specific>
def chrome_tracing_object_transfer_dump(self, filename=None): """Return a list of transfer events that can viewed as a timeline. To view this information as a timeline, simply dump it as a json file by passing in "filename" or using using json.dump, and then load go to chrome://tracing ...
Return a list of transfer events that can viewed as a timeline. To view this information as a timeline, simply dump it as a json file by passing in "filename" or using using json.dump, and then load go to chrome://tracing in the Chrome web browser and load the dumped file. Make sure to ...
Return a list of transfer events that can viewed as a timeline. To view this information as a timeline, simply dump it as a json file by passing in "filename" or using using json.dump, and then load go to chrome://tracing in the Chrome web browser and load the dumped file. Make sure to enable "Flow events" in the "View...
[ "Return", "a", "list", "of", "transfer", "events", "that", "can", "viewed", "as", "a", "timeline", ".", "To", "view", "this", "information", "as", "a", "timeline", "simply", "dump", "it", "as", "a", "json", "file", "by", "passing", "in", "\"", "filename"...
def chrome_tracing_object_transfer_dump(self, filename=None): self._check_connected() node_id_to_address = {} for node_info in self.node_table(): node_id_to_address[node_info["NodeID"]] = "{}:{}".format( node_info["NodeManagerAddress"], node_info["ObjectManagerPort"] ...
[ "def", "chrome_tracing_object_transfer_dump", "(", "self", ",", "filename", "=", "None", ")", ":", "self", ".", "_check_connected", "(", ")", "node_id_to_address", "=", "{", "}", "for", "node_info", "in", "self", ".", "node_table", "(", ")", ":", "node_id_to_a...
Return a list of transfer events that can viewed as a timeline.
[ "Return", "a", "list", "of", "transfer", "events", "that", "can", "viewed", "as", "a", "timeline", "." ]
[ "\"\"\"Return a list of transfer events that can viewed as a timeline.\n\n To view this information as a timeline, simply dump it as a json file\n by passing in \"filename\" or using using json.dump, and then load go to\n chrome://tracing in the Chrome web browser and load the dumped file.\n ...
[ { "param": "self", "type": null }, { "param": "filename", "type": null } ]
{ "returns": [ { "docstring": "If filename is not provided, this returns a list of profiling\nevents. Each profile event is a dictionary.", "docstring_tokens": [ "If", "filename", "is", "not", "provided", "this", "returns", "a", "...
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
workers
<not_specific>
def workers(self): """Get a dictionary mapping worker ID to worker information.""" self._check_connected() # Get all data in worker table worker_table = self.global_state_accessor.get_worker_table() workers_data = {} for i in range(len(worker_table)): worker_...
Get a dictionary mapping worker ID to worker information.
Get a dictionary mapping worker ID to worker information.
[ "Get", "a", "dictionary", "mapping", "worker", "ID", "to", "worker", "information", "." ]
def workers(self): self._check_connected() worker_table = self.global_state_accessor.get_worker_table() workers_data = {} for i in range(len(worker_table)): worker_table_data = gcs_utils.WorkerTableData.FromString(worker_table[i]) if ( worker_table...
[ "def", "workers", "(", "self", ")", ":", "self", ".", "_check_connected", "(", ")", "worker_table", "=", "self", ".", "global_state_accessor", ".", "get_worker_table", "(", ")", "workers_data", "=", "{", "}", "for", "i", "in", "range", "(", "len", "(", "...
Get a dictionary mapping worker ID to worker information.
[ "Get", "a", "dictionary", "mapping", "worker", "ID", "to", "worker", "information", "." ]
[ "\"\"\"Get a dictionary mapping worker ID to worker information.\"\"\"", "# Get all data in worker table" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
add_worker
<not_specific>
def add_worker(self, worker_id, worker_type, worker_info): """Add a worker to the cluster. Args: worker_id: ID of this worker. Type is bytes. worker_type: Type of this worker. Value is gcs_utils.DRIVER or gcs_utils.WORKER. worker_info: Info of this wo...
Add a worker to the cluster. Args: worker_id: ID of this worker. Type is bytes. worker_type: Type of this worker. Value is gcs_utils.DRIVER or gcs_utils.WORKER. worker_info: Info of this worker. Type is dict{str: str}. Returns: Is operat...
Add a worker to the cluster.
[ "Add", "a", "worker", "to", "the", "cluster", "." ]
def add_worker(self, worker_id, worker_type, worker_info): worker_data = gcs_utils.WorkerTableData() worker_data.is_alive = True worker_data.worker_address.worker_id = worker_id worker_data.worker_type = worker_type for k, v in worker_info.items(): worker_data.worker_...
[ "def", "add_worker", "(", "self", ",", "worker_id", ",", "worker_type", ",", "worker_info", ")", ":", "worker_data", "=", "gcs_utils", ".", "WorkerTableData", "(", ")", "worker_data", ".", "is_alive", "=", "True", "worker_data", ".", "worker_address", ".", "wo...
Add a worker to the cluster.
[ "Add", "a", "worker", "to", "the", "cluster", "." ]
[ "\"\"\"Add a worker to the cluster.\n\n Args:\n worker_id: ID of this worker. Type is bytes.\n worker_type: Type of this worker. Value is gcs_utils.DRIVER or\n gcs_utils.WORKER.\n worker_info: Info of this worker. Type is dict{str: str}.\n\n Returns:\n ...
[ { "param": "self", "type": null }, { "param": "worker_id", "type": null }, { "param": "worker_type", "type": null }, { "param": "worker_info", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
9f4223345f2fcfd25acca530276d8bb5a0f0825d
kisuke95/ray
python/ray/state.py
[ "Apache-2.0" ]
Python
_available_resources_per_node
<not_specific>
def _available_resources_per_node(self): """Returns a dictionary mapping node id to avaiable resources.""" self._check_connected() available_resources_by_id = {} all_available_resources = ( self.global_state_accessor.get_all_available_resources() ) for availa...
Returns a dictionary mapping node id to avaiable resources.
Returns a dictionary mapping node id to avaiable resources.
[ "Returns", "a", "dictionary", "mapping", "node", "id", "to", "avaiable", "resources", "." ]
def _available_resources_per_node(self): self._check_connected() available_resources_by_id = {} all_available_resources = ( self.global_state_accessor.get_all_available_resources() ) for available_resource in all_available_resources: message = gcs_utils.Av...
[ "def", "_available_resources_per_node", "(", "self", ")", ":", "self", ".", "_check_connected", "(", ")", "available_resources_by_id", "=", "{", "}", "all_available_resources", "=", "(", "self", ".", "global_state_accessor", ".", "get_all_available_resources", "(", ")...
Returns a dictionary mapping node id to avaiable resources.
[ "Returns", "a", "dictionary", "mapping", "node", "id", "to", "avaiable", "resources", "." ]
[ "\"\"\"Returns a dictionary mapping node id to avaiable resources.\"\"\"", "# Calculate available resources for this node.", "# Update available resources for this node.", "# Update nodes in cluster.", "# Remove disconnected nodes." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
185a6ea2e988c21e6681a8940a036cc0235bda41
kisuke95/ray
rllib/agents/dqn/r2d2.py
[ "Apache-2.0" ]
Python
validate_config
None
def validate_config(self, config: TrainerConfigDict) -> None: """Checks and updates the config based on settings. Rewrites rollout_fragment_length to take into account burn-in and max_seq_len truncation. """ # Call super's validation method. super().validate_config(confi...
Checks and updates the config based on settings. Rewrites rollout_fragment_length to take into account burn-in and max_seq_len truncation.
Checks and updates the config based on settings. Rewrites rollout_fragment_length to take into account burn-in and max_seq_len truncation.
[ "Checks", "and", "updates", "the", "config", "based", "on", "settings", ".", "Rewrites", "rollout_fragment_length", "to", "take", "into", "account", "burn", "-", "in", "and", "max_seq_len", "truncation", "." ]
def validate_config(self, config: TrainerConfigDict) -> None: super().validate_config(config) if config["replay_buffer_config"]["replay_sequence_length"] != -1: raise ValueError( "`replay_sequence_length` is calculated automatically to be " "model->max_seq_len...
[ "def", "validate_config", "(", "self", ",", "config", ":", "TrainerConfigDict", ")", "->", "None", ":", "super", "(", ")", ".", "validate_config", "(", "config", ")", "if", "config", "[", "\"replay_buffer_config\"", "]", "[", "\"replay_sequence_length\"", "]", ...
Checks and updates the config based on settings.
[ "Checks", "and", "updates", "the", "config", "based", "on", "settings", "." ]
[ "\"\"\"Checks and updates the config based on settings.\n\n Rewrites rollout_fragment_length to take into account burn-in and\n max_seq_len truncation.\n \"\"\"", "# Call super's validation method.", "# Add the `burn_in` to the Model's max_seq_len.", "# Set the replay sequence length to t...
[ { "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...
32a7762fc8248fc4723627c77a8f8a06d1c764f8
kisuke95/ray
python/ray/_private/test_utils.py
[ "Apache-2.0" ]
Python
run_string_as_driver
<not_specific>
def run_string_as_driver(driver_script: str, env: Dict = None, encode: str = "utf-8"): """Run a driver as a separate process. Args: driver_script (str): A string to run as a Python script. env (dict): The environment variables for the driver. Returns: The script's output. """ ...
Run a driver as a separate process. Args: driver_script (str): A string to run as a Python script. env (dict): The environment variables for the driver. Returns: The script's output.
Run a driver as a separate process.
[ "Run", "a", "driver", "as", "a", "separate", "process", "." ]
def run_string_as_driver(driver_script: str, env: Dict = None, encode: str = "utf-8"): proc = subprocess.Popen( [sys.executable, "-"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env, ) with proc: output = proc.communicate(driv...
[ "def", "run_string_as_driver", "(", "driver_script", ":", "str", ",", "env", ":", "Dict", "=", "None", ",", "encode", ":", "str", "=", "\"utf-8\"", ")", ":", "proc", "=", "subprocess", ".", "Popen", "(", "[", "sys", ".", "executable", ",", "\"-\"", "]"...
Run a driver as a separate process.
[ "Run", "a", "driver", "as", "a", "separate", "process", "." ]
[ "\"\"\"Run a driver as a separate process.\n\n Args:\n driver_script (str): A string to run as a Python script.\n env (dict): The environment variables for the driver.\n\n Returns:\n The script's output.\n \"\"\"" ]
[ { "param": "driver_script", "type": "str" }, { "param": "env", "type": "Dict" }, { "param": "encode", "type": "str" } ]
{ "returns": [ { "docstring": "The script's output.", "docstring_tokens": [ "The", "script", "'", "s", "output", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "driver_script", "type": "str", ...
32a7762fc8248fc4723627c77a8f8a06d1c764f8
kisuke95/ray
python/ray/_private/test_utils.py
[ "Apache-2.0" ]
Python
run_string_as_driver_nonblocking
<not_specific>
def run_string_as_driver_nonblocking(driver_script, env: Dict = None): """Start a driver as a separate process and return immediately. Args: driver_script: A string to run as a Python script. Returns: A handle to the driver process. """ script = "; ".join( [ "im...
Start a driver as a separate process and return immediately. Args: driver_script: A string to run as a Python script. Returns: A handle to the driver process.
Start a driver as a separate process and return immediately.
[ "Start", "a", "driver", "as", "a", "separate", "process", "and", "return", "immediately", "." ]
def run_string_as_driver_nonblocking(driver_script, env: Dict = None): script = "; ".join( [ "import sys", "script = sys.stdin.read()", "sys.stdin.close()", "del sys", 'exec("del script\\n" + script)', ] ) proc = subprocess.Popen( ...
[ "def", "run_string_as_driver_nonblocking", "(", "driver_script", ",", "env", ":", "Dict", "=", "None", ")", ":", "script", "=", "\"; \"", ".", "join", "(", "[", "\"import sys\"", ",", "\"script = sys.stdin.read()\"", ",", "\"sys.stdin.close()\"", ",", "\"del sys\"",...
Start a driver as a separate process and return immediately.
[ "Start", "a", "driver", "as", "a", "separate", "process", "and", "return", "immediately", "." ]
[ "\"\"\"Start a driver as a separate process and return immediately.\n\n Args:\n driver_script: A string to run as a Python script.\n\n Returns:\n A handle to the driver process.\n \"\"\"" ]
[ { "param": "driver_script", "type": null }, { "param": "env", "type": "Dict" } ]
{ "returns": [ { "docstring": "A handle to the driver process.", "docstring_tokens": [ "A", "handle", "to", "the", "driver", "process", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "driver_scr...
32a7762fc8248fc4723627c77a8f8a06d1c764f8
kisuke95/ray
python/ray/_private/test_utils.py
[ "Apache-2.0" ]
Python
wait_for_condition
<not_specific>
def wait_for_condition( condition_predictor, timeout=10, retry_interval_ms=100, **kwargs: Any ): """Wait until a condition is met or time out with an exception. Args: condition_predictor: A function that predicts the condition. timeout: Maximum timeout in seconds. retry_interval_ms:...
Wait until a condition is met or time out with an exception. Args: condition_predictor: A function that predicts the condition. timeout: Maximum timeout in seconds. retry_interval_ms: Retry interval in milliseconds. Raises: RuntimeError: If the condition is not met before the t...
Wait until a condition is met or time out with an exception.
[ "Wait", "until", "a", "condition", "is", "met", "or", "time", "out", "with", "an", "exception", "." ]
def wait_for_condition( condition_predictor, timeout=10, retry_interval_ms=100, **kwargs: Any ): start = time.time() last_ex = None while time.time() - start <= timeout: try: if condition_predictor(**kwargs): return except Exception as ex: last_ex ...
[ "def", "wait_for_condition", "(", "condition_predictor", ",", "timeout", "=", "10", ",", "retry_interval_ms", "=", "100", ",", "**", "kwargs", ":", "Any", ")", ":", "start", "=", "time", ".", "time", "(", ")", "last_ex", "=", "None", "while", "time", "."...
Wait until a condition is met or time out with an exception.
[ "Wait", "until", "a", "condition", "is", "met", "or", "time", "out", "with", "an", "exception", "." ]
[ "\"\"\"Wait until a condition is met or time out with an exception.\n\n Args:\n condition_predictor: A function that predicts the condition.\n timeout: Maximum timeout in seconds.\n retry_interval_ms: Retry interval in milliseconds.\n\n Raises:\n RuntimeError: If the condition is n...
[ { "param": "condition_predictor", "type": null }, { "param": "timeout", "type": null }, { "param": "retry_interval_ms", "type": null }, { "param": "kwargs", "type": "Any" } ]
{ "returns": [], "raises": [ { "docstring": "If the condition is not met before the timeout expires.", "docstring_tokens": [ "If", "the", "condition", "is", "not", "met", "before", "the", "timeout", "expires", "....
32a7762fc8248fc4723627c77a8f8a06d1c764f8
kisuke95/ray
python/ray/_private/test_utils.py
[ "Apache-2.0" ]
Python
async_wait_for_condition
<not_specific>
async def async_wait_for_condition( condition_predictor, timeout=10, retry_interval_ms=100, **kwargs: Any ): """Wait until a condition is met or time out with an exception. Args: condition_predictor: A function that predicts the condition. timeout: Maximum timeout in seconds. retry_...
Wait until a condition is met or time out with an exception. Args: condition_predictor: A function that predicts the condition. timeout: Maximum timeout in seconds. retry_interval_ms: Retry interval in milliseconds. Raises: RuntimeError: If the condition is not met before the t...
Wait until a condition is met or time out with an exception.
[ "Wait", "until", "a", "condition", "is", "met", "or", "time", "out", "with", "an", "exception", "." ]
async def async_wait_for_condition( condition_predictor, timeout=10, retry_interval_ms=100, **kwargs: Any ): start = time.time() last_ex = None while time.time() - start <= timeout: try: if condition_predictor(**kwargs): return except Exception as ex: ...
[ "async", "def", "async_wait_for_condition", "(", "condition_predictor", ",", "timeout", "=", "10", ",", "retry_interval_ms", "=", "100", ",", "**", "kwargs", ":", "Any", ")", ":", "start", "=", "time", ".", "time", "(", ")", "last_ex", "=", "None", "while"...
Wait until a condition is met or time out with an exception.
[ "Wait", "until", "a", "condition", "is", "met", "or", "time", "out", "with", "an", "exception", "." ]
[ "\"\"\"Wait until a condition is met or time out with an exception.\n\n Args:\n condition_predictor: A function that predicts the condition.\n timeout: Maximum timeout in seconds.\n retry_interval_ms: Retry interval in milliseconds.\n\n Raises:\n RuntimeError: If the condition is n...
[ { "param": "condition_predictor", "type": null }, { "param": "timeout", "type": null }, { "param": "retry_interval_ms", "type": null }, { "param": "kwargs", "type": "Any" } ]
{ "returns": [], "raises": [ { "docstring": "If the condition is not met before the timeout expires.", "docstring_tokens": [ "If", "the", "condition", "is", "not", "met", "before", "the", "timeout", "expires", "....
32a7762fc8248fc4723627c77a8f8a06d1c764f8
kisuke95/ray
python/ray/_private/test_utils.py
[ "Apache-2.0" ]
Python
wait_until_succeeded_without_exception
<not_specific>
def wait_until_succeeded_without_exception( func, exceptions, *args, timeout_ms=1000, retry_interval_ms=100, raise_last_ex=False ): """A helper function that waits until a given function completes without exceptions. Args: func: A function to run. exceptions(tuple): Exceptions that ...
A helper function that waits until a given function completes without exceptions. Args: func: A function to run. exceptions(tuple): Exceptions that are supposed to occur. args: arguments to pass for a given func timeout_ms: Maximum timeout in milliseconds. retry_inte...
A helper function that waits until a given function completes without exceptions.
[ "A", "helper", "function", "that", "waits", "until", "a", "given", "function", "completes", "without", "exceptions", "." ]
def wait_until_succeeded_without_exception( func, exceptions, *args, timeout_ms=1000, retry_interval_ms=100, raise_last_ex=False ): if type(exceptions) != tuple: raise Exception("exceptions arguments should be given as a tuple") time_elapsed = 0 start = time.time() last_ex = None while t...
[ "def", "wait_until_succeeded_without_exception", "(", "func", ",", "exceptions", ",", "*", "args", ",", "timeout_ms", "=", "1000", ",", "retry_interval_ms", "=", "100", ",", "raise_last_ex", "=", "False", ")", ":", "if", "type", "(", "exceptions", ")", "!=", ...
A helper function that waits until a given function completes without exceptions.
[ "A", "helper", "function", "that", "waits", "until", "a", "given", "function", "completes", "without", "exceptions", "." ]
[ "\"\"\"A helper function that waits until a given function\n completes without exceptions.\n\n Args:\n func: A function to run.\n exceptions(tuple): Exceptions that are supposed to occur.\n args: arguments to pass for a given func\n timeout_ms: Maximum timeout in milliseconds.\...
[ { "param": "func", "type": null }, { "param": "exceptions", "type": null }, { "param": "timeout_ms", "type": null }, { "param": "retry_interval_ms", "type": null }, { "param": "raise_last_ex", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "func", "type": null, "docstring": "A function to run.", "docstring_tokens": [ "A", "function", "to", "run", "." ], "default": null, "is_optional": null }, { ...
32a7762fc8248fc4723627c77a8f8a06d1c764f8
kisuke95/ray
python/ray/_private/test_utils.py
[ "Apache-2.0" ]
Python
dicts_equal
<not_specific>
def dicts_equal(dict1, dict2, abs_tol=1e-4): """Compares to dicts whose values may be floating point numbers.""" if dict1.keys() != dict2.keys(): return False for k, v in dict1.items(): if ( isinstance(v, float) and isinstance(dict2[k], float) and math.i...
Compares to dicts whose values may be floating point numbers.
Compares to dicts whose values may be floating point numbers.
[ "Compares", "to", "dicts", "whose", "values", "may", "be", "floating", "point", "numbers", "." ]
def dicts_equal(dict1, dict2, abs_tol=1e-4): if dict1.keys() != dict2.keys(): return False for k, v in dict1.items(): if ( isinstance(v, float) and isinstance(dict2[k], float) and math.isclose(v, dict2[k], abs_tol=abs_tol) ): continue ...
[ "def", "dicts_equal", "(", "dict1", ",", "dict2", ",", "abs_tol", "=", "1e-4", ")", ":", "if", "dict1", ".", "keys", "(", ")", "!=", "dict2", ".", "keys", "(", ")", ":", "return", "False", "for", "k", ",", "v", "in", "dict1", ".", "items", "(", ...
Compares to dicts whose values may be floating point numbers.
[ "Compares", "to", "dicts", "whose", "values", "may", "be", "floating", "point", "numbers", "." ]
[ "\"\"\"Compares to dicts whose values may be floating point numbers.\"\"\"" ]
[ { "param": "dict1", "type": null }, { "param": "dict2", "type": null }, { "param": "abs_tol", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dict1", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dict2", "type": null, "docstring": null, "docstring_tokens":...
32a7762fc8248fc4723627c77a8f8a06d1c764f8
kisuke95/ray
python/ray/_private/test_utils.py
[ "Apache-2.0" ]
Python
init_error_pubsub
<not_specific>
def init_error_pubsub(): """Initialize error info pub/sub""" s = GcsErrorSubscriber(address=ray.worker.global_worker.gcs_client.address) s.subscribe() return s
Initialize error info pub/sub
Initialize error info pub/sub
[ "Initialize", "error", "info", "pub", "/", "sub" ]
def init_error_pubsub(): s = GcsErrorSubscriber(address=ray.worker.global_worker.gcs_client.address) s.subscribe() return s
[ "def", "init_error_pubsub", "(", ")", ":", "s", "=", "GcsErrorSubscriber", "(", "address", "=", "ray", ".", "worker", ".", "global_worker", ".", "gcs_client", ".", "address", ")", "s", ".", "subscribe", "(", ")", "return", "s" ]
Initialize error info pub/sub
[ "Initialize", "error", "info", "pub", "/", "sub" ]
[ "\"\"\"Initialize error info pub/sub\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
32a7762fc8248fc4723627c77a8f8a06d1c764f8
kisuke95/ray
python/ray/_private/test_utils.py
[ "Apache-2.0" ]
Python
monitor_memory_usage
<not_specific>
def monitor_memory_usage( print_interval_s: int = 30, record_interval_s: int = 5, warning_threshold: float = 0.9, ): """Run the memory monitor actor that prints the memory usage. The monitor will run on the same node as this function is called. Params: interval_s (int): The interval me...
Run the memory monitor actor that prints the memory usage. The monitor will run on the same node as this function is called. Params: interval_s (int): The interval memory usage information is printed warning_threshold (float): The threshold where the memory usage warning is printed...
Run the memory monitor actor that prints the memory usage. The monitor will run on the same node as this function is called.
[ "Run", "the", "memory", "monitor", "actor", "that", "prints", "the", "memory", "usage", ".", "The", "monitor", "will", "run", "on", "the", "same", "node", "as", "this", "function", "is", "called", "." ]
def monitor_memory_usage( print_interval_s: int = 30, record_interval_s: int = 5, warning_threshold: float = 0.9, ): assert ray.is_initialized(), "The API is only available when Ray is initialized." @ray.remote(num_cpus=0) class MemoryMonitorActor: def __init__( self, ...
[ "def", "monitor_memory_usage", "(", "print_interval_s", ":", "int", "=", "30", ",", "record_interval_s", ":", "int", "=", "5", ",", "warning_threshold", ":", "float", "=", "0.9", ",", ")", ":", "assert", "ray", ".", "is_initialized", "(", ")", ",", "\"The ...
Run the memory monitor actor that prints the memory usage.
[ "Run", "the", "memory", "monitor", "actor", "that", "prints", "the", "memory", "usage", "." ]
[ "\"\"\"Run the memory monitor actor that prints the memory usage.\n\n The monitor will run on the same node as this function is called.\n\n Params:\n interval_s (int): The interval memory usage information is printed\n warning_threshold (float): The threshold where the\n memory usage ...
[ { "param": "print_interval_s", "type": "int" }, { "param": "record_interval_s", "type": "int" }, { "param": "warning_threshold", "type": "float" } ]
{ "returns": [ { "docstring": "The memory monitor actor.", "docstring_tokens": [ "The", "memory", "monitor", "actor", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "print_interval_s", "type": "int", ...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
to_dict
TrainerConfigDict
def to_dict(self) -> TrainerConfigDict: """Converts all settings into a legacy config dict for backward compatibility. Returns: A complete TrainerConfigDict, usable in backward-compatible Tune/RLlib use cases, e.g. w/ `tune.run()`. """ config = copy.deepcopy(vars...
Converts all settings into a legacy config dict for backward compatibility. Returns: A complete TrainerConfigDict, usable in backward-compatible Tune/RLlib use cases, e.g. w/ `tune.run()`.
Converts all settings into a legacy config dict for backward compatibility.
[ "Converts", "all", "settings", "into", "a", "legacy", "config", "dict", "for", "backward", "compatibility", "." ]
def to_dict(self) -> TrainerConfigDict: config = copy.deepcopy(vars(self)) config.pop("trainer_class") if "lambda_" in config: assert hasattr(self, "lambda_") config["lambda"] = getattr(self, "lambda_") config.pop("lambda_") if "input_" in config: ...
[ "def", "to_dict", "(", "self", ")", "->", "TrainerConfigDict", ":", "config", "=", "copy", ".", "deepcopy", "(", "vars", "(", "self", ")", ")", "config", ".", "pop", "(", "\"trainer_class\"", ")", "if", "\"lambda_\"", "in", "config", ":", "assert", "hasa...
Converts all settings into a legacy config dict for backward compatibility.
[ "Converts", "all", "settings", "into", "a", "legacy", "config", "dict", "for", "backward", "compatibility", "." ]
[ "\"\"\"Converts all settings into a legacy config dict for backward compatibility.\n\n Returns:\n A complete TrainerConfigDict, usable in backward-compatible Tune/RLlib\n use cases, e.g. w/ `tune.run()`.\n \"\"\"", "# Worst naming convention ever: NEVER EVER use reserved key-wo...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "A complete TrainerConfigDict, usable in backward-compatible Tune/RLlib\nuse cases, e.g.", "docstring_tokens": [ "A", "complete", "TrainerConfigDict", "usable", "in", "backward", "-", "compatible", "T...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
build
"Trainer"
def build( self, env: Optional[Union[str, EnvType]] = None, logger_creator: Optional[Callable[[], Logger]] = None, ) -> "Trainer": """Builds a Trainer from the TrainerConfig. Args: env: Name of the environment to use (e.g. a gym-registered str), a...
Builds a Trainer from the TrainerConfig. Args: env: Name of the environment to use (e.g. a gym-registered str), a full class path (e.g. "ray.rllib.examples.env.random_env.RandomEnv"), or an Env class directly. Note that this arg can also be specified ...
Builds a Trainer from the TrainerConfig.
[ "Builds", "a", "Trainer", "from", "the", "TrainerConfig", "." ]
def build( self, env: Optional[Union[str, EnvType]] = None, logger_creator: Optional[Callable[[], Logger]] = None, ) -> "Trainer": if env is not None: self.env = env if self.evaluation_config is not None: self.evaluation_config["env"] = env ...
[ "def", "build", "(", "self", ",", "env", ":", "Optional", "[", "Union", "[", "str", ",", "EnvType", "]", "]", "=", "None", ",", "logger_creator", ":", "Optional", "[", "Callable", "[", "[", "]", ",", "Logger", "]", "]", "=", "None", ",", ")", "->...
Builds a Trainer from the TrainerConfig.
[ "Builds", "a", "Trainer", "from", "the", "TrainerConfig", "." ]
[ "\"\"\"Builds a Trainer from the TrainerConfig.\n\n Args:\n env: Name of the environment to use (e.g. a gym-registered str),\n a full class path (e.g.\n \"ray.rllib.examples.env.random_env.RandomEnv\"), or an Env\n class directly. Note that this arg can...
[ { "param": "self", "type": null }, { "param": "env", "type": "Optional[Union[str, EnvType]]" }, { "param": "logger_creator", "type": "Optional[Callable[[], Logger]]" } ]
{ "returns": [ { "docstring": "A ray.rllib.agents.trainer.Trainer object.", "docstring_tokens": [ "A", "ray", ".", "rllib", ".", "agents", ".", "trainer", ".", "Trainer", "object", "." ], "type"...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
python_environment
"TrainerConfig"
def python_environment( self, *, extra_python_environs_for_driver: Optional[dict] = None, extra_python_environs_for_worker: Optional[dict] = None, ) -> "TrainerConfig": """Sets the config's python environment settings. Args: extra_python_environs_for_driv...
Sets the config's python environment settings. Args: extra_python_environs_for_driver: Any extra python env vars to set in the trainer process, e.g., {"OMP_NUM_THREADS": "16"}. extra_python_environs_for_worker: The extra python environments need to set fo...
Sets the config's python environment settings.
[ "Sets", "the", "config", "'", "s", "python", "environment", "settings", "." ]
def python_environment( self, *, extra_python_environs_for_driver: Optional[dict] = None, extra_python_environs_for_worker: Optional[dict] = None, ) -> "TrainerConfig": if extra_python_environs_for_driver is not None: self.extra_python_environs_for_driver = extra_...
[ "def", "python_environment", "(", "self", ",", "*", ",", "extra_python_environs_for_driver", ":", "Optional", "[", "dict", "]", "=", "None", ",", "extra_python_environs_for_worker", ":", "Optional", "[", "dict", "]", "=", "None", ",", ")", "->", "\"TrainerConfig...
Sets the config's python environment settings.
[ "Sets", "the", "config", "'", "s", "python", "environment", "settings", "." ]
[ "\"\"\"Sets the config's python environment settings.\n\n Args:\n extra_python_environs_for_driver: Any extra python env vars to set in the\n trainer process, e.g., {\"OMP_NUM_THREADS\": \"16\"}.\n extra_python_environs_for_worker: The extra python environments need to se...
[ { "param": "self", "type": null }, { "param": "extra_python_environs_for_driver", "type": "Optional[dict]" }, { "param": "extra_python_environs_for_worker", "type": "Optional[dict]" } ]
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
resources
"TrainerConfig"
def resources( self, *, num_gpus: Optional[Union[float, int]] = None, _fake_gpus: Optional[bool] = None, num_cpus_per_worker: Optional[int] = None, num_gpus_per_worker: Optional[Union[float, int]] = None, num_cpus_for_local_worker: Optional[int] = None, cu...
Specifies resources allocated for a Trainer and its ray actors/workers. Args: num_gpus: Number of GPUs to allocate to the trainer process. Note that not all algorithms can take advantage of trainer GPUs. Support for multi-GPU is currently only available for ...
Specifies resources allocated for a Trainer and its ray actors/workers.
[ "Specifies", "resources", "allocated", "for", "a", "Trainer", "and", "its", "ray", "actors", "/", "workers", "." ]
def resources( self, *, num_gpus: Optional[Union[float, int]] = None, _fake_gpus: Optional[bool] = None, num_cpus_per_worker: Optional[int] = None, num_gpus_per_worker: Optional[Union[float, int]] = None, num_cpus_for_local_worker: Optional[int] = None, cu...
[ "def", "resources", "(", "self", ",", "*", ",", "num_gpus", ":", "Optional", "[", "Union", "[", "float", ",", "int", "]", "]", "=", "None", ",", "_fake_gpus", ":", "Optional", "[", "bool", "]", "=", "None", ",", "num_cpus_per_worker", ":", "Optional", ...
Specifies resources allocated for a Trainer and its ray actors/workers.
[ "Specifies", "resources", "allocated", "for", "a", "Trainer", "and", "its", "ray", "actors", "/", "workers", "." ]
[ "\"\"\"Specifies resources allocated for a Trainer and its ray actors/workers.\n\n Args:\n num_gpus: Number of GPUs to allocate to the trainer process.\n Note that not all algorithms can take advantage of trainer GPUs.\n Support for multi-GPU is currently only availab...
[ { "param": "self", "type": null }, { "param": "num_gpus", "type": "Optional[Union[float, int]]" }, { "param": "_fake_gpus", "type": "Optional[bool]" }, { "param": "num_cpus_per_worker", "type": "Optional[int]" }, { "param": "num_gpus_per_worker", "type": "Opti...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
framework
"TrainerConfig"
def framework( self, framework: Optional[str] = None, *, eager_tracing: Optional[bool] = None, eager_max_retraces: Optional[int] = None, tf_session_args: Optional[Dict[str, Any]] = None, local_tf_session_args: Optional[Dict[str, Any]] = None, ) -> "TrainerConf...
Sets the config's DL framework settings. Args: framework: tf: TensorFlow (static-graph); tf2: TensorFlow 2.x (eager or traced, if eager_tracing=True); torch: PyTorch eager_tracing: Enable tracing in eager mode. This greatly improves performance (speedup ~...
Sets the config's DL framework settings.
[ "Sets", "the", "config", "'", "s", "DL", "framework", "settings", "." ]
def framework( self, framework: Optional[str] = None, *, eager_tracing: Optional[bool] = None, eager_max_retraces: Optional[int] = None, tf_session_args: Optional[Dict[str, Any]] = None, local_tf_session_args: Optional[Dict[str, Any]] = None, ) -> "TrainerConf...
[ "def", "framework", "(", "self", ",", "framework", ":", "Optional", "[", "str", "]", "=", "None", ",", "*", ",", "eager_tracing", ":", "Optional", "[", "bool", "]", "=", "None", ",", "eager_max_retraces", ":", "Optional", "[", "int", "]", "=", "None", ...
Sets the config's DL framework settings.
[ "Sets", "the", "config", "'", "s", "DL", "framework", "settings", "." ]
[ "\"\"\"Sets the config's DL framework settings.\n\n Args:\n framework: tf: TensorFlow (static-graph); tf2: TensorFlow 2.x\n (eager or traced, if eager_tracing=True); torch: PyTorch\n eager_tracing: Enable tracing in eager mode. This greatly improves\n perfo...
[ { "param": "self", "type": null }, { "param": "framework", "type": "Optional[str]" }, { "param": "eager_tracing", "type": "Optional[bool]" }, { "param": "eager_max_retraces", "type": "Optional[int]" }, { "param": "tf_session_args", "type": "Optional[Dict[str, ...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
environment
"TrainerConfig"
def environment( self, *, env: Optional[Union[str, EnvType]] = None, env_config: Optional[EnvConfigDict] = None, observation_space: Optional[gym.spaces.Space] = None, action_space: Optional[gym.spaces.Space] = None, env_task_fn: Optional[Callable[[ResultDict, EnvT...
Sets the config's RL-environment settings. Args: env: The environment specifier. This can either be a tune-registered env, via `tune.register_env([name], lambda env_ctx: [env object])`, or a string specifier of an RLlib supported type. In the latter case, ...
Sets the config's RL-environment settings.
[ "Sets", "the", "config", "'", "s", "RL", "-", "environment", "settings", "." ]
def environment( self, *, env: Optional[Union[str, EnvType]] = None, env_config: Optional[EnvConfigDict] = None, observation_space: Optional[gym.spaces.Space] = None, action_space: Optional[gym.spaces.Space] = None, env_task_fn: Optional[Callable[[ResultDict, EnvT...
[ "def", "environment", "(", "self", ",", "*", ",", "env", ":", "Optional", "[", "Union", "[", "str", ",", "EnvType", "]", "]", "=", "None", ",", "env_config", ":", "Optional", "[", "EnvConfigDict", "]", "=", "None", ",", "observation_space", ":", "Optio...
Sets the config's RL-environment settings.
[ "Sets", "the", "config", "'", "s", "RL", "-", "environment", "settings", "." ]
[ "\"\"\"Sets the config's RL-environment settings.\n\n Args:\n env: The environment specifier. This can either be a tune-registered env,\n via `tune.register_env([name], lambda env_ctx: [env object])`,\n or a string specifier of an RLlib supported type. In the latter c...
[ { "param": "self", "type": null }, { "param": "env", "type": "Optional[Union[str, EnvType]]" }, { "param": "env_config", "type": "Optional[EnvConfigDict]" }, { "param": "observation_space", "type": "Optional[gym.spaces.Space]" }, { "param": "action_space", "ty...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
rollouts
"TrainerConfig"
def rollouts( self, *, num_rollout_workers: Optional[int] = None, num_envs_per_worker: Optional[int] = None, create_env_on_local_worker: Optional[bool] = None, sample_collector: Optional[Type[SampleCollector]] = None, sample_async: Optional[bool] = None, r...
Sets the rollout worker configuration. Args: num_rollout_workers: Number of rollout worker actors to create for parallel sampling. Setting this to 0 will force rollouts to be done in the local worker (driver process or the Trainer actor when using Tune). ...
Sets the rollout worker configuration.
[ "Sets", "the", "rollout", "worker", "configuration", "." ]
def rollouts( self, *, num_rollout_workers: Optional[int] = None, num_envs_per_worker: Optional[int] = None, create_env_on_local_worker: Optional[bool] = None, sample_collector: Optional[Type[SampleCollector]] = None, sample_async: Optional[bool] = None, r...
[ "def", "rollouts", "(", "self", ",", "*", ",", "num_rollout_workers", ":", "Optional", "[", "int", "]", "=", "None", ",", "num_envs_per_worker", ":", "Optional", "[", "int", "]", "=", "None", ",", "create_env_on_local_worker", ":", "Optional", "[", "bool", ...
Sets the rollout worker configuration.
[ "Sets", "the", "rollout", "worker", "configuration", "." ]
[ "\"\"\"Sets the rollout worker configuration.\n\n Args:\n num_rollout_workers: Number of rollout worker actors to create for\n parallel sampling. Setting this to 0 will force rollouts to be done in\n the local worker (driver process or the Trainer actor when using Tun...
[ { "param": "self", "type": null }, { "param": "num_rollout_workers", "type": "Optional[int]" }, { "param": "num_envs_per_worker", "type": "Optional[int]" }, { "param": "create_env_on_local_worker", "type": "Optional[bool]" }, { "param": "sample_collector", "ty...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
training
"TrainerConfig"
def training( self, gamma: Optional[float] = None, lr: Optional[float] = None, train_batch_size: Optional[int] = None, model: Optional[dict] = None, optimizer: Optional[dict] = None, ) -> "TrainerConfig": """Sets the training related configuration. Ar...
Sets the training related configuration. Args: gamma: Float specifying the discount factor of the Markov Decision process. lr: The default learning rate. train_batch_size: Training batch size, if applicable. model: Arguments passed into the policy model. See mode...
Sets the training related configuration.
[ "Sets", "the", "training", "related", "configuration", "." ]
def training( self, gamma: Optional[float] = None, lr: Optional[float] = None, train_batch_size: Optional[int] = None, model: Optional[dict] = None, optimizer: Optional[dict] = None, ) -> "TrainerConfig": if gamma is not None: self.gamma = gamma ...
[ "def", "training", "(", "self", ",", "gamma", ":", "Optional", "[", "float", "]", "=", "None", ",", "lr", ":", "Optional", "[", "float", "]", "=", "None", ",", "train_batch_size", ":", "Optional", "[", "int", "]", "=", "None", ",", "model", ":", "O...
Sets the training related configuration.
[ "Sets", "the", "training", "related", "configuration", "." ]
[ "\"\"\"Sets the training related configuration.\n\n Args:\n gamma: Float specifying the discount factor of the Markov Decision process.\n lr: The default learning rate.\n train_batch_size: Training batch size, if applicable.\n model: Arguments passed into the polic...
[ { "param": "self", "type": null }, { "param": "gamma", "type": "Optional[float]" }, { "param": "lr", "type": "Optional[float]" }, { "param": "train_batch_size", "type": "Optional[int]" }, { "param": "model", "type": "Optional[dict]" }, { "param": "opti...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
exploration
"TrainerConfig"
def exploration( self, *, explore: Optional[bool] = None, exploration_config: Optional[dict] = None, ) -> "TrainerConfig": """Sets the config's exploration settings. Args: explore: Default exploration behavior, iff `explore`=None is passed into ...
Sets the config's exploration settings. Args: explore: Default exploration behavior, iff `explore`=None is passed into compute_action(s). Set to False for no exploration behavior (e.g., for evaluation). exploration_config: A dict specifying the Exploratio...
Sets the config's exploration settings.
[ "Sets", "the", "config", "'", "s", "exploration", "settings", "." ]
def exploration( self, *, explore: Optional[bool] = None, exploration_config: Optional[dict] = None, ) -> "TrainerConfig": if explore is not None: self.explore = explore if exploration_config is not None: self.exploration_config = exploration_c...
[ "def", "exploration", "(", "self", ",", "*", ",", "explore", ":", "Optional", "[", "bool", "]", "=", "None", ",", "exploration_config", ":", "Optional", "[", "dict", "]", "=", "None", ",", ")", "->", "\"TrainerConfig\"", ":", "if", "explore", "is", "no...
Sets the config's exploration settings.
[ "Sets", "the", "config", "'", "s", "exploration", "settings", "." ]
[ "\"\"\"Sets the config's exploration settings.\n\n Args:\n explore: Default exploration behavior, iff `explore`=None is passed into\n compute_action(s). Set to False for no exploration behavior (e.g.,\n for evaluation).\n exploration_config: A dict specifyi...
[ { "param": "self", "type": null }, { "param": "explore", "type": "Optional[bool]" }, { "param": "exploration_config", "type": "Optional[dict]" } ]
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
evaluation
"TrainerConfig"
def evaluation( self, *, evaluation_interval: Optional[int] = None, evaluation_duration: Optional[int] = None, evaluation_duration_unit: Optional[str] = None, evaluation_parallel_to_training: Optional[bool] = None, evaluation_config: Optional[ Union["T...
Sets the config's evaluation settings. Args: evaluation_interval: Evaluate with every `evaluation_interval` training iterations. The evaluation stats will be reported under the "evaluation" metric key. Note that for Ape-X metrics are already only reported for ...
Sets the config's evaluation settings.
[ "Sets", "the", "config", "'", "s", "evaluation", "settings", "." ]
def evaluation( self, *, evaluation_interval: Optional[int] = None, evaluation_duration: Optional[int] = None, evaluation_duration_unit: Optional[str] = None, evaluation_parallel_to_training: Optional[bool] = None, evaluation_config: Optional[ Union["T...
[ "def", "evaluation", "(", "self", ",", "*", ",", "evaluation_interval", ":", "Optional", "[", "int", "]", "=", "None", ",", "evaluation_duration", ":", "Optional", "[", "int", "]", "=", "None", ",", "evaluation_duration_unit", ":", "Optional", "[", "str", ...
Sets the config's evaluation settings.
[ "Sets", "the", "config", "'", "s", "evaluation", "settings", "." ]
[ "\"\"\"Sets the config's evaluation settings.\n\n Args:\n evaluation_interval: Evaluate with every `evaluation_interval` training\n iterations. The evaluation stats will be reported under the \"evaluation\"\n metric key. Note that for Ape-X metrics are already only re...
[ { "param": "self", "type": null }, { "param": "evaluation_interval", "type": "Optional[int]" }, { "param": "evaluation_duration", "type": "Optional[int]" }, { "param": "evaluation_duration_unit", "type": "Optional[str]" }, { "param": "evaluation_parallel_to_traini...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
offline_data
"TrainerConfig"
def offline_data( self, *, input_=None, input_config=None, actions_in_input_normalized=None, input_evaluation=None, postprocess_inputs=None, shuffle_buffer_size=None, output=None, output_config=None, output_compress_columns=None, ...
Sets the config's offline data settings. Args: input_: Specify how to generate experiences: - "sampler": Generate experiences via online (env) simulation (default). - A local directory or file glob expression (e.g., "/tmp/*.json"). - A list of individual file ...
Sets the config's offline data settings.
[ "Sets", "the", "config", "'", "s", "offline", "data", "settings", "." ]
def offline_data( self, *, input_=None, input_config=None, actions_in_input_normalized=None, input_evaluation=None, postprocess_inputs=None, shuffle_buffer_size=None, output=None, output_config=None, output_compress_columns=None, ...
[ "def", "offline_data", "(", "self", ",", "*", ",", "input_", "=", "None", ",", "input_config", "=", "None", ",", "actions_in_input_normalized", "=", "None", ",", "input_evaluation", "=", "None", ",", "postprocess_inputs", "=", "None", ",", "shuffle_buffer_size",...
Sets the config's offline data settings.
[ "Sets", "the", "config", "'", "s", "offline", "data", "settings", "." ]
[ "\"\"\"Sets the config's offline data settings.\n\n Args:\n input_: Specify how to generate experiences:\n - \"sampler\": Generate experiences via online (env) simulation (default).\n - A local directory or file glob expression (e.g., \"/tmp/*.json\").\n - A lis...
[ { "param": "self", "type": null }, { "param": "input_", "type": null }, { "param": "input_config", "type": null }, { "param": "actions_in_input_normalized", "type": null }, { "param": "input_evaluation", "type": null }, { "param": "postprocess_inputs",...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
multi_agent
"TrainerConfig"
def multi_agent( self, *, policies=None, policy_map_capacity=None, policy_map_cache=None, policy_mapping_fn=None, policies_to_train=None, observation_fn=None, replay_mode=None, count_steps_by=None, ) -> "TrainerConfig": """Sets ...
Sets the config's multi-agent settings. Args: policies: Map of type MultiAgentPolicyConfigDict from policy ids to tuples of (policy_cls, obs_space, act_space, config). This defines the observation and action spaces of the policies and any extra config. po...
Sets the config's multi-agent settings.
[ "Sets", "the", "config", "'", "s", "multi", "-", "agent", "settings", "." ]
def multi_agent( self, *, policies=None, policy_map_capacity=None, policy_map_cache=None, policy_mapping_fn=None, policies_to_train=None, observation_fn=None, replay_mode=None, count_steps_by=None, ) -> "TrainerConfig": if polic...
[ "def", "multi_agent", "(", "self", ",", "*", ",", "policies", "=", "None", ",", "policy_map_capacity", "=", "None", ",", "policy_map_cache", "=", "None", ",", "policy_mapping_fn", "=", "None", ",", "policies_to_train", "=", "None", ",", "observation_fn", "=", ...
Sets the config's multi-agent settings.
[ "Sets", "the", "config", "'", "s", "multi", "-", "agent", "settings", "." ]
[ "\"\"\"Sets the config's multi-agent settings.\n\n Args:\n policies: Map of type MultiAgentPolicyConfigDict from policy ids to tuples\n of (policy_cls, obs_space, act_space, config). This defines the\n observation and action spaces of the policies and any extra config...
[ { "param": "self", "type": null }, { "param": "policies", "type": null }, { "param": "policy_map_capacity", "type": null }, { "param": "policy_map_cache", "type": null }, { "param": "policy_mapping_fn", "type": null }, { "param": "policies_to_train", ...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
reporting
"TrainerConfig"
def reporting( self, *, keep_per_episode_custom_metrics: Optional[bool] = None, metrics_episode_collection_timeout_s: Optional[int] = None, metrics_num_episodes_for_smoothing: Optional[int] = None, min_time_s_per_reporting: Optional[int] = None, min_train_timestep...
Sets the config's reporting settings. Args: keep_per_episode_custom_metrics: Store raw custom metrics without calculating max, min, mean metrics_episode_collection_timeout_s: Wait for metric batches for at most this many seconds. Those that have not retur...
Sets the config's reporting settings.
[ "Sets", "the", "config", "'", "s", "reporting", "settings", "." ]
def reporting( self, *, keep_per_episode_custom_metrics: Optional[bool] = None, metrics_episode_collection_timeout_s: Optional[int] = None, metrics_num_episodes_for_smoothing: Optional[int] = None, min_time_s_per_reporting: Optional[int] = None, min_train_timestep...
[ "def", "reporting", "(", "self", ",", "*", ",", "keep_per_episode_custom_metrics", ":", "Optional", "[", "bool", "]", "=", "None", ",", "metrics_episode_collection_timeout_s", ":", "Optional", "[", "int", "]", "=", "None", ",", "metrics_num_episodes_for_smoothing", ...
Sets the config's reporting settings.
[ "Sets", "the", "config", "'", "s", "reporting", "settings", "." ]
[ "\"\"\"Sets the config's reporting settings.\n\n Args:\n keep_per_episode_custom_metrics: Store raw custom metrics without\n calculating max, min, mean\n metrics_episode_collection_timeout_s: Wait for metric batches for at most\n this many seconds. Those th...
[ { "param": "self", "type": null }, { "param": "keep_per_episode_custom_metrics", "type": "Optional[bool]" }, { "param": "metrics_episode_collection_timeout_s", "type": "Optional[int]" }, { "param": "metrics_num_episodes_for_smoothing", "type": "Optional[int]" }, { ...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
debugging
"TrainerConfig"
def debugging( self, *, logger_config: Optional[dict] = None, log_level: Optional[str] = None, log_sys_usage: Optional[bool] = None, fake_sampler: Optional[bool] = None, seed: Optional[int] = None, ) -> "TrainerConfig": """Sets the config's debugging s...
Sets the config's debugging settings. Args: logger_config: Define logger-specific configuration to be used inside Logger Default value None allows overwriting with nested dicts. log_level: Set the ray.rllib.* log level for the agent process and its worker...
Sets the config's debugging settings.
[ "Sets", "the", "config", "'", "s", "debugging", "settings", "." ]
def debugging( self, *, logger_config: Optional[dict] = None, log_level: Optional[str] = None, log_sys_usage: Optional[bool] = None, fake_sampler: Optional[bool] = None, seed: Optional[int] = None, ) -> "TrainerConfig": if logger_config is not None: ...
[ "def", "debugging", "(", "self", ",", "*", ",", "logger_config", ":", "Optional", "[", "dict", "]", "=", "None", ",", "log_level", ":", "Optional", "[", "str", "]", "=", "None", ",", "log_sys_usage", ":", "Optional", "[", "bool", "]", "=", "None", ",...
Sets the config's debugging settings.
[ "Sets", "the", "config", "'", "s", "debugging", "settings", "." ]
[ "\"\"\"Sets the config's debugging settings.\n\n Args:\n logger_config: Define logger-specific configuration to be used inside Logger\n Default value None allows overwriting with nested dicts.\n log_level: Set the ray.rllib.* log level for the agent process and its\n ...
[ { "param": "self", "type": null }, { "param": "logger_config", "type": "Optional[dict]" }, { "param": "log_level", "type": "Optional[str]" }, { "param": "log_sys_usage", "type": "Optional[bool]" }, { "param": "fake_sampler", "type": "Optional[bool]" }, { ...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
66f4795b78a0fe69b2708da41523680f9b92e387
kisuke95/ray
rllib/agents/trainer_config.py
[ "Apache-2.0" ]
Python
experimental
"TrainerConfig"
def experimental( self, *, _tf_policy_handles_more_than_one_loss=None, _disable_preprocessor_api=None, _disable_action_flattening=None, _disable_execution_plan_api=None, ) -> "TrainerConfig": """Sets the config's experimental settings. Args: ...
Sets the config's experimental settings. Args: _tf_policy_handles_more_than_one_loss: Experimental flag. If True, TFPolicy will handle more than one loss/optimizer. Set this to True, if you would like to return more than one loss term from your `loss_...
Sets the config's experimental settings.
[ "Sets", "the", "config", "'", "s", "experimental", "settings", "." ]
def experimental( self, *, _tf_policy_handles_more_than_one_loss=None, _disable_preprocessor_api=None, _disable_action_flattening=None, _disable_execution_plan_api=None, ) -> "TrainerConfig": if _tf_policy_handles_more_than_one_loss is not None: se...
[ "def", "experimental", "(", "self", ",", "*", ",", "_tf_policy_handles_more_than_one_loss", "=", "None", ",", "_disable_preprocessor_api", "=", "None", ",", "_disable_action_flattening", "=", "None", ",", "_disable_execution_plan_api", "=", "None", ",", ")", "->", "...
Sets the config's experimental settings.
[ "Sets", "the", "config", "'", "s", "experimental", "settings", "." ]
[ "\"\"\"Sets the config's experimental settings.\n\n Args:\n _tf_policy_handles_more_than_one_loss: Experimental flag.\n If True, TFPolicy will handle more than one loss/optimizer.\n Set this to True, if you would like to return more than\n one loss term...
[ { "param": "self", "type": null }, { "param": "_tf_policy_handles_more_than_one_loss", "type": null }, { "param": "_disable_preprocessor_api", "type": null }, { "param": "_disable_action_flattening", "type": null }, { "param": "_disable_execution_plan_api", "t...
{ "returns": [ { "docstring": "This updated TrainerConfig object.", "docstring_tokens": [ "This", "updated", "TrainerConfig", "object", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
0b7d80145fa0c8e25ff6cc89b9f08fe0bbaadf67
kisuke95/ray
python/ray/tune/progress_reporter.py
[ "Apache-2.0" ]
Python
_progress_str
<not_specific>
def _progress_str( self, trials: List[Trial], done: bool, *sys_info: Dict, fmt: str = "psql", delim: str = "\n", ): """Returns full progress string. This string contains a progress table and error table. The progress table describes the progre...
Returns full progress string. This string contains a progress table and error table. The progress table describes the progress of each trial. The error table lists the error file, if any, corresponding to each trial. The latter only exists if errors have occurred. Args: ...
Returns full progress string. This string contains a progress table and error table. The progress table describes the progress of each trial. The error table lists the error file, if any, corresponding to each trial. The latter only exists if errors have occurred.
[ "Returns", "full", "progress", "string", ".", "This", "string", "contains", "a", "progress", "table", "and", "error", "table", ".", "The", "progress", "table", "describes", "the", "progress", "of", "each", "trial", ".", "The", "error", "table", "lists", "the...
def _progress_str( self, trials: List[Trial], done: bool, *sys_info: Dict, fmt: str = "psql", delim: str = "\n", ): if not self._metrics_override: user_metrics = self._infer_user_metrics(trials, self._infer_limit) self._metric_columns.u...
[ "def", "_progress_str", "(", "self", ",", "trials", ":", "List", "[", "Trial", "]", ",", "done", ":", "bool", ",", "*", "sys_info", ":", "Dict", ",", "fmt", ":", "str", "=", "\"psql\"", ",", "delim", ":", "str", "=", "\"\\n\"", ",", ")", ":", "if...
Returns full progress string.
[ "Returns", "full", "progress", "string", "." ]
[ "\"\"\"Returns full progress string.\n\n This string contains a progress table and error table. The progress\n table describes the progress of each trial. The error table lists\n the error file, if any, corresponding to each trial. The latter only\n exists if errors have occurred.\n\n ...
[ { "param": "self", "type": null }, { "param": "trials", "type": "List[Trial]" }, { "param": "done", "type": "bool" }, { "param": "sys_info", "type": "Dict" }, { "param": "fmt", "type": "str" }, { "param": "delim", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "trials", "type": "List[Trial]", "docstring": "Trials to report on."...
0b7d80145fa0c8e25ff6cc89b9f08fe0bbaadf67
kisuke95/ray
python/ray/tune/progress_reporter.py
[ "Apache-2.0" ]
Python
trial_progress_str
<not_specific>
def trial_progress_str( trials: List[Trial], metric_columns: Union[List[str], Dict[str, str]], parameter_columns: Optional[Union[List[str], Dict[str, str]]] = None, total_samples: int = 0, force_table: bool = False, fmt: str = "psql", max_rows: Optional[int] = None, done: bool = False, ...
Returns a human readable message for printing to the console. This contains a table where each row represents a trial, its parameters and the current values of its metrics. Args: trials: List of trials to get progress string for. metric_columns: Names of metrics to include. If ...
Returns a human readable message for printing to the console. This contains a table where each row represents a trial, its parameters and the current values of its metrics.
[ "Returns", "a", "human", "readable", "message", "for", "printing", "to", "the", "console", ".", "This", "contains", "a", "table", "where", "each", "row", "represents", "a", "trial", "its", "parameters", "and", "the", "current", "values", "of", "its", "metric...
def trial_progress_str( trials: List[Trial], metric_columns: Union[List[str], Dict[str, str]], parameter_columns: Optional[Union[List[str], Dict[str, str]]] = None, total_samples: int = 0, force_table: bool = False, fmt: str = "psql", max_rows: Optional[int] = None, done: bool = False, ...
[ "def", "trial_progress_str", "(", "trials", ":", "List", "[", "Trial", "]", ",", "metric_columns", ":", "Union", "[", "List", "[", "str", "]", ",", "Dict", "[", "str", ",", "str", "]", "]", ",", "parameter_columns", ":", "Optional", "[", "Union", "[", ...
Returns a human readable message for printing to the console.
[ "Returns", "a", "human", "readable", "message", "for", "printing", "to", "the", "console", "." ]
[ "\"\"\"Returns a human readable message for printing to the console.\n\n This contains a table where each row represents a trial, its parameters\n and the current values of its metrics.\n\n Args:\n trials: List of trials to get progress string for.\n metric_columns: Names of metrics to includ...
[ { "param": "trials", "type": "List[Trial]" }, { "param": "metric_columns", "type": "Union[List[str], Dict[str, str]]" }, { "param": "parameter_columns", "type": "Optional[Union[List[str], Dict[str, str]]]" }, { "param": "total_samples", "type": "int" }, { "param":...
{ "returns": [], "raises": [], "params": [ { "identifier": "trials", "type": "List[Trial]", "docstring": "List of trials to get progress string for.", "docstring_tokens": [ "List", "of", "trials", "to", "get", "progress", "string"...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
from_bytes
"Checkpoint"
def from_bytes(cls, data: bytes) -> "Checkpoint": """Create a checkpoint from the given byte string. Args: data (bytes): Data object containing pickled checkpoint data. Returns: Checkpoint: checkpoint object. """ bytes_data = pickle.loads(data) i...
Create a checkpoint from the given byte string. Args: data (bytes): Data object containing pickled checkpoint data. Returns: Checkpoint: checkpoint object.
Create a checkpoint from the given byte string.
[ "Create", "a", "checkpoint", "from", "the", "given", "byte", "string", "." ]
def from_bytes(cls, data: bytes) -> "Checkpoint": bytes_data = pickle.loads(data) if isinstance(bytes_data, dict): data_dict = bytes_data else: data_dict = {_BYTES_DATA_KEY: bytes_data} return cls.from_dict(data_dict)
[ "def", "from_bytes", "(", "cls", ",", "data", ":", "bytes", ")", "->", "\"Checkpoint\"", ":", "bytes_data", "=", "pickle", ".", "loads", "(", "data", ")", "if", "isinstance", "(", "bytes_data", ",", "dict", ")", ":", "data_dict", "=", "bytes_data", "else...
Create a checkpoint from the given byte string.
[ "Create", "a", "checkpoint", "from", "the", "given", "byte", "string", "." ]
[ "\"\"\"Create a checkpoint from the given byte string.\n\n Args:\n data (bytes): Data object containing pickled checkpoint data.\n\n Returns:\n Checkpoint: checkpoint object.\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "data", "type": "bytes" } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "Checkpoint" } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": ...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
to_bytes
bytes
def to_bytes(self) -> bytes: """Return Checkpoint serialized as bytes object. Returns: bytes: Bytes object containing checkpoint data. """ # Todo: Add support for stream in the future (to_bytes(file_like)) data_dict = self.to_dict() if "bytes_data" in data_di...
Return Checkpoint serialized as bytes object. Returns: bytes: Bytes object containing checkpoint data.
Return Checkpoint serialized as bytes object.
[ "Return", "Checkpoint", "serialized", "as", "bytes", "object", "." ]
def to_bytes(self) -> bytes: data_dict = self.to_dict() if "bytes_data" in data_dict: return data_dict["bytes_data"] return pickle.dumps(self.to_dict())
[ "def", "to_bytes", "(", "self", ")", "->", "bytes", ":", "data_dict", "=", "self", ".", "to_dict", "(", ")", "if", "\"bytes_data\"", "in", "data_dict", ":", "return", "data_dict", "[", "\"bytes_data\"", "]", "return", "pickle", ".", "dumps", "(", "self", ...
Return Checkpoint serialized as bytes object.
[ "Return", "Checkpoint", "serialized", "as", "bytes", "object", "." ]
[ "\"\"\"Return Checkpoint serialized as bytes object.\n\n Returns:\n bytes: Bytes object containing checkpoint data.\n \"\"\"", "# Todo: Add support for stream in the future (to_bytes(file_like))" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Bytes object containing checkpoint data.", "docstring_tokens": [ "Bytes", "object", "containing", "checkpoint", "data", "." ], "type": "bytes" } ], "raises": [], "params": [ { "identifier": "...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
from_dict
"Checkpoint"
def from_dict(cls, data: dict) -> "Checkpoint": """Create checkpoint object from dictionary. Args: data (dict): Dictionary containing checkpoint data. Returns: Checkpoint: checkpoint object. """ return Checkpoint(data_dict=data)
Create checkpoint object from dictionary. Args: data (dict): Dictionary containing checkpoint data. Returns: Checkpoint: checkpoint object.
Create checkpoint object from dictionary.
[ "Create", "checkpoint", "object", "from", "dictionary", "." ]
def from_dict(cls, data: dict) -> "Checkpoint": return Checkpoint(data_dict=data)
[ "def", "from_dict", "(", "cls", ",", "data", ":", "dict", ")", "->", "\"Checkpoint\"", ":", "return", "Checkpoint", "(", "data_dict", "=", "data", ")" ]
Create checkpoint object from dictionary.
[ "Create", "checkpoint", "object", "from", "dictionary", "." ]
[ "\"\"\"Create checkpoint object from dictionary.\n\n Args:\n data (dict): Dictionary containing checkpoint data.\n\n Returns:\n Checkpoint: checkpoint object.\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "data", "type": "dict" } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "Checkpoint" } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": ...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
to_dict
dict
def to_dict(self) -> dict: """Return checkpoint data as dictionary. Returns: dict: Dictionary containing checkpoint data. """ if self._data_dict: # If the checkpoint data is already a dict, return return self._data_dict elif self._obj_ref: ...
Return checkpoint data as dictionary. Returns: dict: Dictionary containing checkpoint data.
Return checkpoint data as dictionary.
[ "Return", "checkpoint", "data", "as", "dictionary", "." ]
def to_dict(self) -> dict: if self._data_dict: return self._data_dict elif self._obj_ref: return ray.get(self._obj_ref) elif self._local_path or self._uri: with self.as_directory() as local_path: checkpoint_data_path = os.path.join( ...
[ "def", "to_dict", "(", "self", ")", "->", "dict", ":", "if", "self", ".", "_data_dict", ":", "return", "self", ".", "_data_dict", "elif", "self", ".", "_obj_ref", ":", "return", "ray", ".", "get", "(", "self", ".", "_obj_ref", ")", "elif", "self", "....
Return checkpoint data as dictionary.
[ "Return", "checkpoint", "data", "as", "dictionary", "." ]
[ "\"\"\"Return checkpoint data as dictionary.\n\n Returns:\n dict: Dictionary containing checkpoint data.\n \"\"\"", "# If the checkpoint data is already a dict, return", "# If the checkpoint data is an object reference, resolve", "# Else, checkpoint is either on FS or external storage...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Dictionary containing checkpoint data.", "docstring_tokens": [ "Dictionary", "containing", "checkpoint", "data", "." ], "type": "dict" } ], "raises": [], "params": [ { "identifier": "self", "ty...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
from_object_ref
"Checkpoint"
def from_object_ref(cls, obj_ref: ray.ObjectRef) -> "Checkpoint": """Create checkpoint object from object reference. Args: obj_ref (ray.ObjectRef): ObjectRef pointing to checkpoint data. Returns: Checkpoint: checkpoint object. """ return Checkpoint(obj_r...
Create checkpoint object from object reference. Args: obj_ref (ray.ObjectRef): ObjectRef pointing to checkpoint data. Returns: Checkpoint: checkpoint object.
Create checkpoint object from object reference.
[ "Create", "checkpoint", "object", "from", "object", "reference", "." ]
def from_object_ref(cls, obj_ref: ray.ObjectRef) -> "Checkpoint": return Checkpoint(obj_ref=obj_ref)
[ "def", "from_object_ref", "(", "cls", ",", "obj_ref", ":", "ray", ".", "ObjectRef", ")", "->", "\"Checkpoint\"", ":", "return", "Checkpoint", "(", "obj_ref", "=", "obj_ref", ")" ]
Create checkpoint object from object reference.
[ "Create", "checkpoint", "object", "from", "object", "reference", "." ]
[ "\"\"\"Create checkpoint object from object reference.\n\n Args:\n obj_ref (ray.ObjectRef): ObjectRef pointing to checkpoint data.\n\n Returns:\n Checkpoint: checkpoint object.\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "obj_ref", "type": "ray.ObjectRef" } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "Checkpoint" } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": ...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
to_object_ref
ray.ObjectRef
def to_object_ref(self) -> ray.ObjectRef: """Return checkpoint data as object reference. Returns: ray.ObjectRef: ObjectRef pointing to checkpoint data. """ if self._obj_ref: return self._obj_ref else: return ray.put(self.to_dict())
Return checkpoint data as object reference. Returns: ray.ObjectRef: ObjectRef pointing to checkpoint data.
Return checkpoint data as object reference.
[ "Return", "checkpoint", "data", "as", "object", "reference", "." ]
def to_object_ref(self) -> ray.ObjectRef: if self._obj_ref: return self._obj_ref else: return ray.put(self.to_dict())
[ "def", "to_object_ref", "(", "self", ")", "->", "ray", ".", "ObjectRef", ":", "if", "self", ".", "_obj_ref", ":", "return", "self", ".", "_obj_ref", "else", ":", "return", "ray", ".", "put", "(", "self", ".", "to_dict", "(", ")", ")" ]
Return checkpoint data as object reference.
[ "Return", "checkpoint", "data", "as", "object", "reference", "." ]
[ "\"\"\"Return checkpoint data as object reference.\n\n Returns:\n ray.ObjectRef: ObjectRef pointing to checkpoint data.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "ObjectRef pointing to checkpoint data.", "docstring_tokens": [ "ObjectRef", "pointing", "to", "checkpoint", "data", "." ], "type": "ray.ObjectRef" } ], "raises": [], "params": [ { "identifier...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
from_directory
"Checkpoint"
def from_directory(cls, path: str) -> "Checkpoint": """Create checkpoint object from directory. Args: path (str): Directory containing checkpoint data. Returns: Checkpoint: checkpoint object. """ return Checkpoint(local_path=path)
Create checkpoint object from directory. Args: path (str): Directory containing checkpoint data. Returns: Checkpoint: checkpoint object.
Create checkpoint object from directory.
[ "Create", "checkpoint", "object", "from", "directory", "." ]
def from_directory(cls, path: str) -> "Checkpoint": return Checkpoint(local_path=path)
[ "def", "from_directory", "(", "cls", ",", "path", ":", "str", ")", "->", "\"Checkpoint\"", ":", "return", "Checkpoint", "(", "local_path", "=", "path", ")" ]
Create checkpoint object from directory.
[ "Create", "checkpoint", "object", "from", "directory", "." ]
[ "\"\"\"Create checkpoint object from directory.\n\n Args:\n path (str): Directory containing checkpoint data.\n\n Returns:\n Checkpoint: checkpoint object.\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "path", "type": "str" } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "Checkpoint" } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": ...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
to_directory
str
def to_directory(self, path: Optional[str] = None) -> str: """Write checkpoint data to directory. Args: path (str): Target directory to restore data in. Returns: str: Directory containing checkpoint data. """ path = path if path is not None else _tempora...
Write checkpoint data to directory. Args: path (str): Target directory to restore data in. Returns: str: Directory containing checkpoint data.
Write checkpoint data to directory.
[ "Write", "checkpoint", "data", "to", "directory", "." ]
def to_directory(self, path: Optional[str] = None) -> str: path = path if path is not None else _temporary_checkpoint_dir() os.makedirs(path, exist_ok=True) open(os.path.join(path, ".is_checkpoint"), "a").close() if self._data_dict or self._obj_ref: data_dict = self.to_dict()...
[ "def", "to_directory", "(", "self", ",", "path", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "str", ":", "path", "=", "path", "if", "path", "is", "not", "None", "else", "_temporary_checkpoint_dir", "(", ")", "os", ".", "makedirs", "(", ...
Write checkpoint data to directory.
[ "Write", "checkpoint", "data", "to", "directory", "." ]
[ "\"\"\"Write checkpoint data to directory.\n\n Args:\n path (str): Target directory to restore data in.\n\n Returns:\n str: Directory containing checkpoint data.\n \"\"\"", "# Drop marker", "# This is a object ref or dict", "# This used to be a true fs checkpoint, so...
[ { "param": "self", "type": null }, { "param": "path", "type": "Optional[str]" } ]
{ "returns": [ { "docstring": "Directory containing checkpoint data.", "docstring_tokens": [ "Directory", "containing", "checkpoint", "data", "." ], "type": "str" } ], "raises": [], "params": [ { "identifier": "self", "type"...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
as_directory
Iterator[str]
def as_directory(self) -> Iterator[str]: """Return checkpoint directory path in a context. This function makes checkpoint data available as a directory while avoiding unnecessary copies and left-over temporary data. If the checkpoint is already a directory checkpoint, it will return ...
Return checkpoint directory path in a context. This function makes checkpoint data available as a directory while avoiding unnecessary copies and left-over temporary data. If the checkpoint is already a directory checkpoint, it will return the existing path. If it is not, it will creat...
Return checkpoint directory path in a context. This function makes checkpoint data available as a directory while avoiding unnecessary copies and left-over temporary data. If the checkpoint is already a directory checkpoint, it will return the existing path. If it is not, it will create a temporary directory, which wi...
[ "Return", "checkpoint", "directory", "path", "in", "a", "context", ".", "This", "function", "makes", "checkpoint", "data", "available", "as", "a", "directory", "while", "avoiding", "unnecessary", "copies", "and", "left", "-", "over", "temporary", "data", ".", ...
def as_directory(self) -> Iterator[str]: if self._local_path: yield self._local_path else: temp_dir = self.to_directory() yield temp_dir shutil.rmtree(temp_dir, ignore_errors=True)
[ "def", "as_directory", "(", "self", ")", "->", "Iterator", "[", "str", "]", ":", "if", "self", ".", "_local_path", ":", "yield", "self", ".", "_local_path", "else", ":", "temp_dir", "=", "self", ".", "to_directory", "(", ")", "yield", "temp_dir", "shutil...
Return checkpoint directory path in a context.
[ "Return", "checkpoint", "directory", "path", "in", "a", "context", "." ]
[ "\"\"\"Return checkpoint directory path in a context.\n\n This function makes checkpoint data available as a directory while avoiding\n unnecessary copies and left-over temporary data.\n\n If the checkpoint is already a directory checkpoint, it will return\n the existing path. If it is 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": "with c...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
from_uri
"Checkpoint"
def from_uri(cls, uri: str) -> "Checkpoint": """Create checkpoint object from location URI (e.g. cloud storage). Valid locations currently include AWS S3 (``s3://``), Google cloud storage (``gs://``), HDFS (``hdfs://``), and local files (``file://``). Args: uri (str...
Create checkpoint object from location URI (e.g. cloud storage). Valid locations currently include AWS S3 (``s3://``), Google cloud storage (``gs://``), HDFS (``hdfs://``), and local files (``file://``). Args: uri (str): Source location URI to read data from. Retur...
Create checkpoint object from location URI .
[ "Create", "checkpoint", "object", "from", "location", "URI", "." ]
def from_uri(cls, uri: str) -> "Checkpoint": return Checkpoint(uri=uri)
[ "def", "from_uri", "(", "cls", ",", "uri", ":", "str", ")", "->", "\"Checkpoint\"", ":", "return", "Checkpoint", "(", "uri", "=", "uri", ")" ]
Create checkpoint object from location URI (e.g.
[ "Create", "checkpoint", "object", "from", "location", "URI", "(", "e", ".", "g", "." ]
[ "\"\"\"Create checkpoint object from location URI (e.g. cloud storage).\n\n Valid locations currently include AWS S3 (``s3://``),\n Google cloud storage (``gs://``), HDFS (``hdfs://``), and\n local files (``file://``).\n\n Args:\n uri (str): Source location URI to read data fr...
[ { "param": "cls", "type": null }, { "param": "uri", "type": "str" } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "Checkpoint" } ], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": ...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
to_uri
str
def to_uri(self, uri: str) -> str: """Write checkpoint data to location URI (e.g. cloud storage). Args: uri (str): Target location URI to write data to. Returns: str: Cloud location containing checkpoint data. """ if uri.startswith("file://"): ...
Write checkpoint data to location URI (e.g. cloud storage). Args: uri (str): Target location URI to write data to. Returns: str: Cloud location containing checkpoint data.
Write checkpoint data to location URI .
[ "Write", "checkpoint", "data", "to", "location", "URI", "." ]
def to_uri(self, uri: str) -> str: if uri.startswith("file://"): local_path = uri[7:] return self.to_directory(local_path) if not is_non_local_path_uri(uri): raise RuntimeError( f"Cannot upload checkpoint to URI: Provided URI " f"does n...
[ "def", "to_uri", "(", "self", ",", "uri", ":", "str", ")", "->", "str", ":", "if", "uri", ".", "startswith", "(", "\"file://\"", ")", ":", "local_path", "=", "uri", "[", "7", ":", "]", "return", "self", ".", "to_directory", "(", "local_path", ")", ...
Write checkpoint data to location URI (e.g.
[ "Write", "checkpoint", "data", "to", "location", "URI", "(", "e", ".", "g", "." ]
[ "\"\"\"Write checkpoint data to location URI (e.g. cloud storage).\n\n Args:\n uri (str): Target location URI to write data to.\n\n Returns:\n str: Cloud location containing checkpoint data.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "uri", "type": "str" } ]
{ "returns": [ { "docstring": "Cloud location containing checkpoint data.", "docstring_tokens": [ "Cloud", "location", "containing", "checkpoint", "data", "." ], "type": "str" } ], "raises": [], "params": [ { "identifier":...
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
_get_local_path
Optional[str]
def _get_local_path(path: Optional[str]) -> Optional[str]: """Check if path is a local path. Otherwise return None.""" if path is None or is_non_local_path_uri(path): return None if path.startswith("file://"): path = path[7:] if os.path.exists(path): return path return None
Check if path is a local path. Otherwise return None.
Check if path is a local path. Otherwise return None.
[ "Check", "if", "path", "is", "a", "local", "path", ".", "Otherwise", "return", "None", "." ]
def _get_local_path(path: Optional[str]) -> Optional[str]: if path is None or is_non_local_path_uri(path): return None if path.startswith("file://"): path = path[7:] if os.path.exists(path): return path return None
[ "def", "_get_local_path", "(", "path", ":", "Optional", "[", "str", "]", ")", "->", "Optional", "[", "str", "]", ":", "if", "path", "is", "None", "or", "is_non_local_path_uri", "(", "path", ")", ":", "return", "None", "if", "path", ".", "startswith", "...
Check if path is a local path.
[ "Check", "if", "path", "is", "a", "local", "path", "." ]
[ "\"\"\"Check if path is a local path. Otherwise return None.\"\"\"" ]
[ { "param": "path", "type": "Optional[str]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": "Optional[str]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8f1595756078aa7d95134947abf60e9d44076e94
kisuke95/ray
python/ray/ml/checkpoint.py
[ "Apache-2.0" ]
Python
_get_external_path
Optional[str]
def _get_external_path(path: Optional[str]) -> Optional[str]: """Check if path is an external path. Otherwise return None.""" if not isinstance(path, str) or not is_non_local_path_uri(path): return None return path
Check if path is an external path. Otherwise return None.
Check if path is an external path. Otherwise return None.
[ "Check", "if", "path", "is", "an", "external", "path", ".", "Otherwise", "return", "None", "." ]
def _get_external_path(path: Optional[str]) -> Optional[str]: if not isinstance(path, str) or not is_non_local_path_uri(path): return None return path
[ "def", "_get_external_path", "(", "path", ":", "Optional", "[", "str", "]", ")", "->", "Optional", "[", "str", "]", ":", "if", "not", "isinstance", "(", "path", ",", "str", ")", "or", "not", "is_non_local_path_uri", "(", "path", ")", ":", "return", "No...
Check if path is an external path.
[ "Check", "if", "path", "is", "an", "external", "path", "." ]
[ "\"\"\"Check if path is an external path. Otherwise return None.\"\"\"" ]
[ { "param": "path", "type": "Optional[str]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": "Optional[str]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cc55375ffac9294f1eb9885643b02990fbb203ec
kisuke95/ray
python/ray/serve/pipeline/api.py
[ "Apache-2.0" ]
Python
build
List[Deployment]
def build(ray_dag_root_node: DAGNode) -> List[Deployment]: """Do all the DAG transformation, extraction and generation needed to produce a runnable and deployable serve pipeline application from a valid DAG authored with Ray DAG API. This should be the only user facing API that user interacts with. ...
Do all the DAG transformation, extraction and generation needed to produce a runnable and deployable serve pipeline application from a valid DAG authored with Ray DAG API. This should be the only user facing API that user interacts with. Assumptions: Following enforcements are only applied at ...
Do all the DAG transformation, extraction and generation needed to produce a runnable and deployable serve pipeline application from a valid DAG authored with Ray DAG API. This should be the only user facing API that user interacts with. Following enforcements are only applied at generating and applying pipeline arti...
[ "Do", "all", "the", "DAG", "transformation", "extraction", "and", "generation", "needed", "to", "produce", "a", "runnable", "and", "deployable", "serve", "pipeline", "application", "from", "a", "valid", "DAG", "authored", "with", "Ray", "DAG", "API", ".", "Thi...
def build(ray_dag_root_node: DAGNode) -> List[Deployment]: with DeploymentNameGenerator() as deployment_name_generator: serve_root_dag = ray_dag_root_node.apply_recursive( lambda node: transform_ray_dag_to_serve_dag(node, deployment_name_generator) ) deployments = extract_deployments...
[ "def", "build", "(", "ray_dag_root_node", ":", "DAGNode", ")", "->", "List", "[", "Deployment", "]", ":", "with", "DeploymentNameGenerator", "(", ")", "as", "deployment_name_generator", ":", "serve_root_dag", "=", "ray_dag_root_node", ".", "apply_recursive", "(", ...
Do all the DAG transformation, extraction and generation needed to produce a runnable and deployable serve pipeline application from a valid DAG authored with Ray DAG API.
[ "Do", "all", "the", "DAG", "transformation", "extraction", "and", "generation", "needed", "to", "produce", "a", "runnable", "and", "deployable", "serve", "pipeline", "application", "from", "a", "valid", "DAG", "authored", "with", "Ray", "DAG", "API", "." ]
[ "\"\"\"Do all the DAG transformation, extraction and generation needed to\n produce a runnable and deployable serve pipeline application from a valid\n DAG authored with Ray DAG API.\n\n This should be the only user facing API that user interacts with.\n\n Assumptions:\n Following enforcements ar...
[ { "param": "ray_dag_root_node", "type": "DAGNode" } ]
{ "returns": [ { "docstring": "All deployments needed for an e2e runnable serve pipeline,\naccessible via python .remote() call.", "docstring_tokens": [ "All", "deployments", "needed", "for", "an", "e2e", "runnable", "serve", "pip...
b5f7b618d56d3241e7ffdaec7ea5b33493c5213d
kisuke95/ray
python/ray/data/datasource/file_based_datasource.py
[ "Apache-2.0" ]
Python
_get_block_metadata
BlockMetadata
def _get_block_metadata( self, paths: List[str], schema: Optional[Union[type, "pyarrow.lib.Schema"]], *, rows_per_file: Optional[int], file_sizes: List[Optional[int]], ) -> BlockMetadata: """Resolves and returns block metadata for the given file paths. ...
Resolves and returns block metadata for the given file paths. Args: paths: The file paths to aggregate block metadata across. These paths will always be a subset of those previously returned from `expand_paths()`. schema: The user-provided or inferred sch...
Resolves and returns block metadata for the given file paths.
[ "Resolves", "and", "returns", "block", "metadata", "for", "the", "given", "file", "paths", "." ]
def _get_block_metadata( self, paths: List[str], schema: Optional[Union[type, "pyarrow.lib.Schema"]], *, rows_per_file: Optional[int], file_sizes: List[Optional[int]], ) -> BlockMetadata: raise NotImplementedError
[ "def", "_get_block_metadata", "(", "self", ",", "paths", ":", "List", "[", "str", "]", ",", "schema", ":", "Optional", "[", "Union", "[", "type", ",", "\"pyarrow.lib.Schema\"", "]", "]", ",", "*", ",", "rows_per_file", ":", "Optional", "[", "int", "]", ...
Resolves and returns block metadata for the given file paths.
[ "Resolves", "and", "returns", "block", "metadata", "for", "the", "given", "file", "paths", "." ]
[ "\"\"\"Resolves and returns block metadata for the given file paths.\n\n Args:\n paths: The file paths to aggregate block metadata across. These\n paths will always be a subset of those previously returned from\n `expand_paths()`.\n schema: The user-provide...
[ { "param": "self", "type": null }, { "param": "paths", "type": "List[str]" }, { "param": "schema", "type": "Optional[Union[type, \"pyarrow.lib.Schema\"]]" }, { "param": "rows_per_file", "type": "Optional[int]" }, { "param": "file_sizes", "type": "List[Optional...
{ "returns": [ { "docstring": "BlockMetadata aggregated across the given file paths.", "docstring_tokens": [ "BlockMetadata", "aggregated", "across", "the", "given", "file", "paths", "." ], "type": null } ], "raises": ...
b5f7b618d56d3241e7ffdaec7ea5b33493c5213d
kisuke95/ray
python/ray/data/datasource/file_based_datasource.py
[ "Apache-2.0" ]
Python
expand_paths
Tuple[List[str], List[Optional[int]]]
def expand_paths( self, paths: List[str], filesystem: Optional["pyarrow.fs.FileSystem"], ) -> Tuple[List[str], List[Optional[int]]]: """Expands all paths into concrete file paths by walking directories. Also returns a sidecar of file sizes. The input paths will be ...
Expands all paths into concrete file paths by walking directories. Also returns a sidecar of file sizes. The input paths will be normalized for compatibility with the input filesystem prior to invocation. Args: paths: A list of file and/or directory paths compatible wit...
Expands all paths into concrete file paths by walking directories. Also returns a sidecar of file sizes. The input paths will be normalized for compatibility with the input filesystem prior to invocation. A list of file and/or directory paths compatible with the given filesystem. filesystem: The filesystem implementa...
[ "Expands", "all", "paths", "into", "concrete", "file", "paths", "by", "walking", "directories", ".", "Also", "returns", "a", "sidecar", "of", "file", "sizes", ".", "The", "input", "paths", "will", "be", "normalized", "for", "compatibility", "with", "the", "i...
def expand_paths( self, paths: List[str], filesystem: Optional["pyarrow.fs.FileSystem"], ) -> Tuple[List[str], List[Optional[int]]]: raise NotImplementedError
[ "def", "expand_paths", "(", "self", ",", "paths", ":", "List", "[", "str", "]", ",", "filesystem", ":", "Optional", "[", "\"pyarrow.fs.FileSystem\"", "]", ",", ")", "->", "Tuple", "[", "List", "[", "str", "]", ",", "List", "[", "Optional", "[", "int", ...
Expands all paths into concrete file paths by walking directories.
[ "Expands", "all", "paths", "into", "concrete", "file", "paths", "by", "walking", "directories", "." ]
[ "\"\"\"Expands all paths into concrete file paths by walking directories.\n\n Also returns a sidecar of file sizes.\n\n The input paths will be normalized for compatibility with the input\n filesystem prior to invocation.\n\n Args:\n paths: A list of file and/or directory p...
[ { "param": "self", "type": null }, { "param": "paths", "type": "List[str]" }, { "param": "filesystem", "type": "Optional[\"pyarrow.fs.FileSystem\"]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "paths", "type": "List[str]", "docstring": null, "docstring_to...
b5f7b618d56d3241e7ffdaec7ea5b33493c5213d
kisuke95/ray
python/ray/data/datasource/file_based_datasource.py
[ "Apache-2.0" ]
Python
prepare_read
List[ReadTask]
def prepare_read( self, parallelism: int, paths: Union[str, List[str]], filesystem: Optional["pyarrow.fs.FileSystem"] = None, schema: Optional[Union[type, "pyarrow.lib.Schema"]] = None, open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFileMeta...
Creates and returns read tasks for a file-based datasource.
Creates and returns read tasks for a file-based datasource.
[ "Creates", "and", "returns", "read", "tasks", "for", "a", "file", "-", "based", "datasource", "." ]
def prepare_read( self, parallelism: int, paths: Union[str, List[str]], filesystem: Optional["pyarrow.fs.FileSystem"] = None, schema: Optional[Union[type, "pyarrow.lib.Schema"]] = None, open_stream_args: Optional[Dict[str, Any]] = None, meta_provider: BaseFileMeta...
[ "def", "prepare_read", "(", "self", ",", "parallelism", ":", "int", ",", "paths", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ",", "filesystem", ":", "Optional", "[", "\"pyarrow.fs.FileSystem\"", "]", "=", "None", ",", "schema", ":", "...
Creates and returns read tasks for a file-based datasource.
[ "Creates", "and", "returns", "read", "tasks", "for", "a", "file", "-", "based", "datasource", "." ]
[ "# TODO(ekl) deprecate this once read fusion is available.", "\"\"\"Creates and returns read tasks for a file-based datasource.\"\"\"", "# If no compression manually given, try to detect", "# compression codec from path.", "# Arrow's compression inference on the file path", "# doesn't work for Snappy, so ...
[ { "param": "self", "type": null }, { "param": "parallelism", "type": "int" }, { "param": "paths", "type": "Union[str, List[str]]" }, { "param": "filesystem", "type": "Optional[\"pyarrow.fs.FileSystem\"]" }, { "param": "schema", "type": "Optional[Union[type, \"...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "parallelism", "type": "int", "docstring": null, "docstring_to...
b5f7b618d56d3241e7ffdaec7ea5b33493c5213d
kisuke95/ray
python/ray/data/datasource/file_based_datasource.py
[ "Apache-2.0" ]
Python
do_write
List[ObjectRef[WriteResult]]
def do_write( self, blocks: List[ObjectRef[Block]], metadata: List[BlockMetadata], path: str, dataset_uuid: str, filesystem: Optional["pyarrow.fs.FileSystem"] = None, try_create_dir: bool = True, open_stream_args: Optional[Dict[str, Any]] = None, b...
Creates and returns write tasks for a file-based datasource.
Creates and returns write tasks for a file-based datasource.
[ "Creates", "and", "returns", "write", "tasks", "for", "a", "file", "-", "based", "datasource", "." ]
def do_write( self, blocks: List[ObjectRef[Block]], metadata: List[BlockMetadata], path: str, dataset_uuid: str, filesystem: Optional["pyarrow.fs.FileSystem"] = None, try_create_dir: bool = True, open_stream_args: Optional[Dict[str, Any]] = None, b...
[ "def", "do_write", "(", "self", ",", "blocks", ":", "List", "[", "ObjectRef", "[", "Block", "]", "]", ",", "metadata", ":", "List", "[", "BlockMetadata", "]", ",", "path", ":", "str", ",", "dataset_uuid", ":", "str", ",", "filesystem", ":", "Optional",...
Creates and returns write tasks for a file-based datasource.
[ "Creates", "and", "returns", "write", "tasks", "for", "a", "file", "-", "based", "datasource", "." ]
[ "\"\"\"Creates and returns write tasks for a file-based datasource.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "blocks", "type": "List[ObjectRef[Block]]" }, { "param": "metadata", "type": "List[BlockMetadata]" }, { "param": "path", "type": "str" }, { "param": "dataset_uuid", "type": "str" }, { "param": "filesystem",...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "blocks", "type": "List[ObjectRef[Block]]", "docstring": null, ...
4dae4310b570e8c0bb53bd071bc84f551a9f8411
kisuke95/ray
python/ray/experimental/state/api.py
[ "Apache-2.0" ]
Python
_list
<not_specific>
def _list(resource_name: str, options: ListApiOptions, api_server_url: str = None): """Query the API server in address to list "resource_name" states. Args: resource_name: The name of the resource. E.g., actor, task. options: The options for the REST API that are translated to query strings. ...
Query the API server in address to list "resource_name" states. Args: resource_name: The name of the resource. E.g., actor, task. options: The options for the REST API that are translated to query strings. address: The address of API server. If it is not give, it assumes the ray ...
Query the API server in address to list "resource_name" states.
[ "Query", "the", "API", "server", "in", "address", "to", "list", "\"", "resource_name", "\"", "states", "." ]
def _list(resource_name: str, options: ListApiOptions, api_server_url: str = None): if api_server_url is None: assert ray.is_initialized() api_server_url = ( f"http://{ray.worker.global_worker.node.address_info['webui_url']}" ) query_strings = [] for field in fields(optio...
[ "def", "_list", "(", "resource_name", ":", "str", ",", "options", ":", "ListApiOptions", ",", "api_server_url", ":", "str", "=", "None", ")", ":", "if", "api_server_url", "is", "None", ":", "assert", "ray", ".", "is_initialized", "(", ")", "api_server_url", ...
Query the API server in address to list "resource_name" states.
[ "Query", "the", "API", "server", "in", "address", "to", "list", "\"", "resource_name", "\"", "states", "." ]
[ "\"\"\"Query the API server in address to list \"resource_name\" states.\n\n Args:\n resource_name: The name of the resource. E.g., actor, task.\n options: The options for the REST API that are translated to query strings.\n address: The address of API server. If it is not give, it assumes t...
[ { "param": "resource_name", "type": "str" }, { "param": "options", "type": "ListApiOptions" }, { "param": "api_server_url", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "resource_name", "type": "str", "docstring": "The name of the resource. E.g., actor, task.", "docstring_tokens": [ "The", "name", "of", "the", "resource", ".", "E", ...
a33eb17f0036fc04fb2741c88774ade82979865f
kisuke95/ray
rllib/utils/debug/memory.py
[ "Apache-2.0" ]
Python
check_memory_leaks
DefaultDict[str, List[Suspect]]
def check_memory_leaks( trainer, to_check: Optional[Set[str]] = None, repeats: Optional[int] = None, max_num_trials: int = 3, ) -> DefaultDict[str, List[Suspect]]: """Diagnoses the given trainer for possible memory leaks. Isolates single components inside the trainer's local worker, e.g. the en...
Diagnoses the given trainer for possible memory leaks. Isolates single components inside the trainer's local worker, e.g. the env, policy, etc.. and calls some of their methods repeatedly, while checking the memory footprints and keeping track of which lines in the code add un-GC'd items to memory. ...
Diagnoses the given trainer for possible memory leaks. Isolates single components inside the trainer's local worker, e.g. the env, policy, etc.. and calls some of their methods repeatedly, while checking the memory footprints and keeping track of which lines in the code add un-GC'd items to memory. The Trainer instanc...
[ "Diagnoses", "the", "given", "trainer", "for", "possible", "memory", "leaks", ".", "Isolates", "single", "components", "inside", "the", "trainer", "'", "s", "local", "worker", "e", ".", "g", ".", "the", "env", "policy", "etc", "..", "and", "calls", "some",...
def check_memory_leaks( trainer, to_check: Optional[Set[str]] = None, repeats: Optional[int] = None, max_num_trials: int = 3, ) -> DefaultDict[str, List[Suspect]]: local_worker = trainer.workers.local_worker() to_check = to_check or {"env", "model", "policy", "rollout_worker"} results_per_ca...
[ "def", "check_memory_leaks", "(", "trainer", ",", "to_check", ":", "Optional", "[", "Set", "[", "str", "]", "]", "=", "None", ",", "repeats", ":", "Optional", "[", "int", "]", "=", "None", ",", "max_num_trials", ":", "int", "=", "3", ",", ")", "->", ...
Diagnoses the given trainer for possible memory leaks.
[ "Diagnoses", "the", "given", "trainer", "for", "possible", "memory", "leaks", "." ]
[ "\"\"\"Diagnoses the given trainer for possible memory leaks.\n\n Isolates single components inside the trainer's local worker, e.g. the env,\n policy, etc.. and calls some of their methods repeatedly, while checking\n the memory footprints and keeping track of which lines in the code add\n un-GC'd item...
[ { "param": "trainer", "type": null }, { "param": "to_check", "type": "Optional[Set[str]]" }, { "param": "repeats", "type": "Optional[int]" }, { "param": "max_num_trials", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "trainer", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "to_check", "type": "Optional[Set[str]]", "docstring": null, ...
fe3c9a42f60aadad6cd7ece275dd4c4feea528d5
kisuke95/ray
python/ray/data/impl/simple_block.py
[ "Apache-2.0" ]
Python
_apply_accum
Optional[U]
def _apply_accum( self, init: AggType, accum: Callable[[AggType, T], AggType], on: KeyFn, ignore_nulls: bool, ) -> Optional[U]: """Helper providing null handling around applying an aggregation.""" if on is not None and not callable(on): raise Value...
Helper providing null handling around applying an aggregation.
Helper providing null handling around applying an aggregation.
[ "Helper", "providing", "null", "handling", "around", "applying", "an", "aggregation", "." ]
def _apply_accum( self, init: AggType, accum: Callable[[AggType, T], AggType], on: KeyFn, ignore_nulls: bool, ) -> Optional[U]: if on is not None and not callable(on): raise ValueError( "on must be a callable or None when aggregating on Sim...
[ "def", "_apply_accum", "(", "self", ",", "init", ":", "AggType", ",", "accum", ":", "Callable", "[", "[", "AggType", ",", "T", "]", ",", "AggType", "]", ",", "on", ":", "KeyFn", ",", "ignore_nulls", ":", "bool", ",", ")", "->", "Optional", "[", "U"...
Helper providing null handling around applying an aggregation.
[ "Helper", "providing", "null", "handling", "around", "applying", "an", "aggregation", "." ]
[ "\"\"\"Helper providing null handling around applying an aggregation.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "init", "type": "AggType" }, { "param": "accum", "type": "Callable[[AggType, T], AggType]" }, { "param": "on", "type": "KeyFn" }, { "param": "ignore_nulls", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "init", "type": "AggType", "docstring": null, "docstring_token...
fe3c9a42f60aadad6cd7ece275dd4c4feea528d5
kisuke95/ray
python/ray/data/impl/simple_block.py
[ "Apache-2.0" ]
Python
combine
Block[Tuple[KeyType, AggType]]
def combine( self, key: KeyFn, aggs: Tuple[AggregateFn] ) -> Block[Tuple[KeyType, AggType]]: """Combine rows with the same key into an accumulator. This assumes the block is already sorted by key in ascending order. Args: key: The key function that returns the key from ...
Combine rows with the same key into an accumulator. This assumes the block is already sorted by key in ascending order. Args: key: The key function that returns the key from the row or None for global aggregation. agg: The aggregations to do. Returns: ...
Combine rows with the same key into an accumulator. This assumes the block is already sorted by key in ascending order.
[ "Combine", "rows", "with", "the", "same", "key", "into", "an", "accumulator", ".", "This", "assumes", "the", "block", "is", "already", "sorted", "by", "key", "in", "ascending", "order", "." ]
def combine( self, key: KeyFn, aggs: Tuple[AggregateFn] ) -> Block[Tuple[KeyType, AggType]]: if key is not None and not callable(key): raise ValueError( "key must be a callable or None when aggregating on Simple blocks, but " f"got: {type(key)}." ...
[ "def", "combine", "(", "self", ",", "key", ":", "KeyFn", ",", "aggs", ":", "Tuple", "[", "AggregateFn", "]", ")", "->", "Block", "[", "Tuple", "[", "KeyType", ",", "AggType", "]", "]", ":", "if", "key", "is", "not", "None", "and", "not", "callable"...
Combine rows with the same key into an accumulator.
[ "Combine", "rows", "with", "the", "same", "key", "into", "an", "accumulator", "." ]
[ "\"\"\"Combine rows with the same key into an accumulator.\n\n This assumes the block is already sorted by key in ascending order.\n\n Args:\n key: The key function that returns the key from the row\n or None for global aggregation.\n agg: The aggregations to do.\n...
[ { "param": "self", "type": null }, { "param": "key", "type": "KeyFn" }, { "param": "aggs", "type": "Tuple[AggregateFn]" } ]
{ "returns": [ { "docstring": "A sorted block of (k, v_1, ..., v_n) tuples where k is the groupby\nkey and v_i is the partially combined accumulator for the ith given\naggregation.\nIf key is None then the k element of tuple is omitted.", "docstring_tokens": [ "A", "sorted", "b...
fe3c9a42f60aadad6cd7ece275dd4c4feea528d5
kisuke95/ray
python/ray/data/impl/simple_block.py
[ "Apache-2.0" ]
Python
iter_groups
Iterator[Tuple[KeyType, Block]]
def iter_groups() -> Iterator[Tuple[KeyType, Block]]: """Creates an iterator over zero-copy group views.""" if key is None: # Global aggregation consists of a single "group", so we short-circuit. yield None, self.to_block() return star...
Creates an iterator over zero-copy group views.
Creates an iterator over zero-copy group views.
[ "Creates", "an", "iterator", "over", "zero", "-", "copy", "group", "views", "." ]
def iter_groups() -> Iterator[Tuple[KeyType, Block]]: if key is None: yield None, self.to_block() return start = end = 0 iter = self.iter_rows() next_row = None has_next_row = False while True: try: ...
[ "def", "iter_groups", "(", ")", "->", "Iterator", "[", "Tuple", "[", "KeyType", ",", "Block", "]", "]", ":", "if", "key", "is", "None", ":", "yield", "None", ",", "self", ".", "to_block", "(", ")", "return", "start", "=", "end", "=", "0", "iter", ...
Creates an iterator over zero-copy group views.
[ "Creates", "an", "iterator", "over", "zero", "-", "copy", "group", "views", "." ]
[ "\"\"\"Creates an iterator over zero-copy group views.\"\"\"", "# Global aggregation consists of a single \"group\", so we short-circuit.", "# Use a bool to indicate if next_row is valid", "# instead of checking if next_row is None", "# since a row can have None value." ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
fe3c9a42f60aadad6cd7ece275dd4c4feea528d5
kisuke95/ray
python/ray/data/impl/simple_block.py
[ "Apache-2.0" ]
Python
aggregate_combined_blocks
Tuple[Block[Tuple[KeyType, U]], BlockMetadata]
def aggregate_combined_blocks( blocks: List[Block[Tuple[KeyType, AggType]]], key: KeyFn, aggs: Tuple[AggregateFn], ) -> Tuple[Block[Tuple[KeyType, U]], BlockMetadata]: """Aggregate sorted, partially combined blocks with the same key range. This assumes blocks are already sor...
Aggregate sorted, partially combined blocks with the same key range. This assumes blocks are already sorted by key in ascending order, so we can do merge sort to get all the rows with the same key. Args: blocks: A list of partially combined and sorted blocks. key: The k...
Aggregate sorted, partially combined blocks with the same key range. This assumes blocks are already sorted by key in ascending order, so we can do merge sort to get all the rows with the same key.
[ "Aggregate", "sorted", "partially", "combined", "blocks", "with", "the", "same", "key", "range", ".", "This", "assumes", "blocks", "are", "already", "sorted", "by", "key", "in", "ascending", "order", "so", "we", "can", "do", "merge", "sort", "to", "get", "...
def aggregate_combined_blocks( blocks: List[Block[Tuple[KeyType, AggType]]], key: KeyFn, aggs: Tuple[AggregateFn], ) -> Tuple[Block[Tuple[KeyType, U]], BlockMetadata]: stats = BlockExecStats.builder() key_fn = (lambda r: r[0]) if key else (lambda r: 0) iter = heapq.me...
[ "def", "aggregate_combined_blocks", "(", "blocks", ":", "List", "[", "Block", "[", "Tuple", "[", "KeyType", ",", "AggType", "]", "]", "]", ",", "key", ":", "KeyFn", ",", "aggs", ":", "Tuple", "[", "AggregateFn", "]", ",", ")", "->", "Tuple", "[", "Bl...
Aggregate sorted, partially combined blocks with the same key range.
[ "Aggregate", "sorted", "partially", "combined", "blocks", "with", "the", "same", "key", "range", "." ]
[ "\"\"\"Aggregate sorted, partially combined blocks with the same key range.\n\n This assumes blocks are already sorted by key in ascending order,\n so we can do merge sort to get all the rows with the same key.\n\n Args:\n blocks: A list of partially combined and sorted blocks.\n ...
[ { "param": "blocks", "type": "List[Block[Tuple[KeyType, AggType]]]" }, { "param": "key", "type": "KeyFn" }, { "param": "aggs", "type": "Tuple[AggregateFn]" } ]
{ "returns": [ { "docstring": "A block of (k, v_1, ..., v_n) tuples and its metadata where k is\nthe groupby key and v_i is the corresponding aggregation result for\nthe ith given aggregation.\nIf key is None then the k element of tuple is omitted.", "docstring_tokens": [ "A", "block",...
6a2e26e103fa753b6a8ffa55a8049dd8b75ed958
kisuke95/ray
python/ray/experimental/dag/input_node.py
[ "Apache-2.0" ]
Python
_in_context_manager
bool
def _in_context_manager(self) -> bool: """Return if InputNode is created in context manager.""" if ( not self._bound_other_args_to_resolve or IN_CONTEXT_MANAGER not in self._bound_other_args_to_resolve ): return False else: return self._bou...
Return if InputNode is created in context manager.
Return if InputNode is created in context manager.
[ "Return", "if", "InputNode", "is", "created", "in", "context", "manager", "." ]
def _in_context_manager(self) -> bool: if ( not self._bound_other_args_to_resolve or IN_CONTEXT_MANAGER not in self._bound_other_args_to_resolve ): return False else: return self._bound_other_args_to_resolve[IN_CONTEXT_MANAGER]
[ "def", "_in_context_manager", "(", "self", ")", "->", "bool", ":", "if", "(", "not", "self", ".", "_bound_other_args_to_resolve", "or", "IN_CONTEXT_MANAGER", "not", "in", "self", ".", "_bound_other_args_to_resolve", ")", ":", "return", "False", "else", ":", "ret...
Return if InputNode is created in context manager.
[ "Return", "if", "InputNode", "is", "created", "in", "context", "manager", "." ]
[ "\"\"\"Return if InputNode is created in context manager.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fc085dbf3fbe4e28eaf96b37675319ef0d0639b1
kisuke95/ray
python/ray/tune/tuner.py
[ "Apache-2.0" ]
Python
restore
"Tuner"
def restore(cls, path: str) -> "Tuner": """Restores Tuner after a previously failed run. Args: path: The path where the previous failed run is checkpointed. This information could be easily located near the end of the console output of previous run. ...
Restores Tuner after a previously failed run. Args: path: The path where the previous failed run is checkpointed. This information could be easily located near the end of the console output of previous run. Note: depending on whether ray client mode is us...
Restores Tuner after a previously failed run.
[ "Restores", "Tuner", "after", "a", "previously", "failed", "run", "." ]
def restore(cls, path: str) -> "Tuner": if not ray.util.client.ray.is_connected(): tuner_internal = TunerInternal(restore_path=path) return Tuner(_tuner_internal=tuner_internal) else: tuner_internal = force_on_current_node( ray.remote(num_cpus=0)(Tuner...
[ "def", "restore", "(", "cls", ",", "path", ":", "str", ")", "->", "\"Tuner\"", ":", "if", "not", "ray", ".", "util", ".", "client", ".", "ray", ".", "is_connected", "(", ")", ":", "tuner_internal", "=", "TunerInternal", "(", "restore_path", "=", "path"...
Restores Tuner after a previously failed run.
[ "Restores", "Tuner", "after", "a", "previously", "failed", "run", "." ]
[ "\"\"\"Restores Tuner after a previously failed run.\n\n Args:\n path: The path where the previous failed run is checkpointed.\n This information could be easily located near the end of the\n console output of previous run.\n Note: depending on whether ray ...
[ { "param": "cls", "type": null }, { "param": "path", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "path", "type": "str", "docstring": "The path where the previous fail...
fc085dbf3fbe4e28eaf96b37675319ef0d0639b1
kisuke95/ray
python/ray/tune/tuner.py
[ "Apache-2.0" ]
Python
fit
ResultGrid
def fit(self) -> ResultGrid: """Executes hyperparameter tuning job as configured and returns result. Failure handling: For the kind of exception that happens during the execution of a trial, one may inspect it together with stacktrace through the returned result grid. See ``Resu...
Executes hyperparameter tuning job as configured and returns result. Failure handling: For the kind of exception that happens during the execution of a trial, one may inspect it together with stacktrace through the returned result grid. See ``ResultGrid`` for reference. Each trial may f...
Executes hyperparameter tuning job as configured and returns result. Failure handling: For the kind of exception that happens during the execution of a trial, one may inspect it together with stacktrace through the returned result grid. See ``ResultGrid`` for reference. Each trial may fail up to a certain number. Exce...
[ "Executes", "hyperparameter", "tuning", "job", "as", "configured", "and", "returns", "result", ".", "Failure", "handling", ":", "For", "the", "kind", "of", "exception", "that", "happens", "during", "the", "execution", "of", "a", "trial", "one", "may", "inspect...
def fit(self) -> ResultGrid: if not self._is_ray_client: try: return self._local_tuner.fit() except Exception as e: raise TuneError( f"Tune run failed. " f'Please use tuner = Tuner.restore("' f'{s...
[ "def", "fit", "(", "self", ")", "->", "ResultGrid", ":", "if", "not", "self", ".", "_is_ray_client", ":", "try", ":", "return", "self", ".", "_local_tuner", ".", "fit", "(", ")", "except", "Exception", "as", "e", ":", "raise", "TuneError", "(", "f\"Tun...
Executes hyperparameter tuning job as configured and returns result.
[ "Executes", "hyperparameter", "tuning", "job", "as", "configured", "and", "returns", "result", "." ]
[ "\"\"\"Executes hyperparameter tuning job as configured and returns result.\n\n Failure handling:\n For the kind of exception that happens during the execution of a trial,\n one may inspect it together with stacktrace through the returned result grid.\n See ``ResultGrid`` for reference. ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4339eed6b07870b20bca2b24712c63652e4123a1
kisuke95/ray
python/ray/tune/schedulers/resource_changing_scheduler.py
[ "Apache-2.0" ]
Python
_validate
bool
def _validate( self, base_trial_resource: PlacementGroupFactory, result: Dict[str, Any] ) -> bool: """Return False if we should keep the current resources outright.""" if not isinstance(base_trial_resource, PlacementGroupFactory): raise ValueError( f"{self.__class...
Return False if we should keep the current resources outright.
Return False if we should keep the current resources outright.
[ "Return", "False", "if", "we", "should", "keep", "the", "current", "resources", "outright", "." ]
def _validate( self, base_trial_resource: PlacementGroupFactory, result: Dict[str, Any] ) -> bool: if not isinstance(base_trial_resource, PlacementGroupFactory): raise ValueError( f"{self.__class__.__name__} only supports PlacementGroupFactories." ) if...
[ "def", "_validate", "(", "self", ",", "base_trial_resource", ":", "PlacementGroupFactory", ",", "result", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "bool", ":", "if", "not", "isinstance", "(", "base_trial_resource", ",", "PlacementGroupFactory", ")"...
Return False if we should keep the current resources outright.
[ "Return", "False", "if", "we", "should", "keep", "the", "current", "resources", "outright", "." ]
[ "\"\"\"Return False if we should keep the current resources outright.\"\"\"", "# Don't bother if this is just the first iteration" ]
[ { "param": "self", "type": null }, { "param": "base_trial_resource", "type": "PlacementGroupFactory" }, { "param": "result", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "base_trial_resource", "type": "PlacementGroupFactory", "docstring":...
4339eed6b07870b20bca2b24712c63652e4123a1
kisuke95/ray
python/ray/tune/schedulers/resource_changing_scheduler.py
[ "Apache-2.0" ]
Python
_get_total_available_resources
Tuple[float, float]
def _get_total_available_resources( self, trial_runner: "trial_runner.TrialRunner" ) -> Tuple[float, float]: """Get the number of CPUs and GPUs avaialble in total (not just free)""" total_available_cpus = ( trial_runner.trial_executor._resource_updater.get_num_cpus() ...
Get the number of CPUs and GPUs avaialble in total (not just free)
Get the number of CPUs and GPUs avaialble in total (not just free)
[ "Get", "the", "number", "of", "CPUs", "and", "GPUs", "avaialble", "in", "total", "(", "not", "just", "free", ")" ]
def _get_total_available_resources( self, trial_runner: "trial_runner.TrialRunner" ) -> Tuple[float, float]: total_available_cpus = ( trial_runner.trial_executor._resource_updater.get_num_cpus() - self.reserve_resources.get("CPU", 0) ) total_available_gpus = (...
[ "def", "_get_total_available_resources", "(", "self", ",", "trial_runner", ":", "\"trial_runner.TrialRunner\"", ")", "->", "Tuple", "[", "float", ",", "float", "]", ":", "total_available_cpus", "=", "(", "trial_runner", ".", "trial_executor", ".", "_resource_updater",...
Get the number of CPUs and GPUs avaialble in total (not just free)
[ "Get", "the", "number", "of", "CPUs", "and", "GPUs", "avaialble", "in", "total", "(", "not", "just", "free", ")" ]
[ "\"\"\"Get the number of CPUs and GPUs avaialble in total (not just free)\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "trial_runner", "type": "\"trial_runner.TrialRunner\"" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "trial_runner", "type": "\"trial_runner.TrialRunner\"", "docstring":...
4339eed6b07870b20bca2b24712c63652e4123a1
kisuke95/ray
python/ray/tune/schedulers/resource_changing_scheduler.py
[ "Apache-2.0" ]
Python
_get_used_cpus_and_gpus
Tuple[float, float]
def _get_used_cpus_and_gpus(self, t: Trial) -> Tuple[float, float]: """Check how many CPUs and GPUs a trial is using currently""" return ( t.placement_group_factory.required_resources.get("CPU", 0), t.placement_group_factory.required_resources.get("GPU", 0), )
Check how many CPUs and GPUs a trial is using currently
Check how many CPUs and GPUs a trial is using currently
[ "Check", "how", "many", "CPUs", "and", "GPUs", "a", "trial", "is", "using", "currently" ]
def _get_used_cpus_and_gpus(self, t: Trial) -> Tuple[float, float]: return ( t.placement_group_factory.required_resources.get("CPU", 0), t.placement_group_factory.required_resources.get("GPU", 0), )
[ "def", "_get_used_cpus_and_gpus", "(", "self", ",", "t", ":", "Trial", ")", "->", "Tuple", "[", "float", ",", "float", "]", ":", "return", "(", "t", ".", "placement_group_factory", ".", "required_resources", ".", "get", "(", "\"CPU\"", ",", "0", ")", ","...
Check how many CPUs and GPUs a trial is using currently
[ "Check", "how", "many", "CPUs", "and", "GPUs", "a", "trial", "is", "using", "currently" ]
[ "\"\"\"Check how many CPUs and GPUs a trial is using currently\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "t", "type": "Trial" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "t", "type": "Trial", "docstring": null, "docstring_tokens": [...
4339eed6b07870b20bca2b24712c63652e4123a1
kisuke95/ray
python/ray/tune/schedulers/resource_changing_scheduler.py
[ "Apache-2.0" ]
Python
_get_resources_from_bundles
Dict[str, float]
def _get_resources_from_bundles( self, bundles: List[Dict[str, float]] ) -> Dict[str, float]: """Get total sums of resources in bundles""" if not bundles: return {"CPU": 0, "GPU": 0} pgf = PlacementGroupFactory(bundles) return pgf.required_resources
Get total sums of resources in bundles
Get total sums of resources in bundles
[ "Get", "total", "sums", "of", "resources", "in", "bundles" ]
def _get_resources_from_bundles( self, bundles: List[Dict[str, float]] ) -> Dict[str, float]: if not bundles: return {"CPU": 0, "GPU": 0} pgf = PlacementGroupFactory(bundles) return pgf.required_resources
[ "def", "_get_resources_from_bundles", "(", "self", ",", "bundles", ":", "List", "[", "Dict", "[", "str", ",", "float", "]", "]", ")", "->", "Dict", "[", "str", ",", "float", "]", ":", "if", "not", "bundles", ":", "return", "{", "\"CPU\"", ":", "0", ...
Get total sums of resources in bundles
[ "Get", "total", "sums", "of", "resources", "in", "bundles" ]
[ "\"\"\"Get total sums of resources in bundles\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "bundles", "type": "List[Dict[str, float]]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bundles", "type": "List[Dict[str, float]]", "docstring": null, ...
4339eed6b07870b20bca2b24712c63652e4123a1
kisuke95/ray
python/ray/tune/schedulers/resource_changing_scheduler.py
[ "Apache-2.0" ]
Python
_get_added_bundles
List[Dict[str, float]]
def _get_added_bundles( self, bundles: List[Dict[str, float]], base_bundles: List[Dict[str, float]] ) -> List[Dict[str, float]]: """Return the difference between bundles and base_bundles""" if self.add_bundles: added_bundles = bundles[len(base_bundles) :] else: ...
Return the difference between bundles and base_bundles
Return the difference between bundles and base_bundles
[ "Return", "the", "difference", "between", "bundles", "and", "base_bundles" ]
def _get_added_bundles( self, bundles: List[Dict[str, float]], base_bundles: List[Dict[str, float]] ) -> List[Dict[str, float]]: if self.add_bundles: added_bundles = bundles[len(base_bundles) :] else: if not bundles: bundles = [{"CPU": 0, "GPU": 0}] ...
[ "def", "_get_added_bundles", "(", "self", ",", "bundles", ":", "List", "[", "Dict", "[", "str", ",", "float", "]", "]", ",", "base_bundles", ":", "List", "[", "Dict", "[", "str", ",", "float", "]", "]", ")", "->", "List", "[", "Dict", "[", "str", ...
Return the difference between bundles and base_bundles
[ "Return", "the", "difference", "between", "bundles", "and", "base_bundles" ]
[ "\"\"\"Return the difference between bundles and base_bundles\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "bundles", "type": "List[Dict[str, float]]" }, { "param": "base_bundles", "type": "List[Dict[str, float]]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bundles", "type": "List[Dict[str, float]]", "docstring": null, ...
4339eed6b07870b20bca2b24712c63652e4123a1
kisuke95/ray
python/ray/tune/schedulers/resource_changing_scheduler.py
[ "Apache-2.0" ]
Python
evenly_distribute_cpus_gpus
Optional[PlacementGroupFactory]
def evenly_distribute_cpus_gpus( trial_runner: "trial_runner.TrialRunner", trial: Trial, result: Dict[str, Any], scheduler: "ResourceChangingScheduler", ) -> Optional[PlacementGroupFactory]: """This is a basic uniform resource allocating function. This function is used by default in ``ResourceC...
This is a basic uniform resource allocating function. This function is used by default in ``ResourceChangingScheduler``. The function naively balances free resources (CPUs and GPUs) between trials, giving them all equal priority, ensuring that all resources are always being used. All of the resources ...
This is a basic uniform resource allocating function. This function is used by default in ``ResourceChangingScheduler``. The function naively balances free resources (CPUs and GPUs) between trials, giving them all equal priority, ensuring that all resources are always being used. All of the resources will be placed in...
[ "This", "is", "a", "basic", "uniform", "resource", "allocating", "function", ".", "This", "function", "is", "used", "by", "default", "in", "`", "`", "ResourceChangingScheduler", "`", "`", ".", "The", "function", "naively", "balances", "free", "resources", "(",...
def evenly_distribute_cpus_gpus( trial_runner: "trial_runner.TrialRunner", trial: Trial, result: Dict[str, Any], scheduler: "ResourceChangingScheduler", ) -> Optional[PlacementGroupFactory]: if log_once("evenly_distribute_cpus_gpus_deprecated"): warnings.warn( "DeprecationWarning...
[ "def", "evenly_distribute_cpus_gpus", "(", "trial_runner", ":", "\"trial_runner.TrialRunner\"", ",", "trial", ":", "Trial", ",", "result", ":", "Dict", "[", "str", ",", "Any", "]", ",", "scheduler", ":", "\"ResourceChangingScheduler\"", ",", ")", "->", "Optional",...
This is a basic uniform resource allocating function.
[ "This", "is", "a", "basic", "uniform", "resource", "allocating", "function", "." ]
[ "\"\"\"This is a basic uniform resource allocating function.\n\n This function is used by default in ``ResourceChangingScheduler``.\n\n The function naively balances free resources (CPUs and GPUs) between\n trials, giving them all equal priority, ensuring that all resources\n are always being used. All ...
[ { "param": "trial_runner", "type": "\"trial_runner.TrialRunner\"" }, { "param": "trial", "type": "Trial" }, { "param": "result", "type": "Dict[str, Any]" }, { "param": "scheduler", "type": "\"ResourceChangingScheduler\"" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "trial_runner", "type": "\"trial_runner.TrialRunner\"", "docstring": "Trial runner for this Tune run.\nCan be used to obtain information about other trials.", "docstring_tokens": [ "Trial", "runner", "fo...
4339eed6b07870b20bca2b24712c63652e4123a1
kisuke95/ray
python/ray/tune/schedulers/resource_changing_scheduler.py
[ "Apache-2.0" ]
Python
evenly_distribute_cpus_gpus_distributed
Optional[PlacementGroupFactory]
def evenly_distribute_cpus_gpus_distributed( trial_runner: "trial_runner.TrialRunner", trial: Trial, result: Dict[str, Any], scheduler: "ResourceChangingScheduler", ) -> Optional[PlacementGroupFactory]: """This is a basic uniform resource allocating function. The function naively balances free ...
This is a basic uniform resource allocating function. The function naively balances free resources (CPUs and GPUs) between trials, giving them all equal priority, ensuring that all resources are always being used. The free resources will be placed in new bundles. This function assumes that all bundles ...
This is a basic uniform resource allocating function. The function naively balances free resources (CPUs and GPUs) between trials, giving them all equal priority, ensuring that all resources are always being used. The free resources will be placed in new bundles. This function assumes that all bundles are equal (there ...
[ "This", "is", "a", "basic", "uniform", "resource", "allocating", "function", ".", "The", "function", "naively", "balances", "free", "resources", "(", "CPUs", "and", "GPUs", ")", "between", "trials", "giving", "them", "all", "equal", "priority", "ensuring", "th...
def evenly_distribute_cpus_gpus_distributed( trial_runner: "trial_runner.TrialRunner", trial: Trial, result: Dict[str, Any], scheduler: "ResourceChangingScheduler", ) -> Optional[PlacementGroupFactory]: if log_once("evenly_distribute_cpus_gpus_deprecated"): warnings.warn( "Deprec...
[ "def", "evenly_distribute_cpus_gpus_distributed", "(", "trial_runner", ":", "\"trial_runner.TrialRunner\"", ",", "trial", ":", "Trial", ",", "result", ":", "Dict", "[", "str", ",", "Any", "]", ",", "scheduler", ":", "\"ResourceChangingScheduler\"", ",", ")", "->", ...
This is a basic uniform resource allocating function.
[ "This", "is", "a", "basic", "uniform", "resource", "allocating", "function", "." ]
[ "\"\"\"This is a basic uniform resource allocating function.\n\n The function naively balances free resources (CPUs and GPUs) between\n trials, giving them all equal priority, ensuring that all resources\n are always being used. The free resources will be placed in new bundles.\n This function assumes t...
[ { "param": "trial_runner", "type": "\"trial_runner.TrialRunner\"" }, { "param": "trial", "type": "Trial" }, { "param": "result", "type": "Dict[str, Any]" }, { "param": "scheduler", "type": "\"ResourceChangingScheduler\"" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "trial_runner", "type": "\"trial_runner.TrialRunner\"", "docstring": "Trial runner for this Tune run.\nCan be used to obtain information about other trials.", "docstring_tokens": [ "Trial", "runner", "fo...
4339eed6b07870b20bca2b24712c63652e4123a1
kisuke95/ray
python/ray/tune/schedulers/resource_changing_scheduler.py
[ "Apache-2.0" ]
Python
_are_resources_the_same
bool
def _are_resources_the_same( self, trial: Trial, new_resources, ) -> bool: """Returns True if trial's resources are value equal to new_resources. Only checks for PlacementGroupFactories at this moment. """ if ( isinstance(new_resources, PlacementG...
Returns True if trial's resources are value equal to new_resources. Only checks for PlacementGroupFactories at this moment.
Returns True if trial's resources are value equal to new_resources. Only checks for PlacementGroupFactories at this moment.
[ "Returns", "True", "if", "trial", "'", "s", "resources", "are", "value", "equal", "to", "new_resources", ".", "Only", "checks", "for", "PlacementGroupFactories", "at", "this", "moment", "." ]
def _are_resources_the_same( self, trial: Trial, new_resources, ) -> bool: if ( isinstance(new_resources, PlacementGroupFactory) and trial.placement_group_factory == new_resources ): logger.debug( f"{trial} PGF " ...
[ "def", "_are_resources_the_same", "(", "self", ",", "trial", ":", "Trial", ",", "new_resources", ",", ")", "->", "bool", ":", "if", "(", "isinstance", "(", "new_resources", ",", "PlacementGroupFactory", ")", "and", "trial", ".", "placement_group_factory", "==", ...
Returns True if trial's resources are value equal to new_resources.
[ "Returns", "True", "if", "trial", "'", "s", "resources", "are", "value", "equal", "to", "new_resources", "." ]
[ "\"\"\"Returns True if trial's resources are value equal to new_resources.\n\n Only checks for PlacementGroupFactories at this moment.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "trial", "type": "Trial" }, { "param": "new_resources", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "trial", "type": "Trial", "docstring": null, "docstring_tokens...
4339eed6b07870b20bca2b24712c63652e4123a1
kisuke95/ray
python/ray/tune/schedulers/resource_changing_scheduler.py
[ "Apache-2.0" ]
Python
reallocate_trial_resources_if_needed
Optional[Union[dict, PlacementGroupFactory]]
def reallocate_trial_resources_if_needed( self, trial_runner: "trial_runner.TrialRunner", trial: Trial, result: Dict ) -> Optional[Union[dict, PlacementGroupFactory]]: """Calls user defined resources_allocation_function. If the returned resources are not none and not the same as currently pr...
Calls user defined resources_allocation_function. If the returned resources are not none and not the same as currently present, returns them. Otherwise, returns None.
Calls user defined resources_allocation_function. If the returned resources are not none and not the same as currently present, returns them. Otherwise, returns None.
[ "Calls", "user", "defined", "resources_allocation_function", ".", "If", "the", "returned", "resources", "are", "not", "none", "and", "not", "the", "same", "as", "currently", "present", "returns", "them", ".", "Otherwise", "returns", "None", "." ]
def reallocate_trial_resources_if_needed( self, trial_runner: "trial_runner.TrialRunner", trial: Trial, result: Dict ) -> Optional[Union[dict, PlacementGroupFactory]]: if self._resources_allocation_function is None: return None if not getattr(self._resources_allocation_function, ...
[ "def", "reallocate_trial_resources_if_needed", "(", "self", ",", "trial_runner", ":", "\"trial_runner.TrialRunner\"", ",", "trial", ":", "Trial", ",", "result", ":", "Dict", ")", "->", "Optional", "[", "Union", "[", "dict", ",", "PlacementGroupFactory", "]", "]", ...
Calls user defined resources_allocation_function.
[ "Calls", "user", "defined", "resources_allocation_function", "." ]
[ "\"\"\"Calls user defined resources_allocation_function. If the returned\n resources are not none and not the same as currently present, returns\n them. Otherwise, returns None.\"\"\"", "# if we can check if the new resources are the same,", "# we do that here and skip resource allocation" ]
[ { "param": "self", "type": null }, { "param": "trial_runner", "type": "\"trial_runner.TrialRunner\"" }, { "param": "trial", "type": "Trial" }, { "param": "result", "type": "Dict" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "trial_runner", "type": "\"trial_runner.TrialRunner\"", "docstring":...
94096e6917f57dc164deafb80da329e4140e637f
kisuke95/ray
python/ray/_private/gcs_utils.py
[ "Apache-2.0" ]
Python
check_health
bool
def check_health(address: str, timeout=2) -> bool: """Checks Ray cluster health, before / without actually connecting to the cluster via ray.init(). Args: address: Ray cluster / GCS address string, e.g. ip:port. timeout: request timeout. Returns: Returns True if the cluster is r...
Checks Ray cluster health, before / without actually connecting to the cluster via ray.init(). Args: address: Ray cluster / GCS address string, e.g. ip:port. timeout: request timeout. Returns: Returns True if the cluster is running and has matching Ray version. Returns False...
Checks Ray cluster health, before / without actually connecting to the cluster via ray.init().
[ "Checks", "Ray", "cluster", "health", "before", "/", "without", "actually", "connecting", "to", "the", "cluster", "via", "ray", ".", "init", "()", "." ]
def check_health(address: str, timeout=2) -> bool: req = gcs_service_pb2.CheckAliveRequest() try: channel = create_gcs_channel(address) stub = gcs_service_pb2_grpc.HeartbeatInfoGcsServiceStub(channel) resp = stub.CheckAlive(req, timeout=timeout) except grpc.RpcError: return F...
[ "def", "check_health", "(", "address", ":", "str", ",", "timeout", "=", "2", ")", "->", "bool", ":", "req", "=", "gcs_service_pb2", ".", "CheckAliveRequest", "(", ")", "try", ":", "channel", "=", "create_gcs_channel", "(", "address", ")", "stub", "=", "g...
Checks Ray cluster health, before / without actually connecting to the cluster via ray.init().
[ "Checks", "Ray", "cluster", "health", "before", "/", "without", "actually", "connecting", "to", "the", "cluster", "via", "ray", ".", "init", "()", "." ]
[ "\"\"\"Checks Ray cluster health, before / without actually connecting to the\n cluster via ray.init().\n\n Args:\n address: Ray cluster / GCS address string, e.g. ip:port.\n timeout: request timeout.\n Returns:\n Returns True if the cluster is running and has matching Ray version.\n ...
[ { "param": "address", "type": "str" }, { "param": "timeout", "type": null } ]
{ "returns": [ { "docstring": "Returns True if the cluster is running and has matching Ray version.\nReturns False if no service is running.\nRaises an exception otherwise.", "docstring_tokens": [ "Returns", "True", "if", "the", "cluster", "is", ...
94096e6917f57dc164deafb80da329e4140e637f
kisuke95/ray
python/ray/_private/gcs_utils.py
[ "Apache-2.0" ]
Python
use_gcs_for_bootstrap
<not_specific>
def use_gcs_for_bootstrap(): """In the current version of Ray, we always use the GCS to bootstrap. (This was previously controlled by a feature flag.) This function is included for the purposes of backwards compatibility. """ return True
In the current version of Ray, we always use the GCS to bootstrap. (This was previously controlled by a feature flag.) This function is included for the purposes of backwards compatibility.
In the current version of Ray, we always use the GCS to bootstrap. (This was previously controlled by a feature flag.) This function is included for the purposes of backwards compatibility.
[ "In", "the", "current", "version", "of", "Ray", "we", "always", "use", "the", "GCS", "to", "bootstrap", ".", "(", "This", "was", "previously", "controlled", "by", "a", "feature", "flag", ".", ")", "This", "function", "is", "included", "for", "the", "purp...
def use_gcs_for_bootstrap(): return True
[ "def", "use_gcs_for_bootstrap", "(", ")", ":", "return", "True" ]
In the current version of Ray, we always use the GCS to bootstrap.
[ "In", "the", "current", "version", "of", "Ray", "we", "always", "use", "the", "GCS", "to", "bootstrap", "." ]
[ "\"\"\"In the current version of Ray, we always use the GCS to bootstrap.\n (This was previously controlled by a feature flag.)\n\n This function is included for the purposes of backwards compatibility.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6d32ec4dc204e34f8fdf850f0bf33e41dca550f9
kisuke95/ray
python/ray/remote_function.py
[ "Apache-2.0" ]
Python
options
<not_specific>
def options(self, **task_options): """Configures and overrides the task invocation parameters. The arguments are the same as those that can be passed to :obj:`ray.remote`. Overriding `max_calls` is not supported. Examples: .. code-block:: python @ray.remote(num_gp...
Configures and overrides the task invocation parameters. The arguments are the same as those that can be passed to :obj:`ray.remote`. Overriding `max_calls` is not supported. Examples: .. code-block:: python @ray.remote(num_gpus=1, max_calls=1, num_returns=2) ...
Configures and overrides the task invocation parameters. The arguments are the same as those that can be passed to :obj:`ray.remote`. Overriding `max_calls` is not supported.
[ "Configures", "and", "overrides", "the", "task", "invocation", "parameters", ".", "The", "arguments", "are", "the", "same", "as", "those", "that", "can", "be", "passed", "to", ":", "obj", ":", "`", "ray", ".", "remote", "`", ".", "Overriding", "`", "max_...
def options(self, **task_options): func_cls = self default_options = self._default_options.copy() default_options.pop("max_calls", None) updated_options = {**default_options, **task_options} ray_option_utils.validate_task_options(updated_options, in_options=True) if "runt...
[ "def", "options", "(", "self", ",", "**", "task_options", ")", ":", "func_cls", "=", "self", "default_options", "=", "self", ".", "_default_options", ".", "copy", "(", ")", "default_options", ".", "pop", "(", "\"max_calls\"", ",", "None", ")", "updated_optio...
Configures and overrides the task invocation parameters.
[ "Configures", "and", "overrides", "the", "task", "invocation", "parameters", "." ]
[ "\"\"\"Configures and overrides the task invocation parameters.\n\n The arguments are the same as those that can be passed to :obj:`ray.remote`.\n Overriding `max_calls` is not supported.\n\n Examples:\n\n .. code-block:: python\n\n @ray.remote(num_gpus=1, max_calls=1, num_ret...
[ { "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, ...
6d32ec4dc204e34f8fdf850f0bf33e41dca550f9
kisuke95/ray
python/ray/remote_function.py
[ "Apache-2.0" ]
Python
bind
<not_specific>
def bind(self, *args, **kwargs): """ **Experimental** For ray DAG building. Implementation and interface subject to changes. """ from ray.experimental.dag.function_node import FunctionNode return FunctionNode(func_cls._fun...
**Experimental** For ray DAG building. Implementation and interface subject to changes.
Experimental For ray DAG building. Implementation and interface subject to changes.
[ "Experimental", "For", "ray", "DAG", "building", ".", "Implementation", "and", "interface", "subject", "to", "changes", "." ]
def bind(self, *args, **kwargs): from ray.experimental.dag.function_node import FunctionNode return FunctionNode(func_cls._function, args, kwargs, updated_options)
[ "def", "bind", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "from", "ray", ".", "experimental", ".", "dag", ".", "function_node", "import", "FunctionNode", "return", "FunctionNode", "(", "func_cls", ".", "_function", ",", "args", ",", "k...
Experimental For ray DAG building.
[ "Experimental", "For", "ray", "DAG", "building", "." ]
[ "\"\"\"\n **Experimental**\n\n For ray DAG building. Implementation and interface subject to changes.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6d32ec4dc204e34f8fdf850f0bf33e41dca550f9
kisuke95/ray
python/ray/remote_function.py
[ "Apache-2.0" ]
Python
_remote
<not_specific>
def _remote(self, args=None, kwargs=None, **task_options): """Submit the remote function for execution.""" # We pop the "max_calls" coming from "@ray.remote" here. We no longer need # it in "_remote()". task_options.pop("max_calls", None) if client_mode_should_convert(auto_init=T...
Submit the remote function for execution.
Submit the remote function for execution.
[ "Submit", "the", "remote", "function", "for", "execution", "." ]
def _remote(self, args=None, kwargs=None, **task_options): task_options.pop("max_calls", None) if client_mode_should_convert(auto_init=True): return client_mode_convert_function(self, args, kwargs, **task_options) worker = ray.worker.global_worker worker.check_connected() ...
[ "def", "_remote", "(", "self", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "**", "task_options", ")", ":", "task_options", ".", "pop", "(", "\"max_calls\"", ",", "None", ")", "if", "client_mode_should_convert", "(", "auto_init", "=", "True",...
Submit the remote function for execution.
[ "Submit", "the", "remote", "function", "for", "execution", "." ]
[ "\"\"\"Submit the remote function for execution.\"\"\"", "# We pop the \"max_calls\" coming from \"@ray.remote\" here. We no longer need", "# it in \"_remote()\".", "# If this function was not exported in this session and job, we need to", "# export this function again, because the current GCS doesn't have ...
[ { "param": "self", "type": null }, { "param": "args", "type": null }, { "param": "kwargs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [...
6d32ec4dc204e34f8fdf850f0bf33e41dca550f9
kisuke95/ray
python/ray/remote_function.py
[ "Apache-2.0" ]
Python
bind
<not_specific>
def bind(self, *args, **kwargs): """ **Experimental** For ray DAG building. Implementation and interface subject to changes. """ from ray.experimental.dag.function_node import FunctionNode return FunctionNode(self._function, args, kwargs, self._default_options)
**Experimental** For ray DAG building. Implementation and interface subject to changes.
Experimental For ray DAG building. Implementation and interface subject to changes.
[ "Experimental", "For", "ray", "DAG", "building", ".", "Implementation", "and", "interface", "subject", "to", "changes", "." ]
def bind(self, *args, **kwargs): from ray.experimental.dag.function_node import FunctionNode return FunctionNode(self._function, args, kwargs, self._default_options)
[ "def", "bind", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "from", "ray", ".", "experimental", ".", "dag", ".", "function_node", "import", "FunctionNode", "return", "FunctionNode", "(", "self", ".", "_function", ",", "args", ",", "kwarg...
Experimental For ray DAG building.
[ "Experimental", "For", "ray", "DAG", "building", "." ]
[ "\"\"\"\n **Experimental**\n\n For ray DAG building. Implementation and interface subject to changes.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4d2f0569a8ddd270ce8186bf8a7004cdc18a8312
kisuke95/ray
python/ray/util/collective/collective_group/gloo_util.py
[ "Apache-2.0" ]
Python
copy_tensor
null
def copy_tensor(dst_tensor, src_tensor): """Copy the content from src_tensor to dst_tensor. Args: dst_tensor: the tensor to copy from. src_tensor: the tensor to copy to. Returns: None """ copied = True if isinstance(dst_tensor, numpy.ndarray) and isinstance(src_tensor, ...
Copy the content from src_tensor to dst_tensor. Args: dst_tensor: the tensor to copy from. src_tensor: the tensor to copy to. Returns: None
Copy the content from src_tensor to dst_tensor.
[ "Copy", "the", "content", "from", "src_tensor", "to", "dst_tensor", "." ]
def copy_tensor(dst_tensor, src_tensor): copied = True if isinstance(dst_tensor, numpy.ndarray) and isinstance(src_tensor, numpy.ndarray): numpy.copyto(dst_tensor, src_tensor) elif torch_available(): if isinstance(dst_tensor, torch.Tensor) and isinstance( src_tensor, torch.Tensor...
[ "def", "copy_tensor", "(", "dst_tensor", ",", "src_tensor", ")", ":", "copied", "=", "True", "if", "isinstance", "(", "dst_tensor", ",", "numpy", ".", "ndarray", ")", "and", "isinstance", "(", "src_tensor", ",", "numpy", ".", "ndarray", ")", ":", "numpy", ...
Copy the content from src_tensor to dst_tensor.
[ "Copy", "the", "content", "from", "src_tensor", "to", "dst_tensor", "." ]
[ "\"\"\"Copy the content from src_tensor to dst_tensor.\n\n Args:\n dst_tensor: the tensor to copy from.\n src_tensor: the tensor to copy to.\n\n Returns:\n None\n \"\"\"" ]
[ { "param": "dst_tensor", "type": null }, { "param": "src_tensor", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "dst_tensor", "type": null, "docstring": "the tensor to copy from.", "docstring_tokens": [ "the", "t...
4d3a032bae314404db42165cc78fb007f2c00316
kisuke95/ray
rllib/agents/ppo/ddppo.py
[ "Apache-2.0" ]
Python
execution_plan
LocalIterator[dict]
def execution_plan( workers: WorkerSet, config: TrainerConfigDict, **kwargs ) -> LocalIterator[dict]: """Execution plan of the DD-PPO algorithm. Defines the distributed dataflow. Args: workers (WorkerSet): The WorkerSet for training the Polic(y/ies) of the Traine...
Execution plan of the DD-PPO algorithm. Defines the distributed dataflow. Args: workers (WorkerSet): The WorkerSet for training the Polic(y/ies) of the Trainer. config (TrainerConfigDict): The trainer's configuration dict. Returns: LocalIterator[dict...
Execution plan of the DD-PPO algorithm. Defines the distributed dataflow.
[ "Execution", "plan", "of", "the", "DD", "-", "PPO", "algorithm", ".", "Defines", "the", "distributed", "dataflow", "." ]
def execution_plan( workers: WorkerSet, config: TrainerConfigDict, **kwargs ) -> LocalIterator[dict]: assert ( len(kwargs) == 0 ), "DDPPO execution_plan does NOT take any additional parameters" rollouts = ParallelRollouts(workers, mode="raw") ip = ray.get(workers....
[ "def", "execution_plan", "(", "workers", ":", "WorkerSet", ",", "config", ":", "TrainerConfigDict", ",", "**", "kwargs", ")", "->", "LocalIterator", "[", "dict", "]", ":", "assert", "(", "len", "(", "kwargs", ")", "==", "0", ")", ",", "\"DDPPO execution_pl...
Execution plan of the DD-PPO algorithm.
[ "Execution", "plan", "of", "the", "DD", "-", "PPO", "algorithm", "." ]
[ "\"\"\"Execution plan of the DD-PPO algorithm. Defines the distributed dataflow.\n\n Args:\n workers (WorkerSet): The WorkerSet for training the Polic(y/ies)\n of the Trainer.\n config (TrainerConfigDict): The trainer's configuration dict.\n\n Returns:\n ...
[ { "param": "workers", "type": "WorkerSet" }, { "param": "config", "type": "TrainerConfigDict" } ]
{ "returns": [ { "docstring": "The Policy class to use with PGTrainer.\nIf None, use `get_default_policy_class()` provided by Trainer.", "docstring_tokens": [ "The", "Policy", "class", "to", "use", "with", "PGTrainer", ".", "If", ...
8f7ed64aa593b15e33cdc1e93d8be0f3cd6ead76
kisuke95/ray
python/ray/autoscaler/_private/kuberay/autoscaling_config.py
[ "Apache-2.0" ]
Python
_generate_provider_config
Dict[str, Any]
def _generate_provider_config(ray_cluster_namespace: str) -> Dict[str, Any]: """Generates the `provider` field of the autoscaling config, which carries data required to instantiate the KubeRay node provider. """ return { "type": "kuberay", "namespace": ray_cluster_namespace, "dis...
Generates the `provider` field of the autoscaling config, which carries data required to instantiate the KubeRay node provider.
Generates the `provider` field of the autoscaling config, which carries data required to instantiate the KubeRay node provider.
[ "Generates", "the", "`", "provider", "`", "field", "of", "the", "autoscaling", "config", "which", "carries", "data", "required", "to", "instantiate", "the", "KubeRay", "node", "provider", "." ]
def _generate_provider_config(ray_cluster_namespace: str) -> Dict[str, Any]: return { "type": "kuberay", "namespace": ray_cluster_namespace, "disable_node_updaters": True, "disable_launch_config_check": True, }
[ "def", "_generate_provider_config", "(", "ray_cluster_namespace", ":", "str", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"type\"", ":", "\"kuberay\"", ",", "\"namespace\"", ":", "ray_cluster_namespace", ",", "\"disable_node_updaters\"", ...
Generates the `provider` field of the autoscaling config, which carries data required to instantiate the KubeRay node provider.
[ "Generates", "the", "`", "provider", "`", "field", "of", "the", "autoscaling", "config", "which", "carries", "data", "required", "to", "instantiate", "the", "KubeRay", "node", "provider", "." ]
[ "\"\"\"Generates the `provider` field of the autoscaling config, which carries data\n required to instantiate the KubeRay node provider.\n \"\"\"" ]
[ { "param": "ray_cluster_namespace", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ray_cluster_namespace", "type": "str", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8f7ed64aa593b15e33cdc1e93d8be0f3cd6ead76
kisuke95/ray
python/ray/autoscaler/_private/kuberay/autoscaling_config.py
[ "Apache-2.0" ]
Python
_generate_legacy_autoscaling_config_fields
Dict[str, Any]
def _generate_legacy_autoscaling_config_fields() -> Dict[str, Any]: """Generates legacy autoscaling config fields required for compatibiliy.""" return { "file_mounts": {}, "cluster_synced_files": [], "file_mounts_sync_continuously": False, "initialization_commands": [], "...
Generates legacy autoscaling config fields required for compatibiliy.
Generates legacy autoscaling config fields required for compatibiliy.
[ "Generates", "legacy", "autoscaling", "config", "fields", "required", "for", "compatibiliy", "." ]
def _generate_legacy_autoscaling_config_fields() -> Dict[str, Any]: return { "file_mounts": {}, "cluster_synced_files": [], "file_mounts_sync_continuously": False, "initialization_commands": [], "setup_commands": [], "head_setup_commands": [], "worker_setup_co...
[ "def", "_generate_legacy_autoscaling_config_fields", "(", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"file_mounts\"", ":", "{", "}", ",", "\"cluster_synced_files\"", ":", "[", "]", ",", "\"file_mounts_sync_continuously\"", ":", "False", ...
Generates legacy autoscaling config fields required for compatibiliy.
[ "Generates", "legacy", "autoscaling", "config", "fields", "required", "for", "compatibiliy", "." ]
[ "\"\"\"Generates legacy autoscaling config fields required for compatibiliy.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
8f7ed64aa593b15e33cdc1e93d8be0f3cd6ead76
kisuke95/ray
python/ray/autoscaler/_private/kuberay/autoscaling_config.py
[ "Apache-2.0" ]
Python
_generate_available_node_types_from_ray_cr_spec
Dict[str, Any]
def _generate_available_node_types_from_ray_cr_spec( ray_cr_spec: Dict[str, Any] ) -> Dict[str, Any]: """Formats autoscaler "available_node_types" field based on the Ray CR's group specs. """ headGroupSpec = ray_cr_spec["headGroupSpec"] return { _HEAD_GROUP_NAME: _node_type_from_group_sp...
Formats autoscaler "available_node_types" field based on the Ray CR's group specs.
Formats autoscaler "available_node_types" field based on the Ray CR's group specs.
[ "Formats", "autoscaler", "\"", "available_node_types", "\"", "field", "based", "on", "the", "Ray", "CR", "'", "s", "group", "specs", "." ]
def _generate_available_node_types_from_ray_cr_spec( ray_cr_spec: Dict[str, Any] ) -> Dict[str, Any]: headGroupSpec = ray_cr_spec["headGroupSpec"] return { _HEAD_GROUP_NAME: _node_type_from_group_spec(headGroupSpec, is_head=True), **{ worker_group_spec["groupName"]: _node_type_fr...
[ "def", "_generate_available_node_types_from_ray_cr_spec", "(", "ray_cr_spec", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "headGroupSpec", "=", "ray_cr_spec", "[", "\"headGroupSpec\"", "]", "return", "{", "_HE...
Formats autoscaler "available_node_types" field based on the Ray CR's group specs.
[ "Formats", "autoscaler", "\"", "available_node_types", "\"", "field", "based", "on", "the", "Ray", "CR", "'", "s", "group", "specs", "." ]
[ "\"\"\"Formats autoscaler \"available_node_types\" field based on the Ray CR's group\n specs.\n \"\"\"" ]
[ { "param": "ray_cr_spec", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ray_cr_spec", "type": "Dict[str, Any]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8f7ed64aa593b15e33cdc1e93d8be0f3cd6ead76
kisuke95/ray
python/ray/autoscaler/_private/kuberay/autoscaling_config.py
[ "Apache-2.0" ]
Python
_node_type_from_group_spec
Dict[str, Any]
def _node_type_from_group_spec( group_spec: Dict[str, Any], is_head: bool ) -> Dict[str, Any]: """Converts CR group spec to autoscaler node type.""" if is_head: # The head node type has no workers because the head is not a worker. min_workers = max_workers = 0 else: # `minReplica...
Converts CR group spec to autoscaler node type.
Converts CR group spec to autoscaler node type.
[ "Converts", "CR", "group", "spec", "to", "autoscaler", "node", "type", "." ]
def _node_type_from_group_spec( group_spec: Dict[str, Any], is_head: bool ) -> Dict[str, Any]: if is_head: min_workers = max_workers = 0 else: min_workers = group_spec["minReplicas"] max_workers = group_spec["maxReplicas"] resources = _get_ray_resources_from_group_spec(group_spec...
[ "def", "_node_type_from_group_spec", "(", "group_spec", ":", "Dict", "[", "str", ",", "Any", "]", ",", "is_head", ":", "bool", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "if", "is_head", ":", "min_workers", "=", "max_workers", "=", "0", "else...
Converts CR group spec to autoscaler node type.
[ "Converts", "CR", "group", "spec", "to", "autoscaler", "node", "type", "." ]
[ "\"\"\"Converts CR group spec to autoscaler node type.\"\"\"", "# The head node type has no workers because the head is not a worker.", "# `minReplicas` and `maxReplicas` are required fields for each workerGroupSpec", "# `node_config` is a legacy field required for compatibility.", "# Pod config data is req...
[ { "param": "group_spec", "type": "Dict[str, Any]" }, { "param": "is_head", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "group_spec", "type": "Dict[str, Any]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "is_head", "type": "bool", "docstring": null, ...
8f7ed64aa593b15e33cdc1e93d8be0f3cd6ead76
kisuke95/ray
python/ray/autoscaler/_private/kuberay/autoscaling_config.py
[ "Apache-2.0" ]
Python
_get_ray_resources_from_group_spec
Dict[str, int]
def _get_ray_resources_from_group_spec( group_spec: Dict[str, Any], is_head: bool ) -> Dict[str, int]: """ Infers Ray resources from rayStartCommands and K8s limits. The resources extracted are used in autoscaling calculations. TODO: Expose a better interface in the RayCluster CRD for Ray resource ...
Infers Ray resources from rayStartCommands and K8s limits. The resources extracted are used in autoscaling calculations. TODO: Expose a better interface in the RayCluster CRD for Ray resource annotations. For now, we take the rayStartParams as the primary source of truth.
Infers Ray resources from rayStartCommands and K8s limits. The resources extracted are used in autoscaling calculations. Expose a better interface in the RayCluster CRD for Ray resource annotations. For now, we take the rayStartParams as the primary source of truth.
[ "Infers", "Ray", "resources", "from", "rayStartCommands", "and", "K8s", "limits", ".", "The", "resources", "extracted", "are", "used", "in", "autoscaling", "calculations", ".", "Expose", "a", "better", "interface", "in", "the", "RayCluster", "CRD", "for", "Ray",...
def _get_ray_resources_from_group_spec( group_spec: Dict[str, Any], is_head: bool ) -> Dict[str, int]: ray_start_params = group_spec["rayStartParams"] k8s_resource_limits = ( group_spec["template"]["spec"]["containers"][0] .get("resources", {}) .get("limits", {}) ) group_name...
[ "def", "_get_ray_resources_from_group_spec", "(", "group_spec", ":", "Dict", "[", "str", ",", "Any", "]", ",", "is_head", ":", "bool", ")", "->", "Dict", "[", "str", ",", "int", "]", ":", "ray_start_params", "=", "group_spec", "[", "\"rayStartParams\"", "]",...
Infers Ray resources from rayStartCommands and K8s limits.
[ "Infers", "Ray", "resources", "from", "rayStartCommands", "and", "K8s", "limits", "." ]
[ "\"\"\"\n Infers Ray resources from rayStartCommands and K8s limits.\n The resources extracted are used in autoscaling calculations.\n\n TODO: Expose a better interface in the RayCluster CRD for Ray resource annotations.\n For now, we take the rayStartParams as the primary source of truth.\n \"\"\"",...
[ { "param": "group_spec", "type": "Dict[str, Any]" }, { "param": "is_head", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "group_spec", "type": "Dict[str, Any]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "is_head", "type": "bool", "docstring": null, ...
8f7ed64aa593b15e33cdc1e93d8be0f3cd6ead76
kisuke95/ray
python/ray/autoscaler/_private/kuberay/autoscaling_config.py
[ "Apache-2.0" ]
Python
_get_memory
Optional[int]
def _get_memory( ray_start_params: Dict[str, str], k8s_resource_limits: Dict[str, Any] ) -> Optional[int]: """Get memory resource annotation from ray_start_params, if it is set there. TODO, maybe: Consider container resource limits as in https://github.com/ray-project/ray/pull/14567/files """ i...
Get memory resource annotation from ray_start_params, if it is set there. TODO, maybe: Consider container resource limits as in https://github.com/ray-project/ray/pull/14567/files
Get memory resource annotation from ray_start_params, if it is set there.
[ "Get", "memory", "resource", "annotation", "from", "ray_start_params", "if", "it", "is", "set", "there", "." ]
def _get_memory( ray_start_params: Dict[str, str], k8s_resource_limits: Dict[str, Any] ) -> Optional[int]: if "memory" in ray_start_params: return int(ray_start_params["memory"]) return None
[ "def", "_get_memory", "(", "ray_start_params", ":", "Dict", "[", "str", ",", "str", "]", ",", "k8s_resource_limits", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Optional", "[", "int", "]", ":", "if", "\"memory\"", "in", "ray_start_params", ":",...
Get memory resource annotation from ray_start_params, if it is set there.
[ "Get", "memory", "resource", "annotation", "from", "ray_start_params", "if", "it", "is", "set", "there", "." ]
[ "\"\"\"Get memory resource annotation from ray_start_params, if it is set there.\n\n TODO, maybe: Consider container resource limits as in\n https://github.com/ray-project/ray/pull/14567/files\n \"\"\"" ]
[ { "param": "ray_start_params", "type": "Dict[str, str]" }, { "param": "k8s_resource_limits", "type": "Dict[str, Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ray_start_params", "type": "Dict[str, str]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "k8s_resource_limits", "type": "Dict[str, Any]", ...
8f7ed64aa593b15e33cdc1e93d8be0f3cd6ead76
kisuke95/ray
python/ray/autoscaler/_private/kuberay/autoscaling_config.py
[ "Apache-2.0" ]
Python
_get_num_gpus
Optional[int]
def _get_num_gpus( ray_start_params: Dict[str, str], k8s_resource_limits: Dict[str, Any], group_name: str, ) -> Optional[int]: """Read the number of GPUs from the Ray start params. Potential TODO: Read GPU info from the container spec, here and in the Ray Operator. """ if "num-gpus" in...
Read the number of GPUs from the Ray start params. Potential TODO: Read GPU info from the container spec, here and in the Ray Operator.
Read the number of GPUs from the Ray start params. Potential TODO: Read GPU info from the container spec, here and in the Ray Operator.
[ "Read", "the", "number", "of", "GPUs", "from", "the", "Ray", "start", "params", ".", "Potential", "TODO", ":", "Read", "GPU", "info", "from", "the", "container", "spec", "here", "and", "in", "the", "Ray", "Operator", "." ]
def _get_num_gpus( ray_start_params: Dict[str, str], k8s_resource_limits: Dict[str, Any], group_name: str, ) -> Optional[int]: if "num-gpus" in ray_start_params: return int(ray_start_params["num-gpus"]) for key in k8s_resource_limits: global _GPU_WARNING_LOGGED if "gpu" in ke...
[ "def", "_get_num_gpus", "(", "ray_start_params", ":", "Dict", "[", "str", ",", "str", "]", ",", "k8s_resource_limits", ":", "Dict", "[", "str", ",", "Any", "]", ",", "group_name", ":", "str", ",", ")", "->", "Optional", "[", "int", "]", ":", "if", "\...
Read the number of GPUs from the Ray start params.
[ "Read", "the", "number", "of", "GPUs", "from", "the", "Ray", "start", "params", "." ]
[ "\"\"\"Read the number of GPUs from the Ray start params.\n\n Potential TODO: Read GPU info from the container spec, here and in the\n Ray Operator.\n \"\"\"", "# Issue a warning if GPUs are present in the container spec but not in the", "# ray start params.", "# TODO: Consider reading GPU info from ...
[ { "param": "ray_start_params", "type": "Dict[str, str]" }, { "param": "k8s_resource_limits", "type": "Dict[str, Any]" }, { "param": "group_name", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ray_start_params", "type": "Dict[str, str]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "k8s_resource_limits", "type": "Dict[str, Any]", ...
8f7ed64aa593b15e33cdc1e93d8be0f3cd6ead76
kisuke95/ray
python/ray/autoscaler/_private/kuberay/autoscaling_config.py
[ "Apache-2.0" ]
Python
_get_custom_resources
Dict[str, int]
def _get_custom_resources( ray_start_params: Dict[str, Any], group_name: str ) -> Dict[str, int]: """Format custom resources based on the `resources` Ray start param. For the current prototype, the value of the `resources` field must be formatted as follows: '"{\"Custom1\": 1, \"Custom2\": 5}"'. ...
Format custom resources based on the `resources` Ray start param. For the current prototype, the value of the `resources` field must be formatted as follows: '"{\"Custom1\": 1, \"Custom2\": 5}"'. We intend to provide a better interface soon. This method first converts the input to a correctly for...
Format custom resources based on the `resources` Ray start param. We intend to provide a better interface soon. This method first converts the input to a correctly formatted json string and then loads that json string to a dict.
[ "Format", "custom", "resources", "based", "on", "the", "`", "resources", "`", "Ray", "start", "param", ".", "We", "intend", "to", "provide", "a", "better", "interface", "soon", ".", "This", "method", "first", "converts", "the", "input", "to", "a", "correct...
def _get_custom_resources( ray_start_params: Dict[str, Any], group_name: str ) -> Dict[str, int]: if "resources" not in ray_start_params: return {} resources_string = ray_start_params["resources"] try: resources_json = resources_string[1:-1].replace("\\", "") resources = json.loa...
[ "def", "_get_custom_resources", "(", "ray_start_params", ":", "Dict", "[", "str", ",", "Any", "]", ",", "group_name", ":", "str", ")", "->", "Dict", "[", "str", ",", "int", "]", ":", "if", "\"resources\"", "not", "in", "ray_start_params", ":", "return", ...
Format custom resources based on the `resources` Ray start param.
[ "Format", "custom", "resources", "based", "on", "the", "`", "resources", "`", "Ray", "start", "param", "." ]
[ "\"\"\"Format custom resources based on the `resources` Ray start param.\n\n For the current prototype, the value of the `resources` field must\n be formatted as follows:\n '\"{\\\"Custom1\\\": 1, \\\"Custom2\\\": 5}\"'.\n\n We intend to provide a better interface soon.\n\n This method first converts...
[ { "param": "ray_start_params", "type": "Dict[str, Any]" }, { "param": "group_name", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ray_start_params", "type": "Dict[str, Any]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "group_name", "type": "str", "docstring": nu...
77b4ac8b92d898ecb53acc0b0ff428534588f3a8
kisuke95/ray
python/ray/ml/preprocessor.py
[ "Apache-2.0" ]
Python
transform_batch
DataBatchType
def transform_batch(self, df: DataBatchType) -> DataBatchType: """Transform a single batch of data. Args: df (DataBatchType): Input data batch. Returns: DataBatchType: The transformed data batch. """ fit_status = self.fit_status() if fit_status i...
Transform a single batch of data. Args: df (DataBatchType): Input data batch. Returns: DataBatchType: The transformed data batch.
Transform a single batch of data.
[ "Transform", "a", "single", "batch", "of", "data", "." ]
def transform_batch(self, df: DataBatchType) -> DataBatchType: fit_status = self.fit_status() if fit_status in ( Preprocessor.FitStatus.PARTIALLY_FITTED, Preprocessor.FitStatus.NOT_FITTED, ): raise PreprocessorNotFittedException( "`fit` must be...
[ "def", "transform_batch", "(", "self", ",", "df", ":", "DataBatchType", ")", "->", "DataBatchType", ":", "fit_status", "=", "self", ".", "fit_status", "(", ")", "if", "fit_status", "in", "(", "Preprocessor", ".", "FitStatus", ".", "PARTIALLY_FITTED", ",", "P...
Transform a single batch of data.
[ "Transform", "a", "single", "batch", "of", "data", "." ]
[ "\"\"\"Transform a single batch of data.\n\n Args:\n df (DataBatchType): Input data batch.\n\n Returns:\n DataBatchType: The transformed data batch.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "df", "type": "DataBatchType" } ]
{ "returns": [ { "docstring": "The transformed data batch.", "docstring_tokens": [ "The", "transformed", "data", "batch", "." ], "type": "DataBatchType" } ], "raises": [], "params": [ { "identifier": "self", "type": null, ...
ec136008be24b88cdb1960d13f0a84202e837227
kisuke95/ray
python/ray/serve/pipeline/json_serde.py
[ "Apache-2.0" ]
Python
convert_to_json_safe_obj
Any
def convert_to_json_safe_obj(obj: Any, *, err_key: str) -> Any: """Converts the provided object into a JSON-safe version of it. The returned object can safely be `json.dumps`'d to a string. Uses the Ray Serve encoder to serialize special objects such as ServeHandles and DAGHandles. Raises: TypeEr...
Converts the provided object into a JSON-safe version of it. The returned object can safely be `json.dumps`'d to a string. Uses the Ray Serve encoder to serialize special objects such as ServeHandles and DAGHandles. Raises: TypeError if the object contains fields that cannot be JSON-serialized. ...
Converts the provided object into a JSON-safe version of it. The returned object can safely be `json.dumps`'d to a string. Uses the Ray Serve encoder to serialize special objects such as ServeHandles and DAGHandles. TypeError if the object contains fields that cannot be JSON-serialized.
[ "Converts", "the", "provided", "object", "into", "a", "JSON", "-", "safe", "version", "of", "it", ".", "The", "returned", "object", "can", "safely", "be", "`", "json", ".", "dumps", "`", "'", "d", "to", "a", "string", ".", "Uses", "the", "Ray", "Serv...
def convert_to_json_safe_obj(obj: Any, *, err_key: str) -> Any: try: return json.loads(json.dumps(obj, cls=DAGNodeEncoder)) except Exception as e: raise TypeError( "All provided fields must be JSON-serializable to build the " f"Serve app. Failed while serializing {err_key...
[ "def", "convert_to_json_safe_obj", "(", "obj", ":", "Any", ",", "*", ",", "err_key", ":", "str", ")", "->", "Any", ":", "try", ":", "return", "json", ".", "loads", "(", "json", ".", "dumps", "(", "obj", ",", "cls", "=", "DAGNodeEncoder", ")", ")", ...
Converts the provided object into a JSON-safe version of it.
[ "Converts", "the", "provided", "object", "into", "a", "JSON", "-", "safe", "version", "of", "it", "." ]
[ "\"\"\"Converts the provided object into a JSON-safe version of it.\n\n The returned object can safely be `json.dumps`'d to a string.\n\n Uses the Ray Serve encoder to serialize special objects such as\n ServeHandles and DAGHandles.\n\n Raises: TypeError if the object contains fields that cannot be\n ...
[ { "param": "obj", "type": "Any" }, { "param": "err_key", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "obj", "type": "Any", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "err_key", "type": "str", "docstring": null, "docstring_tokens...
ec136008be24b88cdb1960d13f0a84202e837227
kisuke95/ray
python/ray/serve/pipeline/json_serde.py
[ "Apache-2.0" ]
Python
convert_from_json_safe_obj
Any
def convert_from_json_safe_obj(obj: Any, *, err_key: str) -> Any: """Converts a JSON-safe object to one that contains Serve special types. The provided object should have been serialized using convert_to_json_safe_obj. Any special-cased objects such as ServeHandles will be recovered on this pass. "...
Converts a JSON-safe object to one that contains Serve special types. The provided object should have been serialized using convert_to_json_safe_obj. Any special-cased objects such as ServeHandles will be recovered on this pass.
Converts a JSON-safe object to one that contains Serve special types. The provided object should have been serialized using convert_to_json_safe_obj. Any special-cased objects such as ServeHandles will be recovered on this pass.
[ "Converts", "a", "JSON", "-", "safe", "object", "to", "one", "that", "contains", "Serve", "special", "types", ".", "The", "provided", "object", "should", "have", "been", "serialized", "using", "convert_to_json_safe_obj", ".", "Any", "special", "-", "cased", "o...
def convert_from_json_safe_obj(obj: Any, *, err_key: str) -> Any: try: return json.loads(json.dumps(obj), object_hook=dagnode_from_json) except Exception as e: raise ValueError(f"Failed to convert {err_key} from JSON:\n{e}")
[ "def", "convert_from_json_safe_obj", "(", "obj", ":", "Any", ",", "*", ",", "err_key", ":", "str", ")", "->", "Any", ":", "try", ":", "return", "json", ".", "loads", "(", "json", ".", "dumps", "(", "obj", ")", ",", "object_hook", "=", "dagnode_from_jso...
Converts a JSON-safe object to one that contains Serve special types.
[ "Converts", "a", "JSON", "-", "safe", "object", "to", "one", "that", "contains", "Serve", "special", "types", "." ]
[ "\"\"\"Converts a JSON-safe object to one that contains Serve special types.\n\n The provided object should have been serialized using\n convert_to_json_safe_obj. Any special-cased objects such as ServeHandles\n will be recovered on this pass.\n \"\"\"" ]
[ { "param": "obj", "type": "Any" }, { "param": "err_key", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "obj", "type": "Any", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "err_key", "type": "str", "docstring": null, "docstring_tokens...
ec136008be24b88cdb1960d13f0a84202e837227
kisuke95/ray
python/ray/serve/pipeline/json_serde.py
[ "Apache-2.0" ]
Python
dagnode_from_json
Union[DAGNode, RayServeHandle, Any]
def dagnode_from_json(input_json: Any) -> Union[DAGNode, RayServeHandle, Any]: """ Decode a DAGNode from given input json dictionary. JSON serialization is only used and enforced in ray serve from ray core API authored DAGNode(s). Covers both RayServeHandle and DAGNode types. Assumptions: ...
Decode a DAGNode from given input json dictionary. JSON serialization is only used and enforced in ray serve from ray core API authored DAGNode(s). Covers both RayServeHandle and DAGNode types. Assumptions: - User object's JSON dict does not have keys that collide with our reserve...
Decode a DAGNode from given input json dictionary. JSON serialization is only used and enforced in ray serve from ray core API authored DAGNode(s). User object's JSON dict does not have keys that collide with our reserved DAGNODE_TYPE_KEY RayServeHandle and Deployment can be re-constructed without losing states need...
[ "Decode", "a", "DAGNode", "from", "given", "input", "json", "dictionary", ".", "JSON", "serialization", "is", "only", "used", "and", "enforced", "in", "ray", "serve", "from", "ray", "core", "API", "authored", "DAGNode", "(", "s", ")", ".", "User", "object"...
def dagnode_from_json(input_json: Any) -> Union[DAGNode, RayServeHandle, Any]: if SERVE_HANDLE_JSON_KEY in input_json: return serve_handle_from_json_dict(input_json) elif DAGNODE_TYPE_KEY not in input_json: return input_json elif input_json[DAGNODE_TYPE_KEY] == RayServeDAGHandle.__name__: ...
[ "def", "dagnode_from_json", "(", "input_json", ":", "Any", ")", "->", "Union", "[", "DAGNode", ",", "RayServeHandle", ",", "Any", "]", ":", "if", "SERVE_HANDLE_JSON_KEY", "in", "input_json", ":", "return", "serve_handle_from_json_dict", "(", "input_json", ")", "...
Decode a DAGNode from given input json dictionary.
[ "Decode", "a", "DAGNode", "from", "given", "input", "json", "dictionary", "." ]
[ "\"\"\"\n Decode a DAGNode from given input json dictionary. JSON serialization is\n only used and enforced in ray serve from ray core API authored DAGNode(s).\n\n Covers both RayServeHandle and DAGNode types.\n\n Assumptions:\n - User object's JSON dict does not have keys that collide with our\n...
[ { "param": "input_json", "type": "Any" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "input_json", "type": "Any", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4dd6a9147c12df497d3b3773df14b4992b50d758
kisuke95/ray
rllib/evaluation/worker_set.py
[ "Apache-2.0" ]
Python
sync_weights
None
def sync_weights( self, policies: Optional[List[PolicyID]] = None, from_worker: Optional[RolloutWorker] = None, global_vars: Optional[Dict[str, TensorType]] = None, ) -> None: """Syncs model weights from the local worker to all remote workers. Args: polic...
Syncs model weights from the local worker to all remote workers. Args: policies: Optional list of PolicyIDs to sync weights for. If None (default), sync weights to/from all policies. from_worker: Optional RolloutWorker instance to sync from. If None (defa...
Syncs model weights from the local worker to all remote workers.
[ "Syncs", "model", "weights", "from", "the", "local", "worker", "to", "all", "remote", "workers", "." ]
def sync_weights( self, policies: Optional[List[PolicyID]] = None, from_worker: Optional[RolloutWorker] = None, global_vars: Optional[Dict[str, TensorType]] = None, ) -> None: if self.local_worker() is None and from_worker is None: raise TypeError( ...
[ "def", "sync_weights", "(", "self", ",", "policies", ":", "Optional", "[", "List", "[", "PolicyID", "]", "]", "=", "None", ",", "from_worker", ":", "Optional", "[", "RolloutWorker", "]", "=", "None", ",", "global_vars", ":", "Optional", "[", "Dict", "[",...
Syncs model weights from the local worker to all remote workers.
[ "Syncs", "model", "weights", "from", "the", "local", "worker", "to", "all", "remote", "workers", "." ]
[ "\"\"\"Syncs model weights from the local worker to all remote workers.\n\n Args:\n policies: Optional list of PolicyIDs to sync weights for.\n If None (default), sync weights to/from all policies.\n from_worker: Optional RolloutWorker instance to sync from.\n ...
[ { "param": "self", "type": null }, { "param": "policies", "type": "Optional[List[PolicyID]]" }, { "param": "from_worker", "type": "Optional[RolloutWorker]" }, { "param": "global_vars", "type": "Optional[Dict[str, TensorType]]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "policies", "type": "Optional[List[PolicyID]]", "docstring": "Option...
4dd6a9147c12df497d3b3773df14b4992b50d758
kisuke95/ray
rllib/evaluation/worker_set.py
[ "Apache-2.0" ]
Python
add_workers
None
def add_workers(self, num_workers: int) -> None: """Creates and adds a number of remote workers to this worker set. Can be called several times on the same WorkerSet to add more RolloutWorkers to the set. Args: num_workers: The number of remote Workers to add to this ...
Creates and adds a number of remote workers to this worker set. Can be called several times on the same WorkerSet to add more RolloutWorkers to the set. Args: num_workers: The number of remote Workers to add to this WorkerSet.
Creates and adds a number of remote workers to this worker set. Can be called several times on the same WorkerSet to add more RolloutWorkers to the set.
[ "Creates", "and", "adds", "a", "number", "of", "remote", "workers", "to", "this", "worker", "set", ".", "Can", "be", "called", "several", "times", "on", "the", "same", "WorkerSet", "to", "add", "more", "RolloutWorkers", "to", "the", "set", "." ]
def add_workers(self, num_workers: int) -> None: old_num_workers = len(self._remote_workers) self._remote_workers.extend( [ self._make_worker( cls=self._cls, env_creator=self._env_creator, validate_env=None, ...
[ "def", "add_workers", "(", "self", ",", "num_workers", ":", "int", ")", "->", "None", ":", "old_num_workers", "=", "len", "(", "self", ".", "_remote_workers", ")", "self", ".", "_remote_workers", ".", "extend", "(", "[", "self", ".", "_make_worker", "(", ...
Creates and adds a number of remote workers to this worker set.
[ "Creates", "and", "adds", "a", "number", "of", "remote", "workers", "to", "this", "worker", "set", "." ]
[ "\"\"\"Creates and adds a number of remote workers to this worker set.\n\n Can be called several times on the same WorkerSet to add more\n RolloutWorkers to the set.\n\n Args:\n num_workers: The number of remote Workers to add to this\n WorkerSet.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "num_workers", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "num_workers", "type": "int", "docstring": "The number of remote Wor...
4dd6a9147c12df497d3b3773df14b4992b50d758
kisuke95/ray
rllib/evaluation/worker_set.py
[ "Apache-2.0" ]
Python
_worker_health_check
List[int]
def _worker_health_check(self) -> List[int]: """Performs a health-check on each remote worker. Returns: List of indices (into `self._remote_workers` list) of faulty workers. Note that index=1 is the 0th item in `self._remote_workers`. """ logger.info("Health chec...
Performs a health-check on each remote worker. Returns: List of indices (into `self._remote_workers` list) of faulty workers. Note that index=1 is the 0th item in `self._remote_workers`.
Performs a health-check on each remote worker.
[ "Performs", "a", "health", "-", "check", "on", "each", "remote", "worker", "." ]
def _worker_health_check(self) -> List[int]: logger.info("Health checking all workers ...") checks = [] for worker in self.remote_workers(): _, obj_ref = worker.sample_with_count.remote() checks.append(obj_ref) faulty_worker_indices = [] for i, obj_ref in ...
[ "def", "_worker_health_check", "(", "self", ")", "->", "List", "[", "int", "]", ":", "logger", ".", "info", "(", "\"Health checking all workers ...\"", ")", "checks", "=", "[", "]", "for", "worker", "in", "self", ".", "remote_workers", "(", ")", ":", "_", ...
Performs a health-check on each remote worker.
[ "Performs", "a", "health", "-", "check", "on", "each", "remote", "worker", "." ]
[ "\"\"\"Performs a health-check on each remote worker.\n\n Returns:\n List of indices (into `self._remote_workers` list) of faulty workers.\n Note that index=1 is the 0th item in `self._remote_workers`.\n \"\"\"", "# TODO: Maybe find a better way to probe for healthiness. Perfor...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "List of indices (into `self._remote_workers` list) of faulty workers.\nNote that index=1 is the 0th item in `self._remote_workers`.", "docstring_tokens": [ "List", "of", "indices", "(", "into", "`", "self", ...
79b38d5e824adb8e3497e80d18fd58f63a1de41b
kisuke95/ray
python/ray/data/dataset.py
[ "Apache-2.0" ]
Python
map
"Dataset[U]"
def map( self, fn: Union[CallableClass, Callable[[T], U]], *, compute: Optional[str] = None, **ray_remote_args, ) -> "Dataset[U]": """Apply the given function to each record of this dataset. This is a blocking operation. Note that mapping individual records ...
Apply the given function to each record of this dataset. This is a blocking operation. Note that mapping individual records can be quite slow. Consider using `.map_batches()` for performance. Examples: >>> import ray >>> # Transform python objects. >>> ds = ...
Apply the given function to each record of this dataset. This is a blocking operation. Note that mapping individual records can be quite slow. Consider using `.map_batches()` for performance.
[ "Apply", "the", "given", "function", "to", "each", "record", "of", "this", "dataset", ".", "This", "is", "a", "blocking", "operation", ".", "Note", "that", "mapping", "individual", "records", "can", "be", "quite", "slow", ".", "Consider", "using", "`", "."...
def map( self, fn: Union[CallableClass, Callable[[T], U]], *, compute: Optional[str] = None, **ray_remote_args, ) -> "Dataset[U]": self._warn_slow() fn = cache_wrapper(fn, compute) context = DatasetContext.get_current() def transform(block: Blo...
[ "def", "map", "(", "self", ",", "fn", ":", "Union", "[", "CallableClass", ",", "Callable", "[", "[", "T", "]", ",", "U", "]", "]", ",", "*", ",", "compute", ":", "Optional", "[", "str", "]", "=", "None", ",", "**", "ray_remote_args", ",", ")", ...
Apply the given function to each record of this dataset.
[ "Apply", "the", "given", "function", "to", "each", "record", "of", "this", "dataset", "." ]
[ "\"\"\"Apply the given function to each record of this dataset.\n\n This is a blocking operation. Note that mapping individual records\n can be quite slow. Consider using `.map_batches()` for performance.\n\n Examples:\n >>> import ray\n >>> # Transform python objects.\n ...
[ { "param": "self", "type": null }, { "param": "fn", "type": "Union[CallableClass, Callable[[T], U]]" }, { "param": "compute", "type": "Optional[str]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fn", "type": "Union[CallableClass, Callable[[T], U]]", "docstring":...
79b38d5e824adb8e3497e80d18fd58f63a1de41b
kisuke95/ray
python/ray/data/dataset.py
[ "Apache-2.0" ]
Python
map_batches
"Dataset[Any]"
def map_batches( self, fn: Union[CallableClass, Callable[[BatchType], BatchType]], *, batch_size: Optional[int] = 4096, compute: Union[str, ComputeStrategy] = None, batch_format: str = "native", **ray_remote_args, ) -> "Dataset[Any]": """Apply the give...
Apply the given function to batches of records of this dataset. This is a blocking operation. Examples: >>> import ray >>> # Transform python objects. >>> ds = ray.data.range(1000) # doctest: +SKIP >>> # Transform batches in parallel. >>> ds....
Apply the given function to batches of records of this dataset. This is a blocking operation.
[ "Apply", "the", "given", "function", "to", "batches", "of", "records", "of", "this", "dataset", ".", "This", "is", "a", "blocking", "operation", "." ]
def map_batches( self, fn: Union[CallableClass, Callable[[BatchType], BatchType]], *, batch_size: Optional[int] = 4096, compute: Union[str, ComputeStrategy] = None, batch_format: str = "native", **ray_remote_args, ) -> "Dataset[Any]": import pyarrow as...
[ "def", "map_batches", "(", "self", ",", "fn", ":", "Union", "[", "CallableClass", ",", "Callable", "[", "[", "BatchType", "]", ",", "BatchType", "]", "]", ",", "*", ",", "batch_size", ":", "Optional", "[", "int", "]", "=", "4096", ",", "compute", ":"...
Apply the given function to batches of records of this dataset.
[ "Apply", "the", "given", "function", "to", "batches", "of", "records", "of", "this", "dataset", "." ]
[ "\"\"\"Apply the given function to batches of records of this dataset.\n\n This is a blocking operation.\n\n Examples:\n >>> import ray\n >>> # Transform python objects.\n >>> ds = ray.data.range(1000) # doctest: +SKIP\n >>> # Transform batches in parallel.\...
[ { "param": "self", "type": null }, { "param": "fn", "type": "Union[CallableClass, Callable[[BatchType], BatchType]]" }, { "param": "batch_size", "type": "Optional[int]" }, { "param": "compute", "type": "Union[str, ComputeStrategy]" }, { "param": "batch_format", ...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fn", "type": "Union[CallableClass, Callable[[BatchType], BatchType]]", ...