repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
ray-project/ray
python/ray/tune/schedulers/hyperband.py
HyperBandScheduler._process_bracket
def _process_bracket(self, trial_runner, bracket, trial): """This is called whenever a trial makes progress. When all live trials in the bracket have no more iterations left, Trials will be successively halved. If bracket is done, all non-running trials will be stopped and cleaned up, ...
python
def _process_bracket(self, trial_runner, bracket, trial): """This is called whenever a trial makes progress. When all live trials in the bracket have no more iterations left, Trials will be successively halved. If bracket is done, all non-running trials will be stopped and cleaned up, ...
[ "def", "_process_bracket", "(", "self", ",", "trial_runner", ",", "bracket", ",", "trial", ")", ":", "action", "=", "TrialScheduler", ".", "PAUSE", "if", "bracket", ".", "cur_iter_done", "(", ")", ":", "if", "bracket", ".", "finished", "(", ")", ":", "br...
This is called whenever a trial makes progress. When all live trials in the bracket have no more iterations left, Trials will be successively halved. If bracket is done, all non-running trials will be stopped and cleaned up, and during each halving phase, bad trials will be stopped whil...
[ "This", "is", "called", "whenever", "a", "trial", "makes", "progress", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L161-L197
train
ray-project/ray
python/ray/tune/schedulers/hyperband.py
HyperBandScheduler.on_trial_remove
def on_trial_remove(self, trial_runner, trial): """Notification when trial terminates. Trial info is removed from bracket. Triggers halving if bracket is not finished.""" bracket, _ = self._trial_info[trial] bracket.cleanup_trial(trial) if not bracket.finished(): ...
python
def on_trial_remove(self, trial_runner, trial): """Notification when trial terminates. Trial info is removed from bracket. Triggers halving if bracket is not finished.""" bracket, _ = self._trial_info[trial] bracket.cleanup_trial(trial) if not bracket.finished(): ...
[ "def", "on_trial_remove", "(", "self", ",", "trial_runner", ",", "trial", ")", ":", "bracket", ",", "_", "=", "self", ".", "_trial_info", "[", "trial", "]", "bracket", ".", "cleanup_trial", "(", "trial", ")", "if", "not", "bracket", ".", "finished", "(",...
Notification when trial terminates. Trial info is removed from bracket. Triggers halving if bracket is not finished.
[ "Notification", "when", "trial", "terminates", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L199-L207
train
ray-project/ray
python/ray/tune/schedulers/hyperband.py
HyperBandScheduler.choose_trial_to_run
def choose_trial_to_run(self, trial_runner): """Fair scheduling within iteration by completion percentage. List of trials not used since all trials are tracked as state of scheduler. If iteration is occupied (ie, no trials to run), then look into next iteration. """ for...
python
def choose_trial_to_run(self, trial_runner): """Fair scheduling within iteration by completion percentage. List of trials not used since all trials are tracked as state of scheduler. If iteration is occupied (ie, no trials to run), then look into next iteration. """ for...
[ "def", "choose_trial_to_run", "(", "self", ",", "trial_runner", ")", ":", "for", "hyperband", "in", "self", ".", "_hyperbands", ":", "# band will have None entries if no resources", "# are to be allocated to that bracket.", "scrubbed", "=", "[", "b", "for", "b", "in", ...
Fair scheduling within iteration by completion percentage. List of trials not used since all trials are tracked as state of scheduler. If iteration is occupied (ie, no trials to run), then look into next iteration.
[ "Fair", "scheduling", "within", "iteration", "by", "completion", "percentage", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L217-L235
train
ray-project/ray
python/ray/tune/schedulers/hyperband.py
HyperBandScheduler.debug_string
def debug_string(self): """This provides a progress notification for the algorithm. For each bracket, the algorithm will output a string as follows: Bracket(Max Size (n)=5, Milestone (r)=33, completed=14.6%): {PENDING: 2, RUNNING: 3, TERMINATED: 2} "Max Size" indicates...
python
def debug_string(self): """This provides a progress notification for the algorithm. For each bracket, the algorithm will output a string as follows: Bracket(Max Size (n)=5, Milestone (r)=33, completed=14.6%): {PENDING: 2, RUNNING: 3, TERMINATED: 2} "Max Size" indicates...
[ "def", "debug_string", "(", "self", ")", ":", "out", "=", "\"Using HyperBand: \"", "out", "+=", "\"num_stopped={} total_brackets={}\"", ".", "format", "(", "self", ".", "_num_stopped", ",", "sum", "(", "len", "(", "band", ")", "for", "band", "in", "self", "....
This provides a progress notification for the algorithm. For each bracket, the algorithm will output a string as follows: Bracket(Max Size (n)=5, Milestone (r)=33, completed=14.6%): {PENDING: 2, RUNNING: 3, TERMINATED: 2} "Max Size" indicates the max number of pending/running ...
[ "This", "provides", "a", "progress", "notification", "for", "the", "algorithm", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L237-L261
train
ray-project/ray
python/ray/tune/schedulers/hyperband.py
Bracket.add_trial
def add_trial(self, trial): """Add trial to bracket assuming bracket is not filled. At a later iteration, a newly added trial will be given equal opportunity to catch up.""" assert not self.filled(), "Cannot add trial to filled bracket!" self._live_trials[trial] = None s...
python
def add_trial(self, trial): """Add trial to bracket assuming bracket is not filled. At a later iteration, a newly added trial will be given equal opportunity to catch up.""" assert not self.filled(), "Cannot add trial to filled bracket!" self._live_trials[trial] = None s...
[ "def", "add_trial", "(", "self", ",", "trial", ")", ":", "assert", "not", "self", ".", "filled", "(", ")", ",", "\"Cannot add trial to filled bracket!\"", "self", ".", "_live_trials", "[", "trial", "]", "=", "None", "self", ".", "_all_trials", ".", "append",...
Add trial to bracket assuming bracket is not filled. At a later iteration, a newly added trial will be given equal opportunity to catch up.
[ "Add", "trial", "to", "bracket", "assuming", "bracket", "is", "not", "filled", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L287-L294
train
ray-project/ray
python/ray/tune/schedulers/hyperband.py
Bracket.cur_iter_done
def cur_iter_done(self): """Checks if all iterations have completed. TODO(rliaw): also check that `t.iterations == self._r`""" return all( self._get_result_time(result) >= self._cumul_r for result in self._live_trials.values())
python
def cur_iter_done(self): """Checks if all iterations have completed. TODO(rliaw): also check that `t.iterations == self._r`""" return all( self._get_result_time(result) >= self._cumul_r for result in self._live_trials.values())
[ "def", "cur_iter_done", "(", "self", ")", ":", "return", "all", "(", "self", ".", "_get_result_time", "(", "result", ")", ">=", "self", ".", "_cumul_r", "for", "result", "in", "self", ".", "_live_trials", ".", "values", "(", ")", ")" ]
Checks if all iterations have completed. TODO(rliaw): also check that `t.iterations == self._r`
[ "Checks", "if", "all", "iterations", "have", "completed", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L296-L302
train
ray-project/ray
python/ray/tune/schedulers/hyperband.py
Bracket.update_trial_stats
def update_trial_stats(self, trial, result): """Update result for trial. Called after trial has finished an iteration - will decrement iteration count. TODO(rliaw): The other alternative is to keep the trials in and make sure they're not set as pending later.""" assert trial in...
python
def update_trial_stats(self, trial, result): """Update result for trial. Called after trial has finished an iteration - will decrement iteration count. TODO(rliaw): The other alternative is to keep the trials in and make sure they're not set as pending later.""" assert trial in...
[ "def", "update_trial_stats", "(", "self", ",", "trial", ",", "result", ")", ":", "assert", "trial", "in", "self", ".", "_live_trials", "assert", "self", ".", "_get_result_time", "(", "result", ")", ">=", "0", "delta", "=", "self", ".", "_get_result_time", ...
Update result for trial. Called after trial has finished an iteration - will decrement iteration count. TODO(rliaw): The other alternative is to keep the trials in and make sure they're not set as pending later.
[ "Update", "result", "for", "trial", ".", "Called", "after", "trial", "has", "finished", "an", "iteration", "-", "will", "decrement", "iteration", "count", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L340-L354
train
ray-project/ray
python/ray/tune/schedulers/hyperband.py
Bracket.cleanup_full
def cleanup_full(self, trial_runner): """Cleans up bracket after bracket is completely finished. Lets the last trial continue to run until termination condition kicks in.""" for trial in self.current_trials(): if (trial.status == Trial.PAUSED): trial_runner.s...
python
def cleanup_full(self, trial_runner): """Cleans up bracket after bracket is completely finished. Lets the last trial continue to run until termination condition kicks in.""" for trial in self.current_trials(): if (trial.status == Trial.PAUSED): trial_runner.s...
[ "def", "cleanup_full", "(", "self", ",", "trial_runner", ")", ":", "for", "trial", "in", "self", ".", "current_trials", "(", ")", ":", "if", "(", "trial", ".", "status", "==", "Trial", ".", "PAUSED", ")", ":", "trial_runner", ".", "stop_trial", "(", "t...
Cleans up bracket after bracket is completely finished. Lets the last trial continue to run until termination condition kicks in.
[ "Cleans", "up", "bracket", "after", "bracket", "is", "completely", "finished", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L366-L373
train
ray-project/ray
python/ray/experimental/state.py
parse_client_table
def parse_client_table(redis_client): """Read the client table. Args: redis_client: A client to the primary Redis shard. Returns: A list of information about the nodes in the cluster. """ NIL_CLIENT_ID = ray.ObjectID.nil().binary() message = redis_client.execute_command("RAY.TA...
python
def parse_client_table(redis_client): """Read the client table. Args: redis_client: A client to the primary Redis shard. Returns: A list of information about the nodes in the cluster. """ NIL_CLIENT_ID = ray.ObjectID.nil().binary() message = redis_client.execute_command("RAY.TA...
[ "def", "parse_client_table", "(", "redis_client", ")", ":", "NIL_CLIENT_ID", "=", "ray", ".", "ObjectID", ".", "nil", "(", ")", ".", "binary", "(", ")", "message", "=", "redis_client", ".", "execute_command", "(", "\"RAY.TABLE_LOOKUP\"", ",", "ray", ".", "gc...
Read the client table. Args: redis_client: A client to the primary Redis shard. Returns: A list of information about the nodes in the cluster.
[ "Read", "the", "client", "table", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L20-L86
train
ray-project/ray
python/ray/experimental/state.py
GlobalState._initialize_global_state
def _initialize_global_state(self, redis_address, redis_password=None, timeout=20): """Initialize the GlobalState object by connecting to Redis. It's possible that certain keys in Redis may not have been ...
python
def _initialize_global_state(self, redis_address, redis_password=None, timeout=20): """Initialize the GlobalState object by connecting to Redis. It's possible that certain keys in Redis may not have been ...
[ "def", "_initialize_global_state", "(", "self", ",", "redis_address", ",", "redis_password", "=", "None", ",", "timeout", "=", "20", ")", ":", "self", ".", "redis_client", "=", "services", ".", "create_redis_client", "(", "redis_address", ",", "redis_password", ...
Initialize the GlobalState object by connecting to Redis. It's possible that certain keys in Redis 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: redis_address: The Redis address to...
[ "Initialize", "the", "GlobalState", "object", "by", "connecting", "to", "Redis", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L128-L184
train
ray-project/ray
python/ray/experimental/state.py
GlobalState._execute_command
def _execute_command(self, key, *args): """Execute a Redis command on the appropriate Redis shard based on key. Args: key: The object ID or the task ID that the query is about. args: The command to run. Returns: The value returned by the Redis command. ...
python
def _execute_command(self, key, *args): """Execute a Redis command on the appropriate Redis shard based on key. Args: key: The object ID or the task ID that the query is about. args: The command to run. Returns: The value returned by the Redis command. ...
[ "def", "_execute_command", "(", "self", ",", "key", ",", "*", "args", ")", ":", "client", "=", "self", ".", "redis_clients", "[", "key", ".", "redis_shard_hash", "(", ")", "%", "len", "(", "self", ".", "redis_clients", ")", "]", "return", "client", "."...
Execute a Redis command on the appropriate Redis shard based on key. Args: key: The object ID or the task ID that the query is about. args: The command to run. Returns: The value returned by the Redis command.
[ "Execute", "a", "Redis", "command", "on", "the", "appropriate", "Redis", "shard", "based", "on", "key", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L186-L198
train
ray-project/ray
python/ray/experimental/state.py
GlobalState._keys
def _keys(self, pattern): """Execute the KEYS command on all Redis shards. Args: pattern: The KEYS pattern to query. Returns: The concatenated list of results from all shards. """ result = [] for client in self.redis_clients: result.e...
python
def _keys(self, pattern): """Execute the KEYS command on all Redis shards. Args: pattern: The KEYS pattern to query. Returns: The concatenated list of results from all shards. """ result = [] for client in self.redis_clients: result.e...
[ "def", "_keys", "(", "self", ",", "pattern", ")", ":", "result", "=", "[", "]", "for", "client", "in", "self", ".", "redis_clients", ":", "result", ".", "extend", "(", "list", "(", "client", ".", "scan_iter", "(", "match", "=", "pattern", ")", ")", ...
Execute the KEYS command on all Redis shards. Args: pattern: The KEYS pattern to query. Returns: The concatenated list of results from all shards.
[ "Execute", "the", "KEYS", "command", "on", "all", "Redis", "shards", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L200-L212
train
ray-project/ray
python/ray/experimental/state.py
GlobalState._object_table
def _object_table(self, object_id): """Fetch and parse the object table information for a single object ID. Args: object_id: An object ID to get information about. Returns: A dictionary with information about the object ID in question. """ # Allow the ar...
python
def _object_table(self, object_id): """Fetch and parse the object table information for a single object ID. Args: object_id: An object ID to get information about. Returns: A dictionary with information about the object ID in question. """ # Allow the ar...
[ "def", "_object_table", "(", "self", ",", "object_id", ")", ":", "# Allow the argument to be either an ObjectID or a hex string.", "if", "not", "isinstance", "(", "object_id", ",", "ray", ".", "ObjectID", ")", ":", "object_id", "=", "ray", ".", "ObjectID", "(", "h...
Fetch and parse the object table information for a single object ID. Args: object_id: An object ID to get information about. Returns: A dictionary with information about the object ID in question.
[ "Fetch", "and", "parse", "the", "object", "table", "information", "for", "a", "single", "object", "ID", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L214-L246
train
ray-project/ray
python/ray/experimental/state.py
GlobalState.object_table
def object_table(self, object_id=None): """Fetch and parse the object table info for one or more object IDs. Args: object_id: An object ID to fetch information about. If this is None, then the entire object table is fetched. Returns: Information from the...
python
def object_table(self, object_id=None): """Fetch and parse the object table info for one or more object IDs. Args: object_id: An object ID to fetch information about. If this is None, then the entire object table is fetched. Returns: Information from the...
[ "def", "object_table", "(", "self", ",", "object_id", "=", "None", ")", ":", "self", ".", "_check_connected", "(", ")", "if", "object_id", "is", "not", "None", ":", "# Return information about a single object ID.", "return", "self", ".", "_object_table", "(", "o...
Fetch and parse the object table info for one or more object IDs. Args: object_id: An object ID to fetch information about. If this is None, then the entire object table is fetched. Returns: Information from the object table.
[ "Fetch", "and", "parse", "the", "object", "table", "info", "for", "one", "or", "more", "object", "IDs", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L248-L275
train
ray-project/ray
python/ray/experimental/state.py
GlobalState._task_table
def _task_table(self, task_id): """Fetch and parse the task table information for a single task ID. Args: task_id: A task ID to get information about. Returns: A dictionary with information about the task ID in question. """ assert isinstance(task_id, ra...
python
def _task_table(self, task_id): """Fetch and parse the task table information for a single task ID. Args: task_id: A task ID to get information about. Returns: A dictionary with information about the task ID in question. """ assert isinstance(task_id, ra...
[ "def", "_task_table", "(", "self", ",", "task_id", ")", ":", "assert", "isinstance", "(", "task_id", ",", "ray", ".", "TaskID", ")", "message", "=", "self", ".", "_execute_command", "(", "task_id", ",", "\"RAY.TABLE_LOOKUP\"", ",", "ray", ".", "gcs_utils", ...
Fetch and parse the task table information for a single task ID. Args: task_id: A task ID to get information about. Returns: A dictionary with information about the task ID in question.
[ "Fetch", "and", "parse", "the", "task", "table", "information", "for", "a", "single", "task", "ID", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L277-L337
train
ray-project/ray
python/ray/experimental/state.py
GlobalState.task_table
def task_table(self, task_id=None): """Fetch and parse the task table information for one or more task IDs. Args: task_id: A hex string of the task ID to fetch information about. If this is None, then the task object table is fetched. Returns: Informatio...
python
def task_table(self, task_id=None): """Fetch and parse the task table information for one or more task IDs. Args: task_id: A hex string of the task ID to fetch information about. If this is None, then the task object table is fetched. Returns: Informatio...
[ "def", "task_table", "(", "self", ",", "task_id", "=", "None", ")", ":", "self", ".", "_check_connected", "(", ")", "if", "task_id", "is", "not", "None", ":", "task_id", "=", "ray", ".", "TaskID", "(", "hex_to_binary", "(", "task_id", ")", ")", "return...
Fetch and parse the task table information for one or more task IDs. Args: task_id: A hex string of the task ID to fetch information about. If this is None, then the task object table is fetched. Returns: Information from the task table.
[ "Fetch", "and", "parse", "the", "task", "table", "information", "for", "one", "or", "more", "task", "IDs", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L339-L365
train
ray-project/ray
python/ray/experimental/state.py
GlobalState.function_table
def function_table(self, function_id=None): """Fetch and parse the function table. Returns: A dictionary that maps function IDs to information about the function. """ self._check_connected() function_table_keys = self.redis_client.keys( ra...
python
def function_table(self, function_id=None): """Fetch and parse the function table. Returns: A dictionary that maps function IDs to information about the function. """ self._check_connected() function_table_keys = self.redis_client.keys( ra...
[ "def", "function_table", "(", "self", ",", "function_id", "=", "None", ")", ":", "self", ".", "_check_connected", "(", ")", "function_table_keys", "=", "self", ".", "redis_client", ".", "keys", "(", "ray", ".", "gcs_utils", ".", "FUNCTION_PREFIX", "+", "\"*\...
Fetch and parse the function table. Returns: A dictionary that maps function IDs to information about the function.
[ "Fetch", "and", "parse", "the", "function", "table", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L367-L386
train
ray-project/ray
python/ray/experimental/state.py
GlobalState._profile_table
def _profile_table(self, batch_id): """Get the profile events for a given batch of profile events. Args: batch_id: An identifier for a batch of profile events. Returns: A list of the profile events for the specified batch. """ # TODO(rkn): This method sh...
python
def _profile_table(self, batch_id): """Get the profile events for a given batch of profile events. Args: batch_id: An identifier for a batch of profile events. Returns: A list of the profile events for the specified batch. """ # TODO(rkn): This method sh...
[ "def", "_profile_table", "(", "self", ",", "batch_id", ")", ":", "# TODO(rkn): This method should support limiting the number of log", "# events and should also support returning a window of events.", "message", "=", "self", ".", "_execute_command", "(", "batch_id", ",", "\"RAY.T...
Get the profile events for a given batch of profile events. Args: batch_id: An identifier for a batch of profile events. Returns: A list of the profile events for the specified batch.
[ "Get", "the", "profile", "events", "for", "a", "given", "batch", "of", "profile", "events", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L398-L446
train
ray-project/ray
python/ray/experimental/state.py
GlobalState.chrome_tracing_dump
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...
python
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...
[ "def", "chrome_tracing_dump", "(", "self", ",", "filename", "=", "None", ")", ":", "# TODO(rkn): Support including the task specification data in the", "# timeline.", "# TODO(rkn): This should support viewing just a window of time or a", "# limited number of events.", "profile_table", ...
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", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L528-L596
train
ray-project/ray
python/ray/experimental/state.py
GlobalState.chrome_tracing_object_transfer_dump
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 ...
python
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 ...
[ "def", "chrome_tracing_object_transfer_dump", "(", "self", ",", "filename", "=", "None", ")", ":", "client_id_to_address", "=", "{", "}", "for", "client_info", "in", "ray", ".", "global_state", ".", "client_table", "(", ")", ":", "client_id_to_address", "[", "cl...
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", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L598-L687
train
ray-project/ray
python/ray/experimental/state.py
GlobalState.workers
def workers(self): """Get a dictionary mapping worker ID to worker information.""" worker_keys = self.redis_client.keys("Worker*") workers_data = {} for worker_key in worker_keys: worker_info = self.redis_client.hgetall(worker_key) worker_id = binary_to_hex(worke...
python
def workers(self): """Get a dictionary mapping worker ID to worker information.""" worker_keys = self.redis_client.keys("Worker*") workers_data = {} for worker_key in worker_keys: worker_info = self.redis_client.hgetall(worker_key) worker_id = binary_to_hex(worke...
[ "def", "workers", "(", "self", ")", ":", "worker_keys", "=", "self", ".", "redis_client", ".", "keys", "(", "\"Worker*\"", ")", "workers_data", "=", "{", "}", "for", "worker_key", "in", "worker_keys", ":", "worker_info", "=", "self", ".", "redis_client", "...
Get a dictionary mapping worker ID to worker information.
[ "Get", "a", "dictionary", "mapping", "worker", "ID", "to", "worker", "information", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L689-L709
train
ray-project/ray
python/ray/experimental/state.py
GlobalState.cluster_resources
def cluster_resources(self): """Get the current total cluster resources. Note that this information can grow stale as nodes are added to or removed from the cluster. Returns: A dictionary mapping resource name to the total quantity of that resource in the cl...
python
def cluster_resources(self): """Get the current total cluster resources. Note that this information can grow stale as nodes are added to or removed from the cluster. Returns: A dictionary mapping resource name to the total quantity of that resource in the cl...
[ "def", "cluster_resources", "(", "self", ")", ":", "resources", "=", "defaultdict", "(", "int", ")", "clients", "=", "self", ".", "client_table", "(", ")", "for", "client", "in", "clients", ":", "# Only count resources from live clients.", "if", "client", "[", ...
Get the current total cluster resources. Note that this information can grow stale as nodes are added to or removed from the cluster. Returns: A dictionary mapping resource name to the total quantity of that resource in the cluster.
[ "Get", "the", "current", "total", "cluster", "resources", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L747-L765
train
ray-project/ray
python/ray/experimental/state.py
GlobalState.available_resources
def available_resources(self): """Get the current available cluster resources. This is different from `cluster_resources` in that this will return idle (available) resources rather than total resources. Note that this information can grow stale as tasks start and finish. Retur...
python
def available_resources(self): """Get the current available cluster resources. This is different from `cluster_resources` in that this will return idle (available) resources rather than total resources. Note that this information can grow stale as tasks start and finish. Retur...
[ "def", "available_resources", "(", "self", ")", ":", "available_resources_by_id", "=", "{", "}", "subscribe_clients", "=", "[", "redis_client", ".", "pubsub", "(", "ignore_subscribe_messages", "=", "True", ")", "for", "redis_client", "in", "self", ".", "redis_clie...
Get the current available cluster resources. This is different from `cluster_resources` in that this will return idle (available) resources rather than total resources. Note that this information can grow stale as tasks start and finish. Returns: A dictionary mapping resou...
[ "Get", "the", "current", "available", "cluster", "resources", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L774-L841
train
ray-project/ray
python/ray/experimental/state.py
GlobalState._error_messages
def _error_messages(self, driver_id): """Get the error messages for a specific driver. Args: driver_id: The ID of the driver to get the errors for. Returns: A list of the error messages for this driver. """ assert isinstance(driver_id, ray.DriverID) ...
python
def _error_messages(self, driver_id): """Get the error messages for a specific driver. Args: driver_id: The ID of the driver to get the errors for. Returns: A list of the error messages for this driver. """ assert isinstance(driver_id, ray.DriverID) ...
[ "def", "_error_messages", "(", "self", ",", "driver_id", ")", ":", "assert", "isinstance", "(", "driver_id", ",", "ray", ".", "DriverID", ")", "message", "=", "self", ".", "redis_client", ".", "execute_command", "(", "\"RAY.TABLE_LOOKUP\"", ",", "ray", ".", ...
Get the error messages for a specific driver. Args: driver_id: The ID of the driver to get the errors for. Returns: A list of the error messages for this driver.
[ "Get", "the", "error", "messages", "for", "a", "specific", "driver", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L843-L874
train
ray-project/ray
python/ray/experimental/state.py
GlobalState.error_messages
def error_messages(self, driver_id=None): """Get the error messages for all drivers or a specific driver. Args: driver_id: The specific driver to get the errors for. If this is None, then this method retrieves the errors for all drivers. Returns: A dicti...
python
def error_messages(self, driver_id=None): """Get the error messages for all drivers or a specific driver. Args: driver_id: The specific driver to get the errors for. If this is None, then this method retrieves the errors for all drivers. Returns: A dicti...
[ "def", "error_messages", "(", "self", ",", "driver_id", "=", "None", ")", ":", "if", "driver_id", "is", "not", "None", ":", "assert", "isinstance", "(", "driver_id", ",", "ray", ".", "DriverID", ")", "return", "self", ".", "_error_messages", "(", "driver_i...
Get the error messages for all drivers or a specific driver. Args: driver_id: The specific driver to get the errors for. If this is None, then this method retrieves the errors for all drivers. Returns: A dictionary mapping driver ID to a list of the error messag...
[ "Get", "the", "error", "messages", "for", "all", "drivers", "or", "a", "specific", "driver", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L876-L902
train
ray-project/ray
python/ray/experimental/state.py
GlobalState.actor_checkpoint_info
def actor_checkpoint_info(self, actor_id): """Get checkpoint info for the given actor id. Args: actor_id: Actor's ID. Returns: A dictionary with information about the actor's checkpoint IDs and their timestamps. """ self._check_connected() ...
python
def actor_checkpoint_info(self, actor_id): """Get checkpoint info for the given actor id. Args: actor_id: Actor's ID. Returns: A dictionary with information about the actor's checkpoint IDs and their timestamps. """ self._check_connected() ...
[ "def", "actor_checkpoint_info", "(", "self", ",", "actor_id", ")", ":", "self", ".", "_check_connected", "(", ")", "message", "=", "self", ".", "_execute_command", "(", "actor_id", ",", "\"RAY.TABLE_LOOKUP\"", ",", "ray", ".", "gcs_utils", ".", "TablePrefix", ...
Get checkpoint info for the given actor id. Args: actor_id: Actor's ID. Returns: A dictionary with information about the actor's checkpoint IDs and their timestamps.
[ "Get", "checkpoint", "info", "for", "the", "given", "actor", "id", ".", "Args", ":", "actor_id", ":", "Actor", "s", "ID", ".", "Returns", ":", "A", "dictionary", "with", "information", "about", "the", "actor", "s", "checkpoint", "IDs", "and", "their", "t...
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L904-L941
train
ray-project/ray
python/ray/experimental/tf_utils.py
TensorFlowVariables.get_flat_size
def get_flat_size(self): """Returns the total length of all of the flattened variables. Returns: The length of all flattened variables concatenated. """ return sum( np.prod(v.get_shape().as_list()) for v in self.variables.values())
python
def get_flat_size(self): """Returns the total length of all of the flattened variables. Returns: The length of all flattened variables concatenated. """ return sum( np.prod(v.get_shape().as_list()) for v in self.variables.values())
[ "def", "get_flat_size", "(", "self", ")", ":", "return", "sum", "(", "np", ".", "prod", "(", "v", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", ")", "for", "v", "in", "self", ".", "variables", ".", "values", "(", ")", ")" ]
Returns the total length of all of the flattened variables. Returns: The length of all flattened variables concatenated.
[ "Returns", "the", "total", "length", "of", "all", "of", "the", "flattened", "variables", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/tf_utils.py#L111-L118
train
ray-project/ray
python/ray/experimental/tf_utils.py
TensorFlowVariables.get_flat
def get_flat(self): """Gets the weights and returns them as a flat array. Returns: 1D Array containing the flattened weights. """ self._check_sess() return np.concatenate([ v.eval(session=self.sess).flatten() for v in self.variables.values() ...
python
def get_flat(self): """Gets the weights and returns them as a flat array. Returns: 1D Array containing the flattened weights. """ self._check_sess() return np.concatenate([ v.eval(session=self.sess).flatten() for v in self.variables.values() ...
[ "def", "get_flat", "(", "self", ")", ":", "self", ".", "_check_sess", "(", ")", "return", "np", ".", "concatenate", "(", "[", "v", ".", "eval", "(", "session", "=", "self", ".", "sess", ")", ".", "flatten", "(", ")", "for", "v", "in", "self", "."...
Gets the weights and returns them as a flat array. Returns: 1D Array containing the flattened weights.
[ "Gets", "the", "weights", "and", "returns", "them", "as", "a", "flat", "array", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/tf_utils.py#L127-L137
train
ray-project/ray
python/ray/experimental/tf_utils.py
TensorFlowVariables.set_flat
def set_flat(self, new_weights): """Sets the weights to new_weights, converting from a flat array. Note: You can only set all weights in the network using this function, i.e., the length of the array must match get_flat_size. Args: new_weights (np.ndarray): ...
python
def set_flat(self, new_weights): """Sets the weights to new_weights, converting from a flat array. Note: You can only set all weights in the network using this function, i.e., the length of the array must match get_flat_size. Args: new_weights (np.ndarray): ...
[ "def", "set_flat", "(", "self", ",", "new_weights", ")", ":", "self", ".", "_check_sess", "(", ")", "shapes", "=", "[", "v", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "for", "v", "in", "self", ".", "variables", ".", "values", "(", ")", ...
Sets the weights to new_weights, converting from a flat array. Note: You can only set all weights in the network using this function, i.e., the length of the array must match get_flat_size. Args: new_weights (np.ndarray): Flat array containing weights.
[ "Sets", "the", "weights", "to", "new_weights", "converting", "from", "a", "flat", "array", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/tf_utils.py#L139-L157
train
ray-project/ray
python/ray/experimental/tf_utils.py
TensorFlowVariables.get_weights
def get_weights(self): """Returns a dictionary containing the weights of the network. Returns: Dictionary mapping variable names to their weights. """ self._check_sess() return { k: v.eval(session=self.sess) for k, v in self.variables.items() ...
python
def get_weights(self): """Returns a dictionary containing the weights of the network. Returns: Dictionary mapping variable names to their weights. """ self._check_sess() return { k: v.eval(session=self.sess) for k, v in self.variables.items() ...
[ "def", "get_weights", "(", "self", ")", ":", "self", ".", "_check_sess", "(", ")", "return", "{", "k", ":", "v", ".", "eval", "(", "session", "=", "self", ".", "sess", ")", "for", "k", ",", "v", "in", "self", ".", "variables", ".", "items", "(", ...
Returns a dictionary containing the weights of the network. Returns: Dictionary mapping variable names to their weights.
[ "Returns", "a", "dictionary", "containing", "the", "weights", "of", "the", "network", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/tf_utils.py#L159-L169
train
ray-project/ray
python/ray/experimental/tf_utils.py
TensorFlowVariables.set_weights
def set_weights(self, new_weights): """Sets the weights to new_weights. Note: Can set subsets of variables as well, by only passing in the variables you want to be set. Args: new_weights (Dict): Dictionary mapping variable names to their weig...
python
def set_weights(self, new_weights): """Sets the weights to new_weights. Note: Can set subsets of variables as well, by only passing in the variables you want to be set. Args: new_weights (Dict): Dictionary mapping variable names to their weig...
[ "def", "set_weights", "(", "self", ",", "new_weights", ")", ":", "self", ".", "_check_sess", "(", ")", "assign_list", "=", "[", "self", ".", "assignment_nodes", "[", "name", "]", "for", "name", "in", "new_weights", ".", "keys", "(", ")", "if", "name", ...
Sets the weights to new_weights. Note: Can set subsets of variables as well, by only passing in the variables you want to be set. Args: new_weights (Dict): Dictionary mapping variable names to their weights.
[ "Sets", "the", "weights", "to", "new_weights", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/tf_utils.py#L171-L198
train
ray-project/ray
python/ray/gcs_utils.py
construct_error_message
def construct_error_message(driver_id, error_type, message, timestamp): """Construct a serialized ErrorTableData object. Args: driver_id: The ID of the driver that the error should go to. If this is nil, then the error will go to all drivers. error_type: The type of the error. ...
python
def construct_error_message(driver_id, error_type, message, timestamp): """Construct a serialized ErrorTableData object. Args: driver_id: The ID of the driver that the error should go to. If this is nil, then the error will go to all drivers. error_type: The type of the error. ...
[ "def", "construct_error_message", "(", "driver_id", ",", "error_type", ",", "message", ",", "timestamp", ")", ":", "builder", "=", "flatbuffers", ".", "Builder", "(", "0", ")", "driver_offset", "=", "builder", ".", "CreateString", "(", "driver_id", ".", "binar...
Construct a serialized ErrorTableData object. Args: driver_id: The ID of the driver that the error should go to. If this is nil, then the error will go to all drivers. error_type: The type of the error. message: The error message. timestamp: The time of the error. R...
[ "Construct", "a", "serialized", "ErrorTableData", "object", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/gcs_utils.py#L60-L91
train
ray-project/ray
python/ray/experimental/async_api.py
init
def init(): """ Initialize synchronously. """ loop = asyncio.get_event_loop() if loop.is_running(): raise Exception("You must initialize the Ray async API by calling " "async_api.init() or async_api.as_future(obj) before " "the event loop start...
python
def init(): """ Initialize synchronously. """ loop = asyncio.get_event_loop() if loop.is_running(): raise Exception("You must initialize the Ray async API by calling " "async_api.init() or async_api.as_future(obj) before " "the event loop start...
[ "def", "init", "(", ")", ":", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "if", "loop", ".", "is_running", "(", ")", ":", "raise", "Exception", "(", "\"You must initialize the Ray async API by calling \"", "\"async_api.init() or async_api.as_future(obj) bef...
Initialize synchronously.
[ "Initialize", "synchronously", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/async_api.py#L24-L34
train
ray-project/ray
python/ray/experimental/async_api.py
shutdown
def shutdown(): """Manually shutdown the async API. Cancels all related tasks and all the socket transportation. """ global handler, transport, protocol if handler is not None: handler.close() transport.close() handler = None transport = None protocol = None
python
def shutdown(): """Manually shutdown the async API. Cancels all related tasks and all the socket transportation. """ global handler, transport, protocol if handler is not None: handler.close() transport.close() handler = None transport = None protocol = None
[ "def", "shutdown", "(", ")", ":", "global", "handler", ",", "transport", ",", "protocol", "if", "handler", "is", "not", "None", ":", "handler", ".", "close", "(", ")", "transport", ".", "close", "(", ")", "handler", "=", "None", "transport", "=", "None...
Manually shutdown the async API. Cancels all related tasks and all the socket transportation.
[ "Manually", "shutdown", "the", "async", "API", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/async_api.py#L51-L62
train
ray-project/ray
python/ray/experimental/features.py
flush_redis_unsafe
def flush_redis_unsafe(redis_client=None): """This removes some non-critical state from the primary Redis shard. This removes the log files as well as the event log from Redis. This can be used to try to address out-of-memory errors caused by the accumulation of metadata in Redis. However, it will only...
python
def flush_redis_unsafe(redis_client=None): """This removes some non-critical state from the primary Redis shard. This removes the log files as well as the event log from Redis. This can be used to try to address out-of-memory errors caused by the accumulation of metadata in Redis. However, it will only...
[ "def", "flush_redis_unsafe", "(", "redis_client", "=", "None", ")", ":", "if", "redis_client", "is", "None", ":", "ray", ".", "worker", ".", "global_worker", ".", "check_connected", "(", ")", "redis_client", "=", "ray", ".", "worker", ".", "global_worker", "...
This removes some non-critical state from the primary Redis shard. This removes the log files as well as the event log from Redis. This can be used to try to address out-of-memory errors caused by the accumulation of metadata in Redis. However, it will only partially address the issue as much of the da...
[ "This", "removes", "some", "non", "-", "critical", "state", "from", "the", "primary", "Redis", "shard", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/features.py#L13-L44
train
ray-project/ray
python/ray/experimental/features.py
flush_task_and_object_metadata_unsafe
def flush_task_and_object_metadata_unsafe(): """This removes some critical state from the Redis shards. In a multitenant environment, this will flush metadata for all jobs, which may be undesirable. This removes all of the object and task metadata. This can be used to try to address out-of-memory ...
python
def flush_task_and_object_metadata_unsafe(): """This removes some critical state from the Redis shards. In a multitenant environment, this will flush metadata for all jobs, which may be undesirable. This removes all of the object and task metadata. This can be used to try to address out-of-memory ...
[ "def", "flush_task_and_object_metadata_unsafe", "(", ")", ":", "ray", ".", "worker", ".", "global_worker", ".", "check_connected", "(", ")", "def", "flush_shard", "(", "redis_client", ")", ":", "# Flush the task table. Note that this also flushes the driver tasks", "# which...
This removes some critical state from the Redis shards. In a multitenant environment, this will flush metadata for all jobs, which may be undesirable. This removes all of the object and task metadata. This can be used to try to address out-of-memory errors caused by the accumulation of metadata in ...
[ "This", "removes", "some", "critical", "state", "from", "the", "Redis", "shards", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/features.py#L47-L84
train
ray-project/ray
python/ray/experimental/features.py
flush_finished_tasks_unsafe
def flush_finished_tasks_unsafe(): """This removes some critical state from the Redis shards. In a multitenant environment, this will flush metadata for all jobs, which may be undesirable. This removes all of the metadata for finished tasks. This can be used to try to address out-of-memory errors ...
python
def flush_finished_tasks_unsafe(): """This removes some critical state from the Redis shards. In a multitenant environment, this will flush metadata for all jobs, which may be undesirable. This removes all of the metadata for finished tasks. This can be used to try to address out-of-memory errors ...
[ "def", "flush_finished_tasks_unsafe", "(", ")", ":", "ray", ".", "worker", ".", "global_worker", ".", "check_connected", "(", ")", "for", "shard_index", "in", "range", "(", "len", "(", "ray", ".", "global_state", ".", "redis_clients", ")", ")", ":", "_flush_...
This removes some critical state from the Redis shards. In a multitenant environment, this will flush metadata for all jobs, which may be undesirable. This removes all of the metadata for finished tasks. This can be used to try to address out-of-memory errors caused by the accumulation of metadata ...
[ "This", "removes", "some", "critical", "state", "from", "the", "Redis", "shards", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/features.py#L155-L169
train
ray-project/ray
python/ray/experimental/features.py
flush_evicted_objects_unsafe
def flush_evicted_objects_unsafe(): """This removes some critical state from the Redis shards. In a multitenant environment, this will flush metadata for all jobs, which may be undesirable. This removes all of the metadata for objects that have been evicted. This can be used to try to address out-...
python
def flush_evicted_objects_unsafe(): """This removes some critical state from the Redis shards. In a multitenant environment, this will flush metadata for all jobs, which may be undesirable. This removes all of the metadata for objects that have been evicted. This can be used to try to address out-...
[ "def", "flush_evicted_objects_unsafe", "(", ")", ":", "ray", ".", "worker", ".", "global_worker", ".", "check_connected", "(", ")", "for", "shard_index", "in", "range", "(", "len", "(", "ray", ".", "global_state", ".", "redis_clients", ")", ")", ":", "_flush...
This removes some critical state from the Redis shards. In a multitenant environment, this will flush metadata for all jobs, which may be undesirable. This removes all of the metadata for objects that have been evicted. This can be used to try to address out-of-memory errors caused by the accumula...
[ "This", "removes", "some", "critical", "state", "from", "the", "Redis", "shards", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/features.py#L172-L186
train
ray-project/ray
python/ray/rllib/agents/ppo/ppo_policy_graph.py
PPOPolicyGraph.copy
def copy(self, existing_inputs): """Creates a copy of self using existing input placeholders.""" return PPOPolicyGraph( self.observation_space, self.action_space, self.config, existing_inputs=existing_inputs)
python
def copy(self, existing_inputs): """Creates a copy of self using existing input placeholders.""" return PPOPolicyGraph( self.observation_space, self.action_space, self.config, existing_inputs=existing_inputs)
[ "def", "copy", "(", "self", ",", "existing_inputs", ")", ":", "return", "PPOPolicyGraph", "(", "self", ".", "observation_space", ",", "self", ".", "action_space", ",", "self", ".", "config", ",", "existing_inputs", "=", "existing_inputs", ")" ]
Creates a copy of self using existing input placeholders.
[ "Creates", "a", "copy", "of", "self", "using", "existing", "input", "placeholders", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/agents/ppo/ppo_policy_graph.py#L318-L324
train
ray-project/ray
examples/parameter_server/model.py
deepnn
def deepnn(x): """deepnn builds the graph for a deep net for classifying digits. Args: x: an input tensor with the dimensions (N_examples, 784), where 784 is the number of pixels in a standard MNIST image. Returns: A tuple (y, keep_prob). y is a tensor of shape (N_examples, 10)...
python
def deepnn(x): """deepnn builds the graph for a deep net for classifying digits. Args: x: an input tensor with the dimensions (N_examples, 784), where 784 is the number of pixels in a standard MNIST image. Returns: A tuple (y, keep_prob). y is a tensor of shape (N_examples, 10)...
[ "def", "deepnn", "(", "x", ")", ":", "# Reshape to use within a convolutional neural net.", "# Last dimension is for \"features\" - there is only one here, since images", "# are grayscale -- it would be 3 for an RGB image, 4 for RGBA, etc.", "with", "tf", ".", "name_scope", "(", "\"resha...
deepnn builds the graph for a deep net for classifying digits. Args: x: an input tensor with the dimensions (N_examples, 784), where 784 is the number of pixels in a standard MNIST image. Returns: A tuple (y, keep_prob). y is a tensor of shape (N_examples, 10), with val...
[ "deepnn", "builds", "the", "graph", "for", "a", "deep", "net", "for", "classifying", "digits", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/examples/parameter_server/model.py#L120-L180
train
ray-project/ray
python/ray/signature.py
get_signature_params
def get_signature_params(func): """Get signature parameters Support Cython functions by grabbing relevant attributes from the Cython function and attaching to a no-op function. This is somewhat brittle, since funcsigs may change, but given that funcsigs is written to a PEP, we hope it is relatively...
python
def get_signature_params(func): """Get signature parameters Support Cython functions by grabbing relevant attributes from the Cython function and attaching to a no-op function. This is somewhat brittle, since funcsigs may change, but given that funcsigs is written to a PEP, we hope it is relatively...
[ "def", "get_signature_params", "(", "func", ")", ":", "# The first condition for Cython functions, the latter for Cython instance", "# methods", "if", "is_cython", "(", "func", ")", ":", "attrs", "=", "[", "\"__code__\"", ",", "\"__annotations__\"", ",", "\"__defaults__\"",...
Get signature parameters Support Cython functions by grabbing relevant attributes from the Cython function and attaching to a no-op function. This is somewhat brittle, since funcsigs may change, but given that funcsigs is written to a PEP, we hope it is relatively stable. Future versions of Python may ...
[ "Get", "signature", "parameters" ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/signature.py#L39-L75
train
ray-project/ray
python/ray/signature.py
check_signature_supported
def check_signature_supported(func, warn=False): """Check if we support the signature of this function. We currently do not allow remote functions to have **kwargs. We also do not support keyword arguments in conjunction with a *args argument. Args: func: The function whose signature should be...
python
def check_signature_supported(func, warn=False): """Check if we support the signature of this function. We currently do not allow remote functions to have **kwargs. We also do not support keyword arguments in conjunction with a *args argument. Args: func: The function whose signature should be...
[ "def", "check_signature_supported", "(", "func", ",", "warn", "=", "False", ")", ":", "function_name", "=", "func", ".", "__name__", "sig_params", "=", "get_signature_params", "(", "func", ")", "has_kwargs_param", "=", "False", "has_kwonly_param", "=", "False", ...
Check if we support the signature of this function. We currently do not allow remote functions to have **kwargs. We also do not support keyword arguments in conjunction with a *args argument. Args: func: The function whose signature should be checked. warn: If this is true, a warning will ...
[ "Check", "if", "we", "support", "the", "signature", "of", "this", "function", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/signature.py#L78-L119
train
ray-project/ray
python/ray/signature.py
extract_signature
def extract_signature(func, ignore_first=False): """Extract the function signature from the function. Args: func: The function whose signature should be extracted. ignore_first: True if the first argument should be ignored. This should be used when func is a method of a class. ...
python
def extract_signature(func, ignore_first=False): """Extract the function signature from the function. Args: func: The function whose signature should be extracted. ignore_first: True if the first argument should be ignored. This should be used when func is a method of a class. ...
[ "def", "extract_signature", "(", "func", ",", "ignore_first", "=", "False", ")", ":", "sig_params", "=", "get_signature_params", "(", "func", ")", "if", "ignore_first", ":", "if", "len", "(", "sig_params", ")", "==", "0", ":", "raise", "Exception", "(", "\...
Extract the function signature from the function. Args: func: The function whose signature should be extracted. ignore_first: True if the first argument should be ignored. This should be used when func is a method of a class. Returns: A function signature object, which incl...
[ "Extract", "the", "function", "signature", "from", "the", "function", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/signature.py#L122-L157
train
ray-project/ray
python/ray/signature.py
extend_args
def extend_args(function_signature, args, kwargs): """Extend the arguments that were passed into a function. This extends the arguments that were passed into a function with the default arguments provided in the function definition. Args: function_signature: The function signature of the funct...
python
def extend_args(function_signature, args, kwargs): """Extend the arguments that were passed into a function. This extends the arguments that were passed into a function with the default arguments provided in the function definition. Args: function_signature: The function signature of the funct...
[ "def", "extend_args", "(", "function_signature", ",", "args", ",", "kwargs", ")", ":", "arg_names", "=", "function_signature", ".", "arg_names", "arg_defaults", "=", "function_signature", ".", "arg_defaults", "arg_is_positionals", "=", "function_signature", ".", "arg_...
Extend the arguments that were passed into a function. This extends the arguments that were passed into a function with the default arguments provided in the function definition. Args: function_signature: The function signature of the function being called. args: The non-keywor...
[ "Extend", "the", "arguments", "that", "were", "passed", "into", "a", "function", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/signature.py#L160-L222
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
wait_for_crm_operation
def wait_for_crm_operation(operation): """Poll for cloud resource manager operation until finished.""" logger.info("wait_for_crm_operation: " "Waiting for operation {} to finish...".format(operation)) for _ in range(MAX_POLLS): result = crm.operations().get(name=operation["name"]).e...
python
def wait_for_crm_operation(operation): """Poll for cloud resource manager operation until finished.""" logger.info("wait_for_crm_operation: " "Waiting for operation {} to finish...".format(operation)) for _ in range(MAX_POLLS): result = crm.operations().get(name=operation["name"]).e...
[ "def", "wait_for_crm_operation", "(", "operation", ")", ":", "logger", ".", "info", "(", "\"wait_for_crm_operation: \"", "\"Waiting for operation {} to finish...\"", ".", "format", "(", "operation", ")", ")", "for", "_", "in", "range", "(", "MAX_POLLS", ")", ":", ...
Poll for cloud resource manager operation until finished.
[ "Poll", "for", "cloud", "resource", "manager", "operation", "until", "finished", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L36-L52
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
wait_for_compute_global_operation
def wait_for_compute_global_operation(project_name, operation): """Poll for global compute operation until finished.""" logger.info("wait_for_compute_global_operation: " "Waiting for operation {} to finish...".format( operation["name"])) for _ in range(MAX_POLLS): ...
python
def wait_for_compute_global_operation(project_name, operation): """Poll for global compute operation until finished.""" logger.info("wait_for_compute_global_operation: " "Waiting for operation {} to finish...".format( operation["name"])) for _ in range(MAX_POLLS): ...
[ "def", "wait_for_compute_global_operation", "(", "project_name", ",", "operation", ")", ":", "logger", ".", "info", "(", "\"wait_for_compute_global_operation: \"", "\"Waiting for operation {} to finish...\"", ".", "format", "(", "operation", "[", "\"name\"", "]", ")", ")"...
Poll for global compute operation until finished.
[ "Poll", "for", "global", "compute", "operation", "until", "finished", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L55-L76
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
key_pair_name
def key_pair_name(i, region, project_id, ssh_user): """Returns the ith default gcp_key_pair_name.""" key_name = "{}_gcp_{}_{}_{}".format(RAY, region, project_id, ssh_user, i) return key_name
python
def key_pair_name(i, region, project_id, ssh_user): """Returns the ith default gcp_key_pair_name.""" key_name = "{}_gcp_{}_{}_{}".format(RAY, region, project_id, ssh_user, i) return key_name
[ "def", "key_pair_name", "(", "i", ",", "region", ",", "project_id", ",", "ssh_user", ")", ":", "key_name", "=", "\"{}_gcp_{}_{}_{}\"", ".", "format", "(", "RAY", ",", "region", ",", "project_id", ",", "ssh_user", ",", "i", ")", "return", "key_name" ]
Returns the ith default gcp_key_pair_name.
[ "Returns", "the", "ith", "default", "gcp_key_pair_name", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L79-L82
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
key_pair_paths
def key_pair_paths(key_name): """Returns public and private key paths for a given key_name.""" public_key_path = os.path.expanduser("~/.ssh/{}.pub".format(key_name)) private_key_path = os.path.expanduser("~/.ssh/{}.pem".format(key_name)) return public_key_path, private_key_path
python
def key_pair_paths(key_name): """Returns public and private key paths for a given key_name.""" public_key_path = os.path.expanduser("~/.ssh/{}.pub".format(key_name)) private_key_path = os.path.expanduser("~/.ssh/{}.pem".format(key_name)) return public_key_path, private_key_path
[ "def", "key_pair_paths", "(", "key_name", ")", ":", "public_key_path", "=", "os", ".", "path", ".", "expanduser", "(", "\"~/.ssh/{}.pub\"", ".", "format", "(", "key_name", ")", ")", "private_key_path", "=", "os", ".", "path", ".", "expanduser", "(", "\"~/.ss...
Returns public and private key paths for a given key_name.
[ "Returns", "public", "and", "private", "key", "paths", "for", "a", "given", "key_name", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L85-L89
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
generate_rsa_key_pair
def generate_rsa_key_pair(): """Create public and private ssh-keys.""" key = rsa.generate_private_key( backend=default_backend(), public_exponent=65537, key_size=2048) public_key = key.public_key().public_bytes( serialization.Encoding.OpenSSH, serialization.PublicFormat.OpenSSH).de...
python
def generate_rsa_key_pair(): """Create public and private ssh-keys.""" key = rsa.generate_private_key( backend=default_backend(), public_exponent=65537, key_size=2048) public_key = key.public_key().public_bytes( serialization.Encoding.OpenSSH, serialization.PublicFormat.OpenSSH).de...
[ "def", "generate_rsa_key_pair", "(", ")", ":", "key", "=", "rsa", ".", "generate_private_key", "(", "backend", "=", "default_backend", "(", ")", ",", "public_exponent", "=", "65537", ",", "key_size", "=", "2048", ")", "public_key", "=", "key", ".", "public_k...
Create public and private ssh-keys.
[ "Create", "public", "and", "private", "ssh", "-", "keys", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L92-L107
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
_configure_project
def _configure_project(config): """Setup a Google Cloud Platform Project. Google Compute Platform organizes all the resources, such as storage buckets, users, and instances under projects. This is different from aws ec2 where everything is global. """ project_id = config["provider"].get("projec...
python
def _configure_project(config): """Setup a Google Cloud Platform Project. Google Compute Platform organizes all the resources, such as storage buckets, users, and instances under projects. This is different from aws ec2 where everything is global. """ project_id = config["provider"].get("projec...
[ "def", "_configure_project", "(", "config", ")", ":", "project_id", "=", "config", "[", "\"provider\"", "]", ".", "get", "(", "\"project_id\"", ")", "assert", "config", "[", "\"provider\"", "]", "[", "\"project_id\"", "]", "is", "not", "None", ",", "(", "\...
Setup a Google Cloud Platform Project. Google Compute Platform organizes all the resources, such as storage buckets, users, and instances under projects. This is different from aws ec2 where everything is global.
[ "Setup", "a", "Google", "Cloud", "Platform", "Project", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L119-L144
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
_configure_iam_role
def _configure_iam_role(config): """Setup a gcp service account with IAM roles. Creates a gcp service acconut and binds IAM roles which allow it to control control storage/compute services. Specifically, the head node needs to have an IAM role that allows it to create further gce instances and store it...
python
def _configure_iam_role(config): """Setup a gcp service account with IAM roles. Creates a gcp service acconut and binds IAM roles which allow it to control control storage/compute services. Specifically, the head node needs to have an IAM role that allows it to create further gce instances and store it...
[ "def", "_configure_iam_role", "(", "config", ")", ":", "email", "=", "SERVICE_ACCOUNT_EMAIL_TEMPLATE", ".", "format", "(", "account_id", "=", "DEFAULT_SERVICE_ACCOUNT_ID", ",", "project_id", "=", "config", "[", "\"provider\"", "]", "[", "\"project_id\"", "]", ")", ...
Setup a gcp service account with IAM roles. Creates a gcp service acconut and binds IAM roles which allow it to control control storage/compute services. Specifically, the head node needs to have an IAM role that allows it to create further gce instances and store items in google cloud storage. TO...
[ "Setup", "a", "gcp", "service", "account", "with", "IAM", "roles", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L147-L183
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
_configure_key_pair
def _configure_key_pair(config): """Configure SSH access, using an existing key pair if possible. Creates a project-wide ssh key that can be used to access all the instances unless explicitly prohibited by instance config. The ssh-keys created by ray are of format: [USERNAME]:ssh-rsa [KEY_VALUE...
python
def _configure_key_pair(config): """Configure SSH access, using an existing key pair if possible. Creates a project-wide ssh key that can be used to access all the instances unless explicitly prohibited by instance config. The ssh-keys created by ray are of format: [USERNAME]:ssh-rsa [KEY_VALUE...
[ "def", "_configure_key_pair", "(", "config", ")", ":", "if", "\"ssh_private_key\"", "in", "config", "[", "\"auth\"", "]", ":", "return", "config", "ssh_user", "=", "config", "[", "\"auth\"", "]", "[", "\"ssh_user\"", "]", "project", "=", "compute", ".", "pro...
Configure SSH access, using an existing key pair if possible. Creates a project-wide ssh key that can be used to access all the instances unless explicitly prohibited by instance config. The ssh-keys created by ray are of format: [USERNAME]:ssh-rsa [KEY_VALUE] [USERNAME] where: [USERNAM...
[ "Configure", "SSH", "access", "using", "an", "existing", "key", "pair", "if", "possible", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L186-L269
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
_configure_subnet
def _configure_subnet(config): """Pick a reasonable subnet if not specified by the config.""" # Rationale: avoid subnet lookup if the network is already # completely manually configured if ("networkInterfaces" in config["head_node"] and "networkInterfaces" in config["worker_nodes"]): ...
python
def _configure_subnet(config): """Pick a reasonable subnet if not specified by the config.""" # Rationale: avoid subnet lookup if the network is already # completely manually configured if ("networkInterfaces" in config["head_node"] and "networkInterfaces" in config["worker_nodes"]): ...
[ "def", "_configure_subnet", "(", "config", ")", ":", "# Rationale: avoid subnet lookup if the network is already", "# completely manually configured", "if", "(", "\"networkInterfaces\"", "in", "config", "[", "\"head_node\"", "]", "and", "\"networkInterfaces\"", "in", "config", ...
Pick a reasonable subnet if not specified by the config.
[ "Pick", "a", "reasonable", "subnet", "if", "not", "specified", "by", "the", "config", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L272-L309
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
_add_iam_policy_binding
def _add_iam_policy_binding(service_account, roles): """Add new IAM roles for the service account.""" project_id = service_account["projectId"] email = service_account["email"] member_id = "serviceAccount:" + email policy = crm.projects().getIamPolicy(resource=project_id).execute() already_con...
python
def _add_iam_policy_binding(service_account, roles): """Add new IAM roles for the service account.""" project_id = service_account["projectId"] email = service_account["email"] member_id = "serviceAccount:" + email policy = crm.projects().getIamPolicy(resource=project_id).execute() already_con...
[ "def", "_add_iam_policy_binding", "(", "service_account", ",", "roles", ")", ":", "project_id", "=", "service_account", "[", "\"projectId\"", "]", "email", "=", "service_account", "[", "\"email\"", "]", "member_id", "=", "\"serviceAccount:\"", "+", "email", "policy"...
Add new IAM roles for the service account.
[ "Add", "new", "IAM", "roles", "for", "the", "service", "account", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L380-L416
train
ray-project/ray
python/ray/autoscaler/gcp/config.py
_create_project_ssh_key_pair
def _create_project_ssh_key_pair(project, public_key, ssh_user): """Inserts an ssh-key into project commonInstanceMetadata""" key_parts = public_key.split(" ") # Sanity checks to make sure that the generated key matches expectation assert len(key_parts) == 2, key_parts assert key_parts[0] == "ssh-...
python
def _create_project_ssh_key_pair(project, public_key, ssh_user): """Inserts an ssh-key into project commonInstanceMetadata""" key_parts = public_key.split(" ") # Sanity checks to make sure that the generated key matches expectation assert len(key_parts) == 2, key_parts assert key_parts[0] == "ssh-...
[ "def", "_create_project_ssh_key_pair", "(", "project", ",", "public_key", ",", "ssh_user", ")", ":", "key_parts", "=", "public_key", ".", "split", "(", "\" \"", ")", "# Sanity checks to make sure that the generated key matches expectation", "assert", "len", "(", "key_part...
Inserts an ssh-key into project commonInstanceMetadata
[ "Inserts", "an", "ssh", "-", "key", "into", "project", "commonInstanceMetadata" ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/gcp/config.py#L419-L451
train
ray-project/ray
python/ray/remote_function.py
RemoteFunction._remote
def _remote(self, args=None, kwargs=None, num_return_vals=None, num_cpus=None, num_gpus=None, resources=None): """An experimental alternate way to submit remote functions.""" worker = ray.worker.get_global_wo...
python
def _remote(self, args=None, kwargs=None, num_return_vals=None, num_cpus=None, num_gpus=None, resources=None): """An experimental alternate way to submit remote functions.""" worker = ray.worker.get_global_wo...
[ "def", "_remote", "(", "self", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "num_return_vals", "=", "None", ",", "num_cpus", "=", "None", ",", "num_gpus", "=", "None", ",", "resources", "=", "None", ")", ":", "worker", "=", "ray", ".", ...
An experimental alternate way to submit remote functions.
[ "An", "experimental", "alternate", "way", "to", "submit", "remote", "functions", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/remote_function.py#L92-L135
train
ray-project/ray
python/ray/experimental/async_plasma.py
PlasmaObjectLinkedList.append
def append(self, future): """Append an object to the linked list. Args: future (PlasmaObjectFuture): A PlasmaObjectFuture instance. """ future.prev = self.tail if self.tail is None: assert self.head is None self.head = future else: ...
python
def append(self, future): """Append an object to the linked list. Args: future (PlasmaObjectFuture): A PlasmaObjectFuture instance. """ future.prev = self.tail if self.tail is None: assert self.head is None self.head = future else: ...
[ "def", "append", "(", "self", ",", "future", ")", ":", "future", ".", "prev", "=", "self", ".", "tail", "if", "self", ".", "tail", "is", "None", ":", "assert", "self", ".", "head", "is", "None", "self", ".", "head", "=", "future", "else", ":", "s...
Append an object to the linked list. Args: future (PlasmaObjectFuture): A PlasmaObjectFuture instance.
[ "Append", "an", "object", "to", "the", "linked", "list", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/async_plasma.py#L97-L111
train
ray-project/ray
python/ray/experimental/async_plasma.py
PlasmaObjectLinkedList.remove
def remove(self, future): """Remove an object from the linked list. Args: future (PlasmaObjectFuture): A PlasmaObjectFuture instance. """ if self._loop.get_debug(): logger.debug("Removing %s from the linked list.", future) if future.prev is None: ...
python
def remove(self, future): """Remove an object from the linked list. Args: future (PlasmaObjectFuture): A PlasmaObjectFuture instance. """ if self._loop.get_debug(): logger.debug("Removing %s from the linked list.", future) if future.prev is None: ...
[ "def", "remove", "(", "self", ",", "future", ")", ":", "if", "self", ".", "_loop", ".", "get_debug", "(", ")", ":", "logger", ".", "debug", "(", "\"Removing %s from the linked list.\"", ",", "future", ")", "if", "future", ".", "prev", "is", "None", ":", ...
Remove an object from the linked list. Args: future (PlasmaObjectFuture): A PlasmaObjectFuture instance.
[ "Remove", "an", "object", "from", "the", "linked", "list", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/async_plasma.py#L113-L138
train
ray-project/ray
python/ray/experimental/async_plasma.py
PlasmaObjectLinkedList.cancel
def cancel(self, *args, **kwargs): """Manually cancel all tasks assigned to this event loop.""" # Because remove all futures will trigger `set_result`, # we cancel itself first. super().cancel() for future in self.traverse(): # All cancelled futures should have callba...
python
def cancel(self, *args, **kwargs): """Manually cancel all tasks assigned to this event loop.""" # Because remove all futures will trigger `set_result`, # we cancel itself first. super().cancel() for future in self.traverse(): # All cancelled futures should have callba...
[ "def", "cancel", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Because remove all futures will trigger `set_result`,", "# we cancel itself first.", "super", "(", ")", ".", "cancel", "(", ")", "for", "future", "in", "self", ".", "traverse",...
Manually cancel all tasks assigned to this event loop.
[ "Manually", "cancel", "all", "tasks", "assigned", "to", "this", "event", "loop", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/async_plasma.py#L140-L150
train
ray-project/ray
python/ray/experimental/async_plasma.py
PlasmaObjectLinkedList.set_result
def set_result(self, result): """Complete all tasks. """ for future in self.traverse(): # All cancelled futures should have callbacks to removed itself # from this linked list. However, these callbacks are scheduled in # an event loop, so we could still find them in o...
python
def set_result(self, result): """Complete all tasks. """ for future in self.traverse(): # All cancelled futures should have callbacks to removed itself # from this linked list. However, these callbacks are scheduled in # an event loop, so we could still find them in o...
[ "def", "set_result", "(", "self", ",", "result", ")", ":", "for", "future", "in", "self", ".", "traverse", "(", ")", ":", "# All cancelled futures should have callbacks to removed itself", "# from this linked list. However, these callbacks are scheduled in", "# an event loop, s...
Complete all tasks.
[ "Complete", "all", "tasks", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/async_plasma.py#L152-L160
train
ray-project/ray
python/ray/experimental/async_plasma.py
PlasmaObjectLinkedList.traverse
def traverse(self): """Traverse this linked list. Yields: PlasmaObjectFuture: PlasmaObjectFuture instances. """ current = self.head while current is not None: yield current current = current.next
python
def traverse(self): """Traverse this linked list. Yields: PlasmaObjectFuture: PlasmaObjectFuture instances. """ current = self.head while current is not None: yield current current = current.next
[ "def", "traverse", "(", "self", ")", ":", "current", "=", "self", ".", "head", "while", "current", "is", "not", "None", ":", "yield", "current", "current", "=", "current", ".", "next" ]
Traverse this linked list. Yields: PlasmaObjectFuture: PlasmaObjectFuture instances.
[ "Traverse", "this", "linked", "list", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/async_plasma.py#L162-L171
train
ray-project/ray
python/ray/experimental/async_plasma.py
PlasmaEventHandler.process_notifications
def process_notifications(self, messages): """Process notifications.""" for object_id, object_size, metadata_size in messages: if object_size > 0 and object_id in self._waiting_dict: linked_list = self._waiting_dict[object_id] self._complete_future(linked_list...
python
def process_notifications(self, messages): """Process notifications.""" for object_id, object_size, metadata_size in messages: if object_size > 0 and object_id in self._waiting_dict: linked_list = self._waiting_dict[object_id] self._complete_future(linked_list...
[ "def", "process_notifications", "(", "self", ",", "messages", ")", ":", "for", "object_id", ",", "object_size", ",", "metadata_size", "in", "messages", ":", "if", "object_size", ">", "0", "and", "object_id", "in", "self", ".", "_waiting_dict", ":", "linked_lis...
Process notifications.
[ "Process", "notifications", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/async_plasma.py#L183-L188
train
ray-project/ray
python/ray/experimental/async_plasma.py
PlasmaEventHandler.as_future
def as_future(self, object_id, check_ready=True): """Turn an object_id into a Future object. Args: object_id: A Ray's object_id. check_ready (bool): If true, check if the object_id is ready. Returns: PlasmaObjectFuture: A future object that waits the object_...
python
def as_future(self, object_id, check_ready=True): """Turn an object_id into a Future object. Args: object_id: A Ray's object_id. check_ready (bool): If true, check if the object_id is ready. Returns: PlasmaObjectFuture: A future object that waits the object_...
[ "def", "as_future", "(", "self", ",", "object_id", ",", "check_ready", "=", "True", ")", ":", "if", "not", "isinstance", "(", "object_id", ",", "ray", ".", "ObjectID", ")", ":", "raise", "TypeError", "(", "\"Input should be an ObjectID.\"", ")", "plain_object_...
Turn an object_id into a Future object. Args: object_id: A Ray's object_id. check_ready (bool): If true, check if the object_id is ready. Returns: PlasmaObjectFuture: A future object that waits the object_id.
[ "Turn", "an", "object_id", "into", "a", "Future", "object", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/async_plasma.py#L205-L237
train
ray-project/ray
python/ray/tune/web_server.py
TuneClient.get_all_trials
def get_all_trials(self): """Returns a list of all trials' information.""" response = requests.get(urljoin(self._path, "trials")) return self._deserialize(response)
python
def get_all_trials(self): """Returns a list of all trials' information.""" response = requests.get(urljoin(self._path, "trials")) return self._deserialize(response)
[ "def", "get_all_trials", "(", "self", ")", ":", "response", "=", "requests", ".", "get", "(", "urljoin", "(", "self", ".", "_path", ",", "\"trials\"", ")", ")", "return", "self", ".", "_deserialize", "(", "response", ")" ]
Returns a list of all trials' information.
[ "Returns", "a", "list", "of", "all", "trials", "information", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/web_server.py#L48-L51
train
ray-project/ray
python/ray/tune/web_server.py
TuneClient.get_trial
def get_trial(self, trial_id): """Returns trial information by trial_id.""" response = requests.get( urljoin(self._path, "trials/{}".format(trial_id))) return self._deserialize(response)
python
def get_trial(self, trial_id): """Returns trial information by trial_id.""" response = requests.get( urljoin(self._path, "trials/{}".format(trial_id))) return self._deserialize(response)
[ "def", "get_trial", "(", "self", ",", "trial_id", ")", ":", "response", "=", "requests", ".", "get", "(", "urljoin", "(", "self", ".", "_path", ",", "\"trials/{}\"", ".", "format", "(", "trial_id", ")", ")", ")", "return", "self", ".", "_deserialize", ...
Returns trial information by trial_id.
[ "Returns", "trial", "information", "by", "trial_id", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/web_server.py#L53-L57
train
ray-project/ray
python/ray/tune/web_server.py
TuneClient.add_trial
def add_trial(self, name, specification): """Adds a trial by name and specification (dict).""" payload = {"name": name, "spec": specification} response = requests.post(urljoin(self._path, "trials"), json=payload) return self._deserialize(response)
python
def add_trial(self, name, specification): """Adds a trial by name and specification (dict).""" payload = {"name": name, "spec": specification} response = requests.post(urljoin(self._path, "trials"), json=payload) return self._deserialize(response)
[ "def", "add_trial", "(", "self", ",", "name", ",", "specification", ")", ":", "payload", "=", "{", "\"name\"", ":", "name", ",", "\"spec\"", ":", "specification", "}", "response", "=", "requests", ".", "post", "(", "urljoin", "(", "self", ".", "_path", ...
Adds a trial by name and specification (dict).
[ "Adds", "a", "trial", "by", "name", "and", "specification", "(", "dict", ")", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/web_server.py#L59-L63
train
ray-project/ray
python/ray/tune/web_server.py
TuneClient.stop_trial
def stop_trial(self, trial_id): """Requests to stop trial by trial_id.""" response = requests.put( urljoin(self._path, "trials/{}".format(trial_id))) return self._deserialize(response)
python
def stop_trial(self, trial_id): """Requests to stop trial by trial_id.""" response = requests.put( urljoin(self._path, "trials/{}".format(trial_id))) return self._deserialize(response)
[ "def", "stop_trial", "(", "self", ",", "trial_id", ")", ":", "response", "=", "requests", ".", "put", "(", "urljoin", "(", "self", ".", "_path", ",", "\"trials/{}\"", ".", "format", "(", "trial_id", ")", ")", ")", "return", "self", ".", "_deserialize", ...
Requests to stop trial by trial_id.
[ "Requests", "to", "stop", "trial", "by", "trial_id", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/web_server.py#L65-L69
train
ray-project/ray
python/ray/experimental/sgd/sgd.py
DistributedSGD.foreach_worker
def foreach_worker(self, fn): """Apply the given function to each remote worker. Returns: List of results from applying the function. """ results = ray.get([w.foreach_worker.remote(fn) for w in self.workers]) return results
python
def foreach_worker(self, fn): """Apply the given function to each remote worker. Returns: List of results from applying the function. """ results = ray.get([w.foreach_worker.remote(fn) for w in self.workers]) return results
[ "def", "foreach_worker", "(", "self", ",", "fn", ")", ":", "results", "=", "ray", ".", "get", "(", "[", "w", ".", "foreach_worker", ".", "remote", "(", "fn", ")", "for", "w", "in", "self", ".", "workers", "]", ")", "return", "results" ]
Apply the given function to each remote worker. Returns: List of results from applying the function.
[ "Apply", "the", "given", "function", "to", "each", "remote", "worker", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/sgd/sgd.py#L130-L137
train
ray-project/ray
python/ray/experimental/sgd/sgd.py
DistributedSGD.foreach_model
def foreach_model(self, fn): """Apply the given function to each model replica in each worker. Returns: List of results from applying the function. """ results = ray.get([w.foreach_model.remote(fn) for w in self.workers]) out = [] for r in results: ...
python
def foreach_model(self, fn): """Apply the given function to each model replica in each worker. Returns: List of results from applying the function. """ results = ray.get([w.foreach_model.remote(fn) for w in self.workers]) out = [] for r in results: ...
[ "def", "foreach_model", "(", "self", ",", "fn", ")", ":", "results", "=", "ray", ".", "get", "(", "[", "w", ".", "foreach_model", ".", "remote", "(", "fn", ")", "for", "w", "in", "self", ".", "workers", "]", ")", "out", "=", "[", "]", "for", "r...
Apply the given function to each model replica in each worker. Returns: List of results from applying the function.
[ "Apply", "the", "given", "function", "to", "each", "model", "replica", "in", "each", "worker", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/sgd/sgd.py#L139-L150
train
ray-project/ray
python/ray/experimental/sgd/sgd.py
DistributedSGD.for_model
def for_model(self, fn): """Apply the given function to a single model replica. Returns: Result from applying the function. """ return ray.get(self.workers[0].for_model.remote(fn))
python
def for_model(self, fn): """Apply the given function to a single model replica. Returns: Result from applying the function. """ return ray.get(self.workers[0].for_model.remote(fn))
[ "def", "for_model", "(", "self", ",", "fn", ")", ":", "return", "ray", ".", "get", "(", "self", ".", "workers", "[", "0", "]", ".", "for_model", ".", "remote", "(", "fn", ")", ")" ]
Apply the given function to a single model replica. Returns: Result from applying the function.
[ "Apply", "the", "given", "function", "to", "a", "single", "model", "replica", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/sgd/sgd.py#L152-L158
train
ray-project/ray
python/ray/experimental/sgd/sgd.py
DistributedSGD.step
def step(self, fetch_stats=False): """Run a single SGD step. Arguments: fetch_stats (bool): Whether to return stats from the step. This can slow down the computation by acting as a global barrier. """ if self.strategy == "ps": return _distributed_...
python
def step(self, fetch_stats=False): """Run a single SGD step. Arguments: fetch_stats (bool): Whether to return stats from the step. This can slow down the computation by acting as a global barrier. """ if self.strategy == "ps": return _distributed_...
[ "def", "step", "(", "self", ",", "fetch_stats", "=", "False", ")", ":", "if", "self", ".", "strategy", "==", "\"ps\"", ":", "return", "_distributed_sgd_step", "(", "self", ".", "workers", ",", "self", ".", "ps_list", ",", "write_timeline", "=", "False", ...
Run a single SGD step. Arguments: fetch_stats (bool): Whether to return stats from the step. This can slow down the computation by acting as a global barrier.
[ "Run", "a", "single", "SGD", "step", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/sgd/sgd.py#L160-L174
train
ray-project/ray
python/ray/experimental/serve/router/__init__.py
start_router
def start_router(router_class, router_name): """Wrapper for starting a router and register it. Args: router_class: The router class to instantiate. router_name: The name to give to the router. Returns: A handle to newly started router actor. """ handle = router_class.remote...
python
def start_router(router_class, router_name): """Wrapper for starting a router and register it. Args: router_class: The router class to instantiate. router_name: The name to give to the router. Returns: A handle to newly started router actor. """ handle = router_class.remote...
[ "def", "start_router", "(", "router_class", ",", "router_name", ")", ":", "handle", "=", "router_class", ".", "remote", "(", "router_name", ")", "ray", ".", "experimental", ".", "register_actor", "(", "router_name", ",", "handle", ")", "handle", ".", "start", ...
Wrapper for starting a router and register it. Args: router_class: The router class to instantiate. router_name: The name to give to the router. Returns: A handle to newly started router actor.
[ "Wrapper", "for", "starting", "a", "router", "and", "register", "it", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/serve/router/__init__.py#L10-L23
train
ray-project/ray
python/ray/tune/automl/search_space.py
SearchSpace.generate_random_one_hot_encoding
def generate_random_one_hot_encoding(self): """Returns a list of one-hot encodings for all parameters. 1 one-hot np.array for 1 parameter, and the 1's place is randomly chosen. """ encoding = [] for ps in self.param_list: one_hot = np.zeros(ps.choices_count()...
python
def generate_random_one_hot_encoding(self): """Returns a list of one-hot encodings for all parameters. 1 one-hot np.array for 1 parameter, and the 1's place is randomly chosen. """ encoding = [] for ps in self.param_list: one_hot = np.zeros(ps.choices_count()...
[ "def", "generate_random_one_hot_encoding", "(", "self", ")", ":", "encoding", "=", "[", "]", "for", "ps", "in", "self", ".", "param_list", ":", "one_hot", "=", "np", ".", "zeros", "(", "ps", ".", "choices_count", "(", ")", ")", "choice", "=", "random", ...
Returns a list of one-hot encodings for all parameters. 1 one-hot np.array for 1 parameter, and the 1's place is randomly chosen.
[ "Returns", "a", "list", "of", "one", "-", "hot", "encodings", "for", "all", "parameters", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/automl/search_space.py#L153-L165
train
ray-project/ray
python/ray/tune/automl/search_space.py
SearchSpace.apply_one_hot_encoding
def apply_one_hot_encoding(self, one_hot_encoding): """Apply one hot encoding to generate a specific config. Arguments: one_hot_encoding (list): A list of one hot encodings, 1 for each parameter. The shape of each encoding should match that ``ParameterSpace`...
python
def apply_one_hot_encoding(self, one_hot_encoding): """Apply one hot encoding to generate a specific config. Arguments: one_hot_encoding (list): A list of one hot encodings, 1 for each parameter. The shape of each encoding should match that ``ParameterSpace`...
[ "def", "apply_one_hot_encoding", "(", "self", ",", "one_hot_encoding", ")", ":", "config", "=", "{", "}", "for", "ps", ",", "one_hot", "in", "zip", "(", "self", ".", "param_list", ",", "one_hot_encoding", ")", ":", "index", "=", "np", ".", "argmax", "(",...
Apply one hot encoding to generate a specific config. Arguments: one_hot_encoding (list): A list of one hot encodings, 1 for each parameter. The shape of each encoding should match that ``ParameterSpace`` Returns: A dict config with specific <na...
[ "Apply", "one", "hot", "encoding", "to", "generate", "a", "specific", "config", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/automl/search_space.py#L167-L183
train
ray-project/ray
python/ray/tune/util.py
pin_in_object_store
def pin_in_object_store(obj): """Pin an object in the object store. It will be available as long as the pinning process is alive. The pinned object can be retrieved by calling get_pinned_object on the identifier returned by this call. """ obj_id = ray.put(_to_pinnable(obj)) _pinned_objects...
python
def pin_in_object_store(obj): """Pin an object in the object store. It will be available as long as the pinning process is alive. The pinned object can be retrieved by calling get_pinned_object on the identifier returned by this call. """ obj_id = ray.put(_to_pinnable(obj)) _pinned_objects...
[ "def", "pin_in_object_store", "(", "obj", ")", ":", "obj_id", "=", "ray", ".", "put", "(", "_to_pinnable", "(", "obj", ")", ")", "_pinned_objects", ".", "append", "(", "ray", ".", "get", "(", "obj_id", ")", ")", "return", "\"{}{}\"", ".", "format", "("...
Pin an object in the object store. It will be available as long as the pinning process is alive. The pinned object can be retrieved by calling get_pinned_object on the identifier returned by this call.
[ "Pin", "an", "object", "in", "the", "object", "store", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/util.py#L19-L30
train
ray-project/ray
python/ray/tune/util.py
get_pinned_object
def get_pinned_object(pinned_id): """Retrieve a pinned object from the object store.""" from ray import ObjectID return _from_pinnable( ray.get( ObjectID(base64.b64decode(pinned_id[len(PINNED_OBJECT_PREFIX):]))))
python
def get_pinned_object(pinned_id): """Retrieve a pinned object from the object store.""" from ray import ObjectID return _from_pinnable( ray.get( ObjectID(base64.b64decode(pinned_id[len(PINNED_OBJECT_PREFIX):]))))
[ "def", "get_pinned_object", "(", "pinned_id", ")", ":", "from", "ray", "import", "ObjectID", "return", "_from_pinnable", "(", "ray", ".", "get", "(", "ObjectID", "(", "base64", ".", "b64decode", "(", "pinned_id", "[", "len", "(", "PINNED_OBJECT_PREFIX", ")", ...
Retrieve a pinned object from the object store.
[ "Retrieve", "a", "pinned", "object", "from", "the", "object", "store", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/util.py#L33-L40
train
ray-project/ray
python/ray/tune/util.py
merge_dicts
def merge_dicts(d1, d2): """Returns a new dict that is d1 and d2 deep merged.""" merged = copy.deepcopy(d1) deep_update(merged, d2, True, []) return merged
python
def merge_dicts(d1, d2): """Returns a new dict that is d1 and d2 deep merged.""" merged = copy.deepcopy(d1) deep_update(merged, d2, True, []) return merged
[ "def", "merge_dicts", "(", "d1", ",", "d2", ")", ":", "merged", "=", "copy", ".", "deepcopy", "(", "d1", ")", "deep_update", "(", "merged", ",", "d2", ",", "True", ",", "[", "]", ")", "return", "merged" ]
Returns a new dict that is d1 and d2 deep merged.
[ "Returns", "a", "new", "dict", "that", "is", "d1", "and", "d2", "deep", "merged", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/util.py#L65-L69
train
ray-project/ray
python/ray/tune/util.py
deep_update
def deep_update(original, new_dict, new_keys_allowed, whitelist): """Updates original dict with values from new_dict recursively. If new key is introduced in new_dict, then if new_keys_allowed is not True, an error will be thrown. Further, for sub-dicts, if the key is in the whitelist, then new subkeys ...
python
def deep_update(original, new_dict, new_keys_allowed, whitelist): """Updates original dict with values from new_dict recursively. If new key is introduced in new_dict, then if new_keys_allowed is not True, an error will be thrown. Further, for sub-dicts, if the key is in the whitelist, then new subkeys ...
[ "def", "deep_update", "(", "original", ",", "new_dict", ",", "new_keys_allowed", ",", "whitelist", ")", ":", "for", "k", ",", "value", "in", "new_dict", ".", "items", "(", ")", ":", "if", "k", "not", "in", "original", ":", "if", "not", "new_keys_allowed"...
Updates original dict with values from new_dict recursively. If new key is introduced in new_dict, then if new_keys_allowed is not True, an error will be thrown. Further, for sub-dicts, if the key is in the whitelist, then new subkeys can be introduced. Args: original (dict): Dictionary with de...
[ "Updates", "original", "dict", "with", "values", "from", "new_dict", "recursively", ".", "If", "new", "key", "is", "introduced", "in", "new_dict", "then", "if", "new_keys_allowed", "is", "not", "True", "an", "error", "will", "be", "thrown", ".", "Further", "...
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/util.py#L72-L97
train
ray-project/ray
python/ray/rllib/utils/actors.py
TaskPool.completed_prefetch
def completed_prefetch(self, blocking_wait=False, max_yield=999): """Similar to completed but only returns once the object is local. Assumes obj_id only is one id.""" for worker, obj_id in self.completed(blocking_wait=blocking_wait): plasma_id = ray.pyarrow.plasma.ObjectID(obj_id.b...
python
def completed_prefetch(self, blocking_wait=False, max_yield=999): """Similar to completed but only returns once the object is local. Assumes obj_id only is one id.""" for worker, obj_id in self.completed(blocking_wait=blocking_wait): plasma_id = ray.pyarrow.plasma.ObjectID(obj_id.b...
[ "def", "completed_prefetch", "(", "self", ",", "blocking_wait", "=", "False", ",", "max_yield", "=", "999", ")", ":", "for", "worker", ",", "obj_id", "in", "self", ".", "completed", "(", "blocking_wait", "=", "blocking_wait", ")", ":", "plasma_id", "=", "r...
Similar to completed but only returns once the object is local. Assumes obj_id only is one id.
[ "Similar", "to", "completed", "but", "only", "returns", "once", "the", "object", "is", "local", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/utils/actors.py#L37-L59
train
ray-project/ray
python/ray/rllib/utils/actors.py
TaskPool.reset_evaluators
def reset_evaluators(self, evaluators): """Notify that some evaluators may be removed.""" for obj_id, ev in self._tasks.copy().items(): if ev not in evaluators: del self._tasks[obj_id] del self._objects[obj_id] ok = [] for ev, obj_id in self._f...
python
def reset_evaluators(self, evaluators): """Notify that some evaluators may be removed.""" for obj_id, ev in self._tasks.copy().items(): if ev not in evaluators: del self._tasks[obj_id] del self._objects[obj_id] ok = [] for ev, obj_id in self._f...
[ "def", "reset_evaluators", "(", "self", ",", "evaluators", ")", ":", "for", "obj_id", ",", "ev", "in", "self", ".", "_tasks", ".", "copy", "(", ")", ".", "items", "(", ")", ":", "if", "ev", "not", "in", "evaluators", ":", "del", "self", ".", "_task...
Notify that some evaluators may be removed.
[ "Notify", "that", "some", "evaluators", "may", "be", "removed", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/utils/actors.py#L61-L71
train
ray-project/ray
python/ray/rllib/optimizers/aso_aggregator.py
AggregationWorkerBase.iter_train_batches
def iter_train_batches(self, max_yield=999): """Iterate over train batches. Arguments: max_yield (int): Max number of batches to iterate over in this cycle. Setting this avoids iter_train_batches returning too much data at once. """ for ev, s...
python
def iter_train_batches(self, max_yield=999): """Iterate over train batches. Arguments: max_yield (int): Max number of batches to iterate over in this cycle. Setting this avoids iter_train_batches returning too much data at once. """ for ev, s...
[ "def", "iter_train_batches", "(", "self", ",", "max_yield", "=", "999", ")", ":", "for", "ev", ",", "sample_batch", "in", "self", ".", "_augment_with_replay", "(", "self", ".", "sample_tasks", ".", "completed_prefetch", "(", "blocking_wait", "=", "True", ",", ...
Iterate over train batches. Arguments: max_yield (int): Max number of batches to iterate over in this cycle. Setting this avoids iter_train_batches returning too much data at once.
[ "Iterate", "over", "train", "batches", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/optimizers/aso_aggregator.py#L92-L131
train
ray-project/ray
python/ray/autoscaler/commands.py
create_or_update_cluster
def create_or_update_cluster(config_file, override_min_workers, override_max_workers, no_restart, restart_only, yes, override_cluster_name): """Create or updates an autoscaling Ray cluster from a config json.""" config = yaml.load(open(config_file).read(...
python
def create_or_update_cluster(config_file, override_min_workers, override_max_workers, no_restart, restart_only, yes, override_cluster_name): """Create or updates an autoscaling Ray cluster from a config json.""" config = yaml.load(open(config_file).read(...
[ "def", "create_or_update_cluster", "(", "config_file", ",", "override_min_workers", ",", "override_max_workers", ",", "no_restart", ",", "restart_only", ",", "yes", ",", "override_cluster_name", ")", ":", "config", "=", "yaml", ".", "load", "(", "open", "(", "conf...
Create or updates an autoscaling Ray cluster from a config json.
[ "Create", "or", "updates", "an", "autoscaling", "Ray", "cluster", "from", "a", "config", "json", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/commands.py#L34-L47
train
ray-project/ray
python/ray/autoscaler/commands.py
teardown_cluster
def teardown_cluster(config_file, yes, workers_only, override_cluster_name): """Destroys all nodes of a Ray cluster described by a config json.""" config = yaml.load(open(config_file).read()) if override_cluster_name is not None: config["cluster_name"] = override_cluster_name validate_config(co...
python
def teardown_cluster(config_file, yes, workers_only, override_cluster_name): """Destroys all nodes of a Ray cluster described by a config json.""" config = yaml.load(open(config_file).read()) if override_cluster_name is not None: config["cluster_name"] = override_cluster_name validate_config(co...
[ "def", "teardown_cluster", "(", "config_file", ",", "yes", ",", "workers_only", ",", "override_cluster_name", ")", ":", "config", "=", "yaml", ".", "load", "(", "open", "(", "config_file", ")", ".", "read", "(", ")", ")", "if", "override_cluster_name", "is",...
Destroys all nodes of a Ray cluster described by a config json.
[ "Destroys", "all", "nodes", "of", "a", "Ray", "cluster", "described", "by", "a", "config", "json", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/commands.py#L73-L116
train
ray-project/ray
python/ray/autoscaler/commands.py
kill_node
def kill_node(config_file, yes, override_cluster_name): """Kills a random Raylet worker.""" config = yaml.load(open(config_file).read()) if override_cluster_name is not None: config["cluster_name"] = override_cluster_name config = _bootstrap_config(config) confirm("This will kill a node in...
python
def kill_node(config_file, yes, override_cluster_name): """Kills a random Raylet worker.""" config = yaml.load(open(config_file).read()) if override_cluster_name is not None: config["cluster_name"] = override_cluster_name config = _bootstrap_config(config) confirm("This will kill a node in...
[ "def", "kill_node", "(", "config_file", ",", "yes", ",", "override_cluster_name", ")", ":", "config", "=", "yaml", ".", "load", "(", "open", "(", "config_file", ")", ".", "read", "(", ")", ")", "if", "override_cluster_name", "is", "not", "None", ":", "co...
Kills a random Raylet worker.
[ "Kills", "a", "random", "Raylet", "worker", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/commands.py#L119-L157
train
ray-project/ray
python/ray/autoscaler/commands.py
get_or_create_head_node
def get_or_create_head_node(config, config_file, no_restart, restart_only, yes, override_cluster_name): """Create the cluster head node, which in turn creates the workers.""" provider = get_node_provider(config["provider"], config["cluster_name"]) try: head_node_tags = { ...
python
def get_or_create_head_node(config, config_file, no_restart, restart_only, yes, override_cluster_name): """Create the cluster head node, which in turn creates the workers.""" provider = get_node_provider(config["provider"], config["cluster_name"]) try: head_node_tags = { ...
[ "def", "get_or_create_head_node", "(", "config", ",", "config_file", ",", "no_restart", ",", "restart_only", ",", "yes", ",", "override_cluster_name", ")", ":", "provider", "=", "get_node_provider", "(", "config", "[", "\"provider\"", "]", ",", "config", "[", "\...
Create the cluster head node, which in turn creates the workers.
[ "Create", "the", "cluster", "head", "node", "which", "in", "turn", "creates", "the", "workers", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/commands.py#L160-L283
train
ray-project/ray
python/ray/autoscaler/commands.py
attach_cluster
def attach_cluster(config_file, start, use_tmux, override_cluster_name, new): """Attaches to a screen for the specified cluster. Arguments: config_file: path to the cluster yaml start: whether to start the cluster if it isn't up use_tmux: whether to use tmux as multiplexer overr...
python
def attach_cluster(config_file, start, use_tmux, override_cluster_name, new): """Attaches to a screen for the specified cluster. Arguments: config_file: path to the cluster yaml start: whether to start the cluster if it isn't up use_tmux: whether to use tmux as multiplexer overr...
[ "def", "attach_cluster", "(", "config_file", ",", "start", ",", "use_tmux", ",", "override_cluster_name", ",", "new", ")", ":", "if", "use_tmux", ":", "if", "new", ":", "cmd", "=", "\"tmux new\"", "else", ":", "cmd", "=", "\"tmux attach || tmux new\"", "else",...
Attaches to a screen for the specified cluster. Arguments: config_file: path to the cluster yaml start: whether to start the cluster if it isn't up use_tmux: whether to use tmux as multiplexer override_cluster_name: set the name of the cluster new: whether to force a new scr...
[ "Attaches", "to", "a", "screen", "for", "the", "specified", "cluster", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/commands.py#L286-L309
train
ray-project/ray
python/ray/autoscaler/commands.py
exec_cluster
def exec_cluster(config_file, cmd, docker, screen, tmux, stop, start, override_cluster_name, port_forward): """Runs a command on the specified cluster. Arguments: config_file: path to the cluster yaml cmd: command to run docker: whether to run command in docker containe...
python
def exec_cluster(config_file, cmd, docker, screen, tmux, stop, start, override_cluster_name, port_forward): """Runs a command on the specified cluster. Arguments: config_file: path to the cluster yaml cmd: command to run docker: whether to run command in docker containe...
[ "def", "exec_cluster", "(", "config_file", ",", "cmd", ",", "docker", ",", "screen", ",", "tmux", ",", "stop", ",", "start", ",", "override_cluster_name", ",", "port_forward", ")", ":", "assert", "not", "(", "screen", "and", "tmux", ")", ",", "\"Can specif...
Runs a command on the specified cluster. Arguments: config_file: path to the cluster yaml cmd: command to run docker: whether to run command in docker container of config screen: whether to run in a screen tmux: whether to run in a tmux session stop: whether to stop ...
[ "Runs", "a", "command", "on", "the", "specified", "cluster", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/commands.py#L312-L391
train
ray-project/ray
python/ray/autoscaler/commands.py
rsync
def rsync(config_file, source, target, override_cluster_name, down): """Rsyncs files. Arguments: config_file: path to the cluster yaml source: source dir target: target dir override_cluster_name: set the name of the cluster down: whether we're syncing remote -> local ...
python
def rsync(config_file, source, target, override_cluster_name, down): """Rsyncs files. Arguments: config_file: path to the cluster yaml source: source dir target: target dir override_cluster_name: set the name of the cluster down: whether we're syncing remote -> local ...
[ "def", "rsync", "(", "config_file", ",", "source", ",", "target", ",", "override_cluster_name", ",", "down", ")", ":", "config", "=", "yaml", ".", "load", "(", "open", "(", "config_file", ")", ".", "read", "(", ")", ")", "if", "override_cluster_name", "i...
Rsyncs files. Arguments: config_file: path to the cluster yaml source: source dir target: target dir override_cluster_name: set the name of the cluster down: whether we're syncing remote -> local
[ "Rsyncs", "files", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/commands.py#L416-L453
train
ray-project/ray
python/ray/autoscaler/commands.py
get_head_node_ip
def get_head_node_ip(config_file, override_cluster_name): """Returns head node IP for given configuration file if exists.""" config = yaml.load(open(config_file).read()) if override_cluster_name is not None: config["cluster_name"] = override_cluster_name provider = get_node_provider(config["pr...
python
def get_head_node_ip(config_file, override_cluster_name): """Returns head node IP for given configuration file if exists.""" config = yaml.load(open(config_file).read()) if override_cluster_name is not None: config["cluster_name"] = override_cluster_name provider = get_node_provider(config["pr...
[ "def", "get_head_node_ip", "(", "config_file", ",", "override_cluster_name", ")", ":", "config", "=", "yaml", ".", "load", "(", "open", "(", "config_file", ")", ".", "read", "(", ")", ")", "if", "override_cluster_name", "is", "not", "None", ":", "config", ...
Returns head node IP for given configuration file if exists.
[ "Returns", "head", "node", "IP", "for", "given", "configuration", "file", "if", "exists", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/commands.py#L456-L473
train
ray-project/ray
python/ray/autoscaler/commands.py
get_worker_node_ips
def get_worker_node_ips(config_file, override_cluster_name): """Returns worker node IPs for given configuration file.""" config = yaml.load(open(config_file).read()) if override_cluster_name is not None: config["cluster_name"] = override_cluster_name provider = get_node_provider(config["provid...
python
def get_worker_node_ips(config_file, override_cluster_name): """Returns worker node IPs for given configuration file.""" config = yaml.load(open(config_file).read()) if override_cluster_name is not None: config["cluster_name"] = override_cluster_name provider = get_node_provider(config["provid...
[ "def", "get_worker_node_ips", "(", "config_file", ",", "override_cluster_name", ")", ":", "config", "=", "yaml", ".", "load", "(", "open", "(", "config_file", ")", ".", "read", "(", ")", ")", "if", "override_cluster_name", "is", "not", "None", ":", "config",...
Returns worker node IPs for given configuration file.
[ "Returns", "worker", "node", "IPs", "for", "given", "configuration", "file", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/commands.py#L476-L492
train
ray-project/ray
python/ray/tune/function_runner.py
FunctionRunner._train
def _train(self): """Implements train() for a Function API. If the RunnerThread finishes without reporting "done", Tune will automatically provide a magic keyword __duplicate__ along with a result with "done=True". The TrialRunner will handle the result accordingly (see tune/tri...
python
def _train(self): """Implements train() for a Function API. If the RunnerThread finishes without reporting "done", Tune will automatically provide a magic keyword __duplicate__ along with a result with "done=True". The TrialRunner will handle the result accordingly (see tune/tri...
[ "def", "_train", "(", "self", ")", ":", "if", "self", ".", "_runner", ".", "is_alive", "(", ")", ":", "# if started and alive, inform the reporter to continue and", "# generate the next result", "self", ".", "_continue_semaphore", ".", "release", "(", ")", "else", "...
Implements train() for a Function API. If the RunnerThread finishes without reporting "done", Tune will automatically provide a magic keyword __duplicate__ along with a result with "done=True". The TrialRunner will handle the result accordingly (see tune/trial_runner.py).
[ "Implements", "train", "()", "for", "a", "Function", "API", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/function_runner.py#L151-L221
train
ray-project/ray
python/ray/experimental/sgd/tfbench/model.py
Model.build_network
def build_network(self, images, phase_train=True, nclass=1001, image_depth=3, data_type=tf.float32, data_format="NCHW", use_tf_layers=True, fp16...
python
def build_network(self, images, phase_train=True, nclass=1001, image_depth=3, data_type=tf.float32, data_format="NCHW", use_tf_layers=True, fp16...
[ "def", "build_network", "(", "self", ",", "images", ",", "phase_train", "=", "True", ",", "nclass", "=", "1001", ",", "image_depth", "=", "3", ",", "data_type", "=", "tf", ".", "float32", ",", "data_format", "=", "\"NCHW\"", ",", "use_tf_layers", "=", "T...
Returns logits and aux_logits from images.
[ "Returns", "logits", "and", "aux_logits", "from", "images", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/sgd/tfbench/model.py#L79-L114
train
ray-project/ray
python/ray/rllib/utils/__init__.py
renamed_class
def renamed_class(cls): """Helper class for renaming Agent => Trainer with a warning.""" class DeprecationWrapper(cls): def __init__(self, config=None, env=None, logger_creator=None): old_name = cls.__name__.replace("Trainer", "Agent") new_name = cls.__name__ logger....
python
def renamed_class(cls): """Helper class for renaming Agent => Trainer with a warning.""" class DeprecationWrapper(cls): def __init__(self, config=None, env=None, logger_creator=None): old_name = cls.__name__.replace("Trainer", "Agent") new_name = cls.__name__ logger....
[ "def", "renamed_class", "(", "cls", ")", ":", "class", "DeprecationWrapper", "(", "cls", ")", ":", "def", "__init__", "(", "self", ",", "config", "=", "None", ",", "env", "=", "None", ",", "logger_creator", "=", "None", ")", ":", "old_name", "=", "cls"...
Helper class for renaming Agent => Trainer with a warning.
[ "Helper", "class", "for", "renaming", "Agent", "=", ">", "Trainer", "with", "a", "warning", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/utils/__init__.py#L12-L26
train
ray-project/ray
python/ray/profiling.py
profile
def profile(event_type, extra_data=None): """Profile a span of time so that it appears in the timeline visualization. Note that this only works in the raylet code path. This function can be used as follows (both on the driver or within a task). .. code-block:: python with ray.profile("custom...
python
def profile(event_type, extra_data=None): """Profile a span of time so that it appears in the timeline visualization. Note that this only works in the raylet code path. This function can be used as follows (both on the driver or within a task). .. code-block:: python with ray.profile("custom...
[ "def", "profile", "(", "event_type", ",", "extra_data", "=", "None", ")", ":", "worker", "=", "ray", ".", "worker", ".", "global_worker", "return", "RayLogSpanRaylet", "(", "worker", ".", "profiler", ",", "event_type", ",", "extra_data", "=", "extra_data", "...
Profile a span of time so that it appears in the timeline visualization. Note that this only works in the raylet code path. This function can be used as follows (both on the driver or within a task). .. code-block:: python with ray.profile("custom event", extra_data={'key': 'value'}): ...
[ "Profile", "a", "span", "of", "time", "so", "that", "it", "appears", "in", "the", "timeline", "visualization", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/profiling.py#L30-L61
train
ray-project/ray
python/ray/profiling.py
Profiler._periodically_flush_profile_events
def _periodically_flush_profile_events(self): """Drivers run this as a thread to flush profile data in the background.""" # Note(rkn): This is run on a background thread in the driver. It uses # the raylet client. This should be ok because it doesn't read # from the raylet client...
python
def _periodically_flush_profile_events(self): """Drivers run this as a thread to flush profile data in the background.""" # Note(rkn): This is run on a background thread in the driver. It uses # the raylet client. This should be ok because it doesn't read # from the raylet client...
[ "def", "_periodically_flush_profile_events", "(", "self", ")", ":", "# Note(rkn): This is run on a background thread in the driver. It uses", "# the raylet client. This should be ok because it doesn't read", "# from the raylet client and we have the GIL here. However,", "# if either of those thing...
Drivers run this as a thread to flush profile data in the background.
[ "Drivers", "run", "this", "as", "a", "thread", "to", "flush", "profile", "data", "in", "the", "background", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/profiling.py#L94-L110
train
ray-project/ray
python/ray/profiling.py
Profiler.flush_profile_data
def flush_profile_data(self): """Push the logged profiling data to the global control store.""" with self.lock: events = self.events self.events = [] if self.worker.mode == ray.WORKER_MODE: component_type = "worker" else: component_type = ...
python
def flush_profile_data(self): """Push the logged profiling data to the global control store.""" with self.lock: events = self.events self.events = [] if self.worker.mode == ray.WORKER_MODE: component_type = "worker" else: component_type = ...
[ "def", "flush_profile_data", "(", "self", ")", ":", "with", "self", ".", "lock", ":", "events", "=", "self", ".", "events", "self", ".", "events", "=", "[", "]", "if", "self", ".", "worker", ".", "mode", "==", "ray", ".", "WORKER_MODE", ":", "compone...
Push the logged profiling data to the global control store.
[ "Push", "the", "logged", "profiling", "data", "to", "the", "global", "control", "store", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/profiling.py#L112-L125
train
ray-project/ray
python/ray/profiling.py
RayLogSpanRaylet.set_attribute
def set_attribute(self, key, value): """Add a key-value pair to the extra_data dict. This can be used to add attributes that are not available when ray.profile was called. Args: key: The attribute name. value: The attribute value. """ if not isin...
python
def set_attribute(self, key, value): """Add a key-value pair to the extra_data dict. This can be used to add attributes that are not available when ray.profile was called. Args: key: The attribute name. value: The attribute value. """ if not isin...
[ "def", "set_attribute", "(", "self", ",", "key", ",", "value", ")", ":", "if", "not", "isinstance", "(", "key", ",", "str", ")", "or", "not", "isinstance", "(", "value", ",", "str", ")", ":", "raise", "ValueError", "(", "\"The arguments 'key' and 'value' m...
Add a key-value pair to the extra_data dict. This can be used to add attributes that are not available when ray.profile was called. Args: key: The attribute name. value: The attribute value.
[ "Add", "a", "key", "-", "value", "pair", "to", "the", "extra_data", "dict", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/profiling.py#L146-L160
train
ray-project/ray
python/ray/tune/log_sync.py
_LogSyncer.sync_to_worker_if_possible
def sync_to_worker_if_possible(self): """Syncs the local logdir on driver to worker if possible. Requires ray cluster to be started with the autoscaler. Also requires rsync to be installed. """ if self.worker_ip == self.local_ip: return ssh_key = get_ssh_key(...
python
def sync_to_worker_if_possible(self): """Syncs the local logdir on driver to worker if possible. Requires ray cluster to be started with the autoscaler. Also requires rsync to be installed. """ if self.worker_ip == self.local_ip: return ssh_key = get_ssh_key(...
[ "def", "sync_to_worker_if_possible", "(", "self", ")", ":", "if", "self", ".", "worker_ip", "==", "self", ".", "local_ip", ":", "return", "ssh_key", "=", "get_ssh_key", "(", ")", "ssh_user", "=", "get_ssh_user", "(", ")", "global", "_log_sync_warned", "if", ...
Syncs the local logdir on driver to worker if possible. Requires ray cluster to be started with the autoscaler. Also requires rsync to be installed.
[ "Syncs", "the", "local", "logdir", "on", "driver", "to", "worker", "if", "possible", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/log_sync.py#L131-L159
train
ray-project/ray
python/ray/rllib/agents/qmix/mixers.py
QMixer.forward
def forward(self, agent_qs, states): """Forward pass for the mixer. Arguments: agent_qs: Tensor of shape [B, T, n_agents, n_actions] states: Tensor of shape [B, T, state_dim] """ bs = agent_qs.size(0) states = states.reshape(-1, self.state_dim) ag...
python
def forward(self, agent_qs, states): """Forward pass for the mixer. Arguments: agent_qs: Tensor of shape [B, T, n_agents, n_actions] states: Tensor of shape [B, T, state_dim] """ bs = agent_qs.size(0) states = states.reshape(-1, self.state_dim) ag...
[ "def", "forward", "(", "self", ",", "agent_qs", ",", "states", ")", ":", "bs", "=", "agent_qs", ".", "size", "(", "0", ")", "states", "=", "states", ".", "reshape", "(", "-", "1", ",", "self", ".", "state_dim", ")", "agent_qs", "=", "agent_qs", "."...
Forward pass for the mixer. Arguments: agent_qs: Tensor of shape [B, T, n_agents, n_actions] states: Tensor of shape [B, T, state_dim]
[ "Forward", "pass", "for", "the", "mixer", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/agents/qmix/mixers.py#L39-L64
train
ray-project/ray
python/ray/tune/suggest/sigopt.py
SigOptSearch.on_trial_complete
def on_trial_complete(self, trial_id, result=None, error=False, early_terminated=False): """Passes the result to SigOpt unless early terminated or errored. If a trial fails, it will be reported as a ...
python
def on_trial_complete(self, trial_id, result=None, error=False, early_terminated=False): """Passes the result to SigOpt unless early terminated or errored. If a trial fails, it will be reported as a ...
[ "def", "on_trial_complete", "(", "self", ",", "trial_id", ",", "result", "=", "None", ",", "error", "=", "False", ",", "early_terminated", "=", "False", ")", ":", "if", "result", ":", "self", ".", "conn", ".", "experiments", "(", "self", ".", "experiment...
Passes the result to SigOpt unless early terminated or errored. If a trial fails, it will be reported as a failed Observation, telling the optimizer that the Suggestion led to a metric failure, which updates the feasible region and improves parameter recommendation. Creates SigOpt Obse...
[ "Passes", "the", "result", "to", "SigOpt", "unless", "early", "terminated", "or", "errored", "." ]
4eade036a0505e244c976f36aaa2d64386b5129b
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/suggest/sigopt.py#L95-L119
train