partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Reporter.run
Run the reporter.
python/ray/reporter.py
def run(self): """Run the reporter.""" while True: try: self.perform_iteration() except Exception: traceback.print_exc() pass time.sleep(ray_constants.REPORTER_UPDATE_INTERVAL_MS / 1000)
def run(self): """Run the reporter.""" while True: try: self.perform_iteration() except Exception: traceback.print_exc() pass time.sleep(ray_constants.REPORTER_UPDATE_INTERVAL_MS / 1000)
[ "Run", "the", "reporter", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/reporter.py#L172-L181
[ "def", "run", "(", "self", ")", ":", "while", "True", ":", "try", ":", "self", ".", "perform_iteration", "(", ")", "except", "Exception", ":", "traceback", ".", "print_exc", "(", ")", "pass", "time", ".", "sleep", "(", "ray_constants", ".", "REPORTER_UPD...
4eade036a0505e244c976f36aaa2d64386b5129b
train
check_serializable
Throws an exception if Ray cannot serialize this class efficiently. Args: cls (type): The class to be serialized. Raises: Exception: An exception is raised if Ray cannot serialize this class efficiently.
python/ray/serialization.py
def check_serializable(cls): """Throws an exception if Ray cannot serialize this class efficiently. Args: cls (type): The class to be serialized. Raises: Exception: An exception is raised if Ray cannot serialize this class efficiently. """ if is_named_tuple(cls): ...
def check_serializable(cls): """Throws an exception if Ray cannot serialize this class efficiently. Args: cls (type): The class to be serialized. Raises: Exception: An exception is raised if Ray cannot serialize this class efficiently. """ if is_named_tuple(cls): ...
[ "Throws", "an", "exception", "if", "Ray", "cannot", "serialize", "this", "class", "efficiently", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/serialization.py#L16-L55
[ "def", "check_serializable", "(", "cls", ")", ":", "if", "is_named_tuple", "(", "cls", ")", ":", "# This case works.", "return", "if", "not", "hasattr", "(", "cls", ",", "\"__new__\"", ")", ":", "print", "(", "\"The class {} does not have a '__new__' attribute and i...
4eade036a0505e244c976f36aaa2d64386b5129b
train
is_named_tuple
Return True if cls is a namedtuple and False otherwise.
python/ray/serialization.py
def is_named_tuple(cls): """Return True if cls is a namedtuple and False otherwise.""" b = cls.__bases__ if len(b) != 1 or b[0] != tuple: return False f = getattr(cls, "_fields", None) if not isinstance(f, tuple): return False return all(type(n) == str for n in f)
def is_named_tuple(cls): """Return True if cls is a namedtuple and False otherwise.""" b = cls.__bases__ if len(b) != 1 or b[0] != tuple: return False f = getattr(cls, "_fields", None) if not isinstance(f, tuple): return False return all(type(n) == str for n in f)
[ "Return", "True", "if", "cls", "is", "a", "namedtuple", "and", "False", "otherwise", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/serialization.py#L58-L66
[ "def", "is_named_tuple", "(", "cls", ")", ":", "b", "=", "cls", ".", "__bases__", "if", "len", "(", "b", ")", "!=", "1", "or", "b", "[", "0", "]", "!=", "tuple", ":", "return", "False", "f", "=", "getattr", "(", "cls", ",", "\"_fields\"", ",", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
register_trainable
Register a trainable function or class. Args: name (str): Name to register. trainable (obj): Function or tune.Trainable class. Functions must take (config, status_reporter) as arguments and will be automatically converted into a class during registration.
python/ray/tune/registry.py
def register_trainable(name, trainable): """Register a trainable function or class. Args: name (str): Name to register. trainable (obj): Function or tune.Trainable class. Functions must take (config, status_reporter) as arguments and will be automatically converted into ...
def register_trainable(name, trainable): """Register a trainable function or class. Args: name (str): Name to register. trainable (obj): Function or tune.Trainable class. Functions must take (config, status_reporter) as arguments and will be automatically converted into ...
[ "Register", "a", "trainable", "function", "or", "class", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/registry.py#L24-L50
[ "def", "register_trainable", "(", "name", ",", "trainable", ")", ":", "from", "ray", ".", "tune", ".", "trainable", "import", "Trainable", "from", "ray", ".", "tune", ".", "function_runner", "import", "wrap_function", "if", "isinstance", "(", "trainable", ",",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
register_env
Register a custom environment for use with RLlib. Args: name (str): Name to register. env_creator (obj): Function that creates an env.
python/ray/tune/registry.py
def register_env(name, env_creator): """Register a custom environment for use with RLlib. Args: name (str): Name to register. env_creator (obj): Function that creates an env. """ if not isinstance(env_creator, FunctionType): raise TypeError("Second argument must be a function."...
def register_env(name, env_creator): """Register a custom environment for use with RLlib. Args: name (str): Name to register. env_creator (obj): Function that creates an env. """ if not isinstance(env_creator, FunctionType): raise TypeError("Second argument must be a function."...
[ "Register", "a", "custom", "environment", "for", "use", "with", "RLlib", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/registry.py#L53-L63
[ "def", "register_env", "(", "name", ",", "env_creator", ")", ":", "if", "not", "isinstance", "(", "env_creator", ",", "FunctionType", ")", ":", "raise", "TypeError", "(", "\"Second argument must be a function.\"", ",", "env_creator", ")", "_global_registry", ".", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
get_learner_stats
Return optimization stats reported from the policy graph. Example: >>> grad_info = evaluator.learn_on_batch(samples) >>> print(get_stats(grad_info)) {"vf_loss": ..., "policy_loss": ...}
python/ray/rllib/evaluation/metrics.py
def get_learner_stats(grad_info): """Return optimization stats reported from the policy graph. Example: >>> grad_info = evaluator.learn_on_batch(samples) >>> print(get_stats(grad_info)) {"vf_loss": ..., "policy_loss": ...} """ if LEARNER_STATS_KEY in grad_info: return g...
def get_learner_stats(grad_info): """Return optimization stats reported from the policy graph. Example: >>> grad_info = evaluator.learn_on_batch(samples) >>> print(get_stats(grad_info)) {"vf_loss": ..., "policy_loss": ...} """ if LEARNER_STATS_KEY in grad_info: return g...
[ "Return", "optimization", "stats", "reported", "from", "the", "policy", "graph", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/evaluation/metrics.py#L23-L41
[ "def", "get_learner_stats", "(", "grad_info", ")", ":", "if", "LEARNER_STATS_KEY", "in", "grad_info", ":", "return", "grad_info", "[", "LEARNER_STATS_KEY", "]", "multiagent_stats", "=", "{", "}", "for", "k", ",", "v", "in", "grad_info", ".", "items", "(", ")...
4eade036a0505e244c976f36aaa2d64386b5129b
train
collect_metrics
Gathers episode metrics from PolicyEvaluator instances.
python/ray/rllib/evaluation/metrics.py
def collect_metrics(local_evaluator=None, remote_evaluators=[], timeout_seconds=180): """Gathers episode metrics from PolicyEvaluator instances.""" episodes, num_dropped = collect_episodes( local_evaluator, remote_evaluators, timeout_seconds=timeout_seconds) ...
def collect_metrics(local_evaluator=None, remote_evaluators=[], timeout_seconds=180): """Gathers episode metrics from PolicyEvaluator instances.""" episodes, num_dropped = collect_episodes( local_evaluator, remote_evaluators, timeout_seconds=timeout_seconds) ...
[ "Gathers", "episode", "metrics", "from", "PolicyEvaluator", "instances", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/evaluation/metrics.py#L45-L53
[ "def", "collect_metrics", "(", "local_evaluator", "=", "None", ",", "remote_evaluators", "=", "[", "]", ",", "timeout_seconds", "=", "180", ")", ":", "episodes", ",", "num_dropped", "=", "collect_episodes", "(", "local_evaluator", ",", "remote_evaluators", ",", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
collect_episodes
Gathers new episodes metrics tuples from the given evaluators.
python/ray/rllib/evaluation/metrics.py
def collect_episodes(local_evaluator=None, remote_evaluators=[], timeout_seconds=180): """Gathers new episodes metrics tuples from the given evaluators.""" pending = [ a.apply.remote(lambda ev: ev.get_metrics()) for a in remote_evaluators ] collected, _...
def collect_episodes(local_evaluator=None, remote_evaluators=[], timeout_seconds=180): """Gathers new episodes metrics tuples from the given evaluators.""" pending = [ a.apply.remote(lambda ev: ev.get_metrics()) for a in remote_evaluators ] collected, _...
[ "Gathers", "new", "episodes", "metrics", "tuples", "from", "the", "given", "evaluators", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/evaluation/metrics.py#L57-L79
[ "def", "collect_episodes", "(", "local_evaluator", "=", "None", ",", "remote_evaluators", "=", "[", "]", ",", "timeout_seconds", "=", "180", ")", ":", "pending", "=", "[", "a", ".", "apply", ".", "remote", "(", "lambda", "ev", ":", "ev", ".", "get_metric...
4eade036a0505e244c976f36aaa2d64386b5129b
train
summarize_episodes
Summarizes a set of episode metrics tuples. Arguments: episodes: smoothed set of episodes including historical ones new_episodes: just the new episodes in this iteration num_dropped: number of workers haven't returned their metrics
python/ray/rllib/evaluation/metrics.py
def summarize_episodes(episodes, new_episodes, num_dropped): """Summarizes a set of episode metrics tuples. Arguments: episodes: smoothed set of episodes including historical ones new_episodes: just the new episodes in this iteration num_dropped: number of workers haven't returned their...
def summarize_episodes(episodes, new_episodes, num_dropped): """Summarizes a set of episode metrics tuples. Arguments: episodes: smoothed set of episodes including historical ones new_episodes: just the new episodes in this iteration num_dropped: number of workers haven't returned their...
[ "Summarizes", "a", "set", "of", "episode", "metrics", "tuples", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/evaluation/metrics.py#L83-L160
[ "def", "summarize_episodes", "(", "episodes", ",", "new_episodes", ",", "num_dropped", ")", ":", "if", "num_dropped", ">", "0", ":", "logger", ".", "warning", "(", "\"WARNING: {} workers have NOT returned metrics\"", ".", "format", "(", "num_dropped", ")", ")", "e...
4eade036a0505e244c976f36aaa2d64386b5129b
train
_partition
Divides metrics data into true rollouts vs off-policy estimates.
python/ray/rllib/evaluation/metrics.py
def _partition(episodes): """Divides metrics data into true rollouts vs off-policy estimates.""" from ray.rllib.evaluation.sampler import RolloutMetrics rollouts, estimates = [], [] for e in episodes: if isinstance(e, RolloutMetrics): rollouts.append(e) elif isinstance(e, O...
def _partition(episodes): """Divides metrics data into true rollouts vs off-policy estimates.""" from ray.rllib.evaluation.sampler import RolloutMetrics rollouts, estimates = [], [] for e in episodes: if isinstance(e, RolloutMetrics): rollouts.append(e) elif isinstance(e, O...
[ "Divides", "metrics", "data", "into", "true", "rollouts", "vs", "off", "-", "policy", "estimates", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/evaluation/metrics.py#L163-L176
[ "def", "_partition", "(", "episodes", ")", ":", "from", "ray", ".", "rllib", ".", "evaluation", ".", "sampler", "import", "RolloutMetrics", "rollouts", ",", "estimates", "=", "[", "]", ",", "[", "]", "for", "e", "in", "episodes", ":", "if", "isinstance",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
TrialExecutor.set_status
Sets status and checkpoints metadata if needed. Only checkpoints metadata if trial status is a terminal condition. PENDING, PAUSED, and RUNNING switches have checkpoints taken care of in the TrialRunner. Args: trial (Trial): Trial to checkpoint. status (Trial.st...
python/ray/tune/trial_executor.py
def set_status(self, trial, status): """Sets status and checkpoints metadata if needed. Only checkpoints metadata if trial status is a terminal condition. PENDING, PAUSED, and RUNNING switches have checkpoints taken care of in the TrialRunner. Args: trial (Trial): T...
def set_status(self, trial, status): """Sets status and checkpoints metadata if needed. Only checkpoints metadata if trial status is a terminal condition. PENDING, PAUSED, and RUNNING switches have checkpoints taken care of in the TrialRunner. Args: trial (Trial): T...
[ "Sets", "status", "and", "checkpoints", "metadata", "if", "needed", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial_executor.py#L30-L43
[ "def", "set_status", "(", "self", ",", "trial", ",", "status", ")", ":", "trial", ".", "status", "=", "status", "if", "status", "in", "[", "Trial", ".", "TERMINATED", ",", "Trial", ".", "ERROR", "]", ":", "self", ".", "try_checkpoint_metadata", "(", "t...
4eade036a0505e244c976f36aaa2d64386b5129b
train
TrialExecutor.try_checkpoint_metadata
Checkpoints metadata. Args: trial (Trial): Trial to checkpoint.
python/ray/tune/trial_executor.py
def try_checkpoint_metadata(self, trial): """Checkpoints metadata. Args: trial (Trial): Trial to checkpoint. """ if trial._checkpoint.storage == Checkpoint.MEMORY: logger.debug("Not saving data for trial w/ memory checkpoint.") return try: ...
def try_checkpoint_metadata(self, trial): """Checkpoints metadata. Args: trial (Trial): Trial to checkpoint. """ if trial._checkpoint.storage == Checkpoint.MEMORY: logger.debug("Not saving data for trial w/ memory checkpoint.") return try: ...
[ "Checkpoints", "metadata", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial_executor.py#L45-L58
[ "def", "try_checkpoint_metadata", "(", "self", ",", "trial", ")", ":", "if", "trial", ".", "_checkpoint", ".", "storage", "==", "Checkpoint", ".", "MEMORY", ":", "logger", ".", "debug", "(", "\"Not saving data for trial w/ memory checkpoint.\"", ")", "return", "tr...
4eade036a0505e244c976f36aaa2d64386b5129b
train
TrialExecutor.pause_trial
Pauses the trial. We want to release resources (specifically GPUs) when pausing an experiment. This results in PAUSED state that similar to TERMINATED.
python/ray/tune/trial_executor.py
def pause_trial(self, trial): """Pauses the trial. We want to release resources (specifically GPUs) when pausing an experiment. This results in PAUSED state that similar to TERMINATED. """ assert trial.status == Trial.RUNNING, trial.status try: self.save(tria...
def pause_trial(self, trial): """Pauses the trial. We want to release resources (specifically GPUs) when pausing an experiment. This results in PAUSED state that similar to TERMINATED. """ assert trial.status == Trial.RUNNING, trial.status try: self.save(tria...
[ "Pauses", "the", "trial", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial_executor.py#L99-L112
[ "def", "pause_trial", "(", "self", ",", "trial", ")", ":", "assert", "trial", ".", "status", "==", "Trial", ".", "RUNNING", ",", "trial", ".", "status", "try", ":", "self", ".", "save", "(", "trial", ",", "Checkpoint", ".", "MEMORY", ")", "self", "."...
4eade036a0505e244c976f36aaa2d64386b5129b
train
TrialExecutor.unpause_trial
Sets PAUSED trial to pending to allow scheduler to start.
python/ray/tune/trial_executor.py
def unpause_trial(self, trial): """Sets PAUSED trial to pending to allow scheduler to start.""" assert trial.status == Trial.PAUSED, trial.status self.set_status(trial, Trial.PENDING)
def unpause_trial(self, trial): """Sets PAUSED trial to pending to allow scheduler to start.""" assert trial.status == Trial.PAUSED, trial.status self.set_status(trial, Trial.PENDING)
[ "Sets", "PAUSED", "trial", "to", "pending", "to", "allow", "scheduler", "to", "start", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial_executor.py#L114-L117
[ "def", "unpause_trial", "(", "self", ",", "trial", ")", ":", "assert", "trial", ".", "status", "==", "Trial", ".", "PAUSED", ",", "trial", ".", "status", "self", ".", "set_status", "(", "trial", ",", "Trial", ".", "PENDING", ")" ]
4eade036a0505e244c976f36aaa2d64386b5129b
train
TrialExecutor.resume_trial
Resumes PAUSED trials. This is a blocking call.
python/ray/tune/trial_executor.py
def resume_trial(self, trial): """Resumes PAUSED trials. This is a blocking call.""" assert trial.status == Trial.PAUSED, trial.status self.start_trial(trial)
def resume_trial(self, trial): """Resumes PAUSED trials. This is a blocking call.""" assert trial.status == Trial.PAUSED, trial.status self.start_trial(trial)
[ "Resumes", "PAUSED", "trials", ".", "This", "is", "a", "blocking", "call", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial_executor.py#L119-L123
[ "def", "resume_trial", "(", "self", ",", "trial", ")", ":", "assert", "trial", ".", "status", "==", "Trial", ".", "PAUSED", ",", "trial", ".", "status", "self", ".", "start_trial", "(", "trial", ")" ]
4eade036a0505e244c976f36aaa2d64386b5129b
train
NevergradSearch.on_trial_complete
Passes the result to Nevergrad unless early terminated or errored. The result is internally negated when interacting with Nevergrad so that Nevergrad Optimizers can "maximize" this value, as it minimizes on default.
python/ray/tune/suggest/nevergrad.py
def on_trial_complete(self, trial_id, result=None, error=False, early_terminated=False): """Passes the result to Nevergrad unless early terminated or errored. The result is internally negated when in...
def on_trial_complete(self, trial_id, result=None, error=False, early_terminated=False): """Passes the result to Nevergrad unless early terminated or errored. The result is internally negated when in...
[ "Passes", "the", "result", "to", "Nevergrad", "unless", "early", "terminated", "or", "errored", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/suggest/nevergrad.py#L109-L122
[ "def", "on_trial_complete", "(", "self", ",", "trial_id", ",", "result", "=", "None", ",", "error", "=", "False", ",", "early_terminated", "=", "False", ")", ":", "ng_trial_info", "=", "self", ".", "_live_trial_mapping", ".", "pop", "(", "trial_id", ")", "...
4eade036a0505e244c976f36aaa2d64386b5129b
train
ImportThread.start
Start the import thread.
python/ray/import_thread.py
def start(self): """Start the import thread.""" self.t = threading.Thread(target=self._run, name="ray_import_thread") # Making the thread a daemon causes it to exit # when the main thread exits. self.t.daemon = True self.t.start()
def start(self): """Start the import thread.""" self.t = threading.Thread(target=self._run, name="ray_import_thread") # Making the thread a daemon causes it to exit # when the main thread exits. self.t.daemon = True self.t.start()
[ "Start", "the", "import", "thread", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/import_thread.py#L36-L42
[ "def", "start", "(", "self", ")", ":", "self", ".", "t", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_run", ",", "name", "=", "\"ray_import_thread\"", ")", "# Making the thread a daemon causes it to exit", "# when the main thread exits.", "s...
4eade036a0505e244c976f36aaa2d64386b5129b
train
ImportThread._process_key
Process the given export key from redis.
python/ray/import_thread.py
def _process_key(self, key): """Process the given export key from redis.""" # Handle the driver case first. if self.mode != ray.WORKER_MODE: if key.startswith(b"FunctionsToRun"): with profiling.profile("fetch_and_run_function"): self.fetch_and_exec...
def _process_key(self, key): """Process the given export key from redis.""" # Handle the driver case first. if self.mode != ray.WORKER_MODE: if key.startswith(b"FunctionsToRun"): with profiling.profile("fetch_and_run_function"): self.fetch_and_exec...
[ "Process", "the", "given", "export", "key", "from", "redis", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/import_thread.py#L87-L113
[ "def", "_process_key", "(", "self", ",", "key", ")", ":", "# Handle the driver case first.", "if", "self", ".", "mode", "!=", "ray", ".", "WORKER_MODE", ":", "if", "key", ".", "startswith", "(", "b\"FunctionsToRun\"", ")", ":", "with", "profiling", ".", "pro...
4eade036a0505e244c976f36aaa2d64386b5129b
train
ImportThread.fetch_and_execute_function_to_run
Run on arbitrary function on the worker.
python/ray/import_thread.py
def fetch_and_execute_function_to_run(self, key): """Run on arbitrary function on the worker.""" (driver_id, serialized_function, run_on_other_drivers) = self.redis_client.hmget( key, ["driver_id", "function", "run_on_other_drivers"]) if (utils.decode(run_on_other_drivers)...
def fetch_and_execute_function_to_run(self, key): """Run on arbitrary function on the worker.""" (driver_id, serialized_function, run_on_other_drivers) = self.redis_client.hmget( key, ["driver_id", "function", "run_on_other_drivers"]) if (utils.decode(run_on_other_drivers)...
[ "Run", "on", "arbitrary", "function", "on", "the", "worker", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/import_thread.py#L115-L140
[ "def", "fetch_and_execute_function_to_run", "(", "self", ",", "key", ")", ":", "(", "driver_id", ",", "serialized_function", ",", "run_on_other_drivers", ")", "=", "self", ".", "redis_client", ".", "hmget", "(", "key", ",", "[", "\"driver_id\"", ",", "\"function...
4eade036a0505e244c976f36aaa2d64386b5129b
train
clip_action
Called to clip actions to the specified range of this policy. Arguments: action: Single action. space: Action space the actions should be present in. Returns: Clipped batch of actions.
python/ray/rllib/evaluation/policy_graph.py
def clip_action(action, space): """Called to clip actions to the specified range of this policy. Arguments: action: Single action. space: Action space the actions should be present in. Returns: Clipped batch of actions. """ if isinstance(space, gym.spaces.Box): ret...
def clip_action(action, space): """Called to clip actions to the specified range of this policy. Arguments: action: Single action. space: Action space the actions should be present in. Returns: Clipped batch of actions. """ if isinstance(space, gym.spaces.Box): ret...
[ "Called", "to", "clip", "actions", "to", "the", "specified", "range", "of", "this", "policy", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/evaluation/policy_graph.py#L265-L287
[ "def", "clip_action", "(", "action", ",", "space", ")", ":", "if", "isinstance", "(", "space", ",", "gym", ".", "spaces", ".", "Box", ")", ":", "return", "np", ".", "clip", "(", "action", ",", "space", ".", "low", ",", "space", ".", "high", ")", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
SkOptSearch.on_trial_complete
Passes the result to skopt unless early terminated or errored. The result is internally negated when interacting with Skopt so that Skopt Optimizers can "maximize" this value, as it minimizes on default.
python/ray/tune/suggest/skopt.py
def on_trial_complete(self, trial_id, result=None, error=False, early_terminated=False): """Passes the result to skopt unless early terminated or errored. The result is internally negated when intera...
def on_trial_complete(self, trial_id, result=None, error=False, early_terminated=False): """Passes the result to skopt unless early terminated or errored. The result is internally negated when intera...
[ "Passes", "the", "result", "to", "skopt", "unless", "early", "terminated", "or", "errored", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/suggest/skopt.py#L121-L134
[ "def", "on_trial_complete", "(", "self", ",", "trial_id", ",", "result", "=", "None", ",", "error", "=", "False", ",", "early_terminated", "=", "False", ")", ":", "skopt_trial_info", "=", "self", ".", "_live_trial_mapping", ".", "pop", "(", "trial_id", ")", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
address_to_ip
Convert a hostname to a numerical IP addresses in an address. This should be a no-op if address already contains an actual numerical IP address. Args: address: This can be either a string containing a hostname (or an IP address) and a port or it can be just an IP address. Returns:...
python/ray/services.py
def address_to_ip(address): """Convert a hostname to a numerical IP addresses in an address. This should be a no-op if address already contains an actual numerical IP address. Args: address: This can be either a string containing a hostname (or an IP address) and a port or it can b...
def address_to_ip(address): """Convert a hostname to a numerical IP addresses in an address. This should be a no-op if address already contains an actual numerical IP address. Args: address: This can be either a string containing a hostname (or an IP address) and a port or it can b...
[ "Convert", "a", "hostname", "to", "a", "numerical", "IP", "addresses", "in", "an", "address", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L174-L193
[ "def", "address_to_ip", "(", "address", ")", ":", "address_parts", "=", "address", ".", "split", "(", "\":\"", ")", "ip_address", "=", "socket", ".", "gethostbyname", "(", "address_parts", "[", "0", "]", ")", "# Make sure localhost isn't resolved to the loopback ip"...
4eade036a0505e244c976f36aaa2d64386b5129b
train
get_node_ip_address
Determine the IP address of the local node. Args: address (str): The IP address and port of any known live service on the network you care about. Returns: The IP address of the current node.
python/ray/services.py
def get_node_ip_address(address="8.8.8.8:53"): """Determine the IP address of the local node. Args: address (str): The IP address and port of any known live service on the network you care about. Returns: The IP address of the current node. """ ip_address, port = addres...
def get_node_ip_address(address="8.8.8.8:53"): """Determine the IP address of the local node. Args: address (str): The IP address and port of any known live service on the network you care about. Returns: The IP address of the current node. """ ip_address, port = addres...
[ "Determine", "the", "IP", "address", "of", "the", "local", "node", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L196-L226
[ "def", "get_node_ip_address", "(", "address", "=", "\"8.8.8.8:53\"", ")", ":", "ip_address", ",", "port", "=", "address", ".", "split", "(", "\":\"", ")", "s", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_DGRAM", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
create_redis_client
Create a Redis client. Args: The IP address, port, and password of the Redis server. Returns: A Redis client.
python/ray/services.py
def create_redis_client(redis_address, password=None): """Create a Redis client. Args: The IP address, port, and password of the Redis server. Returns: A Redis client. """ redis_ip_address, redis_port = redis_address.split(":") # For this command to work, some other client (on ...
def create_redis_client(redis_address, password=None): """Create a Redis client. Args: The IP address, port, and password of the Redis server. Returns: A Redis client. """ redis_ip_address, redis_port = redis_address.split(":") # For this command to work, some other client (on ...
[ "Create", "a", "Redis", "client", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L229-L242
[ "def", "create_redis_client", "(", "redis_address", ",", "password", "=", "None", ")", ":", "redis_ip_address", ",", "redis_port", "=", "redis_address", ".", "split", "(", "\":\"", ")", "# For this command to work, some other client (on the same machine", "# as Redis) must ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
start_ray_process
Start one of the Ray processes. TODO(rkn): We need to figure out how these commands interact. For example, it may only make sense to start a process in gdb if we also start it in tmux. Similarly, certain combinations probably don't make sense, like simultaneously running the process in valgrind and the...
python/ray/services.py
def start_ray_process(command, process_type, env_updates=None, cwd=None, use_valgrind=False, use_gdb=False, use_valgrind_profiler=False, use_perftools_profiler=False,...
def start_ray_process(command, process_type, env_updates=None, cwd=None, use_valgrind=False, use_gdb=False, use_valgrind_profiler=False, use_perftools_profiler=False,...
[ "Start", "one", "of", "the", "Ray", "processes", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L245-L378
[ "def", "start_ray_process", "(", "command", ",", "process_type", ",", "env_updates", "=", "None", ",", "cwd", "=", "None", ",", "use_valgrind", "=", "False", ",", "use_gdb", "=", "False", ",", "use_valgrind_profiler", "=", "False", ",", "use_perftools_profiler",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
wait_for_redis_to_start
Wait for a Redis server to be available. This is accomplished by creating a Redis client and sending a random command to the server until the command gets through. Args: redis_ip_address (str): The IP address of the redis server. redis_port (int): The port of the redis server. pass...
python/ray/services.py
def wait_for_redis_to_start(redis_ip_address, redis_port, password=None, num_retries=5): """Wait for a Redis server to be available. This is accomplished by creating a Redis client and sending a random command to the server...
def wait_for_redis_to_start(redis_ip_address, redis_port, password=None, num_retries=5): """Wait for a Redis server to be available. This is accomplished by creating a Redis client and sending a random command to the server...
[ "Wait", "for", "a", "Redis", "server", "to", "be", "available", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L381-L421
[ "def", "wait_for_redis_to_start", "(", "redis_ip_address", ",", "redis_port", ",", "password", "=", "None", ",", "num_retries", "=", "5", ")", ":", "redis_client", "=", "redis", ".", "StrictRedis", "(", "host", "=", "redis_ip_address", ",", "port", "=", "redis...
4eade036a0505e244c976f36aaa2d64386b5129b
train
_autodetect_num_gpus
Attempt to detect the number of GPUs on this machine. TODO(rkn): This currently assumes Nvidia GPUs and Linux. Returns: The number of GPUs if any were detected, otherwise 0.
python/ray/services.py
def _autodetect_num_gpus(): """Attempt to detect the number of GPUs on this machine. TODO(rkn): This currently assumes Nvidia GPUs and Linux. Returns: The number of GPUs if any were detected, otherwise 0. """ proc_gpus_path = "/proc/driver/nvidia/gpus" if os.path.isdir(proc_gpus_path):...
def _autodetect_num_gpus(): """Attempt to detect the number of GPUs on this machine. TODO(rkn): This currently assumes Nvidia GPUs and Linux. Returns: The number of GPUs if any were detected, otherwise 0. """ proc_gpus_path = "/proc/driver/nvidia/gpus" if os.path.isdir(proc_gpus_path):...
[ "Attempt", "to", "detect", "the", "number", "of", "GPUs", "on", "this", "machine", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L424-L435
[ "def", "_autodetect_num_gpus", "(", ")", ":", "proc_gpus_path", "=", "\"/proc/driver/nvidia/gpus\"", "if", "os", ".", "path", ".", "isdir", "(", "proc_gpus_path", ")", ":", "return", "len", "(", "os", ".", "listdir", "(", "proc_gpus_path", ")", ")", "return", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
_compute_version_info
Compute the versions of Python, pyarrow, and Ray. Returns: A tuple containing the version information.
python/ray/services.py
def _compute_version_info(): """Compute the versions of Python, pyarrow, and Ray. Returns: A tuple containing the version information. """ ray_version = ray.__version__ python_version = ".".join(map(str, sys.version_info[:3])) pyarrow_version = pyarrow.__version__ return ray_version...
def _compute_version_info(): """Compute the versions of Python, pyarrow, and Ray. Returns: A tuple containing the version information. """ ray_version = ray.__version__ python_version = ".".join(map(str, sys.version_info[:3])) pyarrow_version = pyarrow.__version__ return ray_version...
[ "Compute", "the", "versions", "of", "Python", "pyarrow", "and", "Ray", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L438-L447
[ "def", "_compute_version_info", "(", ")", ":", "ray_version", "=", "ray", ".", "__version__", "python_version", "=", "\".\"", ".", "join", "(", "map", "(", "str", ",", "sys", ".", "version_info", "[", ":", "3", "]", ")", ")", "pyarrow_version", "=", "pya...
4eade036a0505e244c976f36aaa2d64386b5129b
train
check_version_info
Check if various version info of this process is correct. This will be used to detect if workers or drivers are started using different versions of Python, pyarrow, or Ray. If the version information is not present in Redis, then no check is done. Args: redis_client: A client for the primary R...
python/ray/services.py
def check_version_info(redis_client): """Check if various version info of this process is correct. This will be used to detect if workers or drivers are started using different versions of Python, pyarrow, or Ray. If the version information is not present in Redis, then no check is done. Args: ...
def check_version_info(redis_client): """Check if various version info of this process is correct. This will be used to detect if workers or drivers are started using different versions of Python, pyarrow, or Ray. If the version information is not present in Redis, then no check is done. Args: ...
[ "Check", "if", "various", "version", "info", "of", "this", "process", "is", "correct", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L462-L498
[ "def", "check_version_info", "(", "redis_client", ")", ":", "redis_reply", "=", "redis_client", ".", "get", "(", "\"VERSION_INFO\"", ")", "# Don't do the check if there is no version information in Redis. This", "# is to make it easier to do things like start the processes by hand.", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
start_redis
Start the Redis global state store. Args: node_ip_address: The IP address of the current node. This is only used for recording the log filenames in Redis. redirect_files: The list of (stdout, stderr) file pairs. port (int): If provided, the primary Redis shard will be started on...
python/ray/services.py
def start_redis(node_ip_address, redirect_files, port=None, redis_shard_ports=None, num_redis_shards=1, redis_max_clients=None, redirect_worker_output=False, password=None, use_credis=None, ...
def start_redis(node_ip_address, redirect_files, port=None, redis_shard_ports=None, num_redis_shards=1, redis_max_clients=None, redirect_worker_output=False, password=None, use_credis=None, ...
[ "Start", "the", "Redis", "global", "state", "store", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L501-L700
[ "def", "start_redis", "(", "node_ip_address", ",", "redirect_files", ",", "port", "=", "None", ",", "redis_shard_ports", "=", "None", ",", "num_redis_shards", "=", "1", ",", "redis_max_clients", "=", "None", ",", "redirect_worker_output", "=", "False", ",", "pas...
4eade036a0505e244c976f36aaa2d64386b5129b
train
_start_redis_instance
Start a single Redis server. Notes: If "port" is not None, then we will only use this port and try only once. Otherwise, random ports will be used and the maximum retries count is "num_retries". Args: executable (str): Full path of the redis-server executable. modules (...
python/ray/services.py
def _start_redis_instance(executable, modules, port=None, redis_max_clients=None, num_retries=20, stdout_file=None, stderr_file=None, pass...
def _start_redis_instance(executable, modules, port=None, redis_max_clients=None, num_retries=20, stdout_file=None, stderr_file=None, pass...
[ "Start", "a", "single", "Redis", "server", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L703-L841
[ "def", "_start_redis_instance", "(", "executable", ",", "modules", ",", "port", "=", "None", ",", "redis_max_clients", "=", "None", ",", "num_retries", "=", "20", ",", "stdout_file", "=", "None", ",", "stderr_file", "=", "None", ",", "password", "=", "None",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
start_log_monitor
Start a log monitor process. Args: redis_address (str): The address of the Redis instance. logs_dir (str): The directory of logging files. stdout_file: A file handle opened for writing to redirect stdout to. If no redirection should happen, then this should be None. stde...
python/ray/services.py
def start_log_monitor(redis_address, logs_dir, stdout_file=None, stderr_file=None, redis_password=None): """Start a log monitor process. Args: redis_address (str): The address of the Redis instance. logs_dir...
def start_log_monitor(redis_address, logs_dir, stdout_file=None, stderr_file=None, redis_password=None): """Start a log monitor process. Args: redis_address (str): The address of the Redis instance. logs_dir...
[ "Start", "a", "log", "monitor", "process", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L844-L877
[ "def", "start_log_monitor", "(", "redis_address", ",", "logs_dir", ",", "stdout_file", "=", "None", ",", "stderr_file", "=", "None", ",", "redis_password", "=", "None", ")", ":", "log_monitor_filepath", "=", "os", ".", "path", ".", "join", "(", "os", ".", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
start_reporter
Start a reporter process. Args: redis_address (str): The address of the Redis instance. stdout_file: A file handle opened for writing to redirect stdout to. If no redirection should happen, then this should be None. stderr_file: A file handle opened for writing to redirect stder...
python/ray/services.py
def start_reporter(redis_address, stdout_file=None, stderr_file=None, redis_password=None): """Start a reporter process. Args: redis_address (str): The address of the Redis instance. stdout_file: A file handle opened for writing to redire...
def start_reporter(redis_address, stdout_file=None, stderr_file=None, redis_password=None): """Start a reporter process. Args: redis_address (str): The address of the Redis instance. stdout_file: A file handle opened for writing to redire...
[ "Start", "a", "reporter", "process", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L880-L918
[ "def", "start_reporter", "(", "redis_address", ",", "stdout_file", "=", "None", ",", "stderr_file", "=", "None", ",", "redis_password", "=", "None", ")", ":", "reporter_filepath", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
start_dashboard
Start a dashboard process. Args: redis_address (str): The address of the Redis instance. temp_dir (str): The temporary directory used for log files and information for this Ray session. stdout_file: A file handle opened for writing to redirect stdout to. If no redire...
python/ray/services.py
def start_dashboard(redis_address, temp_dir, stdout_file=None, stderr_file=None, redis_password=None): """Start a dashboard process. Args: redis_address (str): The address of the Redis instance. temp_dir (str): The ...
def start_dashboard(redis_address, temp_dir, stdout_file=None, stderr_file=None, redis_password=None): """Start a dashboard process. Args: redis_address (str): The address of the Redis instance. temp_dir (str): The ...
[ "Start", "a", "dashboard", "process", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L921-L987
[ "def", "start_dashboard", "(", "redis_address", ",", "temp_dir", ",", "stdout_file", "=", "None", ",", "stderr_file", "=", "None", ",", "redis_password", "=", "None", ")", ":", "port", "=", "8080", "while", "True", ":", "try", ":", "port_test_socket", "=", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
check_and_update_resources
Sanity check a resource dictionary and add sensible defaults. Args: num_cpus: The number of CPUs. num_gpus: The number of GPUs. resources: A dictionary mapping resource names to resource quantities. Returns: A new resource dictionary.
python/ray/services.py
def check_and_update_resources(num_cpus, num_gpus, resources): """Sanity check a resource dictionary and add sensible defaults. Args: num_cpus: The number of CPUs. num_gpus: The number of GPUs. resources: A dictionary mapping resource names to resource quantities. Returns: ...
def check_and_update_resources(num_cpus, num_gpus, resources): """Sanity check a resource dictionary and add sensible defaults. Args: num_cpus: The number of CPUs. num_gpus: The number of GPUs. resources: A dictionary mapping resource names to resource quantities. Returns: ...
[ "Sanity", "check", "a", "resource", "dictionary", "and", "add", "sensible", "defaults", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L990-L1057
[ "def", "check_and_update_resources", "(", "num_cpus", ",", "num_gpus", ",", "resources", ")", ":", "if", "resources", "is", "None", ":", "resources", "=", "{", "}", "resources", "=", "resources", ".", "copy", "(", ")", "assert", "\"CPU\"", "not", "in", "re...
4eade036a0505e244c976f36aaa2d64386b5129b
train
start_raylet
Start a raylet, which is a combined local scheduler and object manager. Args: redis_address (str): The address of the primary Redis server. node_ip_address (str): The IP address of this node. raylet_name (str): The name of the raylet socket to create. plasma_store_name (str): The na...
python/ray/services.py
def start_raylet(redis_address, node_ip_address, raylet_name, plasma_store_name, worker_path, temp_dir, num_cpus=None, num_gpus=None, resources=None, object_manager_po...
def start_raylet(redis_address, node_ip_address, raylet_name, plasma_store_name, worker_path, temp_dir, num_cpus=None, num_gpus=None, resources=None, object_manager_po...
[ "Start", "a", "raylet", "which", "is", "a", "combined", "local", "scheduler", "and", "object", "manager", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L1060-L1206
[ "def", "start_raylet", "(", "redis_address", ",", "node_ip_address", ",", "raylet_name", ",", "plasma_store_name", ",", "worker_path", ",", "temp_dir", ",", "num_cpus", "=", "None", ",", "num_gpus", "=", "None", ",", "resources", "=", "None", ",", "object_manage...
4eade036a0505e244c976f36aaa2d64386b5129b
train
build_java_worker_command
This method assembles the command used to start a Java worker. Args: java_worker_options (str): The command options for Java worker. redis_address (str): Redis address of GCS. plasma_store_name (str): The name of the plasma store socket to connect to. raylet_name (str): T...
python/ray/services.py
def build_java_worker_command( java_worker_options, redis_address, plasma_store_name, raylet_name, redis_password, temp_dir, ): """This method assembles the command used to start a Java worker. Args: java_worker_options (str): The command options for Java...
def build_java_worker_command( java_worker_options, redis_address, plasma_store_name, raylet_name, redis_password, temp_dir, ): """This method assembles the command used to start a Java worker. Args: java_worker_options (str): The command options for Java...
[ "This", "method", "assembles", "the", "command", "used", "to", "start", "a", "Java", "worker", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L1209-L1256
[ "def", "build_java_worker_command", "(", "java_worker_options", ",", "redis_address", ",", "plasma_store_name", ",", "raylet_name", ",", "redis_password", ",", "temp_dir", ",", ")", ":", "assert", "java_worker_options", "is", "not", "None", "command", "=", "\"java \""...
4eade036a0505e244c976f36aaa2d64386b5129b
train
determine_plasma_store_config
Figure out how to configure the plasma object store. This will determine which directory to use for the plasma store (e.g., /tmp or /dev/shm) and how much memory to start the store with. On Linux, we will try to use /dev/shm unless the shared memory file system is too small, in which case we will fall ...
python/ray/services.py
def determine_plasma_store_config(object_store_memory=None, plasma_directory=None, huge_pages=False): """Figure out how to configure the plasma object store. This will determine which directory to use for the plasma store (e.g., /tmp or /d...
def determine_plasma_store_config(object_store_memory=None, plasma_directory=None, huge_pages=False): """Figure out how to configure the plasma object store. This will determine which directory to use for the plasma store (e.g., /tmp or /d...
[ "Figure", "out", "how", "to", "configure", "the", "plasma", "object", "store", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L1259-L1337
[ "def", "determine_plasma_store_config", "(", "object_store_memory", "=", "None", ",", "plasma_directory", "=", "None", ",", "huge_pages", "=", "False", ")", ":", "system_memory", "=", "ray", ".", "utils", ".", "get_system_memory", "(", ")", "# Choose a default objec...
4eade036a0505e244c976f36aaa2d64386b5129b
train
_start_plasma_store
Start a plasma store process. Args: plasma_store_memory (int): The amount of memory in bytes to start the plasma store with. use_valgrind (bool): True if the plasma store should be started inside of valgrind. If this is True, use_profiler must be False. use_profiler ...
python/ray/services.py
def _start_plasma_store(plasma_store_memory, use_valgrind=False, use_profiler=False, stdout_file=None, stderr_file=None, plasma_directory=None, huge_pages=False, ...
def _start_plasma_store(plasma_store_memory, use_valgrind=False, use_profiler=False, stdout_file=None, stderr_file=None, plasma_directory=None, huge_pages=False, ...
[ "Start", "a", "plasma", "store", "process", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L1340-L1402
[ "def", "_start_plasma_store", "(", "plasma_store_memory", ",", "use_valgrind", "=", "False", ",", "use_profiler", "=", "False", ",", "stdout_file", "=", "None", ",", "stderr_file", "=", "None", ",", "plasma_directory", "=", "None", ",", "huge_pages", "=", "False...
4eade036a0505e244c976f36aaa2d64386b5129b
train
start_plasma_store
This method starts an object store process. Args: stdout_file: A file handle opened for writing to redirect stdout to. If no redirection should happen, then this should be None. stderr_file: A file handle opened for writing to redirect stderr to. If no redirection should hap...
python/ray/services.py
def start_plasma_store(stdout_file=None, stderr_file=None, object_store_memory=None, plasma_directory=None, huge_pages=False, plasma_store_socket_name=None): """This method starts an object store proce...
def start_plasma_store(stdout_file=None, stderr_file=None, object_store_memory=None, plasma_directory=None, huge_pages=False, plasma_store_socket_name=None): """This method starts an object store proce...
[ "This", "method", "starts", "an", "object", "store", "process", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L1405-L1452
[ "def", "start_plasma_store", "(", "stdout_file", "=", "None", ",", "stderr_file", "=", "None", ",", "object_store_memory", "=", "None", ",", "plasma_directory", "=", "None", ",", "huge_pages", "=", "False", ",", "plasma_store_socket_name", "=", "None", ")", ":",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
start_worker
This method starts a worker process. Args: node_ip_address (str): The IP address of the node that this worker is running on. object_store_name (str): The socket name of the object store. raylet_name (str): The socket name of the raylet server. redis_address (str): The ad...
python/ray/services.py
def start_worker(node_ip_address, object_store_name, raylet_name, redis_address, worker_path, temp_dir, stdout_file=None, stderr_file=None): """This method starts a worker process. Args: ...
def start_worker(node_ip_address, object_store_name, raylet_name, redis_address, worker_path, temp_dir, stdout_file=None, stderr_file=None): """This method starts a worker process. Args: ...
[ "This", "method", "starts", "a", "worker", "process", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L1455-L1494
[ "def", "start_worker", "(", "node_ip_address", ",", "object_store_name", ",", "raylet_name", ",", "redis_address", ",", "worker_path", ",", "temp_dir", ",", "stdout_file", "=", "None", ",", "stderr_file", "=", "None", ")", ":", "command", "=", "[", "sys", ".",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
start_monitor
Run a process to monitor the other processes. Args: redis_address (str): The address that the Redis server is listening on. stdout_file: A file handle opened for writing to redirect stdout to. If no redirection should happen, then this should be None. stderr_file: A file handle ...
python/ray/services.py
def start_monitor(redis_address, stdout_file=None, stderr_file=None, autoscaling_config=None, redis_password=None): """Run a process to monitor the other processes. Args: redis_address (str): The address that the Redis server is li...
def start_monitor(redis_address, stdout_file=None, stderr_file=None, autoscaling_config=None, redis_password=None): """Run a process to monitor the other processes. Args: redis_address (str): The address that the Redis server is li...
[ "Run", "a", "process", "to", "monitor", "the", "other", "processes", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L1497-L1531
[ "def", "start_monitor", "(", "redis_address", ",", "stdout_file", "=", "None", ",", "stderr_file", "=", "None", ",", "autoscaling_config", "=", "None", ",", "redis_password", "=", "None", ")", ":", "monitor_path", "=", "os", ".", "path", ".", "join", "(", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
start_raylet_monitor
Run a process to monitor the other processes. Args: redis_address (str): The address that the Redis server is listening on. stdout_file: A file handle opened for writing to redirect stdout to. If no redirection should happen, then this should be None. stderr_file: A file handle ...
python/ray/services.py
def start_raylet_monitor(redis_address, stdout_file=None, stderr_file=None, redis_password=None, config=None): """Run a process to monitor the other processes. Args: redis_address (str): The address that...
def start_raylet_monitor(redis_address, stdout_file=None, stderr_file=None, redis_password=None, config=None): """Run a process to monitor the other processes. Args: redis_address (str): The address that...
[ "Run", "a", "process", "to", "monitor", "the", "other", "processes", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/services.py#L1534-L1571
[ "def", "start_raylet_monitor", "(", "redis_address", ",", "stdout_file", "=", "None", ",", "stderr_file", "=", "None", ",", "redis_password", "=", "None", ",", "config", "=", "None", ")", ":", "gcs_ip_address", ",", "gcs_port", "=", "redis_address", ".", "spli...
4eade036a0505e244c976f36aaa2d64386b5129b
train
restore_original_dimensions
Unpacks Dict and Tuple space observations into their original form. This is needed since we flatten Dict and Tuple observations in transit. Before sending them to the model though, we should unflatten them into Dicts or Tuples of tensors. Arguments: obs: The flattened observation tensor. ...
python/ray/rllib/models/model.py
def restore_original_dimensions(obs, obs_space, tensorlib=tf): """Unpacks Dict and Tuple space observations into their original form. This is needed since we flatten Dict and Tuple observations in transit. Before sending them to the model though, we should unflatten them into Dicts or Tuples of tensors...
def restore_original_dimensions(obs, obs_space, tensorlib=tf): """Unpacks Dict and Tuple space observations into their original form. This is needed since we flatten Dict and Tuple observations in transit. Before sending them to the model though, we should unflatten them into Dicts or Tuples of tensors...
[ "Unpacks", "Dict", "and", "Tuple", "space", "observations", "into", "their", "original", "form", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/models/model.py#L208-L229
[ "def", "restore_original_dimensions", "(", "obs", ",", "obs_space", ",", "tensorlib", "=", "tf", ")", ":", "if", "hasattr", "(", "obs_space", ",", "\"original_space\"", ")", ":", "return", "_unpack_obs", "(", "obs", ",", "obs_space", ".", "original_space", ","...
4eade036a0505e244c976f36aaa2d64386b5129b
train
_unpack_obs
Unpack a flattened Dict or Tuple observation array/tensor. Arguments: obs: The flattened observation tensor space: The original space prior to flattening tensorlib: The library used to unflatten (reshape) the array/tensor
python/ray/rllib/models/model.py
def _unpack_obs(obs, space, tensorlib=tf): """Unpack a flattened Dict or Tuple observation array/tensor. Arguments: obs: The flattened observation tensor space: The original space prior to flattening tensorlib: The library used to unflatten (reshape) the array/tensor """ if (is...
def _unpack_obs(obs, space, tensorlib=tf): """Unpack a flattened Dict or Tuple observation array/tensor. Arguments: obs: The flattened observation tensor space: The original space prior to flattening tensorlib: The library used to unflatten (reshape) the array/tensor """ if (is...
[ "Unpack", "a", "flattened", "Dict", "or", "Tuple", "observation", "array", "/", "tensor", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/models/model.py#L232-L272
[ "def", "_unpack_obs", "(", "obs", ",", "space", ",", "tensorlib", "=", "tf", ")", ":", "if", "(", "isinstance", "(", "space", ",", "gym", ".", "spaces", ".", "Dict", ")", "or", "isinstance", "(", "space", ",", "gym", ".", "spaces", ".", "Tuple", ")...
4eade036a0505e244c976f36aaa2d64386b5129b
train
to_aws_format
Convert the Ray node name tag to the AWS-specific 'Name' tag.
python/ray/autoscaler/aws/node_provider.py
def to_aws_format(tags): """Convert the Ray node name tag to the AWS-specific 'Name' tag.""" if TAG_RAY_NODE_NAME in tags: tags["Name"] = tags[TAG_RAY_NODE_NAME] del tags[TAG_RAY_NODE_NAME] return tags
def to_aws_format(tags): """Convert the Ray node name tag to the AWS-specific 'Name' tag.""" if TAG_RAY_NODE_NAME in tags: tags["Name"] = tags[TAG_RAY_NODE_NAME] del tags[TAG_RAY_NODE_NAME] return tags
[ "Convert", "the", "Ray", "node", "name", "tag", "to", "the", "AWS", "-", "specific", "Name", "tag", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/aws/node_provider.py#L18-L24
[ "def", "to_aws_format", "(", "tags", ")", ":", "if", "TAG_RAY_NODE_NAME", "in", "tags", ":", "tags", "[", "\"Name\"", "]", "=", "tags", "[", "TAG_RAY_NODE_NAME", "]", "del", "tags", "[", "TAG_RAY_NODE_NAME", "]", "return", "tags" ]
4eade036a0505e244c976f36aaa2d64386b5129b
train
AWSNodeProvider._node_tag_update_loop
Update the AWS tags for a cluster periodically. The purpose of this loop is to avoid excessive EC2 calls when a large number of nodes are being launched simultaneously.
python/ray/autoscaler/aws/node_provider.py
def _node_tag_update_loop(self): """ Update the AWS tags for a cluster periodically. The purpose of this loop is to avoid excessive EC2 calls when a large number of nodes are being launched simultaneously. """ while True: self.tag_cache_update_event.wait() ...
def _node_tag_update_loop(self): """ Update the AWS tags for a cluster periodically. The purpose of this loop is to avoid excessive EC2 calls when a large number of nodes are being launched simultaneously. """ while True: self.tag_cache_update_event.wait() ...
[ "Update", "the", "AWS", "tags", "for", "a", "cluster", "periodically", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/aws/node_provider.py#L59-L94
[ "def", "_node_tag_update_loop", "(", "self", ")", ":", "while", "True", ":", "self", ".", "tag_cache_update_event", ".", "wait", "(", ")", "self", ".", "tag_cache_update_event", ".", "clear", "(", ")", "batch_updates", "=", "defaultdict", "(", "list", ")", "...
4eade036a0505e244c976f36aaa2d64386b5129b
train
AWSNodeProvider._get_node
Refresh and get info for this node, updating the cache.
python/ray/autoscaler/aws/node_provider.py
def _get_node(self, node_id): """Refresh and get info for this node, updating the cache.""" self.non_terminated_nodes({}) # Side effect: updates cache if node_id in self.cached_nodes: return self.cached_nodes[node_id] # Node not in {pending, running} -- retry with a point ...
def _get_node(self, node_id): """Refresh and get info for this node, updating the cache.""" self.non_terminated_nodes({}) # Side effect: updates cache if node_id in self.cached_nodes: return self.cached_nodes[node_id] # Node not in {pending, running} -- retry with a point ...
[ "Refresh", "and", "get", "info", "for", "this", "node", "updating", "the", "cache", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/aws/node_provider.py#L231-L242
[ "def", "_get_node", "(", "self", ",", "node_id", ")", ":", "self", ".", "non_terminated_nodes", "(", "{", "}", ")", "# Side effect: updates cache", "if", "node_id", "in", "self", ".", "cached_nodes", ":", "return", "self", ".", "cached_nodes", "[", "node_id", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
ExportFormat.validate
Validates export_formats. Raises: ValueError if the format is unknown.
python/ray/tune/trial.py
def validate(export_formats): """Validates export_formats. Raises: ValueError if the format is unknown. """ for i in range(len(export_formats)): export_formats[i] = export_formats[i].strip().lower() if export_formats[i] not in [ Ex...
def validate(export_formats): """Validates export_formats. Raises: ValueError if the format is unknown. """ for i in range(len(export_formats)): export_formats[i] = export_formats[i].strip().lower() if export_formats[i] not in [ Ex...
[ "Validates", "export_formats", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial.py#L215-L227
[ "def", "validate", "(", "export_formats", ")", ":", "for", "i", "in", "range", "(", "len", "(", "export_formats", ")", ")", ":", "export_formats", "[", "i", "]", "=", "export_formats", "[", "i", "]", ".", "strip", "(", ")", ".", "lower", "(", ")", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
Trial.init_logger
Init logger.
python/ray/tune/trial.py
def init_logger(self): """Init logger.""" if not self.result_logger: if not os.path.exists(self.local_dir): os.makedirs(self.local_dir) if not self.logdir: self.logdir = tempfile.mkdtemp( prefix="{}_{}".format( ...
def init_logger(self): """Init logger.""" if not self.result_logger: if not os.path.exists(self.local_dir): os.makedirs(self.local_dir) if not self.logdir: self.logdir = tempfile.mkdtemp( prefix="{}_{}".format( ...
[ "Init", "logger", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial.py#L346-L365
[ "def", "init_logger", "(", "self", ")", ":", "if", "not", "self", ".", "result_logger", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "local_dir", ")", ":", "os", ".", "makedirs", "(", "self", ".", "local_dir", ")", "if", "n...
4eade036a0505e244c976f36aaa2d64386b5129b
train
Trial.update_resources
EXPERIMENTAL: Updates the resource requirements. Should only be called when the trial is not running. Raises: ValueError if trial status is running.
python/ray/tune/trial.py
def update_resources(self, cpu, gpu, **kwargs): """EXPERIMENTAL: Updates the resource requirements. Should only be called when the trial is not running. Raises: ValueError if trial status is running. """ if self.status is Trial.RUNNING: raise ValueError(...
def update_resources(self, cpu, gpu, **kwargs): """EXPERIMENTAL: Updates the resource requirements. Should only be called when the trial is not running. Raises: ValueError if trial status is running. """ if self.status is Trial.RUNNING: raise ValueError(...
[ "EXPERIMENTAL", ":", "Updates", "the", "resource", "requirements", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial.py#L367-L377
[ "def", "update_resources", "(", "self", ",", "cpu", ",", "gpu", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "status", "is", "Trial", ".", "RUNNING", ":", "raise", "ValueError", "(", "\"Cannot update resources while Trial is running.\"", ")", "self", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
Trial.should_stop
Whether the given result meets this trial's stopping criteria.
python/ray/tune/trial.py
def should_stop(self, result): """Whether the given result meets this trial's stopping criteria.""" if result.get(DONE): return True for criteria, stop_value in self.stopping_criterion.items(): if criteria not in result: raise TuneError( ...
def should_stop(self, result): """Whether the given result meets this trial's stopping criteria.""" if result.get(DONE): return True for criteria, stop_value in self.stopping_criterion.items(): if criteria not in result: raise TuneError( ...
[ "Whether", "the", "given", "result", "meets", "this", "trial", "s", "stopping", "criteria", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial.py#L403-L417
[ "def", "should_stop", "(", "self", ",", "result", ")", ":", "if", "result", ".", "get", "(", "DONE", ")", ":", "return", "True", "for", "criteria", ",", "stop_value", "in", "self", ".", "stopping_criterion", ".", "items", "(", ")", ":", "if", "criteria...
4eade036a0505e244c976f36aaa2d64386b5129b
train
Trial.should_checkpoint
Whether this trial is due for checkpointing.
python/ray/tune/trial.py
def should_checkpoint(self): """Whether this trial is due for checkpointing.""" result = self.last_result or {} if result.get(DONE) and self.checkpoint_at_end: return True if self.checkpoint_freq: return result.get(TRAINING_ITERATION, ...
def should_checkpoint(self): """Whether this trial is due for checkpointing.""" result = self.last_result or {} if result.get(DONE) and self.checkpoint_at_end: return True if self.checkpoint_freq: return result.get(TRAINING_ITERATION, ...
[ "Whether", "this", "trial", "is", "due", "for", "checkpointing", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial.py#L419-L430
[ "def", "should_checkpoint", "(", "self", ")", ":", "result", "=", "self", ".", "last_result", "or", "{", "}", "if", "result", ".", "get", "(", "DONE", ")", "and", "self", ".", "checkpoint_at_end", ":", "return", "True", "if", "self", ".", "checkpoint_fre...
4eade036a0505e244c976f36aaa2d64386b5129b
train
Trial.progress_string
Returns a progress message for printing out to the console.
python/ray/tune/trial.py
def progress_string(self): """Returns a progress message for printing out to the console.""" if not self.last_result: return self._status_string() def location_string(hostname, pid): if hostname == os.uname()[1]: return "pid={}".format(pid) e...
def progress_string(self): """Returns a progress message for printing out to the console.""" if not self.last_result: return self._status_string() def location_string(hostname, pid): if hostname == os.uname()[1]: return "pid={}".format(pid) e...
[ "Returns", "a", "progress", "message", "for", "printing", "out", "to", "the", "console", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial.py#L432-L472
[ "def", "progress_string", "(", "self", ")", ":", "if", "not", "self", ".", "last_result", ":", "return", "self", ".", "_status_string", "(", ")", "def", "location_string", "(", "hostname", ",", "pid", ")", ":", "if", "hostname", "==", "os", ".", "uname",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
Trial.should_recover
Returns whether the trial qualifies for restoring. This is if a checkpoint frequency is set and has not failed more than max_failures. This may return true even when there may not yet be a checkpoint.
python/ray/tune/trial.py
def should_recover(self): """Returns whether the trial qualifies for restoring. This is if a checkpoint frequency is set and has not failed more than max_failures. This may return true even when there may not yet be a checkpoint. """ return (self.checkpoint_freq > 0 ...
def should_recover(self): """Returns whether the trial qualifies for restoring. This is if a checkpoint frequency is set and has not failed more than max_failures. This may return true even when there may not yet be a checkpoint. """ return (self.checkpoint_freq > 0 ...
[ "Returns", "whether", "the", "trial", "qualifies", "for", "restoring", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial.py#L486-L495
[ "def", "should_recover", "(", "self", ")", ":", "return", "(", "self", ".", "checkpoint_freq", ">", "0", "and", "(", "self", ".", "num_failures", "<", "self", ".", "max_failures", "or", "self", ".", "max_failures", "<", "0", ")", ")" ]
4eade036a0505e244c976f36aaa2d64386b5129b
train
Trial.compare_checkpoints
Compares two checkpoints based on the attribute attr_mean param. Greater than is used by default. If command-line parameter checkpoint_score_attr starts with "min-" less than is used. Arguments: attr_mean: mean of attribute value for the current checkpoint Returns: ...
python/ray/tune/trial.py
def compare_checkpoints(self, attr_mean): """Compares two checkpoints based on the attribute attr_mean param. Greater than is used by default. If command-line parameter checkpoint_score_attr starts with "min-" less than is used. Arguments: attr_mean: mean of attribute value...
def compare_checkpoints(self, attr_mean): """Compares two checkpoints based on the attribute attr_mean param. Greater than is used by default. If command-line parameter checkpoint_score_attr starts with "min-" less than is used. Arguments: attr_mean: mean of attribute value...
[ "Compares", "two", "checkpoints", "based", "on", "the", "attribute", "attr_mean", "param", ".", "Greater", "than", "is", "used", "by", "default", ".", "If", "command", "-", "line", "parameter", "checkpoint_score_attr", "starts", "with", "min", "-", "less", "th...
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/trial.py#L509-L529
[ "def", "compare_checkpoints", "(", "self", ",", "attr_mean", ")", ":", "if", "self", ".", "_cmp_greater", "and", "attr_mean", ">", "self", ".", "best_checkpoint_attr_value", ":", "return", "True", "elif", "(", "not", "self", ".", "_cmp_greater", "and", "attr_m...
4eade036a0505e244c976f36aaa2d64386b5129b
train
preprocess
Preprocess 210x160x3 uint8 frame into 6400 (80x80) 1D float vector.
examples/rl_pong/driver.py
def preprocess(img): """Preprocess 210x160x3 uint8 frame into 6400 (80x80) 1D float vector.""" # Crop the image. img = img[35:195] # Downsample by factor of 2. img = img[::2, ::2, 0] # Erase background (background type 1). img[img == 144] = 0 # Erase background (background type 2). i...
def preprocess(img): """Preprocess 210x160x3 uint8 frame into 6400 (80x80) 1D float vector.""" # Crop the image. img = img[35:195] # Downsample by factor of 2. img = img[::2, ::2, 0] # Erase background (background type 1). img[img == 144] = 0 # Erase background (background type 2). i...
[ "Preprocess", "210x160x3", "uint8", "frame", "into", "6400", "(", "80x80", ")", "1D", "float", "vector", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/examples/rl_pong/driver.py#L35-L47
[ "def", "preprocess", "(", "img", ")", ":", "# Crop the image.", "img", "=", "img", "[", "35", ":", "195", "]", "# Downsample by factor of 2.", "img", "=", "img", "[", ":", ":", "2", ",", ":", ":", "2", ",", "0", "]", "# Erase background (background type 1)...
4eade036a0505e244c976f36aaa2d64386b5129b
train
discount_rewards
take 1D float array of rewards and compute discounted reward
examples/rl_pong/driver.py
def discount_rewards(r): """take 1D float array of rewards and compute discounted reward""" discounted_r = np.zeros_like(r) running_add = 0 for t in reversed(range(0, r.size)): # Reset the sum, since this was a game boundary (pong specific!). if r[t] != 0: running_add = 0 ...
def discount_rewards(r): """take 1D float array of rewards and compute discounted reward""" discounted_r = np.zeros_like(r) running_add = 0 for t in reversed(range(0, r.size)): # Reset the sum, since this was a game boundary (pong specific!). if r[t] != 0: running_add = 0 ...
[ "take", "1D", "float", "array", "of", "rewards", "and", "compute", "discounted", "reward" ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/examples/rl_pong/driver.py#L50-L60
[ "def", "discount_rewards", "(", "r", ")", ":", "discounted_r", "=", "np", ".", "zeros_like", "(", "r", ")", "running_add", "=", "0", "for", "t", "in", "reversed", "(", "range", "(", "0", ",", "r", ".", "size", ")", ")", ":", "# Reset the sum, since thi...
4eade036a0505e244c976f36aaa2d64386b5129b
train
policy_backward
backward pass. (eph is array of intermediate hidden states)
examples/rl_pong/driver.py
def policy_backward(eph, epx, epdlogp, model): """backward pass. (eph is array of intermediate hidden states)""" dW2 = np.dot(eph.T, epdlogp).ravel() dh = np.outer(epdlogp, model["W2"]) # Backprop relu. dh[eph <= 0] = 0 dW1 = np.dot(dh.T, epx) return {"W1": dW1, "W2": dW2}
def policy_backward(eph, epx, epdlogp, model): """backward pass. (eph is array of intermediate hidden states)""" dW2 = np.dot(eph.T, epdlogp).ravel() dh = np.outer(epdlogp, model["W2"]) # Backprop relu. dh[eph <= 0] = 0 dW1 = np.dot(dh.T, epx) return {"W1": dW1, "W2": dW2}
[ "backward", "pass", ".", "(", "eph", "is", "array", "of", "intermediate", "hidden", "states", ")" ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/examples/rl_pong/driver.py#L72-L79
[ "def", "policy_backward", "(", "eph", ",", "epx", ",", "epdlogp", ",", "model", ")", ":", "dW2", "=", "np", ".", "dot", "(", "eph", ".", "T", ",", "epdlogp", ")", ".", "ravel", "(", ")", "dh", "=", "np", ".", "outer", "(", "epdlogp", ",", "mode...
4eade036a0505e244c976f36aaa2d64386b5129b
train
load_class
Load a class at runtime given a full path. Example of the path: mypkg.mysubpkg.myclass
python/ray/autoscaler/node_provider.py
def load_class(path): """ Load a class at runtime given a full path. Example of the path: mypkg.mysubpkg.myclass """ class_data = path.split(".") if len(class_data) < 2: raise ValueError( "You need to pass a valid path like mymodule.provider_class") module_path = ".".joi...
def load_class(path): """ Load a class at runtime given a full path. Example of the path: mypkg.mysubpkg.myclass """ class_data = path.split(".") if len(class_data) < 2: raise ValueError( "You need to pass a valid path like mymodule.provider_class") module_path = ".".joi...
[ "Load", "a", "class", "at", "runtime", "given", "a", "full", "path", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/node_provider.py#L76-L89
[ "def", "load_class", "(", "path", ")", ":", "class_data", "=", "path", ".", "split", "(", "\".\"", ")", "if", "len", "(", "class_data", ")", "<", "2", ":", "raise", "ValueError", "(", "\"You need to pass a valid path like mymodule.provider_class\"", ")", "module...
4eade036a0505e244c976f36aaa2d64386b5129b
train
NodeProvider.terminate_nodes
Terminates a set of nodes. May be overridden with a batch method.
python/ray/autoscaler/node_provider.py
def terminate_nodes(self, node_ids): """Terminates a set of nodes. May be overridden with a batch method.""" for node_id in node_ids: logger.info("NodeProvider: " "{}: Terminating node".format(node_id)) self.terminate_node(node_id)
def terminate_nodes(self, node_ids): """Terminates a set of nodes. May be overridden with a batch method.""" for node_id in node_ids: logger.info("NodeProvider: " "{}: Terminating node".format(node_id)) self.terminate_node(node_id)
[ "Terminates", "a", "set", "of", "nodes", ".", "May", "be", "overridden", "with", "a", "batch", "method", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/autoscaler/node_provider.py#L181-L186
[ "def", "terminate_nodes", "(", "self", ",", "node_ids", ")", ":", "for", "node_id", "in", "node_ids", ":", "logger", ".", "info", "(", "\"NodeProvider: \"", "\"{}: Terminating node\"", ".", "format", "(", "node_id", ")", ")", "self", ".", "terminate_node", "("...
4eade036a0505e244c976f36aaa2d64386b5129b
train
BayesOptSearch.on_trial_complete
Passes the result to BayesOpt unless early terminated or errored
python/ray/tune/suggest/bayesopt.py
def on_trial_complete(self, trial_id, result=None, error=False, early_terminated=False): """Passes the result to BayesOpt unless early terminated or errored""" if result: self.optimizer.re...
def on_trial_complete(self, trial_id, result=None, error=False, early_terminated=False): """Passes the result to BayesOpt unless early terminated or errored""" if result: self.optimizer.re...
[ "Passes", "the", "result", "to", "BayesOpt", "unless", "early", "terminated", "or", "errored" ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/suggest/bayesopt.py#L79-L90
[ "def", "on_trial_complete", "(", "self", ",", "trial_id", ",", "result", "=", "None", ",", "error", "=", "False", ",", "early_terminated", "=", "False", ")", ":", "if", "result", ":", "self", ".", "optimizer", ".", "register", "(", "params", "=", "self",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
_execute_and_seal_error
Execute method with arg and return the result. If the method fails, return a RayTaskError so it can be sealed in the resultOID and retried by user.
python/ray/experimental/serve/mixin.py
def _execute_and_seal_error(method, arg, method_name): """Execute method with arg and return the result. If the method fails, return a RayTaskError so it can be sealed in the resultOID and retried by user. """ try: return method(arg) except Exception: return ray.worker.RayTaskEr...
def _execute_and_seal_error(method, arg, method_name): """Execute method with arg and return the result. If the method fails, return a RayTaskError so it can be sealed in the resultOID and retried by user. """ try: return method(arg) except Exception: return ray.worker.RayTaskEr...
[ "Execute", "method", "with", "arg", "and", "return", "the", "result", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/serve/mixin.py#L21-L30
[ "def", "_execute_and_seal_error", "(", "method", ",", "arg", ",", "method_name", ")", ":", "try", ":", "return", "method", "(", "arg", ")", "except", "Exception", ":", "return", "ray", ".", "worker", ".", "RayTaskError", "(", "method_name", ",", "traceback",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
RayServeMixin._dispatch
Helper method to dispatch a batch of input to self.serve_method.
python/ray/experimental/serve/mixin.py
def _dispatch(self, input_batch: List[SingleQuery]): """Helper method to dispatch a batch of input to self.serve_method.""" method = getattr(self, self.serve_method) if hasattr(method, "ray_serve_batched_input"): batch = [inp.data for inp in input_batch] result = _execute...
def _dispatch(self, input_batch: List[SingleQuery]): """Helper method to dispatch a batch of input to self.serve_method.""" method = getattr(self, self.serve_method) if hasattr(method, "ray_serve_batched_input"): batch = [inp.data for inp in input_batch] result = _execute...
[ "Helper", "method", "to", "dispatch", "a", "batch", "of", "input", "to", "self", ".", "serve_method", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/serve/mixin.py#L50-L63
[ "def", "_dispatch", "(", "self", ",", "input_batch", ":", "List", "[", "SingleQuery", "]", ")", ":", "method", "=", "getattr", "(", "self", ",", "self", ".", "serve_method", ")", "if", "hasattr", "(", "method", ",", "\"ray_serve_batched_input\"", ")", ":",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
get_wrapper_by_cls
Returns the gym env wrapper of the given class, or None.
python/ray/rllib/env/atari_wrappers.py
def get_wrapper_by_cls(env, cls): """Returns the gym env wrapper of the given class, or None.""" currentenv = env while True: if isinstance(currentenv, cls): return currentenv elif isinstance(currentenv, gym.Wrapper): currentenv = currentenv.env else: ...
def get_wrapper_by_cls(env, cls): """Returns the gym env wrapper of the given class, or None.""" currentenv = env while True: if isinstance(currentenv, cls): return currentenv elif isinstance(currentenv, gym.Wrapper): currentenv = currentenv.env else: ...
[ "Returns", "the", "gym", "env", "wrapper", "of", "the", "given", "class", "or", "None", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/env/atari_wrappers.py#L17-L26
[ "def", "get_wrapper_by_cls", "(", "env", ",", "cls", ")", ":", "currentenv", "=", "env", "while", "True", ":", "if", "isinstance", "(", "currentenv", ",", "cls", ")", ":", "return", "currentenv", "elif", "isinstance", "(", "currentenv", ",", "gym", ".", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
wrap_deepmind
Configure environment for DeepMind-style Atari. Note that we assume reward clipping is done outside the wrapper. Args: dim (int): Dimension to resize observations to (dim x dim). framestack (bool): Whether to framestack observations.
python/ray/rllib/env/atari_wrappers.py
def wrap_deepmind(env, dim=84, framestack=True): """Configure environment for DeepMind-style Atari. Note that we assume reward clipping is done outside the wrapper. Args: dim (int): Dimension to resize observations to (dim x dim). framestack (bool): Whether to framestack observations. ...
def wrap_deepmind(env, dim=84, framestack=True): """Configure environment for DeepMind-style Atari. Note that we assume reward clipping is done outside the wrapper. Args: dim (int): Dimension to resize observations to (dim x dim). framestack (bool): Whether to framestack observations. ...
[ "Configure", "environment", "for", "DeepMind", "-", "style", "Atari", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/env/atari_wrappers.py#L270-L291
[ "def", "wrap_deepmind", "(", "env", ",", "dim", "=", "84", ",", "framestack", "=", "True", ")", ":", "env", "=", "MonitorEnv", "(", "env", ")", "env", "=", "NoopResetEnv", "(", "env", ",", "noop_max", "=", "30", ")", "if", "\"NoFrameskip\"", "in", "e...
4eade036a0505e244c976f36aaa2d64386b5129b
train
valid_padding
Note: Padding is added to match TF conv2d `same` padding. See www.tensorflow.org/versions/r0.12/api_docs/python/nn/convolution Params: in_size (tuple): Rows (Height), Column (Width) for input stride_size (tuple): Rows (Height), Column (Width) for stride filter_size (tuple): Rows (Height...
python/ray/rllib/models/pytorch/misc.py
def valid_padding(in_size, filter_size, stride_size): """Note: Padding is added to match TF conv2d `same` padding. See www.tensorflow.org/versions/r0.12/api_docs/python/nn/convolution Params: in_size (tuple): Rows (Height), Column (Width) for input stride_size (tuple): Rows (Height), Column...
def valid_padding(in_size, filter_size, stride_size): """Note: Padding is added to match TF conv2d `same` padding. See www.tensorflow.org/versions/r0.12/api_docs/python/nn/convolution Params: in_size (tuple): Rows (Height), Column (Width) for input stride_size (tuple): Rows (Height), Column...
[ "Note", ":", "Padding", "is", "added", "to", "match", "TF", "conv2d", "same", "padding", ".", "See", "www", ".", "tensorflow", ".", "org", "/", "versions", "/", "r0", ".", "12", "/", "api_docs", "/", "python", "/", "nn", "/", "convolution" ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/models/pytorch/misc.py#L20-L50
[ "def", "valid_padding", "(", "in_size", ",", "filter_size", ",", "stride_size", ")", ":", "in_height", ",", "in_width", "=", "in_size", "filter_height", ",", "filter_width", "=", "filter_size", "stride_height", ",", "stride_width", "=", "stride_size", "out_height", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
ray_get_and_free
Call ray.get and then queue the object ids for deletion. This function should be used whenever possible in RLlib, to optimize memory usage. The only exception is when an object_id is shared among multiple readers. Args: object_ids (ObjectID|List[ObjectID]): Object ids to fetch and free. R...
python/ray/rllib/utils/memory.py
def ray_get_and_free(object_ids): """Call ray.get and then queue the object ids for deletion. This function should be used whenever possible in RLlib, to optimize memory usage. The only exception is when an object_id is shared among multiple readers. Args: object_ids (ObjectID|List[ObjectI...
def ray_get_and_free(object_ids): """Call ray.get and then queue the object ids for deletion. This function should be used whenever possible in RLlib, to optimize memory usage. The only exception is when an object_id is shared among multiple readers. Args: object_ids (ObjectID|List[ObjectI...
[ "Call", "ray", ".", "get", "and", "then", "queue", "the", "object", "ids", "for", "deletion", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/utils/memory.py#L16-L46
[ "def", "ray_get_and_free", "(", "object_ids", ")", ":", "global", "_last_free_time", "global", "_to_free", "result", "=", "ray", ".", "get", "(", "object_ids", ")", "if", "type", "(", "object_ids", ")", "is", "not", "list", ":", "object_ids", "=", "[", "ob...
4eade036a0505e244c976f36aaa2d64386b5129b
train
aligned_array
Returns an array of a given size that is 64-byte aligned. The returned array can be efficiently copied into GPU memory by TensorFlow.
python/ray/rllib/utils/memory.py
def aligned_array(size, dtype, align=64): """Returns an array of a given size that is 64-byte aligned. The returned array can be efficiently copied into GPU memory by TensorFlow. """ n = size * dtype.itemsize empty = np.empty(n + (align - 1), dtype=np.uint8) data_align = empty.ctypes.data % al...
def aligned_array(size, dtype, align=64): """Returns an array of a given size that is 64-byte aligned. The returned array can be efficiently copied into GPU memory by TensorFlow. """ n = size * dtype.itemsize empty = np.empty(n + (align - 1), dtype=np.uint8) data_align = empty.ctypes.data % al...
[ "Returns", "an", "array", "of", "a", "given", "size", "that", "is", "64", "-", "byte", "aligned", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/utils/memory.py#L49-L63
[ "def", "aligned_array", "(", "size", ",", "dtype", ",", "align", "=", "64", ")", ":", "n", "=", "size", "*", "dtype", ".", "itemsize", "empty", "=", "np", ".", "empty", "(", "n", "+", "(", "align", "-", "1", ")", ",", "dtype", "=", "np", ".", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
concat_aligned
Concatenate arrays, ensuring the output is 64-byte aligned. We only align float arrays; other arrays are concatenated as normal. This should be used instead of np.concatenate() to improve performance when the output array is likely to be fed into TensorFlow.
python/ray/rllib/utils/memory.py
def concat_aligned(items): """Concatenate arrays, ensuring the output is 64-byte aligned. We only align float arrays; other arrays are concatenated as normal. This should be used instead of np.concatenate() to improve performance when the output array is likely to be fed into TensorFlow. """ ...
def concat_aligned(items): """Concatenate arrays, ensuring the output is 64-byte aligned. We only align float arrays; other arrays are concatenated as normal. This should be used instead of np.concatenate() to improve performance when the output array is likely to be fed into TensorFlow. """ ...
[ "Concatenate", "arrays", "ensuring", "the", "output", "is", "64", "-", "byte", "aligned", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/utils/memory.py#L66-L92
[ "def", "concat_aligned", "(", "items", ")", ":", "if", "len", "(", "items", ")", "==", "0", ":", "return", "[", "]", "elif", "len", "(", "items", ")", "==", "1", ":", "# we assume the input is aligned. In any case, it doesn't help", "# performance to force align i...
4eade036a0505e244c976f36aaa2d64386b5129b
train
Queue.put
Adds an item to the queue. Uses polling if block=True, so there is no guarantee of order if multiple producers put to the same full queue. Raises: Full if the queue is full and blocking is False.
python/ray/experimental/queue.py
def put(self, item, block=True, timeout=None): """Adds an item to the queue. Uses polling if block=True, so there is no guarantee of order if multiple producers put to the same full queue. Raises: Full if the queue is full and blocking is False. """ if self....
def put(self, item, block=True, timeout=None): """Adds an item to the queue. Uses polling if block=True, so there is no guarantee of order if multiple producers put to the same full queue. Raises: Full if the queue is full and blocking is False. """ if self....
[ "Adds", "an", "item", "to", "the", "queue", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/queue.py#L49-L79
[ "def", "put", "(", "self", ",", "item", ",", "block", "=", "True", ",", "timeout", "=", "None", ")", ":", "if", "self", ".", "maxsize", "<=", "0", ":", "self", ".", "actor", ".", "put", ".", "remote", "(", "item", ")", "elif", "not", "block", "...
4eade036a0505e244c976f36aaa2d64386b5129b
train
Queue.get
Gets an item from the queue. Uses polling if block=True, so there is no guarantee of order if multiple consumers get from the same empty queue. Returns: The next item in the queue. Raises: Empty if the queue is empty and blocking is False.
python/ray/experimental/queue.py
def get(self, block=True, timeout=None): """Gets an item from the queue. Uses polling if block=True, so there is no guarantee of order if multiple consumers get from the same empty queue. Returns: The next item in the queue. Raises: Empty if the queue i...
def get(self, block=True, timeout=None): """Gets an item from the queue. Uses polling if block=True, so there is no guarantee of order if multiple consumers get from the same empty queue. Returns: The next item in the queue. Raises: Empty if the queue i...
[ "Gets", "an", "item", "from", "the", "queue", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/queue.py#L81-L115
[ "def", "get", "(", "self", ",", "block", "=", "True", ",", "timeout", "=", "None", ")", ":", "if", "not", "block", ":", "success", ",", "item", "=", "ray", ".", "get", "(", "self", ".", "actor", ".", "get", ".", "remote", "(", ")", ")", "if", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
override
Annotation for documenting method overrides. Arguments: cls (type): The superclass that provides the overriden method. If this cls does not actually have the method, an error is raised.
python/ray/rllib/utils/annotations.py
def override(cls): """Annotation for documenting method overrides. Arguments: cls (type): The superclass that provides the overriden method. If this cls does not actually have the method, an error is raised. """ def check_override(method): if method.__name__ not in dir(cls)...
def override(cls): """Annotation for documenting method overrides. Arguments: cls (type): The superclass that provides the overriden method. If this cls does not actually have the method, an error is raised. """ def check_override(method): if method.__name__ not in dir(cls)...
[ "Annotation", "for", "documenting", "method", "overrides", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/rllib/utils/annotations.py#L6-L20
[ "def", "override", "(", "cls", ")", ":", "def", "check_override", "(", "method", ")", ":", "if", "method", ".", "__name__", "not", "in", "dir", "(", "cls", ")", ":", "raise", "NameError", "(", "\"{} does not override any method of {}\"", ".", "format", "(", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
HyperBandScheduler.on_trial_add
Adds new trial. On a new trial add, if current bracket is not filled, add to current bracket. Else, if current band is not filled, create new bracket, add to current bracket. Else, create new iteration, create new bracket, add to bracket.
python/ray/tune/schedulers/hyperband.py
def on_trial_add(self, trial_runner, trial): """Adds new trial. On a new trial add, if current bracket is not filled, add to current bracket. Else, if current band is not filled, create new bracket, add to current bracket. Else, create new iteration, create new bracket, add to b...
def on_trial_add(self, trial_runner, trial): """Adds new trial. On a new trial add, if current bracket is not filled, add to current bracket. Else, if current band is not filled, create new bracket, add to current bracket. Else, create new iteration, create new bracket, add to b...
[ "Adds", "new", "trial", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L98-L132
[ "def", "on_trial_add", "(", "self", ",", "trial_runner", ",", "trial", ")", ":", "cur_bracket", "=", "self", ".", "_state", "[", "\"bracket\"", "]", "cur_band", "=", "self", ".", "_hyperbands", "[", "self", ".", "_state", "[", "\"band_idx\"", "]", "]", "...
4eade036a0505e244c976f36aaa2d64386b5129b
train
HyperBandScheduler._cur_band_filled
Checks if the current band is filled. The size of the current band should be equal to s_max_1
python/ray/tune/schedulers/hyperband.py
def _cur_band_filled(self): """Checks if the current band is filled. The size of the current band should be equal to s_max_1""" cur_band = self._hyperbands[self._state["band_idx"]] return len(cur_band) == self._s_max_1
def _cur_band_filled(self): """Checks if the current band is filled. The size of the current band should be equal to s_max_1""" cur_band = self._hyperbands[self._state["band_idx"]] return len(cur_band) == self._s_max_1
[ "Checks", "if", "the", "current", "band", "is", "filled", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L134-L140
[ "def", "_cur_band_filled", "(", "self", ")", ":", "cur_band", "=", "self", ".", "_hyperbands", "[", "self", ".", "_state", "[", "\"band_idx\"", "]", "]", "return", "len", "(", "cur_band", ")", "==", "self", ".", "_s_max_1" ]
4eade036a0505e244c976f36aaa2d64386b5129b
train
HyperBandScheduler.on_trial_result
If bracket is finished, all trials will be stopped. If a given trial finishes and bracket iteration is not done, the trial will be paused and resources will be given up. This scheduler will not start trials but will stop trials. The current running trial will not be handled, as...
python/ray/tune/schedulers/hyperband.py
def on_trial_result(self, trial_runner, trial, result): """If bracket is finished, all trials will be stopped. If a given trial finishes and bracket iteration is not done, the trial will be paused and resources will be given up. This scheduler will not start trials but will stop trials...
def on_trial_result(self, trial_runner, trial, result): """If bracket is finished, all trials will be stopped. If a given trial finishes and bracket iteration is not done, the trial will be paused and resources will be given up. This scheduler will not start trials but will stop trials...
[ "If", "bracket", "is", "finished", "all", "trials", "will", "be", "stopped", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L142-L159
[ "def", "on_trial_result", "(", "self", ",", "trial_runner", ",", "trial", ",", "result", ")", ":", "bracket", ",", "_", "=", "self", ".", "_trial_info", "[", "trial", "]", "bracket", ".", "update_trial_stats", "(", "trial", ",", "result", ")", "if", "bra...
4eade036a0505e244c976f36aaa2d64386b5129b
train
HyperBandScheduler._process_bracket
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...
python/ray/tune/schedulers/hyperband.py
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): """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, ...
[ "This", "is", "called", "whenever", "a", "trial", "makes", "progress", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L161-L197
[ "def", "_process_bracket", "(", "self", ",", "trial_runner", ",", "bracket", ",", "trial", ")", ":", "action", "=", "TrialScheduler", ".", "PAUSE", "if", "bracket", ".", "cur_iter_done", "(", ")", ":", "if", "bracket", ".", "finished", "(", ")", ":", "br...
4eade036a0505e244c976f36aaa2d64386b5129b
train
HyperBandScheduler.on_trial_remove
Notification when trial terminates. Trial info is removed from bracket. Triggers halving if bracket is not finished.
python/ray/tune/schedulers/hyperband.py
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): """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(): ...
[ "Notification", "when", "trial", "terminates", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L199-L207
[ "def", "on_trial_remove", "(", "self", ",", "trial_runner", ",", "trial", ")", ":", "bracket", ",", "_", "=", "self", ".", "_trial_info", "[", "trial", "]", "bracket", ".", "cleanup_trial", "(", "trial", ")", "if", "not", "bracket", ".", "finished", "(",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
HyperBandScheduler.choose_trial_to_run
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.
python/ray/tune/schedulers/hyperband.py
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): """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...
[ "Fair", "scheduling", "within", "iteration", "by", "completion", "percentage", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L217-L235
[ "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", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
HyperBandScheduler.debug_string
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 ...
python/ray/tune/schedulers/hyperband.py
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): """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...
[ "This", "provides", "a", "progress", "notification", "for", "the", "algorithm", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L237-L261
[ "def", "debug_string", "(", "self", ")", ":", "out", "=", "\"Using HyperBand: \"", "out", "+=", "\"num_stopped={} total_brackets={}\"", ".", "format", "(", "self", ".", "_num_stopped", ",", "sum", "(", "len", "(", "band", ")", "for", "band", "in", "self", "....
4eade036a0505e244c976f36aaa2d64386b5129b
train
Bracket.add_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.
python/ray/tune/schedulers/hyperband.py
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): """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...
[ "Add", "trial", "to", "bracket", "assuming", "bracket", "is", "not", "filled", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L287-L294
[ "def", "add_trial", "(", "self", ",", "trial", ")", ":", "assert", "not", "self", ".", "filled", "(", ")", ",", "\"Cannot add trial to filled bracket!\"", "self", ".", "_live_trials", "[", "trial", "]", "=", "None", "self", ".", "_all_trials", ".", "append",...
4eade036a0505e244c976f36aaa2d64386b5129b
train
Bracket.cur_iter_done
Checks if all iterations have completed. TODO(rliaw): also check that `t.iterations == self._r`
python/ray/tune/schedulers/hyperband.py
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): """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())
[ "Checks", "if", "all", "iterations", "have", "completed", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L296-L302
[ "def", "cur_iter_done", "(", "self", ")", ":", "return", "all", "(", "self", ".", "_get_result_time", "(", "result", ")", ">=", "self", ".", "_cumul_r", "for", "result", "in", "self", ".", "_live_trials", ".", "values", "(", ")", ")" ]
4eade036a0505e244c976f36aaa2d64386b5129b
train
Bracket.update_trial_stats
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.
python/ray/tune/schedulers/hyperband.py
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): """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...
[ "Update", "result", "for", "trial", ".", "Called", "after", "trial", "has", "finished", "an", "iteration", "-", "will", "decrement", "iteration", "count", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L340-L354
[ "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", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
Bracket.cleanup_full
Cleans up bracket after bracket is completely finished. Lets the last trial continue to run until termination condition kicks in.
python/ray/tune/schedulers/hyperband.py
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): """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...
[ "Cleans", "up", "bracket", "after", "bracket", "is", "completely", "finished", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/tune/schedulers/hyperband.py#L366-L373
[ "def", "cleanup_full", "(", "self", ",", "trial_runner", ")", ":", "for", "trial", "in", "self", ".", "current_trials", "(", ")", ":", "if", "(", "trial", ".", "status", "==", "Trial", ".", "PAUSED", ")", ":", "trial_runner", ".", "stop_trial", "(", "t...
4eade036a0505e244c976f36aaa2d64386b5129b
train
parse_client_table
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.
python/ray/experimental/state.py
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): """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...
[ "Read", "the", "client", "table", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L20-L86
[ "def", "parse_client_table", "(", "redis_client", ")", ":", "NIL_CLIENT_ID", "=", "ray", ".", "ObjectID", ".", "nil", "(", ")", ".", "binary", "(", ")", "message", "=", "redis_client", ".", "execute_command", "(", "\"RAY.TABLE_LOOKUP\"", ",", "ray", ".", "gc...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState._initialize_global_state
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...
python/ray/experimental/state.py
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): """Initialize the GlobalState object by connecting to Redis. It's possible that certain keys in Redis may not have been ...
[ "Initialize", "the", "GlobalState", "object", "by", "connecting", "to", "Redis", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L128-L184
[ "def", "_initialize_global_state", "(", "self", ",", "redis_address", ",", "redis_password", "=", "None", ",", "timeout", "=", "20", ")", ":", "self", ".", "redis_client", "=", "services", ".", "create_redis_client", "(", "redis_address", ",", "redis_password", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState._execute_command
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/ray/experimental/state.py
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): """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", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L186-L198
[ "def", "_execute_command", "(", "self", ",", "key", ",", "*", "args", ")", ":", "client", "=", "self", ".", "redis_clients", "[", "key", ".", "redis_shard_hash", "(", ")", "%", "len", "(", "self", ".", "redis_clients", ")", "]", "return", "client", "."...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState._keys
Execute the KEYS command on all Redis shards. Args: pattern: The KEYS pattern to query. Returns: The concatenated list of results from all shards.
python/ray/experimental/state.py
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): """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...
[ "Execute", "the", "KEYS", "command", "on", "all", "Redis", "shards", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L200-L212
[ "def", "_keys", "(", "self", ",", "pattern", ")", ":", "result", "=", "[", "]", "for", "client", "in", "self", ".", "redis_clients", ":", "result", ".", "extend", "(", "list", "(", "client", ".", "scan_iter", "(", "match", "=", "pattern", ")", ")", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState._object_table
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.
python/ray/experimental/state.py
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): """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...
[ "Fetch", "and", "parse", "the", "object", "table", "information", "for", "a", "single", "object", "ID", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L214-L246
[ "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...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState.object_table
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.
python/ray/experimental/state.py
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): """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...
[ "Fetch", "and", "parse", "the", "object", "table", "info", "for", "one", "or", "more", "object", "IDs", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L248-L275
[ "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...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState._task_table
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.
python/ray/experimental/state.py
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): """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...
[ "Fetch", "and", "parse", "the", "task", "table", "information", "for", "a", "single", "task", "ID", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L277-L337
[ "def", "_task_table", "(", "self", ",", "task_id", ")", ":", "assert", "isinstance", "(", "task_id", ",", "ray", ".", "TaskID", ")", "message", "=", "self", ".", "_execute_command", "(", "task_id", ",", "\"RAY.TABLE_LOOKUP\"", ",", "ray", ".", "gcs_utils", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState.task_table
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.
python/ray/experimental/state.py
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): """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...
[ "Fetch", "and", "parse", "the", "task", "table", "information", "for", "one", "or", "more", "task", "IDs", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L339-L365
[ "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...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState.function_table
Fetch and parse the function table. Returns: A dictionary that maps function IDs to information about the function.
python/ray/experimental/state.py
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): """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...
[ "Fetch", "and", "parse", "the", "function", "table", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L367-L386
[ "def", "function_table", "(", "self", ",", "function_id", "=", "None", ")", ":", "self", ".", "_check_connected", "(", ")", "function_table_keys", "=", "self", ".", "redis_client", ".", "keys", "(", "ray", ".", "gcs_utils", ".", "FUNCTION_PREFIX", "+", "\"*\...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState._profile_table
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.
python/ray/experimental/state.py
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): """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...
[ "Get", "the", "profile", "events", "for", "a", "given", "batch", "of", "profile", "events", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L398-L446
[ "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...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState.chrome_tracing_dump
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...
python/ray/experimental/state.py
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): """Return a list of profiling events that can viewed as a timeline. To view this information as a timeline, simply dump it as a json file by passing in "filename" or using using json.dump, and then load go to chrome://tracing in the Chrome w...
[ "Return", "a", "list", "of", "profiling", "events", "that", "can", "viewed", "as", "a", "timeline", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L528-L596
[ "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", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState.chrome_tracing_object_transfer_dump
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 ...
python/ray/experimental/state.py
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): """Return a list of transfer events that can viewed as a timeline. To view this information as a timeline, simply dump it as a json file by passing in "filename" or using using json.dump, and then load go to chrome://tracing ...
[ "Return", "a", "list", "of", "transfer", "events", "that", "can", "viewed", "as", "a", "timeline", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L598-L687
[ "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...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState.workers
Get a dictionary mapping worker ID to worker information.
python/ray/experimental/state.py
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): """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...
[ "Get", "a", "dictionary", "mapping", "worker", "ID", "to", "worker", "information", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L689-L709
[ "def", "workers", "(", "self", ")", ":", "worker_keys", "=", "self", ".", "redis_client", ".", "keys", "(", "\"Worker*\"", ")", "workers_data", "=", "{", "}", "for", "worker_key", "in", "worker_keys", ":", "worker_info", "=", "self", ".", "redis_client", "...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState.cluster_resources
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.
python/ray/experimental/state.py
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): """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...
[ "Get", "the", "current", "total", "cluster", "resources", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L747-L765
[ "def", "cluster_resources", "(", "self", ")", ":", "resources", "=", "defaultdict", "(", "int", ")", "clients", "=", "self", ".", "client_table", "(", ")", "for", "client", "in", "clients", ":", "# Only count resources from live clients.", "if", "client", "[", ...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState.available_resources
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...
python/ray/experimental/state.py
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): """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...
[ "Get", "the", "current", "available", "cluster", "resources", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L774-L841
[ "def", "available_resources", "(", "self", ")", ":", "available_resources_by_id", "=", "{", "}", "subscribe_clients", "=", "[", "redis_client", ".", "pubsub", "(", "ignore_subscribe_messages", "=", "True", ")", "for", "redis_client", "in", "self", ".", "redis_clie...
4eade036a0505e244c976f36aaa2d64386b5129b
train
GlobalState._error_messages
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.
python/ray/experimental/state.py
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): """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) ...
[ "Get", "the", "error", "messages", "for", "a", "specific", "driver", "." ]
ray-project/ray
python
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/experimental/state.py#L843-L874
[ "def", "_error_messages", "(", "self", ",", "driver_id", ")", ":", "assert", "isinstance", "(", "driver_id", ",", "ray", ".", "DriverID", ")", "message", "=", "self", ".", "redis_client", ".", "execute_command", "(", "\"RAY.TABLE_LOOKUP\"", ",", "ray", ".", ...
4eade036a0505e244c976f36aaa2d64386b5129b