hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
79b38d5e824adb8e3497e80d18fd58f63a1de41b | kisuke95/ray | python/ray/data/dataset.py | [
"Apache-2.0"
] | Python | repartition | "Dataset[T]" | def repartition(self, num_blocks: int, *, shuffle: bool = False) -> "Dataset[T]":
"""Repartition the dataset into exactly this number of blocks.
This is a blocking operation. After repartitioning, all blocks in the
returned dataset will have approximately the same number of rows.
Examp... | Repartition the dataset into exactly this number of blocks.
This is a blocking operation. After repartitioning, all blocks in the
returned dataset will have approximately the same number of rows.
Examples:
>>> import ray
>>> ds = ray.data.range(100) # doctest: +SKIP
... | Repartition the dataset into exactly this number of blocks.
This is a blocking operation. After repartitioning, all blocks in the
returned dataset will have approximately the same number of rows. | [
"Repartition",
"the",
"dataset",
"into",
"exactly",
"this",
"number",
"of",
"blocks",
".",
"This",
"is",
"a",
"blocking",
"operation",
".",
"After",
"repartitioning",
"all",
"blocks",
"in",
"the",
"returned",
"dataset",
"will",
"have",
"approximately",
"the",
... | def repartition(self, num_blocks: int, *, shuffle: bool = False) -> "Dataset[T]":
if shuffle:
def do_shuffle(
block_list, clear_input_blocks: bool, block_udf, remote_args
):
if clear_input_blocks:
blocks = block_list.copy()
... | [
"def",
"repartition",
"(",
"self",
",",
"num_blocks",
":",
"int",
",",
"*",
",",
"shuffle",
":",
"bool",
"=",
"False",
")",
"->",
"\"Dataset[T]\"",
":",
"if",
"shuffle",
":",
"def",
"do_shuffle",
"(",
"block_list",
",",
"clear_input_blocks",
":",
"bool",
... | Repartition the dataset into exactly this number of blocks. | [
"Repartition",
"the",
"dataset",
"into",
"exactly",
"this",
"number",
"of",
"blocks",
"."
] | [
"\"\"\"Repartition the dataset into exactly this number of blocks.\n\n This is a blocking operation. After repartitioning, all blocks in the\n returned dataset will have approximately the same number of rows.\n\n Examples:\n >>> import ray\n >>> ds = ray.data.range(100) # ... | [
{
"param": "self",
"type": null
},
{
"param": "num_blocks",
"type": "int"
},
{
"param": "shuffle",
"type": "bool"
}
] | {
"returns": [
{
"docstring": "The repartitioned dataset.",
"docstring_tokens": [
"The",
"repartitioned",
"dataset",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
79b38d5e824adb8e3497e80d18fd58f63a1de41b | kisuke95/ray | python/ray/data/dataset.py | [
"Apache-2.0"
] | Python | random_shuffle | "Dataset[T]" | def random_shuffle(
self,
*,
seed: Optional[int] = None,
num_blocks: Optional[int] = None,
) -> "Dataset[T]":
"""Randomly shuffle the elements of this dataset.
This is a blocking operation similar to repartition().
Examples:
>>> import ray
... | Randomly shuffle the elements of this dataset.
This is a blocking operation similar to repartition().
Examples:
>>> import ray
>>> ds = ray.data.range(100) # doctest: +SKIP
>>> # Shuffle this dataset randomly.
>>> ds.random_shuffle() # doctest: +SKIP
... | Randomly shuffle the elements of this dataset.
This is a blocking operation similar to repartition(). | [
"Randomly",
"shuffle",
"the",
"elements",
"of",
"this",
"dataset",
".",
"This",
"is",
"a",
"blocking",
"operation",
"similar",
"to",
"repartition",
"()",
"."
] | def random_shuffle(
self,
*,
seed: Optional[int] = None,
num_blocks: Optional[int] = None,
) -> "Dataset[T]":
def do_shuffle(block_list, clear_input_blocks: bool, block_udf, remote_args):
num_blocks = block_list.executed_num_blocks()
if num_blocks ==... | [
"def",
"random_shuffle",
"(",
"self",
",",
"*",
",",
"seed",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"num_blocks",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
")",
"->",
"\"Dataset[T]\"",
":",
"def",
"do_shuffle",
"(",
"block_list",... | Randomly shuffle the elements of this dataset. | [
"Randomly",
"shuffle",
"the",
"elements",
"of",
"this",
"dataset",
"."
] | [
"\"\"\"Randomly shuffle the elements of this dataset.\n\n This is a blocking operation similar to repartition().\n\n Examples:\n >>> import ray\n >>> ds = ray.data.range(100) # doctest: +SKIP\n >>> # Shuffle this dataset randomly.\n >>> ds.random_shuffle() #... | [
{
"param": "self",
"type": null
},
{
"param": "seed",
"type": "Optional[int]"
},
{
"param": "num_blocks",
"type": "Optional[int]"
}
] | {
"returns": [
{
"docstring": "The shuffled dataset.",
"docstring_tokens": [
"The",
"shuffled",
"dataset",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docs... |
79b38d5e824adb8e3497e80d18fd58f63a1de41b | kisuke95/ray | python/ray/data/dataset.py | [
"Apache-2.0"
] | Python | union | "Dataset[T]" | def union(self, *other: List["Dataset[T]"]) -> "Dataset[T]":
"""Combine this dataset with others of the same type.
The order of the blocks in the datasets is preserved, as is the
relative ordering between the datasets passed in the argument list.
Args:
other: List of datase... | Combine this dataset with others of the same type.
The order of the blocks in the datasets is preserved, as is the
relative ordering between the datasets passed in the argument list.
Args:
other: List of datasets to combine with this one. The datasets
must have the ... | Combine this dataset with others of the same type.
The order of the blocks in the datasets is preserved, as is the
relative ordering between the datasets passed in the argument list. | [
"Combine",
"this",
"dataset",
"with",
"others",
"of",
"the",
"same",
"type",
".",
"The",
"order",
"of",
"the",
"blocks",
"in",
"the",
"datasets",
"is",
"preserved",
"as",
"is",
"the",
"relative",
"ordering",
"between",
"the",
"datasets",
"passed",
"in",
"t... | def union(self, *other: List["Dataset[T]"]) -> "Dataset[T]":
start_time = time.perf_counter()
context = DatasetContext.get_current()
tasks: List[ReadTask] = []
block_partition_refs: List[ObjectRef[BlockPartition]] = []
block_partition_meta_refs: List[ObjectRef[BlockPartitionMetad... | [
"def",
"union",
"(",
"self",
",",
"*",
"other",
":",
"List",
"[",
"\"Dataset[T]\"",
"]",
")",
"->",
"\"Dataset[T]\"",
":",
"start_time",
"=",
"time",
".",
"perf_counter",
"(",
")",
"context",
"=",
"DatasetContext",
".",
"get_current",
"(",
")",
"tasks",
... | Combine this dataset with others of the same type. | [
"Combine",
"this",
"dataset",
"with",
"others",
"of",
"the",
"same",
"type",
"."
] | [
"\"\"\"Combine this dataset with others of the same type.\n\n The order of the blocks in the datasets is preserved, as is the\n relative ordering between the datasets passed in the argument list.\n\n Args:\n other: List of datasets to combine with this one. The datasets\n ... | [
{
"param": "self",
"type": null
},
{
"param": "other",
"type": "List[\"Dataset[T]\"]"
}
] | {
"returns": [
{
"docstring": "A new dataset holding the union of their data.",
"docstring_tokens": [
"A",
"new",
"dataset",
"holding",
"the",
"union",
"of",
"their",
"data",
"."
],
"type": null
}
],
"r... |
79b38d5e824adb8e3497e80d18fd58f63a1de41b | kisuke95/ray | python/ray/data/dataset.py | [
"Apache-2.0"
] | Python | write_datasource | None | def write_datasource(self, datasource: Datasource[T], **write_args) -> None:
"""Write the dataset to a custom datasource.
Examples:
>>> import ray
>>> from ray.data.datasource import Datasource
>>> ds = ray.data.range(100) # doctest: +SKIP
>>> class Custo... | Write the dataset to a custom datasource.
Examples:
>>> import ray
>>> from ray.data.datasource import Datasource
>>> ds = ray.data.range(100) # doctest: +SKIP
>>> class CustomDatasource(Datasource): # doctest: +SKIP
... # define custom data sourc... | Write the dataset to a custom datasource. | [
"Write",
"the",
"dataset",
"to",
"a",
"custom",
"datasource",
"."
] | def write_datasource(self, datasource: Datasource[T], **write_args) -> None:
ctx = DatasetContext.get_current()
blocks, metadata = zip(*self._plan.execute().get_blocks_with_metadata())
if "RAY_DATASET_FORCE_LOCAL_METADATA" in os.environ:
write_results: List[ObjectRef[WriteResult]] = ... | [
"def",
"write_datasource",
"(",
"self",
",",
"datasource",
":",
"Datasource",
"[",
"T",
"]",
",",
"**",
"write_args",
")",
"->",
"None",
":",
"ctx",
"=",
"DatasetContext",
".",
"get_current",
"(",
")",
"blocks",
",",
"metadata",
"=",
"zip",
"(",
"*",
"... | Write the dataset to a custom datasource. | [
"Write",
"the",
"dataset",
"to",
"a",
"custom",
"datasource",
"."
] | [
"\"\"\"Write the dataset to a custom datasource.\n\n Examples:\n >>> import ray\n >>> from ray.data.datasource import Datasource\n >>> ds = ray.data.range(100) # doctest: +SKIP\n >>> class CustomDatasource(Datasource): # doctest: +SKIP\n ... # define... | [
{
"param": "self",
"type": null
},
{
"param": "datasource",
"type": "Datasource[T]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "datasource",
"type": "Datasource[T]",
"docstring": "The datasource ... |
79b38d5e824adb8e3497e80d18fd58f63a1de41b | kisuke95/ray | python/ray/data/dataset.py | [
"Apache-2.0"
] | Python | to_spark | "pyspark.sql.DataFrame" | def to_spark(self, spark: "pyspark.sql.SparkSession") -> "pyspark.sql.DataFrame":
"""Convert this dataset into a Spark dataframe.
Time complexity: O(dataset size / parallelism)
Returns:
A Spark dataframe created from this dataset.
"""
import raydp
core_work... | Convert this dataset into a Spark dataframe.
Time complexity: O(dataset size / parallelism)
Returns:
A Spark dataframe created from this dataset.
| Convert this dataset into a Spark dataframe.
Time complexity: O(dataset size / parallelism) | [
"Convert",
"this",
"dataset",
"into",
"a",
"Spark",
"dataframe",
".",
"Time",
"complexity",
":",
"O",
"(",
"dataset",
"size",
"/",
"parallelism",
")"
] | def to_spark(self, spark: "pyspark.sql.SparkSession") -> "pyspark.sql.DataFrame":
import raydp
core_worker = ray.worker.global_worker.core_worker
locations = [
core_worker.get_owner_address(block)
for block in self.get_internal_block_refs()
]
return raydp.... | [
"def",
"to_spark",
"(",
"self",
",",
"spark",
":",
"\"pyspark.sql.SparkSession\"",
")",
"->",
"\"pyspark.sql.DataFrame\"",
":",
"import",
"raydp",
"core_worker",
"=",
"ray",
".",
"worker",
".",
"global_worker",
".",
"core_worker",
"locations",
"=",
"[",
"core_work... | Convert this dataset into a Spark dataframe. | [
"Convert",
"this",
"dataset",
"into",
"a",
"Spark",
"dataframe",
"."
] | [
"\"\"\"Convert this dataset into a Spark dataframe.\n\n Time complexity: O(dataset size / parallelism)\n\n Returns:\n A Spark dataframe created from this dataset.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "spark",
"type": "\"pyspark.sql.SparkSession\""
}
] | {
"returns": [
{
"docstring": "A Spark dataframe created from this dataset.",
"docstring_tokens": [
"A",
"Spark",
"dataframe",
"created",
"from",
"this",
"dataset",
"."
],
"type": null
}
],
"raises": [],
"params": [
... |
79b38d5e824adb8e3497e80d18fd58f63a1de41b | kisuke95/ray | python/ray/data/dataset.py | [
"Apache-2.0"
] | Python | repeat | "DatasetPipeline[T]" | def repeat(self, times: Optional[int] = None) -> "DatasetPipeline[T]":
"""Convert this into a DatasetPipeline by looping over this dataset.
Transformations prior to the call to ``repeat()`` are evaluated once.
Transformations done on the returned pipeline are evaluated on each
loop of t... | Convert this into a DatasetPipeline by looping over this dataset.
Transformations prior to the call to ``repeat()`` are evaluated once.
Transformations done on the returned pipeline are evaluated on each
loop of the pipeline over the base dataset.
Note that every repeat of the dataset ... | Convert this into a DatasetPipeline by looping over this dataset.
Transformations prior to the call to ``repeat()`` are evaluated once.
Transformations done on the returned pipeline are evaluated on each
loop of the pipeline over the base dataset.
Note that every repeat of the dataset is considered an "epoch" for
the ... | [
"Convert",
"this",
"into",
"a",
"DatasetPipeline",
"by",
"looping",
"over",
"this",
"dataset",
".",
"Transformations",
"prior",
"to",
"the",
"call",
"to",
"`",
"`",
"repeat",
"()",
"`",
"`",
"are",
"evaluated",
"once",
".",
"Transformations",
"done",
"on",
... | def repeat(self, times: Optional[int] = None) -> "DatasetPipeline[T]":
from ray.data.dataset_pipeline import DatasetPipeline
from ray.data.impl.plan import _rewrite_read_stage
ctx = DatasetContext.get_current()
if self._plan.is_read_stage() and ctx.optimize_fuse_read_stages:
... | [
"def",
"repeat",
"(",
"self",
",",
"times",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"\"DatasetPipeline[T]\"",
":",
"from",
"ray",
".",
"data",
".",
"dataset_pipeline",
"import",
"DatasetPipeline",
"from",
"ray",
".",
"data",
".",
"impl",
... | Convert this into a DatasetPipeline by looping over this dataset. | [
"Convert",
"this",
"into",
"a",
"DatasetPipeline",
"by",
"looping",
"over",
"this",
"dataset",
"."
] | [
"\"\"\"Convert this into a DatasetPipeline by looping over this dataset.\n\n Transformations prior to the call to ``repeat()`` are evaluated once.\n Transformations done on the returned pipeline are evaluated on each\n loop of the pipeline over the base dataset.\n\n Note that every repea... | [
{
"param": "self",
"type": null
},
{
"param": "times",
"type": "Optional[int]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "times",
"type": "Optional[int]",
"docstring": "The number of times ... |
79b38d5e824adb8e3497e80d18fd58f63a1de41b | kisuke95/ray | python/ray/data/dataset.py | [
"Apache-2.0"
] | Python | window | "DatasetPipeline[T]" | def window(
self,
*,
blocks_per_window: Optional[int] = None,
bytes_per_window: Optional[int] = None,
) -> "DatasetPipeline[T]":
"""Convert this into a DatasetPipeline by windowing over data blocks.
Transformations prior to the call to ``window()`` are evaluated in
... | Convert this into a DatasetPipeline by windowing over data blocks.
Transformations prior to the call to ``window()`` are evaluated in
bulk on the entire dataset. Transformations done on the returned
pipeline are evaluated incrementally per window of blocks as data is
read from the outpu... | Convert this into a DatasetPipeline by windowing over data blocks.
Transformations prior to the call to ``window()`` are evaluated in
bulk on the entire dataset. Transformations done on the returned
pipeline are evaluated incrementally per window of blocks as data is
read from the output of the pipeline.
Windowing exe... | [
"Convert",
"this",
"into",
"a",
"DatasetPipeline",
"by",
"windowing",
"over",
"data",
"blocks",
".",
"Transformations",
"prior",
"to",
"the",
"call",
"to",
"`",
"`",
"window",
"()",
"`",
"`",
"are",
"evaluated",
"in",
"bulk",
"on",
"the",
"entire",
"datase... | def window(
self,
*,
blocks_per_window: Optional[int] = None,
bytes_per_window: Optional[int] = None,
) -> "DatasetPipeline[T]":
from ray.data.dataset_pipeline import DatasetPipeline
from ray.data.impl.plan import _rewrite_read_stage
if blocks_per_window is no... | [
"def",
"window",
"(",
"self",
",",
"*",
",",
"blocks_per_window",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
"bytes_per_window",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
",",
")",
"->",
"\"DatasetPipeline[T]\"",
":",
"from",
"ray",
".",
... | Convert this into a DatasetPipeline by windowing over data blocks. | [
"Convert",
"this",
"into",
"a",
"DatasetPipeline",
"by",
"windowing",
"over",
"data",
"blocks",
"."
] | [
"\"\"\"Convert this into a DatasetPipeline by windowing over data blocks.\n\n Transformations prior to the call to ``window()`` are evaluated in\n bulk on the entire dataset. Transformations done on the returned\n pipeline are evaluated incrementally per window of blocks as data is\n rea... | [
{
"param": "self",
"type": null
},
{
"param": "blocks_per_window",
"type": "Optional[int]"
},
{
"param": "bytes_per_window",
"type": "Optional[int]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "blocks_per_window",
"type": "Optional[int]",
"docstring": "The wind... |
79b38d5e824adb8e3497e80d18fd58f63a1de41b | kisuke95/ray | python/ray/data/dataset.py | [
"Apache-2.0"
] | Python | fully_executed | "Dataset[T]" | def fully_executed(self) -> "Dataset[T]":
"""Force full evaluation of the blocks of this dataset.
This can be used to read all blocks into memory. By default, Datasets
doesn't read blocks from the datasource until the first transform.
Returns:
A Dataset with all blocks full... | Force full evaluation of the blocks of this dataset.
This can be used to read all blocks into memory. By default, Datasets
doesn't read blocks from the datasource until the first transform.
Returns:
A Dataset with all blocks fully materialized in memory.
| Force full evaluation of the blocks of this dataset.
This can be used to read all blocks into memory. By default, Datasets
doesn't read blocks from the datasource until the first transform. | [
"Force",
"full",
"evaluation",
"of",
"the",
"blocks",
"of",
"this",
"dataset",
".",
"This",
"can",
"be",
"used",
"to",
"read",
"all",
"blocks",
"into",
"memory",
".",
"By",
"default",
"Datasets",
"doesn",
"'",
"t",
"read",
"blocks",
"from",
"the",
"datas... | def fully_executed(self) -> "Dataset[T]":
plan = self._plan.deep_copy(preserve_uuid=True)
plan.execute(force_read=True)
ds = Dataset(plan, self._epoch, lazy=False)
ds._set_uuid(self._get_uuid())
return ds | [
"def",
"fully_executed",
"(",
"self",
")",
"->",
"\"Dataset[T]\"",
":",
"plan",
"=",
"self",
".",
"_plan",
".",
"deep_copy",
"(",
"preserve_uuid",
"=",
"True",
")",
"plan",
".",
"execute",
"(",
"force_read",
"=",
"True",
")",
"ds",
"=",
"Dataset",
"(",
... | Force full evaluation of the blocks of this dataset. | [
"Force",
"full",
"evaluation",
"of",
"the",
"blocks",
"of",
"this",
"dataset",
"."
] | [
"\"\"\"Force full evaluation of the blocks of this dataset.\n\n This can be used to read all blocks into memory. By default, Datasets\n doesn't read blocks from the datasource until the first transform.\n\n Returns:\n A Dataset with all blocks fully materialized in memory.\n \... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A Dataset with all blocks fully materialized in memory.",
"docstring_tokens": [
"A",
"Dataset",
"with",
"all",
"blocks",
"fully",
"materialized",
"in",
"memory",
"."
],
"type": nu... |
312da04b8f4617a88fcf90e65afe9303d5434090 | kisuke95/ray | rllib/env/multi_agent_env.py | [
"Apache-2.0"
] | Python | step | Tuple[MultiAgentDict, MultiAgentDict, MultiAgentDict, MultiAgentDict] | def step(
self, action_dict: MultiAgentDict
) -> Tuple[MultiAgentDict, MultiAgentDict, MultiAgentDict, MultiAgentDict]:
"""Returns observations from ready agents.
The returns are dicts mapping from agent_id strings to values. The
number of agents in the env can vary over time.
... | Returns observations from ready agents.
The returns are dicts mapping from agent_id strings to values. The
number of agents in the env can vary over time.
Returns:
Tuple containing 1) new observations for
each ready agent, 2) reward values for each ready agent. If
... | Returns observations from ready agents.
The returns are dicts mapping from agent_id strings to values. The
number of agents in the env can vary over time. | [
"Returns",
"observations",
"from",
"ready",
"agents",
".",
"The",
"returns",
"are",
"dicts",
"mapping",
"from",
"agent_id",
"strings",
"to",
"values",
".",
"The",
"number",
"of",
"agents",
"in",
"the",
"env",
"can",
"vary",
"over",
"time",
"."
] | def step(
self, action_dict: MultiAgentDict
) -> Tuple[MultiAgentDict, MultiAgentDict, MultiAgentDict, MultiAgentDict]:
raise NotImplementedError | [
"def",
"step",
"(",
"self",
",",
"action_dict",
":",
"MultiAgentDict",
")",
"->",
"Tuple",
"[",
"MultiAgentDict",
",",
"MultiAgentDict",
",",
"MultiAgentDict",
",",
"MultiAgentDict",
"]",
":",
"raise",
"NotImplementedError"
] | Returns observations from ready agents. | [
"Returns",
"observations",
"from",
"ready",
"agents",
"."
] | [
"\"\"\"Returns observations from ready agents.\n\n The returns are dicts mapping from agent_id strings to values. The\n number of agents in the env can vary over time.\n\n Returns:\n Tuple containing 1) new observations for\n each ready agent, 2) reward values for each rea... | [
{
"param": "self",
"type": null
},
{
"param": "action_dict",
"type": "MultiAgentDict"
}
] | {
"returns": [
{
"docstring": "Tuple containing 1) new observations for\neach ready agent, 2) reward values for each ready agent. If\nthe episode is just started, the value will be None.\n3) Done values for each ready agent. The special key\n\"__all__\" (required) is used to indicate env termination.\n4) Op... |
312da04b8f4617a88fcf90e65afe9303d5434090 | kisuke95/ray | rllib/env/multi_agent_env.py | [
"Apache-2.0"
] | Python | observation_space_contains | bool | def observation_space_contains(self, x: MultiAgentDict) -> bool:
"""Checks if the observation space contains the given key.
Args:
x: Observations to check.
Returns:
True if the observation space contains the given all observations
in x.
"""
... | Checks if the observation space contains the given key.
Args:
x: Observations to check.
Returns:
True if the observation space contains the given all observations
in x.
| Checks if the observation space contains the given key. | [
"Checks",
"if",
"the",
"observation",
"space",
"contains",
"the",
"given",
"key",
"."
] | def observation_space_contains(self, x: MultiAgentDict) -> bool:
if (
not hasattr(self, "_spaces_in_preferred_format")
or self._spaces_in_preferred_format is None
):
self._spaces_in_preferred_format = (
self._check_if_space_maps_agent_id_to_sub_space()... | [
"def",
"observation_space_contains",
"(",
"self",
",",
"x",
":",
"MultiAgentDict",
")",
"->",
"bool",
":",
"if",
"(",
"not",
"hasattr",
"(",
"self",
",",
"\"_spaces_in_preferred_format\"",
")",
"or",
"self",
".",
"_spaces_in_preferred_format",
"is",
"None",
")",... | Checks if the observation space contains the given key. | [
"Checks",
"if",
"the",
"observation",
"space",
"contains",
"the",
"given",
"key",
"."
] | [
"\"\"\"Checks if the observation space contains the given key.\n\n Args:\n x: Observations to check.\n\n Returns:\n True if the observation space contains the given all observations\n in x.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "x",
"type": "MultiAgentDict"
}
] | {
"returns": [
{
"docstring": "True if the observation space contains the given all observations\nin x.",
"docstring_tokens": [
"True",
"if",
"the",
"observation",
"space",
"contains",
"the",
"given",
"all",
"observations"... |
312da04b8f4617a88fcf90e65afe9303d5434090 | kisuke95/ray | rllib/env/multi_agent_env.py | [
"Apache-2.0"
] | Python | action_space_contains | bool | def action_space_contains(self, x: MultiAgentDict) -> bool:
"""Checks if the action space contains the given action.
Args:
x: Actions to check.
Returns:
True if the action space contains all actions in x.
"""
if (
not hasattr(self, "_spaces_i... | Checks if the action space contains the given action.
Args:
x: Actions to check.
Returns:
True if the action space contains all actions in x.
| Checks if the action space contains the given action. | [
"Checks",
"if",
"the",
"action",
"space",
"contains",
"the",
"given",
"action",
"."
] | def action_space_contains(self, x: MultiAgentDict) -> bool:
if (
not hasattr(self, "_spaces_in_preferred_format")
or self._spaces_in_preferred_format is None
):
self._spaces_in_preferred_format = (
self._check_if_space_maps_agent_id_to_sub_space()
... | [
"def",
"action_space_contains",
"(",
"self",
",",
"x",
":",
"MultiAgentDict",
")",
"->",
"bool",
":",
"if",
"(",
"not",
"hasattr",
"(",
"self",
",",
"\"_spaces_in_preferred_format\"",
")",
"or",
"self",
".",
"_spaces_in_preferred_format",
"is",
"None",
")",
":... | Checks if the action space contains the given action. | [
"Checks",
"if",
"the",
"action",
"space",
"contains",
"the",
"given",
"action",
"."
] | [
"\"\"\"Checks if the action space contains the given action.\n\n Args:\n x: Actions to check.\n\n Returns:\n True if the action space contains all actions in x.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "x",
"type": "MultiAgentDict"
}
] | {
"returns": [
{
"docstring": "True if the action space contains all actions in x.",
"docstring_tokens": [
"True",
"if",
"the",
"action",
"space",
"contains",
"all",
"actions",
"in",
"x",
"."
],
"type":... |
312da04b8f4617a88fcf90e65afe9303d5434090 | kisuke95/ray | rllib/env/multi_agent_env.py | [
"Apache-2.0"
] | Python | action_space_sample | MultiAgentDict | def action_space_sample(self, agent_ids: list = None) -> MultiAgentDict:
"""Returns a random action for each environment, and potentially each
agent in that environment.
Args:
agent_ids: List of agent ids to sample actions for. If None or
empty list, sample actio... | Returns a random action for each environment, and potentially each
agent in that environment.
Args:
agent_ids: List of agent ids to sample actions for. If None or
empty list, sample actions for all agents in the
environment.
Returns:
... | Returns a random action for each environment, and potentially each
agent in that environment. | [
"Returns",
"a",
"random",
"action",
"for",
"each",
"environment",
"and",
"potentially",
"each",
"agent",
"in",
"that",
"environment",
"."
] | def action_space_sample(self, agent_ids: list = None) -> MultiAgentDict:
if (
not hasattr(self, "_spaces_in_preferred_format")
or self._spaces_in_preferred_format is None
):
self._spaces_in_preferred_format = (
self._check_if_space_maps_agent_id_to_sub... | [
"def",
"action_space_sample",
"(",
"self",
",",
"agent_ids",
":",
"list",
"=",
"None",
")",
"->",
"MultiAgentDict",
":",
"if",
"(",
"not",
"hasattr",
"(",
"self",
",",
"\"_spaces_in_preferred_format\"",
")",
"or",
"self",
".",
"_spaces_in_preferred_format",
"is"... | Returns a random action for each environment, and potentially each
agent in that environment. | [
"Returns",
"a",
"random",
"action",
"for",
"each",
"environment",
"and",
"potentially",
"each",
"agent",
"in",
"that",
"environment",
"."
] | [
"\"\"\"Returns a random action for each environment, and potentially each\n agent in that environment.\n\n Args:\n agent_ids: List of agent ids to sample actions for. If None or\n empty list, sample actions for all agents in the\n environment.\n\n Re... | [
{
"param": "self",
"type": null
},
{
"param": "agent_ids",
"type": "list"
}
] | {
"returns": [
{
"docstring": "A random action for each environment.",
"docstring_tokens": [
"A",
"random",
"action",
"for",
"each",
"environment",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier":... |
312da04b8f4617a88fcf90e65afe9303d5434090 | kisuke95/ray | rllib/env/multi_agent_env.py | [
"Apache-2.0"
] | Python | observation_space_sample | MultiEnvDict | def observation_space_sample(self, agent_ids: list = None) -> MultiEnvDict:
"""Returns a random observation from the observation space for each
agent if agent_ids is None, otherwise returns a random observation for
the agents in agent_ids.
Args:
agent_ids: List of agent ids ... | Returns a random observation from the observation space for each
agent if agent_ids is None, otherwise returns a random observation for
the agents in agent_ids.
Args:
agent_ids: List of agent ids to sample actions for. If None or
empty list, sample actions for all ag... | Returns a random observation from the observation space for each
agent if agent_ids is None, otherwise returns a random observation for
the agents in agent_ids. | [
"Returns",
"a",
"random",
"observation",
"from",
"the",
"observation",
"space",
"for",
"each",
"agent",
"if",
"agent_ids",
"is",
"None",
"otherwise",
"returns",
"a",
"random",
"observation",
"for",
"the",
"agents",
"in",
"agent_ids",
"."
] | def observation_space_sample(self, agent_ids: list = None) -> MultiEnvDict:
if (
not hasattr(self, "_spaces_in_preferred_format")
or self._spaces_in_preferred_format is None
):
self._spaces_in_preferred_format = (
self._check_if_space_maps_agent_id_to_... | [
"def",
"observation_space_sample",
"(",
"self",
",",
"agent_ids",
":",
"list",
"=",
"None",
")",
"->",
"MultiEnvDict",
":",
"if",
"(",
"not",
"hasattr",
"(",
"self",
",",
"\"_spaces_in_preferred_format\"",
")",
"or",
"self",
".",
"_spaces_in_preferred_format",
"... | Returns a random observation from the observation space for each
agent if agent_ids is None, otherwise returns a random observation for
the agents in agent_ids. | [
"Returns",
"a",
"random",
"observation",
"from",
"the",
"observation",
"space",
"for",
"each",
"agent",
"if",
"agent_ids",
"is",
"None",
"otherwise",
"returns",
"a",
"random",
"observation",
"for",
"the",
"agents",
"in",
"agent_ids",
"."
] | [
"\"\"\"Returns a random observation from the observation space for each\n agent if agent_ids is None, otherwise returns a random observation for\n the agents in agent_ids.\n\n Args:\n agent_ids: List of agent ids to sample actions for. If None or\n empty list, sample a... | [
{
"param": "self",
"type": null
},
{
"param": "agent_ids",
"type": "list"
}
] | {
"returns": [
{
"docstring": "A random action for each environment.",
"docstring_tokens": [
"A",
"random",
"action",
"for",
"each",
"environment",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier":... |
312da04b8f4617a88fcf90e65afe9303d5434090 | kisuke95/ray | rllib/env/multi_agent_env.py | [
"Apache-2.0"
] | Python | with_agent_groups | "MultiAgentEnv" | def with_agent_groups(
self,
groups: Dict[str, List[AgentID]],
obs_space: gym.Space = None,
act_space: gym.Space = None) -> "MultiAgentEnv":
"""Convenience method for grouping together agents in this env.
An agent group is a list of agent IDs that are mapped to a sin... | Convenience method for grouping together agents in this env.
An agent group is a list of agent IDs that are mapped to a single
logical agent. All agents of the group must act at the same time in the
environment. The grouped agent exposes Tuple action and observation
spaces that are the ... | Convenience method for grouping together agents in this env.
An agent group is a list of agent IDs that are mapped to a single
logical agent. All agents of the group must act at the same time in the
environment. The grouped agent exposes Tuple action and observation
spaces that are the concatenated action and obs space... | [
"Convenience",
"method",
"for",
"grouping",
"together",
"agents",
"in",
"this",
"env",
".",
"An",
"agent",
"group",
"is",
"a",
"list",
"of",
"agent",
"IDs",
"that",
"are",
"mapped",
"to",
"a",
"single",
"logical",
"agent",
".",
"All",
"agents",
"of",
"th... | def with_agent_groups(
self,
groups: Dict[str, List[AgentID]],
obs_space: gym.Space = None,
act_space: gym.Space = None) -> "MultiAgentEnv":
from ray.rllib.env.wrappers.group_agents_wrapper import \
GroupAgentsWrapper
return GroupAgentsWrapper(self, groups... | [
"def",
"with_agent_groups",
"(",
"self",
",",
"groups",
":",
"Dict",
"[",
"str",
",",
"List",
"[",
"AgentID",
"]",
"]",
",",
"obs_space",
":",
"gym",
".",
"Space",
"=",
"None",
",",
"act_space",
":",
"gym",
".",
"Space",
"=",
"None",
")",
"->",
"\"... | Convenience method for grouping together agents in this env. | [
"Convenience",
"method",
"for",
"grouping",
"together",
"agents",
"in",
"this",
"env",
"."
] | [
"\"\"\"Convenience method for grouping together agents in this env.\n\n An agent group is a list of agent IDs that are mapped to a single\n logical agent. All agents of the group must act at the same time in the\n environment. The grouped agent exposes Tuple action and observation\n spac... | [
{
"param": "self",
"type": null
},
{
"param": "groups",
"type": "Dict[str, List[AgentID]]"
},
{
"param": "obs_space",
"type": "gym.Space"
},
{
"param": "act_space",
"type": "gym.Space"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "groups",
"type": "Dict[str, List[AgentID]]",
"docstring": "Mapping ... |
312da04b8f4617a88fcf90e65afe9303d5434090 | kisuke95/ray | rllib/env/multi_agent_env.py | [
"Apache-2.0"
] | Python | make_multi_agent | Type["MultiAgentEnv"] | def make_multi_agent(
env_name_or_creator: Union[str, EnvCreator],
) -> Type["MultiAgentEnv"]:
"""Convenience wrapper for any single-agent env to be converted into MA.
Allows you to convert a simple (single-agent) `gym.Env` class
into a `MultiAgentEnv` class. This function simply stacks n instances
... | Convenience wrapper for any single-agent env to be converted into MA.
Allows you to convert a simple (single-agent) `gym.Env` class
into a `MultiAgentEnv` class. This function simply stacks n instances
of the given ```gym.Env``` class into one unified ``MultiAgentEnv`` class
and returns this class, thu... | Convenience wrapper for any single-agent env to be converted into MA.
Allows you to convert a simple (single-agent) `gym.Env` class
into a `MultiAgentEnv` class.
Agent IDs in the resulting and are int numbers starting from 0
(first agent). | [
"Convenience",
"wrapper",
"for",
"any",
"single",
"-",
"agent",
"env",
"to",
"be",
"converted",
"into",
"MA",
".",
"Allows",
"you",
"to",
"convert",
"a",
"simple",
"(",
"single",
"-",
"agent",
")",
"`",
"gym",
".",
"Env",
"`",
"class",
"into",
"a",
"... | def make_multi_agent(
env_name_or_creator: Union[str, EnvCreator],
) -> Type["MultiAgentEnv"]:
class MultiEnv(MultiAgentEnv):
def __init__(self, config=None):
MultiAgentEnv.__init__(self)
config = config or {}
num = config.pop("num_agents", 1)
if isinstanc... | [
"def",
"make_multi_agent",
"(",
"env_name_or_creator",
":",
"Union",
"[",
"str",
",",
"EnvCreator",
"]",
",",
")",
"->",
"Type",
"[",
"\"MultiAgentEnv\"",
"]",
":",
"class",
"MultiEnv",
"(",
"MultiAgentEnv",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"... | Convenience wrapper for any single-agent env to be converted into MA. | [
"Convenience",
"wrapper",
"for",
"any",
"single",
"-",
"agent",
"env",
"to",
"be",
"converted",
"into",
"MA",
"."
] | [
"\"\"\"Convenience wrapper for any single-agent env to be converted into MA.\n\n Allows you to convert a simple (single-agent) `gym.Env` class\n into a `MultiAgentEnv` class. This function simply stacks n instances\n of the given ```gym.Env``` class into one unified ``MultiAgentEnv`` class\n and returns... | [
{
"param": "env_name_or_creator",
"type": "Union[str, EnvCreator]"
}
] | {
"returns": [
{
"docstring": "New MultiAgentEnv class to be used as env.\nThe constructor takes a config dict with `num_agents` key\n(default=1). The rest of the config dict will be passed on to the\nunderlying single-agent env's constructor.",
"docstring_tokens": [
"New",
"MultiAgent... |
ca27d5248e5ae65afa63b967a81b31230f2c4021 | kisuke95/ray | python/ray/_private/ray_option_utils.py | [
"Apache-2.0"
] | Python | _counting_option | <not_specific> | def _counting_option(name: str, infinite: bool = True, default_value: Any = None):
"""This is used for positive and discrete options.
Args:
name: The name of the option keyword.
infinite: If True, user could use -1 to represent infinity.
default_value: The default value for this option.... | This is used for positive and discrete options.
Args:
name: The name of the option keyword.
infinite: If True, user could use -1 to represent infinity.
default_value: The default value for this option.
| This is used for positive and discrete options. | [
"This",
"is",
"used",
"for",
"positive",
"and",
"discrete",
"options",
"."
] | def _counting_option(name: str, infinite: bool = True, default_value: Any = None):
if infinite:
return Option(
(int, type(None)),
lambda x: x is None or x >= -1,
f"The keyword '{name}' only accepts None, 0, -1 or a positive integer, "
"where -1 represents infi... | [
"def",
"_counting_option",
"(",
"name",
":",
"str",
",",
"infinite",
":",
"bool",
"=",
"True",
",",
"default_value",
":",
"Any",
"=",
"None",
")",
":",
"if",
"infinite",
":",
"return",
"Option",
"(",
"(",
"int",
",",
"type",
"(",
"None",
")",
")",
... | This is used for positive and discrete options. | [
"This",
"is",
"used",
"for",
"positive",
"and",
"discrete",
"options",
"."
] | [
"\"\"\"This is used for positive and discrete options.\n\n Args:\n name: The name of the option keyword.\n infinite: If True, user could use -1 to represent infinity.\n default_value: The default value for this option.\n \"\"\""
] | [
{
"param": "name",
"type": "str"
},
{
"param": "infinite",
"type": "bool"
},
{
"param": "default_value",
"type": "Any"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "str",
"docstring": "The name of the option keyword.",
"docstring_tokens": [
"The",
"name",
"of",
"the",
"option",
"keyword",
"."
],
"default":... |
ca27d5248e5ae65afa63b967a81b31230f2c4021 | kisuke95/ray | python/ray/_private/ray_option_utils.py | [
"Apache-2.0"
] | Python | _resource_option | <not_specific> | def _resource_option(name: str, default_value: Any = None):
"""This is used for non-negative options, typically for defining resources."""
return Option(
(float, int, type(None)),
lambda x: x is None or x >= 0,
f"The keyword '{name}' only accepts None, 0 or a positive number",
de... | This is used for non-negative options, typically for defining resources. | This is used for non-negative options, typically for defining resources. | [
"This",
"is",
"used",
"for",
"non",
"-",
"negative",
"options",
"typically",
"for",
"defining",
"resources",
"."
] | def _resource_option(name: str, default_value: Any = None):
return Option(
(float, int, type(None)),
lambda x: x is None or x >= 0,
f"The keyword '{name}' only accepts None, 0 or a positive number",
default_value=default_value,
) | [
"def",
"_resource_option",
"(",
"name",
":",
"str",
",",
"default_value",
":",
"Any",
"=",
"None",
")",
":",
"return",
"Option",
"(",
"(",
"float",
",",
"int",
",",
"type",
"(",
"None",
")",
")",
",",
"lambda",
"x",
":",
"x",
"is",
"None",
"or",
... | This is used for non-negative options, typically for defining resources. | [
"This",
"is",
"used",
"for",
"non",
"-",
"negative",
"options",
"typically",
"for",
"defining",
"resources",
"."
] | [
"\"\"\"This is used for non-negative options, typically for defining resources.\"\"\""
] | [
{
"param": "name",
"type": "str"
},
{
"param": "default_value",
"type": "Any"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "default_value",
"type": "Any",
"docstring": null,
"docstring... |
ca27d5248e5ae65afa63b967a81b31230f2c4021 | kisuke95/ray | python/ray/_private/ray_option_utils.py | [
"Apache-2.0"
] | Python | _check_deprecate_placement_group | null | def _check_deprecate_placement_group(options: Dict[str, Any]):
"""Check if deprecated placement group option exists."""
placement_group = options.get("placement_group", "default")
scheduling_strategy = options.get("scheduling_strategy")
# TODO(suquark): @ray.remote(placement_group=None) is used in
#... | Check if deprecated placement group option exists. | Check if deprecated placement group option exists. | [
"Check",
"if",
"deprecated",
"placement",
"group",
"option",
"exists",
"."
] | def _check_deprecate_placement_group(options: Dict[str, Any]):
placement_group = options.get("placement_group", "default")
scheduling_strategy = options.get("scheduling_strategy")
if (placement_group not in ("default", None)) and (scheduling_strategy is not None):
raise ValueError(
"Plac... | [
"def",
"_check_deprecate_placement_group",
"(",
"options",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
":",
"placement_group",
"=",
"options",
".",
"get",
"(",
"\"placement_group\"",
",",
"\"default\"",
")",
"scheduling_strategy",
"=",
"options",
".",
"get",
... | Check if deprecated placement group option exists. | [
"Check",
"if",
"deprecated",
"placement",
"group",
"option",
"exists",
"."
] | [
"\"\"\"Check if deprecated placement group option exists.\"\"\"",
"# TODO(suquark): @ray.remote(placement_group=None) is used in",
"# \"python/ray/data/impl/remote_fn.py\" and many other places,",
"# while \"ray.data.read_api.read_datasource\" set \"scheduling_strategy=SPREAD\".",
"# This might be a bug, bu... | [
{
"param": "options",
"type": "Dict[str, Any]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "options",
"type": "Dict[str, Any]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ca27d5248e5ae65afa63b967a81b31230f2c4021 | kisuke95/ray | python/ray/_private/ray_option_utils.py | [
"Apache-2.0"
] | Python | validate_task_options | null | def validate_task_options(options: Dict[str, Any], in_options: bool):
"""Options check for Ray tasks.
Args:
options: Options for Ray tasks.
in_options: If True, we are checking the options under the context of
".options()".
"""
for k, v in options.items():
if k not i... | Options check for Ray tasks.
Args:
options: Options for Ray tasks.
in_options: If True, we are checking the options under the context of
".options()".
| Options check for Ray tasks. | [
"Options",
"check",
"for",
"Ray",
"tasks",
"."
] | def validate_task_options(options: Dict[str, Any], in_options: bool):
for k, v in options.items():
if k not in task_options:
raise ValueError(
f"Invalid option keyword {k} for remote functions. "
f"Valid ones are {list(task_options)}."
)
task_o... | [
"def",
"validate_task_options",
"(",
"options",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"in_options",
":",
"bool",
")",
":",
"for",
"k",
",",
"v",
"in",
"options",
".",
"items",
"(",
")",
":",
"if",
"k",
"not",
"in",
"task_options",
":",
"ra... | Options check for Ray tasks. | [
"Options",
"check",
"for",
"Ray",
"tasks",
"."
] | [
"\"\"\"Options check for Ray tasks.\n\n Args:\n options: Options for Ray tasks.\n in_options: If True, we are checking the options under the context of\n \".options()\".\n \"\"\""
] | [
{
"param": "options",
"type": "Dict[str, Any]"
},
{
"param": "in_options",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "options",
"type": "Dict[str, Any]",
"docstring": "Options for Ray tasks.",
"docstring_tokens": [
"Options",
"for",
"Ray",
"tasks",
"."
],
"default": null,
"is_optional"... |
ca27d5248e5ae65afa63b967a81b31230f2c4021 | kisuke95/ray | python/ray/_private/ray_option_utils.py | [
"Apache-2.0"
] | Python | validate_actor_options | null | def validate_actor_options(options: Dict[str, Any], in_options: bool):
"""Options check for Ray actors.
Args:
options: Options for Ray actors.
in_options: If True, we are checking the options under the context of
".options()".
"""
for k, v in options.items():
if k no... | Options check for Ray actors.
Args:
options: Options for Ray actors.
in_options: If True, we are checking the options under the context of
".options()".
| Options check for Ray actors. | [
"Options",
"check",
"for",
"Ray",
"actors",
"."
] | def validate_actor_options(options: Dict[str, Any], in_options: bool):
for k, v in options.items():
if k not in actor_options:
raise ValueError(
f"Invalid option keyword {k} for actors. "
f"Valid ones are {list(actor_options)}."
)
actor_options... | [
"def",
"validate_actor_options",
"(",
"options",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
",",
"in_options",
":",
"bool",
")",
":",
"for",
"k",
",",
"v",
"in",
"options",
".",
"items",
"(",
")",
":",
"if",
"k",
"not",
"in",
"actor_options",
":",
"... | Options check for Ray actors. | [
"Options",
"check",
"for",
"Ray",
"actors",
"."
] | [
"\"\"\"Options check for Ray actors.\n\n Args:\n options: Options for Ray actors.\n in_options: If True, we are checking the options under the context of\n \".options()\".\n \"\"\""
] | [
{
"param": "options",
"type": "Dict[str, Any]"
},
{
"param": "in_options",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "options",
"type": "Dict[str, Any]",
"docstring": "Options for Ray actors.",
"docstring_tokens": [
"Options",
"for",
"Ray",
"actors",
"."
],
"default": null,
"is_optiona... |
9acb5aacee04e23c64255c9c97b657a371521d58 | kisuke95/ray | python/ray/data/grouped_dataset.py | [
"Apache-2.0"
] | Python | map | List[Union[BlockMetadata, Block]] | def map(
idx: int,
block: Block,
output_num_blocks: int,
boundaries: List[KeyType],
key: KeyFn,
aggs: Tuple[AggregateFn],
) -> List[Union[BlockMetadata, Block]]:
"""Partition the block and combine rows with the same key."""
stats = BlockExecStats.build... | Partition the block and combine rows with the same key. | Partition the block and combine rows with the same key. | [
"Partition",
"the",
"block",
"and",
"combine",
"rows",
"with",
"the",
"same",
"key",
"."
] | def map(
idx: int,
block: Block,
output_num_blocks: int,
boundaries: List[KeyType],
key: KeyFn,
aggs: Tuple[AggregateFn],
) -> List[Union[BlockMetadata, Block]]:
stats = BlockExecStats.builder()
if key is None:
partitions = [block]
... | [
"def",
"map",
"(",
"idx",
":",
"int",
",",
"block",
":",
"Block",
",",
"output_num_blocks",
":",
"int",
",",
"boundaries",
":",
"List",
"[",
"KeyType",
"]",
",",
"key",
":",
"KeyFn",
",",
"aggs",
":",
"Tuple",
"[",
"AggregateFn",
"]",
",",
")",
"->... | Partition the block and combine rows with the same key. | [
"Partition",
"the",
"block",
"and",
"combine",
"rows",
"with",
"the",
"same",
"key",
"."
] | [
"\"\"\"Partition the block and combine rows with the same key.\"\"\""
] | [
{
"param": "idx",
"type": "int"
},
{
"param": "block",
"type": "Block"
},
{
"param": "output_num_blocks",
"type": "int"
},
{
"param": "boundaries",
"type": "List[KeyType]"
},
{
"param": "key",
"type": "KeyFn"
},
{
"param": "aggs",
"type": "Tuple[Ag... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "idx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "Block",
"docstring": null,
"docstring_tokens... |
9acb5aacee04e23c64255c9c97b657a371521d58 | kisuke95/ray | python/ray/data/grouped_dataset.py | [
"Apache-2.0"
] | Python | reduce | (Block, BlockMetadata) | def reduce(
key: KeyFn, aggs: Tuple[AggregateFn], *mapper_outputs: List[Block]
) -> (Block, BlockMetadata):
"""Aggregate sorted and partially combined blocks."""
return BlockAccessor.for_block(mapper_outputs[0]).aggregate_combined_blocks(
list(mapper_outputs), key, aggs
) | Aggregate sorted and partially combined blocks. | Aggregate sorted and partially combined blocks. | [
"Aggregate",
"sorted",
"and",
"partially",
"combined",
"blocks",
"."
] | def reduce(
key: KeyFn, aggs: Tuple[AggregateFn], *mapper_outputs: List[Block]
) -> (Block, BlockMetadata):
return BlockAccessor.for_block(mapper_outputs[0]).aggregate_combined_blocks(
list(mapper_outputs), key, aggs
) | [
"def",
"reduce",
"(",
"key",
":",
"KeyFn",
",",
"aggs",
":",
"Tuple",
"[",
"AggregateFn",
"]",
",",
"*",
"mapper_outputs",
":",
"List",
"[",
"Block",
"]",
")",
"->",
"(",
"Block",
",",
"BlockMetadata",
")",
":",
"return",
"BlockAccessor",
".",
"for_blo... | Aggregate sorted and partially combined blocks. | [
"Aggregate",
"sorted",
"and",
"partially",
"combined",
"blocks",
"."
] | [
"\"\"\"Aggregate sorted and partially combined blocks.\"\"\""
] | [
{
"param": "key",
"type": "KeyFn"
},
{
"param": "aggs",
"type": "Tuple[AggregateFn]"
},
{
"param": "mapper_outputs",
"type": "List[Block]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "key",
"type": "KeyFn",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "aggs",
"type": "Tuple[AggregateFn]",
"docstring": null,
"do... |
9acb5aacee04e23c64255c9c97b657a371521d58 | kisuke95/ray | python/ray/data/grouped_dataset.py | [
"Apache-2.0"
] | Python | aggregate | Dataset[U] | def aggregate(self, *aggs: AggregateFn) -> Dataset[U]:
"""Implements an accumulator-based aggregation.
This is a blocking operation.
Examples:
>>> import ray
>>> from ray.data.aggregate import AggregateFn
>>> ds = ray.data.range(100) # doctest: +SKIP
... | Implements an accumulator-based aggregation.
This is a blocking operation.
Examples:
>>> import ray
>>> from ray.data.aggregate import AggregateFn
>>> ds = ray.data.range(100) # doctest: +SKIP
>>> grouped_ds = ds.groupby(lambda x: x % 3) # doctest: +SKIP... | Implements an accumulator-based aggregation.
This is a blocking operation. | [
"Implements",
"an",
"accumulator",
"-",
"based",
"aggregation",
".",
"This",
"is",
"a",
"blocking",
"operation",
"."
] | def aggregate(self, *aggs: AggregateFn) -> Dataset[U]:
def do_agg(blocks, clear_input_blocks: bool, *_):
stage_info = {}
if len(aggs) == 0:
raise ValueError("Aggregate requires at least one aggregation")
for agg in aggs:
agg._validate(self._dat... | [
"def",
"aggregate",
"(",
"self",
",",
"*",
"aggs",
":",
"AggregateFn",
")",
"->",
"Dataset",
"[",
"U",
"]",
":",
"def",
"do_agg",
"(",
"blocks",
",",
"clear_input_blocks",
":",
"bool",
",",
"*",
"_",
")",
":",
"stage_info",
"=",
"{",
"}",
"if",
"le... | Implements an accumulator-based aggregation. | [
"Implements",
"an",
"accumulator",
"-",
"based",
"aggregation",
"."
] | [
"\"\"\"Implements an accumulator-based aggregation.\n\n This is a blocking operation.\n\n Examples:\n >>> import ray\n >>> from ray.data.aggregate import AggregateFn\n >>> ds = ray.data.range(100) # doctest: +SKIP\n >>> grouped_ds = ds.groupby(lambda x: x % ... | [
{
"param": "self",
"type": null
},
{
"param": "aggs",
"type": "AggregateFn"
}
] | {
"returns": [
{
"docstring": "If the input dataset is simple dataset then the output is a simple\ndataset of ``(k, v_1, ..., v_n)`` tuples where ``k`` is the groupby\nkey and ``v_i`` is the result of the ith given aggregation.\nIf the input dataset is an Arrow dataset then the output is an\nArrow dataset o... |
9acb5aacee04e23c64255c9c97b657a371521d58 | kisuke95/ray | python/ray/data/grouped_dataset.py | [
"Apache-2.0"
] | Python | _aggregate_on | <not_specific> | def _aggregate_on(
self,
agg_cls: type,
on: Union[KeyFn, List[KeyFn]],
ignore_nulls: bool,
*args,
**kwargs,
):
"""Helper for aggregating on a particular subset of the dataset.
This validates the `on` argument, and converts a list of column names
... | Helper for aggregating on a particular subset of the dataset.
This validates the `on` argument, and converts a list of column names
or lambdas to a multi-aggregation. A null `on` results in a
multi-aggregation on all columns for an Arrow Dataset, and a single
aggregation on the entire r... | Helper for aggregating on a particular subset of the dataset.
This validates the `on` argument, and converts a list of column names
or lambdas to a multi-aggregation. A null `on` results in a
multi-aggregation on all columns for an Arrow Dataset, and a single
aggregation on the entire row for a simple Dataset. | [
"Helper",
"for",
"aggregating",
"on",
"a",
"particular",
"subset",
"of",
"the",
"dataset",
".",
"This",
"validates",
"the",
"`",
"on",
"`",
"argument",
"and",
"converts",
"a",
"list",
"of",
"column",
"names",
"or",
"lambdas",
"to",
"a",
"multi",
"-",
"ag... | def _aggregate_on(
self,
agg_cls: type,
on: Union[KeyFn, List[KeyFn]],
ignore_nulls: bool,
*args,
**kwargs,
):
aggs = self._dataset._build_multicolumn_aggs(
agg_cls, on, ignore_nulls, *args, skip_cols=self._key, **kwargs
)
return se... | [
"def",
"_aggregate_on",
"(",
"self",
",",
"agg_cls",
":",
"type",
",",
"on",
":",
"Union",
"[",
"KeyFn",
",",
"List",
"[",
"KeyFn",
"]",
"]",
",",
"ignore_nulls",
":",
"bool",
",",
"*",
"args",
",",
"**",
"kwargs",
",",
")",
":",
"aggs",
"=",
"se... | Helper for aggregating on a particular subset of the dataset. | [
"Helper",
"for",
"aggregating",
"on",
"a",
"particular",
"subset",
"of",
"the",
"dataset",
"."
] | [
"\"\"\"Helper for aggregating on a particular subset of the dataset.\n\n This validates the `on` argument, and converts a list of column names\n or lambdas to a multi-aggregation. A null `on` results in a\n multi-aggregation on all columns for an Arrow Dataset, and a single\n aggregation... | [
{
"param": "self",
"type": null
},
{
"param": "agg_cls",
"type": "type"
},
{
"param": "on",
"type": "Union[KeyFn, List[KeyFn]]"
},
{
"param": "ignore_nulls",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "agg_cls",
"type": "type",
"docstring": null,
"docstring_token... |
9acb5aacee04e23c64255c9c97b657a371521d58 | kisuke95/ray | python/ray/data/grouped_dataset.py | [
"Apache-2.0"
] | Python | map_groups | "Dataset[Any]" | def map_groups(
self,
fn: Union[CallableClass, Callable[[BatchType], BatchType]],
*,
compute: Union[str, ComputeStrategy] = None,
batch_format: str = "native",
**ray_remote_args,
) -> "Dataset[Any]":
# TODO AttributeError: 'GroupedDataset' object has no attrib... | Apply the given function to each group of records of this dataset.
While map_groups() is very flexible, note that it comes with downsides:
* It may be slower than using more specific methods such as min(), max().
* It requires that each group fits in memory on a single node.
In... | Apply the given function to each group of records of this dataset.
While map_groups() is very flexible, note that it comes with downsides:
It may be slower than using more specific methods such as min(), max().
It requires that each group fits in memory on a single node.
In general, prefer to use aggregate() instead o... | [
"Apply",
"the",
"given",
"function",
"to",
"each",
"group",
"of",
"records",
"of",
"this",
"dataset",
".",
"While",
"map_groups",
"()",
"is",
"very",
"flexible",
"note",
"that",
"it",
"comes",
"with",
"downsides",
":",
"It",
"may",
"be",
"slower",
"than",
... | def map_groups(
self,
fn: Union[CallableClass, Callable[[BatchType], BatchType]],
*,
compute: Union[str, ComputeStrategy] = None,
batch_format: str = "native",
**ray_remote_args,
) -> "Dataset[Any]":
if self._key is not None:
sorted_ds = self._data... | [
"def",
"map_groups",
"(",
"self",
",",
"fn",
":",
"Union",
"[",
"CallableClass",
",",
"Callable",
"[",
"[",
"BatchType",
"]",
",",
"BatchType",
"]",
"]",
",",
"*",
",",
"compute",
":",
"Union",
"[",
"str",
",",
"ComputeStrategy",
"]",
"=",
"None",
",... | Apply the given function to each group of records of this dataset. | [
"Apply",
"the",
"given",
"function",
"to",
"each",
"group",
"of",
"records",
"of",
"this",
"dataset",
"."
] | [
"# TODO AttributeError: 'GroupedDataset' object has no attribute 'map_groups'",
"# in the example below.",
"\"\"\"Apply the given function to each group of records of this dataset.\n\n While map_groups() is very flexible, note that it comes with downsides:\n * It may be slower than using more... | [
{
"param": "self",
"type": null
},
{
"param": "fn",
"type": "Union[CallableClass, Callable[[BatchType], BatchType]]"
},
{
"param": "compute",
"type": "Union[str, ComputeStrategy]"
},
{
"param": "batch_format",
"type": "str"
}
] | {
"returns": [
{
"docstring": "The return type is determined by the return type of ``fn``, and the return\nvalue is combined from results of all groups.",
"docstring_tokens": [
"The",
"return",
"type",
"is",
"determined",
"by",
"the",
"re... |
0134c12271d357819a8639b44479861f7d708b9f | kisuke95/ray | rllib/agents/dqn/apex.py | [
"Apache-2.0"
] | Python | sample_from_replay_buffer_place_on_learner_queue_non_blocking | None | def sample_from_replay_buffer_place_on_learner_queue_non_blocking(
self, num_samples_collected: Dict[ActorHandle, int]
) -> None:
"""Get samples from the replay buffer and place them on the learner queue.
Args:
num_samples_collected: A mapping from ActorHandle (RolloutWorker) to... | Get samples from the replay buffer and place them on the learner queue.
Args:
num_samples_collected: A mapping from ActorHandle (RolloutWorker) to
number of samples returned by the remote worker. This is used to
implement training intensity which is the concept of tr... | Get samples from the replay buffer and place them on the learner queue. | [
"Get",
"samples",
"from",
"the",
"replay",
"buffer",
"and",
"place",
"them",
"on",
"the",
"learner",
"queue",
"."
] | def sample_from_replay_buffer_place_on_learner_queue_non_blocking(
self, num_samples_collected: Dict[ActorHandle, int]
) -> None:
def wait_on_replay_actors(timeout: float) -> None:
replay_samples_ready: Dict[ActorHandle, T] = wait_asynchronous_requests(
remote_requests_in... | [
"def",
"sample_from_replay_buffer_place_on_learner_queue_non_blocking",
"(",
"self",
",",
"num_samples_collected",
":",
"Dict",
"[",
"ActorHandle",
",",
"int",
"]",
")",
"->",
"None",
":",
"def",
"wait_on_replay_actors",
"(",
"timeout",
":",
"float",
")",
"->",
"Non... | Get samples from the replay buffer and place them on the learner queue. | [
"Get",
"samples",
"from",
"the",
"replay",
"buffer",
"and",
"place",
"them",
"on",
"the",
"learner",
"queue",
"."
] | [
"\"\"\"Get samples from the replay buffer and place them on the learner queue.\n\n Args:\n num_samples_collected: A mapping from ActorHandle (RolloutWorker) to\n number of samples returned by the remote worker. This is used to\n implement training intensity which is t... | [
{
"param": "self",
"type": null
},
{
"param": "num_samples_collected",
"type": "Dict[ActorHandle, int]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_samples_collected",
"type": "Dict[ActorHandle, int]",
"docstrin... |
0134c12271d357819a8639b44479861f7d708b9f | kisuke95/ray | rllib/agents/dqn/apex.py | [
"Apache-2.0"
] | Python | update_replay_sample_priority | int | def update_replay_sample_priority(self) -> int:
"""Update the priorities of the sample batches with new priorities that are
computed by the learner thread.
Returns:
The number of samples trained by the learner thread since the last
training iteration.
"""
... | Update the priorities of the sample batches with new priorities that are
computed by the learner thread.
Returns:
The number of samples trained by the learner thread since the last
training iteration.
| Update the priorities of the sample batches with new priorities that are
computed by the learner thread. | [
"Update",
"the",
"priorities",
"of",
"the",
"sample",
"batches",
"with",
"new",
"priorities",
"that",
"are",
"computed",
"by",
"the",
"learner",
"thread",
"."
] | def update_replay_sample_priority(self) -> int:
num_samples_trained_this_itr = 0
for _ in range(self.learner_thread.outqueue.qsize()):
if self.learner_thread.is_alive():
(
replay_actor,
priority_dict,
env_steps,
... | [
"def",
"update_replay_sample_priority",
"(",
"self",
")",
"->",
"int",
":",
"num_samples_trained_this_itr",
"=",
"0",
"for",
"_",
"in",
"range",
"(",
"self",
".",
"learner_thread",
".",
"outqueue",
".",
"qsize",
"(",
")",
")",
":",
"if",
"self",
".",
"lear... | Update the priorities of the sample batches with new priorities that are
computed by the learner thread. | [
"Update",
"the",
"priorities",
"of",
"the",
"sample",
"batches",
"with",
"new",
"priorities",
"that",
"are",
"computed",
"by",
"the",
"learner",
"thread",
"."
] | [
"\"\"\"Update the priorities of the sample batches with new priorities that are\n computed by the learner thread.\n\n Returns:\n The number of samples trained by the learner thread since the last\n training iteration.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "The number of samples trained by the learner thread since the last\ntraining iteration.",
"docstring_tokens": [
"The",
"number",
"of",
"samples",
"trained",
"by",
"the",
"learner",
"thread",
... |
5dde89344bc629257eda288a5d3496502649215b | kisuke95/ray | dashboard/modules/log/log_head.py | [
"Apache-2.0"
] | Python | _list_logs_single_node | <not_specific> | def _list_logs_single_node(log_files: List[str], filters: List[str]):
"""
Returns a JSON file mapping a category of log component to a list of filenames,
on the given node.
"""
filters = [] if filters == [""] else filters
def contains_all_filters(log_file_name):
... |
Returns a JSON file mapping a category of log component to a list of filenames,
on the given node.
| Returns a JSON file mapping a category of log component to a list of filenames,
on the given node. | [
"Returns",
"a",
"JSON",
"file",
"mapping",
"a",
"category",
"of",
"log",
"component",
"to",
"a",
"list",
"of",
"filenames",
"on",
"the",
"given",
"node",
"."
] | def _list_logs_single_node(log_files: List[str], filters: List[str]):
filters = [] if filters == [""] else filters
def contains_all_filters(log_file_name):
return all(f in log_file_name for f in filters)
filtered = list(filter(contains_all_filters, log_files))
logs = {}
... | [
"def",
"_list_logs_single_node",
"(",
"log_files",
":",
"List",
"[",
"str",
"]",
",",
"filters",
":",
"List",
"[",
"str",
"]",
")",
":",
"filters",
"=",
"[",
"]",
"if",
"filters",
"==",
"[",
"\"\"",
"]",
"else",
"filters",
"def",
"contains_all_filters",
... | Returns a JSON file mapping a category of log component to a list of filenames,
on the given node. | [
"Returns",
"a",
"JSON",
"file",
"mapping",
"a",
"category",
"of",
"log",
"component",
"to",
"a",
"list",
"of",
"filenames",
"on",
"the",
"given",
"node",
"."
] | [
"\"\"\"\n Returns a JSON file mapping a category of log component to a list of filenames,\n on the given node.\n \"\"\""
] | [
{
"param": "log_files",
"type": "List[str]"
},
{
"param": "filters",
"type": "List[str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "log_files",
"type": "List[str]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filters",
"type": "List[str]",
"docstring": null,
... |
5dde89344bc629257eda288a5d3496502649215b | kisuke95/ray | dashboard/modules/log/log_head.py | [
"Apache-2.0"
] | Python | _wait_until_initialized | <not_specific> | async def _wait_until_initialized(self):
"""
Wait until connected to at least one node's log agent.
"""
POLL_SLEEP_TIME = 0.5
POLL_RETRIES = 10
for _ in range(POLL_RETRIES):
if self._stubs != {}:
return None
await asyncio.sleep(POLL... |
Wait until connected to at least one node's log agent.
| Wait until connected to at least one node's log agent. | [
"Wait",
"until",
"connected",
"to",
"at",
"least",
"one",
"node",
"'",
"s",
"log",
"agent",
"."
] | async def _wait_until_initialized(self):
POLL_SLEEP_TIME = 0.5
POLL_RETRIES = 10
for _ in range(POLL_RETRIES):
if self._stubs != {}:
return None
await asyncio.sleep(POLL_SLEEP_TIME)
return aiohttp.web.HTTPGatewayTimeout(
reason="Could n... | [
"async",
"def",
"_wait_until_initialized",
"(",
"self",
")",
":",
"POLL_SLEEP_TIME",
"=",
"0.5",
"POLL_RETRIES",
"=",
"10",
"for",
"_",
"in",
"range",
"(",
"POLL_RETRIES",
")",
":",
"if",
"self",
".",
"_stubs",
"!=",
"{",
"}",
":",
"return",
"None",
"awa... | Wait until connected to at least one node's log agent. | [
"Wait",
"until",
"connected",
"to",
"at",
"least",
"one",
"node",
"'",
"s",
"log",
"agent",
"."
] | [
"\"\"\"\n Wait until connected to at least one node's log agent.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5dde89344bc629257eda288a5d3496502649215b | kisuke95/ray | dashboard/modules/log/log_head.py | [
"Apache-2.0"
] | Python | _list_logs | <not_specific> | async def _list_logs(self, node_id_query: str, filters: List[str]):
"""
Helper function to list the logs by querying each agent
on each cluster via gRPC.
"""
response = {}
tasks = []
for node_id, grpc_stub in self._stubs.items():
if node_id_query is No... |
Helper function to list the logs by querying each agent
on each cluster via gRPC.
| Helper function to list the logs by querying each agent
on each cluster via gRPC. | [
"Helper",
"function",
"to",
"list",
"the",
"logs",
"by",
"querying",
"each",
"agent",
"on",
"each",
"cluster",
"via",
"gRPC",
"."
] | async def _list_logs(self, node_id_query: str, filters: List[str]):
response = {}
tasks = []
for node_id, grpc_stub in self._stubs.items():
if node_id_query is None or node_id_query == node_id:
async def coro():
reply = await grpc_stub.ListLogs(
... | [
"async",
"def",
"_list_logs",
"(",
"self",
",",
"node_id_query",
":",
"str",
",",
"filters",
":",
"List",
"[",
"str",
"]",
")",
":",
"response",
"=",
"{",
"}",
"tasks",
"=",
"[",
"]",
"for",
"node_id",
",",
"grpc_stub",
"in",
"self",
".",
"_stubs",
... | Helper function to list the logs by querying each agent
on each cluster via gRPC. | [
"Helper",
"function",
"to",
"list",
"the",
"logs",
"by",
"querying",
"each",
"agent",
"on",
"each",
"cluster",
"via",
"gRPC",
"."
] | [
"\"\"\"\n Helper function to list the logs by querying each agent\n on each cluster via gRPC.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "node_id_query",
"type": "str"
},
{
"param": "filters",
"type": "List[str]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node_id_query",
"type": "str",
"docstring": null,
"docstring_... |
5dde89344bc629257eda288a5d3496502649215b | kisuke95/ray | dashboard/modules/log/log_head.py | [
"Apache-2.0"
] | Python | handle_list_logs | <not_specific> | async def handle_list_logs(self, req):
"""
Returns a JSON file containing, for each node in the cluster,
a dict mapping a category of log component to a list of filenames.
"""
try:
node_id = req.query.get("node_id", None)
if node_id is None:
... |
Returns a JSON file containing, for each node in the cluster,
a dict mapping a category of log component to a list of filenames.
| Returns a JSON file containing, for each node in the cluster,
a dict mapping a category of log component to a list of filenames. | [
"Returns",
"a",
"JSON",
"file",
"containing",
"for",
"each",
"node",
"in",
"the",
"cluster",
"a",
"dict",
"mapping",
"a",
"category",
"of",
"log",
"component",
"to",
"a",
"list",
"of",
"filenames",
"."
] | async def handle_list_logs(self, req):
try:
node_id = req.query.get("node_id", None)
if node_id is None:
ip = req.query.get("node_ip", None)
if ip is not None:
if ip not in self._ip_to_node_id:
return aiohttp.web... | [
"async",
"def",
"handle_list_logs",
"(",
"self",
",",
"req",
")",
":",
"try",
":",
"node_id",
"=",
"req",
".",
"query",
".",
"get",
"(",
"\"node_id\"",
",",
"None",
")",
"if",
"node_id",
"is",
"None",
":",
"ip",
"=",
"req",
".",
"query",
".",
"get"... | Returns a JSON file containing, for each node in the cluster,
a dict mapping a category of log component to a list of filenames. | [
"Returns",
"a",
"JSON",
"file",
"containing",
"for",
"each",
"node",
"in",
"the",
"cluster",
"a",
"dict",
"mapping",
"a",
"category",
"of",
"log",
"component",
"to",
"a",
"list",
"of",
"filenames",
"."
] | [
"\"\"\"\n Returns a JSON file containing, for each node in the cluster,\n a dict mapping a category of log component to a list of filenames.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "req",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "req",
"type": null,
"docstring": null,
"docstring_tokens": []... |
f9e78b125c3e1ea3df680d3d87b8284c9e86012a | kisuke95/ray | python/ray/tune/tests/test_ray_trial_executor.py | [
"Apache-2.0"
] | Python | testAsyncSave | null | def testAsyncSave(self):
"""Tests that saved checkpoint value not immediately set."""
trial = Trial("__fake")
self._simulate_starting_trial(trial)
self._simulate_getting_result(trial)
self._simulate_saving(trial)
self.trial_executor.stop_trial(trial)
self.asser... | Tests that saved checkpoint value not immediately set. | Tests that saved checkpoint value not immediately set. | [
"Tests",
"that",
"saved",
"checkpoint",
"value",
"not",
"immediately",
"set",
"."
] | def testAsyncSave(self):
trial = Trial("__fake")
self._simulate_starting_trial(trial)
self._simulate_getting_result(trial)
self._simulate_saving(trial)
self.trial_executor.stop_trial(trial)
self.assertEqual(Trial.TERMINATED, trial.status) | [
"def",
"testAsyncSave",
"(",
"self",
")",
":",
"trial",
"=",
"Trial",
"(",
"\"__fake\"",
")",
"self",
".",
"_simulate_starting_trial",
"(",
"trial",
")",
"self",
".",
"_simulate_getting_result",
"(",
"trial",
")",
"self",
".",
"_simulate_saving",
"(",
"trial",... | Tests that saved checkpoint value not immediately set. | [
"Tests",
"that",
"saved",
"checkpoint",
"value",
"not",
"immediately",
"set",
"."
] | [
"\"\"\"Tests that saved checkpoint value not immediately set.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f9e78b125c3e1ea3df680d3d87b8284c9e86012a | kisuke95/ray | python/ray/tune/tests/test_ray_trial_executor.py | [
"Apache-2.0"
] | Python | testPauseResume | null | def testPauseResume(self):
"""Tests that pausing works for trials in flight."""
trial = Trial("__fake")
self._simulate_starting_trial(trial)
self.trial_executor.pause_trial(trial)
self.assertEqual(Trial.PAUSED, trial.status)
self._simulate_starting_trial(trial)
... | Tests that pausing works for trials in flight. | Tests that pausing works for trials in flight. | [
"Tests",
"that",
"pausing",
"works",
"for",
"trials",
"in",
"flight",
"."
] | def testPauseResume(self):
trial = Trial("__fake")
self._simulate_starting_trial(trial)
self.trial_executor.pause_trial(trial)
self.assertEqual(Trial.PAUSED, trial.status)
self._simulate_starting_trial(trial)
self.trial_executor.stop_trial(trial)
self.assertEqual(... | [
"def",
"testPauseResume",
"(",
"self",
")",
":",
"trial",
"=",
"Trial",
"(",
"\"__fake\"",
")",
"self",
".",
"_simulate_starting_trial",
"(",
"trial",
")",
"self",
".",
"trial_executor",
".",
"pause_trial",
"(",
"trial",
")",
"self",
".",
"assertEqual",
"(",... | Tests that pausing works for trials in flight. | [
"Tests",
"that",
"pausing",
"works",
"for",
"trials",
"in",
"flight",
"."
] | [
"\"\"\"Tests that pausing works for trials in flight.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f9e78b125c3e1ea3df680d3d87b8284c9e86012a | kisuke95/ray | python/ray/tune/tests/test_ray_trial_executor.py | [
"Apache-2.0"
] | Python | testSavePauseResumeErrorRestore | null | def testSavePauseResumeErrorRestore(self):
"""Tests that pause checkpoint does not replace restore checkpoint."""
trial = Trial("__fake")
self._simulate_starting_trial(trial)
self._simulate_getting_result(trial)
# Save
self._simulate_saving(trial)
# Train
... | Tests that pause checkpoint does not replace restore checkpoint. | Tests that pause checkpoint does not replace restore checkpoint. | [
"Tests",
"that",
"pause",
"checkpoint",
"does",
"not",
"replace",
"restore",
"checkpoint",
"."
] | def testSavePauseResumeErrorRestore(self):
trial = Trial("__fake")
self._simulate_starting_trial(trial)
self._simulate_getting_result(trial)
self._simulate_saving(trial)
self.trial_executor.continue_training(trial)
self._simulate_getting_result(trial)
self.trial_e... | [
"def",
"testSavePauseResumeErrorRestore",
"(",
"self",
")",
":",
"trial",
"=",
"Trial",
"(",
"\"__fake\"",
")",
"self",
".",
"_simulate_starting_trial",
"(",
"trial",
")",
"self",
".",
"_simulate_getting_result",
"(",
"trial",
")",
"self",
".",
"_simulate_saving",... | Tests that pause checkpoint does not replace restore checkpoint. | [
"Tests",
"that",
"pause",
"checkpoint",
"does",
"not",
"replace",
"restore",
"checkpoint",
"."
] | [
"\"\"\"Tests that pause checkpoint does not replace restore checkpoint.\"\"\"",
"# Save",
"# Train",
"# Pause",
"# Resume",
"# Error",
"# Restore"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f9e78b125c3e1ea3df680d3d87b8284c9e86012a | kisuke95/ray | python/ray/tune/tests/test_ray_trial_executor.py | [
"Apache-2.0"
] | Python | testPauseResume2 | null | def testPauseResume2(self):
"""Tests that pausing works for trials being processed."""
trial = Trial("__fake")
self._simulate_starting_trial(trial)
self._simulate_getting_result(trial)
self.trial_executor.pause_trial(trial)
self.assertEqual(Trial.PAUSED, trial.status)
... | Tests that pausing works for trials being processed. | Tests that pausing works for trials being processed. | [
"Tests",
"that",
"pausing",
"works",
"for",
"trials",
"being",
"processed",
"."
] | def testPauseResume2(self):
trial = Trial("__fake")
self._simulate_starting_trial(trial)
self._simulate_getting_result(trial)
self.trial_executor.pause_trial(trial)
self.assertEqual(Trial.PAUSED, trial.status)
self._simulate_starting_trial(trial)
self.trial_execut... | [
"def",
"testPauseResume2",
"(",
"self",
")",
":",
"trial",
"=",
"Trial",
"(",
"\"__fake\"",
")",
"self",
".",
"_simulate_starting_trial",
"(",
"trial",
")",
"self",
".",
"_simulate_getting_result",
"(",
"trial",
")",
"self",
".",
"trial_executor",
".",
"pause_... | Tests that pausing works for trials being processed. | [
"Tests",
"that",
"pausing",
"works",
"for",
"trials",
"being",
"processed",
"."
] | [
"\"\"\"Tests that pausing works for trials being processed.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f9e78b125c3e1ea3df680d3d87b8284c9e86012a | kisuke95/ray | python/ray/tune/tests/test_ray_trial_executor.py | [
"Apache-2.0"
] | Python | testNoResetTrial | null | def testNoResetTrial(self):
"""Tests that reset handles NotImplemented properly."""
trial = Trial("__fake")
self._simulate_starting_trial(trial)
exists = self.trial_executor.reset_trial(trial, {}, "modified_mock")
self.assertEqual(exists, False)
self.assertEqual(Trial.RUN... | Tests that reset handles NotImplemented properly. | Tests that reset handles NotImplemented properly. | [
"Tests",
"that",
"reset",
"handles",
"NotImplemented",
"properly",
"."
] | def testNoResetTrial(self):
trial = Trial("__fake")
self._simulate_starting_trial(trial)
exists = self.trial_executor.reset_trial(trial, {}, "modified_mock")
self.assertEqual(exists, False)
self.assertEqual(Trial.RUNNING, trial.status) | [
"def",
"testNoResetTrial",
"(",
"self",
")",
":",
"trial",
"=",
"Trial",
"(",
"\"__fake\"",
")",
"self",
".",
"_simulate_starting_trial",
"(",
"trial",
")",
"exists",
"=",
"self",
".",
"trial_executor",
".",
"reset_trial",
"(",
"trial",
",",
"{",
"}",
",",... | Tests that reset handles NotImplemented properly. | [
"Tests",
"that",
"reset",
"handles",
"NotImplemented",
"properly",
"."
] | [
"\"\"\"Tests that reset handles NotImplemented properly.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f9e78b125c3e1ea3df680d3d87b8284c9e86012a | kisuke95/ray | python/ray/tune/tests/test_ray_trial_executor.py | [
"Apache-2.0"
] | Python | testResetTrial | <not_specific> | def testResetTrial(self):
"""Tests that reset works as expected."""
class B(Trainable):
def step(self):
return dict(timesteps_this_iter=1, done=True)
def reset_config(self, config):
self.config = config
return True
trials... | Tests that reset works as expected. | Tests that reset works as expected. | [
"Tests",
"that",
"reset",
"works",
"as",
"expected",
"."
] | def testResetTrial(self):
class B(Trainable):
def step(self):
return dict(timesteps_this_iter=1, done=True)
def reset_config(self, config):
self.config = config
return True
trials = self.generate_trials(
{
... | [
"def",
"testResetTrial",
"(",
"self",
")",
":",
"class",
"B",
"(",
"Trainable",
")",
":",
"def",
"step",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"timesteps_this_iter",
"=",
"1",
",",
"done",
"=",
"True",
")",
"def",
"reset_config",
"(",
"self",
... | Tests that reset works as expected. | [
"Tests",
"that",
"reset",
"works",
"as",
"expected",
"."
] | [
"\"\"\"Tests that reset works as expected.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f9e78b125c3e1ea3df680d3d87b8284c9e86012a | kisuke95/ray | python/ray/tune/tests/test_ray_trial_executor.py | [
"Apache-2.0"
] | Python | testPlacementGroupFactoryEquality | null | def testPlacementGroupFactoryEquality(self):
"""
Test that two different placement group factory objects are considered
equal and evaluate to the same hash.
"""
from collections import Counter
pgf_1 = PlacementGroupFactory(
[{"CPU": 2, "GPU": 4, "custom": 7},... |
Test that two different placement group factory objects are considered
equal and evaluate to the same hash.
| Test that two different placement group factory objects are considered
equal and evaluate to the same hash. | [
"Test",
"that",
"two",
"different",
"placement",
"group",
"factory",
"objects",
"are",
"considered",
"equal",
"and",
"evaluate",
"to",
"the",
"same",
"hash",
"."
] | def testPlacementGroupFactoryEquality(self):
from collections import Counter
pgf_1 = PlacementGroupFactory(
[{"CPU": 2, "GPU": 4, "custom": 7}, {"GPU": 2, "custom": 1, "CPU": 3}],
"PACK",
"no_name",
None,
)
pgf_2 = PlacementGroupFactory(
... | [
"def",
"testPlacementGroupFactoryEquality",
"(",
"self",
")",
":",
"from",
"collections",
"import",
"Counter",
"pgf_1",
"=",
"PlacementGroupFactory",
"(",
"[",
"{",
"\"CPU\"",
":",
"2",
",",
"\"GPU\"",
":",
"4",
",",
"\"custom\"",
":",
"7",
"}",
",",
"{",
... | Test that two different placement group factory objects are considered
equal and evaluate to the same hash. | [
"Test",
"that",
"two",
"different",
"placement",
"group",
"factory",
"objects",
"are",
"considered",
"equal",
"and",
"evaluate",
"to",
"the",
"same",
"hash",
"."
] | [
"\"\"\"\n Test that two different placement group factory objects are considered\n equal and evaluate to the same hash.\n \"\"\"",
"# Hash testing"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8dc4f0e54a8ad26355c1a21b54980156c572a9c | kisuke95/ray | python/ray/workflow/api.py | [
"Apache-2.0"
] | Python | step | <not_specific> | def step(*args, **kwargs):
"""A decorator used for creating workflow steps.
Examples:
>>> from ray import workflow
>>> Flight, Hotel = ... # doctest: +SKIP
>>> @workflow.step # doctest: +SKIP
... def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP
... ... | A decorator used for creating workflow steps.
Examples:
>>> from ray import workflow
>>> Flight, Hotel = ... # doctest: +SKIP
>>> @workflow.step # doctest: +SKIP
... def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP
... return Flight(...) # doctest: +SKI... | A decorator used for creating workflow steps. | [
"A",
"decorator",
"used",
"for",
"creating",
"workflow",
"steps",
"."
] | def step(*args, **kwargs):
if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
options = WorkflowStepRuntimeOptions.make(step_type=StepType.FUNCTION)
return make_step_decorator(options)(args[0])
if len(args) != 0:
raise ValueError(f"Invalid arguments for step decorator {args}")... | [
"def",
"step",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
"and",
"len",
"(",
"kwargs",
")",
"==",
"0",
"and",
"callable",
"(",
"args",
"[",
"0",
"]",
")",
":",
"options",
"=",
"WorkflowStepRuntimeOp... | A decorator used for creating workflow steps. | [
"A",
"decorator",
"used",
"for",
"creating",
"workflow",
"steps",
"."
] | [
"\"\"\"A decorator used for creating workflow steps.\n\n Examples:\n >>> from ray import workflow\n >>> Flight, Hotel = ... # doctest: +SKIP\n >>> @workflow.step # doctest: +SKIP\n ... def book_flight(origin: str, dest: str) -> Flight: # doctest: +SKIP\n ... return Flight(..... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": [
{
"identifier": "examples",
"docstring": ">>> from ray import workflow\n>>> Flight, Hotel = ... # doctest: +SKIP\n>>> @workflow.step # doctest: +SKIP\ndef book_flight(origin: str, dest: str) -> Flight: # doctest: +S... |
d8dc4f0e54a8ad26355c1a21b54980156c572a9c | kisuke95/ray | python/ray/workflow/api.py | [
"Apache-2.0"
] | Python | list_all | List[Tuple[str, WorkflowStatus]] | def list_all(
status_filter: Optional[
Union[Union[WorkflowStatus, str], Set[Union[WorkflowStatus, str]]]
] = None
) -> List[Tuple[str, WorkflowStatus]]:
"""List all workflows matching a given status filter.
Args:
status: If given, only returns workflow with that status. This can
... | List all workflows matching a given status filter.
Args:
status: If given, only returns workflow with that status. This can
be a single status or set of statuses. The string form of the
status is also acceptable, i.e.,
"RUNNING"/"FAILED"/"SUCCESSFUL"/"CANCELED"/"RESUMABL... | List all workflows matching a given status filter. | [
"List",
"all",
"workflows",
"matching",
"a",
"given",
"status",
"filter",
"."
] | def list_all(
status_filter: Optional[
Union[Union[WorkflowStatus, str], Set[Union[WorkflowStatus, str]]]
] = None
) -> List[Tuple[str, WorkflowStatus]]:
ensure_ray_initialized()
if isinstance(status_filter, str):
status_filter = set({WorkflowStatus(status_filter)})
elif isinstance(s... | [
"def",
"list_all",
"(",
"status_filter",
":",
"Optional",
"[",
"Union",
"[",
"Union",
"[",
"WorkflowStatus",
",",
"str",
"]",
",",
"Set",
"[",
"Union",
"[",
"WorkflowStatus",
",",
"str",
"]",
"]",
"]",
"]",
"=",
"None",
")",
"->",
"List",
"[",
"Tuple... | List all workflows matching a given status filter. | [
"List",
"all",
"workflows",
"matching",
"a",
"given",
"status",
"filter",
"."
] | [
"\"\"\"List all workflows matching a given status filter.\n\n Args:\n status: If given, only returns workflow with that status. This can\n be a single status or set of statuses. The string form of the\n status is also acceptable, i.e.,\n \"RUNNING\"/\"FAILED\"/\"SUCCESSFUL... | [
{
"param": "status_filter",
"type": "Optional[\n Union[Union[WorkflowStatus, str], Set[Union[WorkflowStatus, str]]]\n ]"
}
] | {
"returns": [
{
"docstring": "A list of tuple with workflow id and workflow status",
"docstring_tokens": [
"A",
"list",
"of",
"tuple",
"with",
"workflow",
"id",
"and",
"workflow",
"status"
],
"type": null
... |
d8dc4f0e54a8ad26355c1a21b54980156c572a9c | kisuke95/ray | python/ray/workflow/api.py | [
"Apache-2.0"
] | Python | sleep | "DAGNode[Event]" | def sleep(duration: float) -> "DAGNode[Event]":
"""
A workfow that resolves after sleeping for a given duration.
"""
@ray.remote
def end_time():
return time.time() + duration
return wait_for_event(TimerListener, end_time.bind()) |
A workfow that resolves after sleeping for a given duration.
| A workfow that resolves after sleeping for a given duration. | [
"A",
"workfow",
"that",
"resolves",
"after",
"sleeping",
"for",
"a",
"given",
"duration",
"."
] | def sleep(duration: float) -> "DAGNode[Event]":
@ray.remote
def end_time():
return time.time() + duration
return wait_for_event(TimerListener, end_time.bind()) | [
"def",
"sleep",
"(",
"duration",
":",
"float",
")",
"->",
"\"DAGNode[Event]\"",
":",
"@",
"ray",
".",
"remote",
"def",
"end_time",
"(",
")",
":",
"return",
"time",
".",
"time",
"(",
")",
"+",
"duration",
"return",
"wait_for_event",
"(",
"TimerListener",
... | A workfow that resolves after sleeping for a given duration. | [
"A",
"workfow",
"that",
"resolves",
"after",
"sleeping",
"for",
"a",
"given",
"duration",
"."
] | [
"\"\"\"\n A workfow that resolves after sleeping for a given duration.\n \"\"\""
] | [
{
"param": "duration",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "duration",
"type": "float",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d8dc4f0e54a8ad26355c1a21b54980156c572a9c | kisuke95/ray | python/ray/workflow/api.py | [
"Apache-2.0"
] | Python | wait | Workflow[WaitResult] | def wait(
workflows: List[Workflow], num_returns: int = 1, timeout: Optional[float] = None
) -> Workflow[WaitResult]:
"""Return a list of result of workflows that are ready and a list of
workflows that are pending.
Examples:
>>> from ray import workflow
>>> task, forever = ... # doctest... | Return a list of result of workflows that are ready and a list of
workflows that are pending.
Examples:
>>> from ray import workflow
>>> task, forever = ... # doctest: +SKIP
>>> tasks = [task.step() for _ in range(3)] # doctest: +SKIP
>>> wait_step = workflow.wait(tasks, num_ret... | Return a list of result of workflows that are ready and a list of
workflows that are pending. | [
"Return",
"a",
"list",
"of",
"result",
"of",
"workflows",
"that",
"are",
"ready",
"and",
"a",
"list",
"of",
"workflows",
"that",
"are",
"pending",
"."
] | def wait(
workflows: List[Workflow], num_returns: int = 1, timeout: Optional[float] = None
) -> Workflow[WaitResult]:
from ray.workflow import serialization_context
from ray.workflow.common import WorkflowData
for w in workflows:
if not isinstance(w, Workflow):
raise TypeError("The i... | [
"def",
"wait",
"(",
"workflows",
":",
"List",
"[",
"Workflow",
"]",
",",
"num_returns",
":",
"int",
"=",
"1",
",",
"timeout",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
")",
"->",
"Workflow",
"[",
"WaitResult",
"]",
":",
"from",
"ray",
".",
"... | Return a list of result of workflows that are ready and a list of
workflows that are pending. | [
"Return",
"a",
"list",
"of",
"result",
"of",
"workflows",
"that",
"are",
"ready",
"and",
"a",
"list",
"of",
"workflows",
"that",
"are",
"pending",
"."
] | [
"\"\"\"Return a list of result of workflows that are ready and a list of\n workflows that are pending.\n\n Examples:\n >>> from ray import workflow\n >>> task, forever = ... # doctest: +SKIP\n >>> tasks = [task.step() for _ in range(3)] # doctest: +SKIP\n >>> wait_step = workflow.w... | [
{
"param": "workflows",
"type": "List[Workflow]"
},
{
"param": "num_returns",
"type": "int"
},
{
"param": "timeout",
"type": "Optional[float]"
}
] | {
"returns": [
{
"docstring": "A list of ready workflow results that are ready and a list of the\nremaining workflows.",
"docstring_tokens": [
"A",
"list",
"of",
"ready",
"workflow",
"results",
"that",
"are",
"ready",
"and... |
d8dc4f0e54a8ad26355c1a21b54980156c572a9c | kisuke95/ray | python/ray/workflow/api.py | [
"Apache-2.0"
] | Python | create | Workflow | def create(dag_node: "DAGNode", *args, **kwargs) -> Workflow:
"""Converts a DAG into a workflow.
Args:
dag_node: The DAG to be converted.
args: Positional arguments of the DAG input node.
kwargs: Keyword arguments of the DAG input node.
"""
from ray.workflow.dag_to_workflow impo... | Converts a DAG into a workflow.
Args:
dag_node: The DAG to be converted.
args: Positional arguments of the DAG input node.
kwargs: Keyword arguments of the DAG input node.
| Converts a DAG into a workflow. | [
"Converts",
"a",
"DAG",
"into",
"a",
"workflow",
"."
] | def create(dag_node: "DAGNode", *args, **kwargs) -> Workflow:
from ray.workflow.dag_to_workflow import transform_ray_dag_to_workflow
if not isinstance(dag_node, DAGNode):
raise TypeError("Input should be a DAG.")
input_context = DAGInputData(*args, **kwargs)
return transform_ray_dag_to_workflow(... | [
"def",
"create",
"(",
"dag_node",
":",
"\"DAGNode\"",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
"->",
"Workflow",
":",
"from",
"ray",
".",
"workflow",
".",
"dag_to_workflow",
"import",
"transform_ray_dag_to_workflow",
"if",
"not",
"isinstance",
"(",
"dag_nod... | Converts a DAG into a workflow. | [
"Converts",
"a",
"DAG",
"into",
"a",
"workflow",
"."
] | [
"\"\"\"Converts a DAG into a workflow.\n\n Args:\n dag_node: The DAG to be converted.\n args: Positional arguments of the DAG input node.\n kwargs: Keyword arguments of the DAG input node.\n \"\"\""
] | [
{
"param": "dag_node",
"type": "\"DAGNode\""
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dag_node",
"type": "\"DAGNode\"",
"docstring": "The DAG to be converted.",
"docstring_tokens": [
"The",
"DAG",
"to",
"be",
"converted",
"."
],
"default": null,
... |
d8dc4f0e54a8ad26355c1a21b54980156c572a9c | kisuke95/ray | python/ray/workflow/api.py | [
"Apache-2.0"
] | Python | continuation | Union[Workflow, ray.ObjectRef] | def continuation(dag_node: "DAGNode") -> Union[Workflow, ray.ObjectRef]:
"""Converts a DAG into a continuation.
The result depends on the context. If it is inside a workflow, it
returns a workflow; otherwise it executes and get the result of
the DAG.
Args:
dag_node: The DAG to be converted... | Converts a DAG into a continuation.
The result depends on the context. If it is inside a workflow, it
returns a workflow; otherwise it executes and get the result of
the DAG.
Args:
dag_node: The DAG to be converted.
| Converts a DAG into a continuation.
The result depends on the context. If it is inside a workflow, it
returns a workflow; otherwise it executes and get the result of
the DAG. | [
"Converts",
"a",
"DAG",
"into",
"a",
"continuation",
".",
"The",
"result",
"depends",
"on",
"the",
"context",
".",
"If",
"it",
"is",
"inside",
"a",
"workflow",
"it",
"returns",
"a",
"workflow",
";",
"otherwise",
"it",
"executes",
"and",
"get",
"the",
"re... | def continuation(dag_node: "DAGNode") -> Union[Workflow, ray.ObjectRef]:
from ray.workflow.workflow_context import in_workflow_execution
if not isinstance(dag_node, DAGNode):
raise TypeError("Input should be a DAG.")
if in_workflow_execution():
return create(dag_node)
return ray.get(dag_... | [
"def",
"continuation",
"(",
"dag_node",
":",
"\"DAGNode\"",
")",
"->",
"Union",
"[",
"Workflow",
",",
"ray",
".",
"ObjectRef",
"]",
":",
"from",
"ray",
".",
"workflow",
".",
"workflow_context",
"import",
"in_workflow_execution",
"if",
"not",
"isinstance",
"(",... | Converts a DAG into a continuation. | [
"Converts",
"a",
"DAG",
"into",
"a",
"continuation",
"."
] | [
"\"\"\"Converts a DAG into a continuation.\n\n The result depends on the context. If it is inside a workflow, it\n returns a workflow; otherwise it executes and get the result of\n the DAG.\n\n Args:\n dag_node: The DAG to be converted.\n \"\"\""
] | [
{
"param": "dag_node",
"type": "\"DAGNode\""
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dag_node",
"type": "\"DAGNode\"",
"docstring": "The DAG to be converted.",
"docstring_tokens": [
"The",
"DAG",
"to",
"be",
"converted",
"."
],
"default": null,
... |
bb229d419dc34a21226d03611d2f6dfab56ca235 | kisuke95/ray | python/ray/tune/analysis/experiment_analysis.py | [
"Apache-2.0"
] | Python | _parse_cloud_path | <not_specific> | def _parse_cloud_path(self, local_path: str):
"""Convert local path into cloud storage path"""
if not self._sync_config or not self._sync_config.upload_dir:
return None
return local_path.replace(self._local_base_dir, self._sync_config.upload_dir) | Convert local path into cloud storage path | Convert local path into cloud storage path | [
"Convert",
"local",
"path",
"into",
"cloud",
"storage",
"path"
] | def _parse_cloud_path(self, local_path: str):
if not self._sync_config or not self._sync_config.upload_dir:
return None
return local_path.replace(self._local_base_dir, self._sync_config.upload_dir) | [
"def",
"_parse_cloud_path",
"(",
"self",
",",
"local_path",
":",
"str",
")",
":",
"if",
"not",
"self",
".",
"_sync_config",
"or",
"not",
"self",
".",
"_sync_config",
".",
"upload_dir",
":",
"return",
"None",
"return",
"local_path",
".",
"replace",
"(",
"se... | Convert local path into cloud storage path | [
"Convert",
"local",
"path",
"into",
"cloud",
"storage",
"path"
] | [
"\"\"\"Convert local path into cloud storage path\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "local_path",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "local_path",
"type": "str",
"docstring": null,
"docstring_tok... |
bb229d419dc34a21226d03611d2f6dfab56ca235 | kisuke95/ray | python/ray/tune/analysis/experiment_analysis.py | [
"Apache-2.0"
] | Python | results_df | DataFrame | def results_df(self) -> DataFrame:
"""Get all the last results as a pandas dataframe."""
if not pd:
raise ValueError(
"`results_df` requires pandas. Install with `pip install pandas`."
)
return pd.DataFrame.from_records(
[
flatt... | Get all the last results as a pandas dataframe. | Get all the last results as a pandas dataframe. | [
"Get",
"all",
"the",
"last",
"results",
"as",
"a",
"pandas",
"dataframe",
"."
] | def results_df(self) -> DataFrame:
if not pd:
raise ValueError(
"`results_df` requires pandas. Install with `pip install pandas`."
)
return pd.DataFrame.from_records(
[
flatten_dict(trial.last_result, delimiter=self._delimiter())
... | [
"def",
"results_df",
"(",
"self",
")",
"->",
"DataFrame",
":",
"if",
"not",
"pd",
":",
"raise",
"ValueError",
"(",
"\"`results_df` requires pandas. Install with `pip install pandas`.\"",
")",
"return",
"pd",
".",
"DataFrame",
".",
"from_records",
"(",
"[",
"flatten_... | Get all the last results as a pandas dataframe. | [
"Get",
"all",
"the",
"last",
"results",
"as",
"a",
"pandas",
"dataframe",
"."
] | [
"\"\"\"Get all the last results as a pandas dataframe.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bb229d419dc34a21226d03611d2f6dfab56ca235 | kisuke95/ray | python/ray/tune/analysis/experiment_analysis.py | [
"Apache-2.0"
] | Python | dataframe | DataFrame | def dataframe(
self, metric: Optional[str] = None, mode: Optional[str] = None
) -> DataFrame:
"""Returns a pandas.DataFrame object constructed from the trials.
This function will look through all observed results of each trial
and return the one corresponding to the passed ``metric`... | Returns a pandas.DataFrame object constructed from the trials.
This function will look through all observed results of each trial
and return the one corresponding to the passed ``metric`` and
``mode``: If ``mode=min``, it returns the result with the lowest
*ever* observed ``metric`` for... | Returns a pandas.DataFrame object constructed from the trials. | [
"Returns",
"a",
"pandas",
".",
"DataFrame",
"object",
"constructed",
"from",
"the",
"trials",
"."
] | def dataframe(
self, metric: Optional[str] = None, mode: Optional[str] = None
) -> DataFrame:
if mode and mode not in ["min", "max"]:
raise ValueError("If set, `mode` has to be one of [min, max]")
if mode and not metric:
raise ValueError(
"If a `mode` ... | [
"def",
"dataframe",
"(",
"self",
",",
"metric",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"mode",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"DataFrame",
":",
"if",
"mode",
"and",
"mode",
"not",
"in",
"[",
"\"min\"",
",",
... | Returns a pandas.DataFrame object constructed from the trials. | [
"Returns",
"a",
"pandas",
".",
"DataFrame",
"object",
"constructed",
"from",
"the",
"trials",
"."
] | [
"\"\"\"Returns a pandas.DataFrame object constructed from the trials.\n\n This function will look through all observed results of each trial\n and return the one corresponding to the passed ``metric`` and\n ``mode``: If ``mode=min``, it returns the result with the lowest\n *ever* observe... | [
{
"param": "self",
"type": null
},
{
"param": "metric",
"type": "Optional[str]"
},
{
"param": "mode",
"type": "Optional[str]"
}
] | {
"returns": [
{
"docstring": "Constructed from a result dict of each trial.",
"docstring_tokens": [
"Constructed",
"from",
"a",
"result",
"dict",
"of",
"each",
"trial",
"."
],
"type": "pd.DataFrame"
}
],
"rais... |
bb229d419dc34a21226d03611d2f6dfab56ca235 | kisuke95/ray | python/ray/tune/analysis/experiment_analysis.py | [
"Apache-2.0"
] | Python | fetch_trial_dataframes | Dict[str, DataFrame] | def fetch_trial_dataframes(self) -> Dict[str, DataFrame]:
"""Fetches trial dataframes from files.
Returns:
A dictionary containing "trial dir" to Dataframe.
"""
fail_count = 0
force_dtype = {"trial_id": str} # Never convert trial_id to float.
for path in sel... | Fetches trial dataframes from files.
Returns:
A dictionary containing "trial dir" to Dataframe.
| Fetches trial dataframes from files. | [
"Fetches",
"trial",
"dataframes",
"from",
"files",
"."
] | def fetch_trial_dataframes(self) -> Dict[str, DataFrame]:
fail_count = 0
force_dtype = {"trial_id": str}
for path in self._get_trial_paths():
try:
if self._file_type == "json":
with open(os.path.join(path, EXPR_RESULT_FILE), "r") as f:
... | [
"def",
"fetch_trial_dataframes",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"DataFrame",
"]",
":",
"fail_count",
"=",
"0",
"force_dtype",
"=",
"{",
"\"trial_id\"",
":",
"str",
"}",
"for",
"path",
"in",
"self",
".",
"_get_trial_paths",
"(",
")",
":"... | Fetches trial dataframes from files. | [
"Fetches",
"trial",
"dataframes",
"from",
"files",
"."
] | [
"\"\"\"Fetches trial dataframes from files.\n\n Returns:\n A dictionary containing \"trial dir\" to Dataframe.\n \"\"\"",
"# Never convert trial_id to float."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "A dictionary containing \"trial dir\" to Dataframe.",
"docstring_tokens": [
"A",
"dictionary",
"containing",
"\"",
"trial",
"dir",
"\"",
"to",
"Dataframe",
"."
],
"type": null
... |
bb229d419dc34a21226d03611d2f6dfab56ca235 | kisuke95/ray | python/ray/tune/analysis/experiment_analysis.py | [
"Apache-2.0"
] | Python | stats | Dict | def stats(self) -> Dict:
"""Returns a dictionary of the statistics of the experiment.
If ``experiment_checkpoint_path`` pointed to a directory of
experiments, the dict will be in the format of
``{experiment_session_id: stats}``."""
if len(self._experiment_states) == 1:
... | Returns a dictionary of the statistics of the experiment.
If ``experiment_checkpoint_path`` pointed to a directory of
experiments, the dict will be in the format of
``{experiment_session_id: stats}``. | Returns a dictionary of the statistics of the experiment. | [
"Returns",
"a",
"dictionary",
"of",
"the",
"statistics",
"of",
"the",
"experiment",
"."
] | def stats(self) -> Dict:
if len(self._experiment_states) == 1:
return self._experiment_states[0]["stats"]
else:
return {
experiment_state["runner_data"]["_session_str"]: experiment_state[
"stats"
]
for experiment... | [
"def",
"stats",
"(",
"self",
")",
"->",
"Dict",
":",
"if",
"len",
"(",
"self",
".",
"_experiment_states",
")",
"==",
"1",
":",
"return",
"self",
".",
"_experiment_states",
"[",
"0",
"]",
"[",
"\"stats\"",
"]",
"else",
":",
"return",
"{",
"experiment_st... | Returns a dictionary of the statistics of the experiment. | [
"Returns",
"a",
"dictionary",
"of",
"the",
"statistics",
"of",
"the",
"experiment",
"."
] | [
"\"\"\"Returns a dictionary of the statistics of the experiment.\n\n If ``experiment_checkpoint_path`` pointed to a directory of\n experiments, the dict will be in the format of\n ``{experiment_session_id: stats}``.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
bb229d419dc34a21226d03611d2f6dfab56ca235 | kisuke95/ray | python/ray/tune/analysis/experiment_analysis.py | [
"Apache-2.0"
] | Python | runner_data | Dict | def runner_data(self) -> Dict:
"""Returns a dictionary of the TrialRunner data.
If ``experiment_checkpoint_path`` pointed to a directory of
experiments, the dict will be in the format of
``{experiment_session_id: TrialRunner_data}``."""
if len(self._experiment_states) == 1:
... | Returns a dictionary of the TrialRunner data.
If ``experiment_checkpoint_path`` pointed to a directory of
experiments, the dict will be in the format of
``{experiment_session_id: TrialRunner_data}``. | Returns a dictionary of the TrialRunner data. | [
"Returns",
"a",
"dictionary",
"of",
"the",
"TrialRunner",
"data",
"."
] | def runner_data(self) -> Dict:
if len(self._experiment_states) == 1:
return self._experiment_states[0]["runner_data"]
else:
return {
experiment_state["runner_data"]["_session_str"]: experiment_state[
"runner_data"
]
... | [
"def",
"runner_data",
"(",
"self",
")",
"->",
"Dict",
":",
"if",
"len",
"(",
"self",
".",
"_experiment_states",
")",
"==",
"1",
":",
"return",
"self",
".",
"_experiment_states",
"[",
"0",
"]",
"[",
"\"runner_data\"",
"]",
"else",
":",
"return",
"{",
"e... | Returns a dictionary of the TrialRunner data. | [
"Returns",
"a",
"dictionary",
"of",
"the",
"TrialRunner",
"data",
"."
] | [
"\"\"\"Returns a dictionary of the TrialRunner data.\n\n If ``experiment_checkpoint_path`` pointed to a directory of\n experiments, the dict will be in the format of\n ``{experiment_session_id: TrialRunner_data}``.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4d4d9858fa7545d3035ae30b7dbd15de05ffba62 | kisuke95/ray | python/ray/tune/checkpoint_manager.py | [
"Apache-2.0"
] | Python | is_ready | <not_specific> | def is_ready(self):
"""Returns whether the checkpoint is ready to be used for restoration.
A PERSISTENT checkpoint is considered ready once its value is resolved
to an actual path. MEMORY checkpoints are always considered ready since
they are transient.
"""
if self.stora... | Returns whether the checkpoint is ready to be used for restoration.
A PERSISTENT checkpoint is considered ready once its value is resolved
to an actual path. MEMORY checkpoints are always considered ready since
they are transient.
| Returns whether the checkpoint is ready to be used for restoration.
A PERSISTENT checkpoint is considered ready once its value is resolved
to an actual path. MEMORY checkpoints are always considered ready since
they are transient. | [
"Returns",
"whether",
"the",
"checkpoint",
"is",
"ready",
"to",
"be",
"used",
"for",
"restoration",
".",
"A",
"PERSISTENT",
"checkpoint",
"is",
"considered",
"ready",
"once",
"its",
"value",
"is",
"resolved",
"to",
"an",
"actual",
"path",
".",
"MEMORY",
"che... | def is_ready(self):
if self.storage == _TuneCheckpoint.PERSISTENT:
return isinstance(self.value, str)
return self.storage == _TuneCheckpoint.MEMORY | [
"def",
"is_ready",
"(",
"self",
")",
":",
"if",
"self",
".",
"storage",
"==",
"_TuneCheckpoint",
".",
"PERSISTENT",
":",
"return",
"isinstance",
"(",
"self",
".",
"value",
",",
"str",
")",
"return",
"self",
".",
"storage",
"==",
"_TuneCheckpoint",
".",
"... | Returns whether the checkpoint is ready to be used for restoration. | [
"Returns",
"whether",
"the",
"checkpoint",
"is",
"ready",
"to",
"be",
"used",
"for",
"restoration",
"."
] | [
"\"\"\"Returns whether the checkpoint is ready to be used for restoration.\n\n A PERSISTENT checkpoint is considered ready once its value is resolved\n to an actual path. MEMORY checkpoints are always considered ready since\n they are transient.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4d4d9858fa7545d3035ae30b7dbd15de05ffba62 | kisuke95/ray | python/ray/tune/checkpoint_manager.py | [
"Apache-2.0"
] | Python | newest_checkpoint | <not_specific> | def newest_checkpoint(self):
"""Returns the newest checkpoint (based on training iteration)."""
newest_checkpoint = max(
[self.newest_persistent_checkpoint, self.newest_memory_checkpoint],
key=lambda c: c.order,
)
return newest_checkpoint | Returns the newest checkpoint (based on training iteration). | Returns the newest checkpoint (based on training iteration). | [
"Returns",
"the",
"newest",
"checkpoint",
"(",
"based",
"on",
"training",
"iteration",
")",
"."
] | def newest_checkpoint(self):
newest_checkpoint = max(
[self.newest_persistent_checkpoint, self.newest_memory_checkpoint],
key=lambda c: c.order,
)
return newest_checkpoint | [
"def",
"newest_checkpoint",
"(",
"self",
")",
":",
"newest_checkpoint",
"=",
"max",
"(",
"[",
"self",
".",
"newest_persistent_checkpoint",
",",
"self",
".",
"newest_memory_checkpoint",
"]",
",",
"key",
"=",
"lambda",
"c",
":",
"c",
".",
"order",
",",
")",
... | Returns the newest checkpoint (based on training iteration). | [
"Returns",
"the",
"newest",
"checkpoint",
"(",
"based",
"on",
"training",
"iteration",
")",
"."
] | [
"\"\"\"Returns the newest checkpoint (based on training iteration).\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4d4d9858fa7545d3035ae30b7dbd15de05ffba62 | kisuke95/ray | python/ray/tune/checkpoint_manager.py | [
"Apache-2.0"
] | Python | on_checkpoint | <not_specific> | def on_checkpoint(self, checkpoint: _TuneCheckpoint):
"""Starts tracking checkpoint metadata on checkpoint.
Checkpoints get assigned with an `order` as they come in.
The order is monotonically increasing.
Sets the newest checkpoint. For PERSISTENT checkpoints: Deletes
previous ... | Starts tracking checkpoint metadata on checkpoint.
Checkpoints get assigned with an `order` as they come in.
The order is monotonically increasing.
Sets the newest checkpoint. For PERSISTENT checkpoints: Deletes
previous checkpoint as long as it isn't one of the best ones. Also
... | Starts tracking checkpoint metadata on checkpoint.
Checkpoints get assigned with an `order` as they come in.
The order is monotonically increasing.
Sets the newest checkpoint. For PERSISTENT checkpoints: Deletes
previous checkpoint as long as it isn't one of the best ones. Also
deletes the worst checkpoint if at capac... | [
"Starts",
"tracking",
"checkpoint",
"metadata",
"on",
"checkpoint",
".",
"Checkpoints",
"get",
"assigned",
"with",
"an",
"`",
"order",
"`",
"as",
"they",
"come",
"in",
".",
"The",
"order",
"is",
"monotonically",
"increasing",
".",
"Sets",
"the",
"newest",
"c... | def on_checkpoint(self, checkpoint: _TuneCheckpoint):
self._cur_order += 1
checkpoint.order = self._cur_order
if checkpoint.storage == _TuneCheckpoint.MEMORY:
self.replace_newest_memory_checkpoint(checkpoint)
return
old_checkpoint = self.newest_persistent_checkpoi... | [
"def",
"on_checkpoint",
"(",
"self",
",",
"checkpoint",
":",
"_TuneCheckpoint",
")",
":",
"self",
".",
"_cur_order",
"+=",
"1",
"checkpoint",
".",
"order",
"=",
"self",
".",
"_cur_order",
"if",
"checkpoint",
".",
"storage",
"==",
"_TuneCheckpoint",
".",
"MEM... | Starts tracking checkpoint metadata on checkpoint. | [
"Starts",
"tracking",
"checkpoint",
"metadata",
"on",
"checkpoint",
"."
] | [
"\"\"\"Starts tracking checkpoint metadata on checkpoint.\n\n Checkpoints get assigned with an `order` as they come in.\n The order is monotonically increasing.\n\n Sets the newest checkpoint. For PERSISTENT checkpoints: Deletes\n previous checkpoint as long as it isn't one of the best o... | [
{
"param": "self",
"type": null
},
{
"param": "checkpoint",
"type": "_TuneCheckpoint"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "checkpoint",
"type": "_TuneCheckpoint",
"docstring": "Trial state c... |
9bdffbaa9d5435a989d96c684a75c09a11842fe2 | kisuke95/ray | python/ray/serve/deployment.py | [
"Apache-2.0"
] | Python | url | Optional[str] | def url(self) -> Optional[str]:
"""Full HTTP url for this deployment."""
if self._route_prefix is None:
# this deployment is not exposed over HTTP
return None
return get_global_client().root_url + self.route_prefix | Full HTTP url for this deployment. | Full HTTP url for this deployment. | [
"Full",
"HTTP",
"url",
"for",
"this",
"deployment",
"."
] | def url(self) -> Optional[str]:
if self._route_prefix is None:
return None
return get_global_client().root_url + self.route_prefix | [
"def",
"url",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"if",
"self",
".",
"_route_prefix",
"is",
"None",
":",
"return",
"None",
"return",
"get_global_client",
"(",
")",
".",
"root_url",
"+",
"self",
".",
"route_prefix"
] | Full HTTP url for this deployment. | [
"Full",
"HTTP",
"url",
"for",
"this",
"deployment",
"."
] | [
"\"\"\"Full HTTP url for this deployment.\"\"\"",
"# this deployment is not exposed over HTTP"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9bdffbaa9d5435a989d96c684a75c09a11842fe2 | kisuke95/ray | python/ray/serve/deployment.py | [
"Apache-2.0"
] | Python | bind | Union[ClassNode, FunctionNode] | def bind(self, *args, **kwargs) -> Union[ClassNode, FunctionNode]:
"""Bind the provided arguments and return a class or function node.
The returned bound deployment can be deployed or bound to other
deployments to create a deployment graph.
"""
copied_self = copy(self)
... | Bind the provided arguments and return a class or function node.
The returned bound deployment can be deployed or bound to other
deployments to create a deployment graph.
| Bind the provided arguments and return a class or function node.
The returned bound deployment can be deployed or bound to other
deployments to create a deployment graph. | [
"Bind",
"the",
"provided",
"arguments",
"and",
"return",
"a",
"class",
"or",
"function",
"node",
".",
"The",
"returned",
"bound",
"deployment",
"can",
"be",
"deployed",
"or",
"bound",
"to",
"other",
"deployments",
"to",
"create",
"a",
"deployment",
"graph",
... | def bind(self, *args, **kwargs) -> Union[ClassNode, FunctionNode]:
copied_self = copy(self)
copied_self._init_args = []
copied_self._init_kwargs = {}
copied_self._func_or_class = "dummpy.module"
schema_shell = deployment_to_schema(copied_self)
if inspect.isfunction(self._... | [
"def",
"bind",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
"->",
"Union",
"[",
"ClassNode",
",",
"FunctionNode",
"]",
":",
"copied_self",
"=",
"copy",
"(",
"self",
")",
"copied_self",
".",
"_init_args",
"=",
"[",
"]",
"copied_self",
".",
... | Bind the provided arguments and return a class or function node. | [
"Bind",
"the",
"provided",
"arguments",
"and",
"return",
"a",
"class",
"or",
"function",
"node",
"."
] | [
"\"\"\"Bind the provided arguments and return a class or function node.\n\n The returned bound deployment can be deployed or bound to other\n deployments to create a deployment graph.\n \"\"\"",
"# Used to bind and resolve DAG only, can take user input",
"# Used to bind and resolve DAG only... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9bdffbaa9d5435a989d96c684a75c09a11842fe2 | kisuke95/ray | python/ray/serve/deployment.py | [
"Apache-2.0"
] | Python | deploy | <not_specific> | def deploy(self, *init_args, _blocking=True, **init_kwargs):
"""Deploy or update this deployment.
Args:
init_args (optional): args to pass to the class __init__
method. Not valid if this deployment wraps a function.
init_kwargs (optional): kwargs to pass to the c... | Deploy or update this deployment.
Args:
init_args (optional): args to pass to the class __init__
method. Not valid if this deployment wraps a function.
init_kwargs (optional): kwargs to pass to the class __init__
method. Not valid if this deployment wraps... | Deploy or update this deployment. | [
"Deploy",
"or",
"update",
"this",
"deployment",
"."
] | def deploy(self, *init_args, _blocking=True, **init_kwargs):
if len(init_args) == 0 and self._init_args is not None:
init_args = self._init_args
if len(init_kwargs) == 0 and self._init_kwargs is not None:
init_kwargs = self._init_kwargs
return get_global_client().deploy(
... | [
"def",
"deploy",
"(",
"self",
",",
"*",
"init_args",
",",
"_blocking",
"=",
"True",
",",
"**",
"init_kwargs",
")",
":",
"if",
"len",
"(",
"init_args",
")",
"==",
"0",
"and",
"self",
".",
"_init_args",
"is",
"not",
"None",
":",
"init_args",
"=",
"self... | Deploy or update this deployment. | [
"Deploy",
"or",
"update",
"this",
"deployment",
"."
] | [
"\"\"\"Deploy or update this deployment.\n\n Args:\n init_args (optional): args to pass to the class __init__\n method. Not valid if this deployment wraps a function.\n init_kwargs (optional): kwargs to pass to the class __init__\n method. Not valid if this... | [
{
"param": "self",
"type": null
},
{
"param": "_blocking",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "_blocking",
"type": null,
"docstring": null,
"docstring_token... |
a9003d7ba46d66b8b14bd3009dc0a149341620e8 | kisuke95/ray | python/ray/tests/kuberay/test_autoscaling_config.py | [
"Apache-2.0"
] | Python | _get_basic_autoscaling_config | dict | def _get_basic_autoscaling_config() -> dict:
"""The expected autoscaling derived from the example Ray CR."""
return {
"cluster_name": "raycluster-complete",
"provider": {
"disable_launch_config_check": True,
"disable_node_updaters": True,
"namespace": "default... | The expected autoscaling derived from the example Ray CR. | The expected autoscaling derived from the example Ray CR. | [
"The",
"expected",
"autoscaling",
"derived",
"from",
"the",
"example",
"Ray",
"CR",
"."
] | def _get_basic_autoscaling_config() -> dict:
return {
"cluster_name": "raycluster-complete",
"provider": {
"disable_launch_config_check": True,
"disable_node_updaters": True,
"namespace": "default",
"type": "kuberay",
},
"available_node... | [
"def",
"_get_basic_autoscaling_config",
"(",
")",
"->",
"dict",
":",
"return",
"{",
"\"cluster_name\"",
":",
"\"raycluster-complete\"",
",",
"\"provider\"",
":",
"{",
"\"disable_launch_config_check\"",
":",
"True",
",",
"\"disable_node_updaters\"",
":",
"True",
",",
"... | The expected autoscaling derived from the example Ray CR. | [
"The",
"expected",
"autoscaling",
"derived",
"from",
"the",
"example",
"Ray",
"CR",
"."
] | [
"\"\"\"The expected autoscaling derived from the example Ray CR.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
22be4fb6f529faf05886375582bf7230cf7b7ecb | kisuke95/ray | python/ray/tests/kuberay/test_autoscaling_e2e.py | [
"Apache-2.0"
] | Python | _get_ray_cr_config_file | str | def _get_ray_cr_config_file(self) -> str:
"""Formats a RayCluster CR based on the example in the Ray documentation.
- Replaces Ray node and autoscaler images in example CR with the test image.
- Set image pull policies to IfNotPresent.
- Writes modified CR to temp file.
- Return... | Formats a RayCluster CR based on the example in the Ray documentation.
- Replaces Ray node and autoscaler images in example CR with the test image.
- Set image pull policies to IfNotPresent.
- Writes modified CR to temp file.
- Returns temp file's name.
| Formats a RayCluster CR based on the example in the Ray documentation.
Replaces Ray node and autoscaler images in example CR with the test image.
Set image pull policies to IfNotPresent.
Writes modified CR to temp file.
Returns temp file's name. | [
"Formats",
"a",
"RayCluster",
"CR",
"based",
"on",
"the",
"example",
"in",
"the",
"Ray",
"documentation",
".",
"Replaces",
"Ray",
"node",
"and",
"autoscaler",
"images",
"in",
"example",
"CR",
"with",
"the",
"test",
"image",
".",
"Set",
"image",
"pull",
"po... | def _get_ray_cr_config_file(self) -> str:
with open(EXAMPLE_CLUSTER_PATH) as example_cluster_file:
ray_cr_config_str = example_cluster_file.read()
ray_images = [
word for word in ray_cr_config_str.split() if "rayproject/ray:" in word
]
for ray_image in ray_images:... | [
"def",
"_get_ray_cr_config_file",
"(",
"self",
")",
"->",
"str",
":",
"with",
"open",
"(",
"EXAMPLE_CLUSTER_PATH",
")",
"as",
"example_cluster_file",
":",
"ray_cr_config_str",
"=",
"example_cluster_file",
".",
"read",
"(",
")",
"ray_images",
"=",
"[",
"word",
"f... | Formats a RayCluster CR based on the example in the Ray documentation. | [
"Formats",
"a",
"RayCluster",
"CR",
"based",
"on",
"the",
"example",
"in",
"the",
"Ray",
"documentation",
"."
] | [
"\"\"\"Formats a RayCluster CR based on the example in the Ray documentation.\n\n - Replaces Ray node and autoscaler images in example CR with the test image.\n - Set image pull policies to IfNotPresent.\n - Writes modified CR to temp file.\n - Returns temp file's name.\n \"\"\"",... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
22be4fb6f529faf05886375582bf7230cf7b7ecb | kisuke95/ray | python/ray/tests/kuberay/test_autoscaling_e2e.py | [
"Apache-2.0"
] | Python | _get_ray_cr_config | Dict[str, Any] | def _get_ray_cr_config(
self, min_replicas=0, max_replicas=300, replicas=0
) -> Dict[str, Any]:
"""Get Ray CR config yaml.
Use configurable replica fields for a CPU workerGroup.
Also add a GPU-annotated group for testing GPU upscaling.
"""
with open(self._get_ray_cr... | Get Ray CR config yaml.
Use configurable replica fields for a CPU workerGroup.
Also add a GPU-annotated group for testing GPU upscaling.
| Get Ray CR config yaml.
Use configurable replica fields for a CPU workerGroup.
Also add a GPU-annotated group for testing GPU upscaling. | [
"Get",
"Ray",
"CR",
"config",
"yaml",
".",
"Use",
"configurable",
"replica",
"fields",
"for",
"a",
"CPU",
"workerGroup",
".",
"Also",
"add",
"a",
"GPU",
"-",
"annotated",
"group",
"for",
"testing",
"GPU",
"upscaling",
"."
] | def _get_ray_cr_config(
self, min_replicas=0, max_replicas=300, replicas=0
) -> Dict[str, Any]:
with open(self._get_ray_cr_config_file()) as ray_config_file:
ray_config_str = ray_config_file.read()
config = yaml.safe_load(ray_config_str)
cpu_group = config["spec"]["worker... | [
"def",
"_get_ray_cr_config",
"(",
"self",
",",
"min_replicas",
"=",
"0",
",",
"max_replicas",
"=",
"300",
",",
"replicas",
"=",
"0",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"with",
"open",
"(",
"self",
".",
"_get_ray_cr_config_file",
"(",
... | Get Ray CR config yaml. | [
"Get",
"Ray",
"CR",
"config",
"yaml",
"."
] | [
"\"\"\"Get Ray CR config yaml.\n\n Use configurable replica fields for a CPU workerGroup.\n\n Also add a GPU-annotated group for testing GPU upscaling.\n \"\"\"",
"# Add a GPU-annotated group.",
"# (We're not using real GPUs, just adding a GPU annotation for the autoscaler",
"# and Ray sc... | [
{
"param": "self",
"type": null
},
{
"param": "min_replicas",
"type": null
},
{
"param": "max_replicas",
"type": null
},
{
"param": "replicas",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "min_replicas",
"type": null,
"docstring": null,
"docstring_to... |
22be4fb6f529faf05886375582bf7230cf7b7ecb | kisuke95/ray | python/ray/tests/kuberay/test_autoscaling_e2e.py | [
"Apache-2.0"
] | Python | testAutoscaling | null | def testAutoscaling(self):
"""Test the following behaviors:
1. Spinning up a Ray cluster
2. Scaling up a Ray worker via autoscaler.sdk.request_resources()
3. Scaling up by updating the CRD's minReplicas
4. Scaling down by removing the resource request and reducing maxReplicas
... | Test the following behaviors:
1. Spinning up a Ray cluster
2. Scaling up a Ray worker via autoscaler.sdk.request_resources()
3. Scaling up by updating the CRD's minReplicas
4. Scaling down by removing the resource request and reducing maxReplicas
Items 1. and 2. protect the exa... | Test the following behaviors:
1. Spinning up a Ray cluster
2. Scaling up a Ray worker via autoscaler.sdk.request_resources()
3. Scaling up by updating the CRD's minReplicas
4. Scaling down by removing the resource request and reducing maxReplicas
Items 1. and 2. protect the example in the documentation.
Items 3. and 4... | [
"Test",
"the",
"following",
"behaviors",
":",
"1",
".",
"Spinning",
"up",
"a",
"Ray",
"cluster",
"2",
".",
"Scaling",
"up",
"a",
"Ray",
"worker",
"via",
"autoscaler",
".",
"sdk",
".",
"request_resources",
"()",
"3",
".",
"Scaling",
"up",
"by",
"updating"... | def testAutoscaling(self):
logger.info("Creating a RayCluster with no worker pods.")
self._apply_ray_cr(min_replicas=0, replicas=0)
logger.info("Confirming presence of head.")
wait_for_pods(goal_num_pods=1, namespace="default")
logger.info("Waiting for head pod to start Running."... | [
"def",
"testAutoscaling",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"Creating a RayCluster with no worker pods.\"",
")",
"self",
".",
"_apply_ray_cr",
"(",
"min_replicas",
"=",
"0",
",",
"replicas",
"=",
"0",
")",
"logger",
".",
"info",
"(",
"\"Conf... | Test the following behaviors:
1. | [
"Test",
"the",
"following",
"behaviors",
":",
"1",
"."
] | [
"\"\"\"Test the following behaviors:\n\n 1. Spinning up a Ray cluster\n 2. Scaling up a Ray worker via autoscaler.sdk.request_resources()\n 3. Scaling up by updating the CRD's minReplicas\n 4. Scaling down by removing the resource request and reducing maxReplicas\n\n Items 1. and ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3bf0f88f3e0dbc92373c76a56725801787875e3 | kisuke95/ray | python/ray/workflow/step_executor.py | [
"Apache-2.0"
] | Python | _resolve_static_workflow_ref | <not_specific> | def _resolve_static_workflow_ref(workflow_ref: WorkflowStaticRef):
"""Get the output of a workflow step with the step ID and ObjectRef."""
while isinstance(workflow_ref, WorkflowStaticRef):
workflow_ref = ray.get(workflow_ref.ref)
return workflow_ref | Get the output of a workflow step with the step ID and ObjectRef. | Get the output of a workflow step with the step ID and ObjectRef. | [
"Get",
"the",
"output",
"of",
"a",
"workflow",
"step",
"with",
"the",
"step",
"ID",
"and",
"ObjectRef",
"."
] | def _resolve_static_workflow_ref(workflow_ref: WorkflowStaticRef):
while isinstance(workflow_ref, WorkflowStaticRef):
workflow_ref = ray.get(workflow_ref.ref)
return workflow_ref | [
"def",
"_resolve_static_workflow_ref",
"(",
"workflow_ref",
":",
"WorkflowStaticRef",
")",
":",
"while",
"isinstance",
"(",
"workflow_ref",
",",
"WorkflowStaticRef",
")",
":",
"workflow_ref",
"=",
"ray",
".",
"get",
"(",
"workflow_ref",
".",
"ref",
")",
"return",
... | Get the output of a workflow step with the step ID and ObjectRef. | [
"Get",
"the",
"output",
"of",
"a",
"workflow",
"step",
"with",
"the",
"step",
"ID",
"and",
"ObjectRef",
"."
] | [
"\"\"\"Get the output of a workflow step with the step ID and ObjectRef.\"\"\""
] | [
{
"param": "workflow_ref",
"type": "WorkflowStaticRef"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "workflow_ref",
"type": "WorkflowStaticRef",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3bf0f88f3e0dbc92373c76a56725801787875e3 | kisuke95/ray | python/ray/workflow/step_executor.py | [
"Apache-2.0"
] | Python | _resolve_dynamic_workflow_refs | <not_specific> | def _resolve_dynamic_workflow_refs(workflow_refs: "List[WorkflowRef]"):
"""Get the output of a workflow step with the step ID at runtime.
We lookup the output by the following order:
1. Query cached step output in the workflow manager. Fetch the physical
output object.
2. If failed to fetch the ... | Get the output of a workflow step with the step ID at runtime.
We lookup the output by the following order:
1. Query cached step output in the workflow manager. Fetch the physical
output object.
2. If failed to fetch the physical output object, look into the storage
to see whether the output ... | Get the output of a workflow step with the step ID at runtime.
We lookup the output by the following order:
1. Query cached step output in the workflow manager. Fetch the physical
output object.
2. If failed to fetch the physical output object, look into the storage
to see whether the output is checkpointed. Load the c... | [
"Get",
"the",
"output",
"of",
"a",
"workflow",
"step",
"with",
"the",
"step",
"ID",
"at",
"runtime",
".",
"We",
"lookup",
"the",
"output",
"by",
"the",
"following",
"order",
":",
"1",
".",
"Query",
"cached",
"step",
"output",
"in",
"the",
"workflow",
"... | def _resolve_dynamic_workflow_refs(workflow_refs: "List[WorkflowRef]"):
workflow_manager = get_or_create_management_actor()
context = workflow_context.get_workflow_step_context()
workflow_id = context.workflow_id
storage_url = context.storage_url
workflow_ref_mapping = []
for workflow_ref in wor... | [
"def",
"_resolve_dynamic_workflow_refs",
"(",
"workflow_refs",
":",
"\"List[WorkflowRef]\"",
")",
":",
"workflow_manager",
"=",
"get_or_create_management_actor",
"(",
")",
"context",
"=",
"workflow_context",
".",
"get_workflow_step_context",
"(",
")",
"workflow_id",
"=",
... | Get the output of a workflow step with the step ID at runtime. | [
"Get",
"the",
"output",
"of",
"a",
"workflow",
"step",
"with",
"the",
"step",
"ID",
"at",
"runtime",
"."
] | [
"\"\"\"Get the output of a workflow step with the step ID at runtime.\n\n We lookup the output by the following order:\n 1. Query cached step output in the workflow manager. Fetch the physical\n output object.\n 2. If failed to fetch the physical output object, look into the storage\n to see wh... | [
{
"param": "workflow_refs",
"type": "\"List[WorkflowRef]\""
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "workflow_refs",
"type": "\"List[WorkflowRef]\"",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3bf0f88f3e0dbc92373c76a56725801787875e3 | kisuke95/ray | python/ray/workflow/step_executor.py | [
"Apache-2.0"
] | Python | _execute_workflow | "WorkflowExecutionResult" | def _execute_workflow(workflow: "Workflow") -> "WorkflowExecutionResult":
"""Internal function of workflow execution."""
if workflow.executed:
return workflow.result
# Stage 1: prepare inputs
workflow_data = workflow.data
inputs = workflow_data.inputs
# Here A is the outer workflow step... | Internal function of workflow execution. | Internal function of workflow execution. | [
"Internal",
"function",
"of",
"workflow",
"execution",
"."
] | def _execute_workflow(workflow: "Workflow") -> "WorkflowExecutionResult":
if workflow.executed:
return workflow.result
workflow_data = workflow.data
inputs = workflow_data.inputs
@workflow.step
def A():
b = B.step()
return C.step(b)
If the outer workflow step skips c... | [
"def",
"_execute_workflow",
"(",
"workflow",
":",
"\"Workflow\"",
")",
"->",
"\"WorkflowExecutionResult\"",
":",
"if",
"workflow",
".",
"executed",
":",
"return",
"workflow",
".",
"result",
"workflow_data",
"=",
"workflow",
".",
"data",
"inputs",
"=",
"workflow_da... | Internal function of workflow execution. | [
"Internal",
"function",
"of",
"workflow",
"execution",
"."
] | [
"\"\"\"Internal function of workflow execution.\"\"\"",
"# Stage 1: prepare inputs",
"# Here A is the outer workflow step, B & C are the inner steps.",
"# C is the output step for A, because C produces the output for A.",
"#",
"# @workflow.step",
"# def A():",
"# b = B.step()",
"# return C.s... | [
{
"param": "workflow",
"type": "\"Workflow\""
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "workflow",
"type": "\"Workflow\"",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e3bf0f88f3e0dbc92373c76a56725801787875e3 | kisuke95/ray | python/ray/workflow/step_executor.py | [
"Apache-2.0"
] | Python | execute_workflow | "WorkflowExecutionResult" | def execute_workflow(workflow: Workflow) -> "WorkflowExecutionResult":
"""Execute workflow.
This function also performs tail-recursion optimization for inplace
workflow steps.
Args:
workflow: The workflow to be executed.
Returns:
An object ref that represent the result.
"""
... | Execute workflow.
This function also performs tail-recursion optimization for inplace
workflow steps.
Args:
workflow: The workflow to be executed.
Returns:
An object ref that represent the result.
| Execute workflow.
This function also performs tail-recursion optimization for inplace
workflow steps. | [
"Execute",
"workflow",
".",
"This",
"function",
"also",
"performs",
"tail",
"-",
"recursion",
"optimization",
"for",
"inplace",
"workflow",
"steps",
"."
] | def execute_workflow(workflow: Workflow) -> "WorkflowExecutionResult":
context = {}
while True:
with workflow_context.fork_workflow_step_context(**context):
result = _execute_workflow(workflow)
if not isinstance(result.persisted_output, InplaceReturnedWorkflow):
break
... | [
"def",
"execute_workflow",
"(",
"workflow",
":",
"Workflow",
")",
"->",
"\"WorkflowExecutionResult\"",
":",
"context",
"=",
"{",
"}",
"while",
"True",
":",
"with",
"workflow_context",
".",
"fork_workflow_step_context",
"(",
"**",
"context",
")",
":",
"result",
"... | Execute workflow. | [
"Execute",
"workflow",
"."
] | [
"\"\"\"Execute workflow.\n\n This function also performs tail-recursion optimization for inplace\n workflow steps.\n\n Args:\n workflow: The workflow to be executed.\n Returns:\n An object ref that represent the result.\n \"\"\"",
"# Tail recursion optimization.",
"# Convert the out... | [
{
"param": "workflow",
"type": "Workflow"
}
] | {
"returns": [
{
"docstring": "An object ref that represent the result.",
"docstring_tokens": [
"An",
"object",
"ref",
"that",
"represent",
"the",
"result",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
... |
e3bf0f88f3e0dbc92373c76a56725801787875e3 | kisuke95/ray | python/ray/workflow/step_executor.py | [
"Apache-2.0"
] | Python | _wrap_run | Tuple[Any, Any] | def _wrap_run(
func: Callable, runtime_options: "WorkflowStepRuntimeOptions", *args, **kwargs
) -> Tuple[Any, Any]:
"""Wrap the function and execute it.
It returns two parts, persisted_output (p-out) and volatile_output (v-out).
P-out is the part of result to persist in a storage and pass to the
ne... | Wrap the function and execute it.
It returns two parts, persisted_output (p-out) and volatile_output (v-out).
P-out is the part of result to persist in a storage and pass to the
next step. V-out is the part of result to return to the user but does not
require persistence.
This table describes thei... | Wrap the function and execute it.
It returns two parts, persisted_output (p-out) and volatile_output (v-out).
P-out is the part of result to persist in a storage and pass to the
next step. V-out is the part of result to return to the user but does not
require persistence.
This table describes their relationships
| [
"Wrap",
"the",
"function",
"and",
"execute",
"it",
".",
"It",
"returns",
"two",
"parts",
"persisted_output",
"(",
"p",
"-",
"out",
")",
"and",
"volatile_output",
"(",
"v",
"-",
"out",
")",
".",
"P",
"-",
"out",
"is",
"the",
"part",
"of",
"result",
"t... | def _wrap_run(
func: Callable, runtime_options: "WorkflowStepRuntimeOptions", *args, **kwargs
) -> Tuple[Any, Any]:
exception = None
result = None
done = False
i = 0
while not done:
if i == 0:
logger.info(f"{get_step_status_info(WorkflowStatus.RUNNING)}")
else:
... | [
"def",
"_wrap_run",
"(",
"func",
":",
"Callable",
",",
"runtime_options",
":",
"\"WorkflowStepRuntimeOptions\"",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
"->",
"Tuple",
"[",
"Any",
",",
"Any",
"]",
":",
"exception",
"=",
"None",
"result",
"=",
"None",
... | Wrap the function and execute it. | [
"Wrap",
"the",
"function",
"and",
"execute",
"it",
"."
] | [
"\"\"\"Wrap the function and execute it.\n\n It returns two parts, persisted_output (p-out) and volatile_output (v-out).\n P-out is the part of result to persist in a storage and pass to the\n next step. V-out is the part of result to return to the user but does not\n require persistence.\n\n This ta... | [
{
"param": "func",
"type": "Callable"
},
{
"param": "runtime_options",
"type": "\"WorkflowStepRuntimeOptions\""
}
] | {
"returns": [
{
"docstring": "State and output.",
"docstring_tokens": [
"State",
"and",
"output",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "func",
"type": "Callable",
"docstring": "The function body.... |
e3bf0f88f3e0dbc92373c76a56725801787875e3 | kisuke95/ray | python/ray/workflow/step_executor.py | [
"Apache-2.0"
] | Python | _workflow_step_executor | Tuple[Any, Any] | def _workflow_step_executor(
func: Callable,
context: "WorkflowStepContext",
step_id: "StepID",
baked_inputs: "_BakedWorkflowInputs",
runtime_options: "WorkflowStepRuntimeOptions",
inplace: bool = False,
) -> Tuple[Any, Any]:
"""Executor function for workflow step.
Args:
step_id... | Executor function for workflow step.
Args:
step_id: ID of the step.
func: The workflow step function.
baked_inputs: The processed inputs for the step.
context: Workflow step context. Used to access correct storage etc.
runtime_options: Parameters for workflow step execution.... | Executor function for workflow step. | [
"Executor",
"function",
"for",
"workflow",
"step",
"."
] | def _workflow_step_executor(
func: Callable,
context: "WorkflowStepContext",
step_id: "StepID",
baked_inputs: "_BakedWorkflowInputs",
runtime_options: "WorkflowStepRuntimeOptions",
inplace: bool = False,
) -> Tuple[Any, Any]:
workflow_context.update_workflow_step_context(context, step_id)
... | [
"def",
"_workflow_step_executor",
"(",
"func",
":",
"Callable",
",",
"context",
":",
"\"WorkflowStepContext\"",
",",
"step_id",
":",
"\"StepID\"",
",",
"baked_inputs",
":",
"\"_BakedWorkflowInputs\"",
",",
"runtime_options",
":",
"\"WorkflowStepRuntimeOptions\"",
",",
"... | Executor function for workflow step. | [
"Executor",
"function",
"for",
"workflow",
"step",
"."
] | [
"\"\"\"Executor function for workflow step.\n\n Args:\n step_id: ID of the step.\n func: The workflow step function.\n baked_inputs: The processed inputs for the step.\n context: Workflow step context. Used to access correct storage etc.\n runtime_options: Parameters for workfl... | [
{
"param": "func",
"type": "Callable"
},
{
"param": "context",
"type": "\"WorkflowStepContext\""
},
{
"param": "step_id",
"type": "\"StepID\""
},
{
"param": "baked_inputs",
"type": "\"_BakedWorkflowInputs\""
},
{
"param": "runtime_options",
"type": "\"Workflow... | {
"returns": [
{
"docstring": "Workflow step output.",
"docstring_tokens": [
"Workflow",
"step",
"output",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "func",
"type": "Callable",
"docstring": "The workfl... |
e3bf0f88f3e0dbc92373c76a56725801787875e3 | kisuke95/ray | python/ray/workflow/step_executor.py | [
"Apache-2.0"
] | Python | resolve | Tuple[List, Dict] | def resolve(self) -> Tuple[List, Dict]:
"""
This function resolves the inputs for the code inside
a workflow step (works on the callee side). For outputs from other
workflows, we resolve them into object instances inplace.
For each ObjectRef argument, the function returns both t... |
This function resolves the inputs for the code inside
a workflow step (works on the callee side). For outputs from other
workflows, we resolve them into object instances inplace.
For each ObjectRef argument, the function returns both the ObjectRef
and the object instance. If th... | This function resolves the inputs for the code inside
a workflow step (works on the callee side). For outputs from other
workflows, we resolve them into object instances inplace.
For each ObjectRef argument, the function returns both the ObjectRef
and the object instance. If the ObjectRef is a chain of nested
ObjectRe... | [
"This",
"function",
"resolves",
"the",
"inputs",
"for",
"the",
"code",
"inside",
"a",
"workflow",
"step",
"(",
"works",
"on",
"the",
"callee",
"side",
")",
".",
"For",
"outputs",
"from",
"other",
"workflows",
"we",
"resolve",
"them",
"into",
"object",
"ins... | def resolve(self) -> Tuple[List, Dict]:
objects_mapping = []
for static_workflow_ref in self.workflow_outputs:
if static_workflow_ref._resolve_like_object_ref_in_args:
obj = ray.put(_SelfDereference(static_workflow_ref))
else:
obj = _resolve_static... | [
"def",
"resolve",
"(",
"self",
")",
"->",
"Tuple",
"[",
"List",
",",
"Dict",
"]",
":",
"objects_mapping",
"=",
"[",
"]",
"for",
"static_workflow_ref",
"in",
"self",
".",
"workflow_outputs",
":",
"if",
"static_workflow_ref",
".",
"_resolve_like_object_ref_in_args... | This function resolves the inputs for the code inside
a workflow step (works on the callee side). | [
"This",
"function",
"resolves",
"the",
"inputs",
"for",
"the",
"code",
"inside",
"a",
"workflow",
"step",
"(",
"works",
"on",
"the",
"callee",
"side",
")",
"."
] | [
"\"\"\"\n This function resolves the inputs for the code inside\n a workflow step (works on the callee side). For outputs from other\n workflows, we resolve them into object instances inplace.\n\n For each ObjectRef argument, the function returns both the ObjectRef\n and the objec... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "Instances of arguments.",
"docstring_tokens": [
"Instances",
"of",
"arguments",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"... |
44f805cc7a525b69c617b9bdff1200bb1cbe0558 | coursekevin/avlpy | avlpy/read_avl_sys_mat.py | [
"MIT"
] | Python | read_avl_sys_mat | <not_specific> | def read_avl_sys_mat(fname):
""" This function reads a filename and returns an avl_dict. The keys in the dictionary are the
values found in the file and avl_dict[key] is the value.
--------------------------------------------------------------------------------
INPUTS
- fname: filename containing path to sy... | This function reads a filename and returns an avl_dict. The keys in the dictionary are the
values found in the file and avl_dict[key] is the value.
--------------------------------------------------------------------------------
INPUTS
- fname: filename containing path to system matrix output
-----------... | This function reads a filename and returns an avl_dict. The keys in the dictionary are the
values found in the file and avl_dict[key] is the value.
INPUTS
fname: filename containing path to system matrix output
OUTPUTS
A: dynamic system marix
B: dynamic control matrix | [
"This",
"function",
"reads",
"a",
"filename",
"and",
"returns",
"an",
"avl_dict",
".",
"The",
"keys",
"in",
"the",
"dictionary",
"are",
"the",
"values",
"found",
"in",
"the",
"file",
"and",
"avl_dict",
"[",
"key",
"]",
"is",
"the",
"value",
".",
"INPUTS"... | def read_avl_sys_mat(fname):
A = []
B = []
with open(fname,"r") as file:
for line in file:
num_match = re.search("\d",line)
if num_match:
line_split = line.split()
A_row = [float(a) for a in line_split[:12]]
A.append(A_row)
B_row = [float(b) for b in line_split[12:]]
B.append(B_row)
retu... | [
"def",
"read_avl_sys_mat",
"(",
"fname",
")",
":",
"A",
"=",
"[",
"]",
"B",
"=",
"[",
"]",
"with",
"open",
"(",
"fname",
",",
"\"r\"",
")",
"as",
"file",
":",
"for",
"line",
"in",
"file",
":",
"num_match",
"=",
"re",
".",
"search",
"(",
"\"\\d\""... | This function reads a filename and returns an avl_dict. | [
"This",
"function",
"reads",
"a",
"filename",
"and",
"returns",
"an",
"avl_dict",
"."
] | [
"\"\"\" This function reads a filename and returns an avl_dict. The keys in the dictionary are the \n\t\tvalues found in the file and avl_dict[key] is the value.\n\n\t\t--------------------------------------------------------------------------------\n\t\tINPUTS\n\t\t\t- fname: filename containing path to system mat... | [
{
"param": "fname",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fname",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
abf68f261dfbc79848ac5f34611fbcb4907ac95c | coursekevin/avlpy | avlpy/read_avl_file.py | [
"MIT"
] | Python | read_avl_file | <not_specific> | def read_avl_file(fname):
""" This function reads an avl file into a list of dictionaries for each surface
-------------------------------------------------------------------------------
INPUTS
- fname: filename string
-------------------------------------------------------------------------------
OUTPUTS... | This function reads an avl file into a list of dictionaries for each surface
-------------------------------------------------------------------------------
INPUTS
- fname: filename string
-------------------------------------------------------------------------------
OUTPUTS
- surfaces: list containin... | This function reads an avl file into a list of dictionaries for each surface
INPUTS
fname: filename string
OUTPUTS
surfaces: list containing dictionaries of avl sections | [
"This",
"function",
"reads",
"an",
"avl",
"file",
"into",
"a",
"list",
"of",
"dictionaries",
"for",
"each",
"surface",
"INPUTS",
"fname",
":",
"filename",
"string",
"OUTPUTS",
"surfaces",
":",
"list",
"containing",
"dictionaries",
"of",
"avl",
"sections"
] | def read_avl_file(fname):
surfaces = []
with open(fname,"r") as file:
line_list = [line for line in file if not re.match("^#|^\s*$",line)]
for (line,idx) in zip(line_list,range(len(line_list))):
surf_match = re.search("SURFACE",line)
ydup_match = re.search("YDUP",line)
angl_match = re.search("ANGLE",line... | [
"def",
"read_avl_file",
"(",
"fname",
")",
":",
"surfaces",
"=",
"[",
"]",
"with",
"open",
"(",
"fname",
",",
"\"r\"",
")",
"as",
"file",
":",
"line_list",
"=",
"[",
"line",
"for",
"line",
"in",
"file",
"if",
"not",
"re",
".",
"match",
"(",
"\"^#|^... | This function reads an avl file into a list of dictionaries for each surface
INPUTS
fname: filename string | [
"This",
"function",
"reads",
"an",
"avl",
"file",
"into",
"a",
"list",
"of",
"dictionaries",
"for",
"each",
"surface",
"INPUTS",
"fname",
":",
"filename",
"string"
] | [
"\"\"\" This function reads an avl file into a list of dictionaries for each surface\n\n\t\t-------------------------------------------------------------------------------\n\t\tINPUTS\n\t\t\t- fname:\tfilename string\n\n\t\t-------------------------------------------------------------------------------\n\t\tOUTPUTS... | [
{
"param": "fname",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fname",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6de7ab37f2cb67755669a20a4dd4a8c35d0aef6d | coursekevin/avlpy | avlpy/avlRun.py | [
"MIT"
] | Python | custom_cmd | <not_specific> | def custom_cmd(self,cmd_list):
""" This function runs the custom command sequence given in cmd_list
--------------------------------------------------------------------------------------
INPUTS
- cmd_list: list of string
"""
cmd_tmp = self.cmd_path.copy()
[cmd_tmp.append(cmd)for cmd in cmd_list]
... | This function runs the custom command sequence given in cmd_list
--------------------------------------------------------------------------------------
INPUTS
- cmd_list: list of string
| This function runs the custom command sequence given in cmd_list
INPUTS
cmd_list: list of string | [
"This",
"function",
"runs",
"the",
"custom",
"command",
"sequence",
"given",
"in",
"cmd_list",
"INPUTS",
"cmd_list",
":",
"list",
"of",
"string"
] | def custom_cmd(self,cmd_list):
cmd_tmp = self.cmd_path.copy()
[cmd_tmp.append(cmd)for cmd in cmd_list]
if cmd_list[-1] == "q":
cmd_bytes = "\n".join(cmd_tmp)
else:
cmd_tmp.append("q")
cmd_bytes = "\n".join(cmd_tmp)
with open(self.tmp_dir + '/stdout.txt','wb') as outfile:
return(subprocess.run(self... | [
"def",
"custom_cmd",
"(",
"self",
",",
"cmd_list",
")",
":",
"cmd_tmp",
"=",
"self",
".",
"cmd_path",
".",
"copy",
"(",
")",
"[",
"cmd_tmp",
".",
"append",
"(",
"cmd",
")",
"for",
"cmd",
"in",
"cmd_list",
"]",
"if",
"cmd_list",
"[",
"-",
"1",
"]",
... | This function runs the custom command sequence given in cmd_list
INPUTS
cmd_list: list of string | [
"This",
"function",
"runs",
"the",
"custom",
"command",
"sequence",
"given",
"in",
"cmd_list",
"INPUTS",
"cmd_list",
":",
"list",
"of",
"string"
] | [
"\"\"\" This function runs the custom command sequence given in cmd_list\n\n\t\t\t--------------------------------------------------------------------------------------\n\t\t\tINPUTS\n\t\t\t\t- cmd_list: list of string\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "cmd_list",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cmd_list",
"type": null,
"docstring": null,
"docstring_tokens... |
904e04d52f6a644350bfb95779c3d57fa6f28d76 | coursekevin/avlpy | avlpy/read_avl_flow_analysis.py | [
"MIT"
] | Python | read_avl_flow_analysis | <not_specific> | def read_avl_flow_analysis(fname,printValues = False):
""" This function reads a filename and returns an avl_dict. The keys in the dictionary are the
values found in the file and avl_dict[key] is the value.
---------------------------------------------------------------------------------
INPUTS
- fname: fil... | This function reads a filename and returns an avl_dict. The keys in the dictionary are the
values found in the file and avl_dict[key] is the value.
---------------------------------------------------------------------------------
INPUTS
- fname: filename of flow analysis file to be read
-----------------... | This function reads a filename and returns an avl_dict. The keys in the dictionary are the
values found in the file and avl_dict[key] is the value.
INPUTS
fname: filename of flow analysis file to be read
OUTPUTS
avl_dict: dictionary containing all values computed through flow analysis | [
"This",
"function",
"reads",
"a",
"filename",
"and",
"returns",
"an",
"avl_dict",
".",
"The",
"keys",
"in",
"the",
"dictionary",
"are",
"the",
"values",
"found",
"in",
"the",
"file",
"and",
"avl_dict",
"[",
"key",
"]",
"is",
"the",
"value",
".",
"INPUTS"... | def read_avl_flow_analysis(fname,printValues = False):
avl_dict = {}
with open(fname,"r") as file:
for line in file:
comment_match = re.search('#',line)
if comment_match:
continue
else:
assignment_match = re.search("=",line)
if assignment_match:
if printValues:
print(line)
data ... | [
"def",
"read_avl_flow_analysis",
"(",
"fname",
",",
"printValues",
"=",
"False",
")",
":",
"avl_dict",
"=",
"{",
"}",
"with",
"open",
"(",
"fname",
",",
"\"r\"",
")",
"as",
"file",
":",
"for",
"line",
"in",
"file",
":",
"comment_match",
"=",
"re",
".",... | This function reads a filename and returns an avl_dict. | [
"This",
"function",
"reads",
"a",
"filename",
"and",
"returns",
"an",
"avl_dict",
"."
] | [
"\"\"\" This function reads a filename and returns an avl_dict. The keys in the dictionary are the \n\t\tvalues found in the file and avl_dict[key] is the value.\n\n\t\t---------------------------------------------------------------------------------\n\t\tINPUTS\n\t\t\t- fname: filename of flow analysis file to be ... | [
{
"param": "fname",
"type": null
},
{
"param": "printValues",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fname",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "printValues",
"type": null,
"docstring": null,
"docstring_to... |
1fb8ec7550a0d921da2e3987bb9d606498dbfbac | jackee777/pybabelnet | babelnetpy/babelnet.py | [
"MIT"
] | Python | make_url | <not_specific> | def make_url(self, **params):
"""
this makes the target url that corresponds to the function
params: lemma, id, lang, targetLang, pos, source
lemma; word
id: babelnet synsetids
lang: language
targetLang: target language that is often the same as lang; how... |
this makes the target url that corresponds to the function
params: lemma, id, lang, targetLang, pos, source
lemma; word
id: babelnet synsetids
lang: language
targetLang: target language that is often the same as lang; howerver rarely is not same.
pos: pa... | this makes the target url that corresponds to the function
params: lemma, id, lang, targetLang, pos, source
lemma; word
id: babelnet synsetids
lang: language
targetLang: target language that is often the same as lang; howerver rarely is not same.
pos: part of speech
source: wikipedia and so on
lemma_type: full, simple
... | [
"this",
"makes",
"the",
"target",
"url",
"that",
"corresponds",
"to",
"the",
"function",
"params",
":",
"lemma",
"id",
"lang",
"targetLang",
"pos",
"source",
"lemma",
";",
"word",
"id",
":",
"babelnet",
"synsetids",
"lang",
":",
"language",
"targetLang",
":"... | def make_url(self, **params):
synset_url = self.API_PATH
synset_url += params["function"]
if params.get("lemma"):
synset_url += "lemma={0}".format(params["lemma"])
if params.get("id"):
synset_url += "id={0}".format(params["id"])
if params.get("lang"):
... | [
"def",
"make_url",
"(",
"self",
",",
"**",
"params",
")",
":",
"synset_url",
"=",
"self",
".",
"API_PATH",
"synset_url",
"+=",
"params",
"[",
"\"function\"",
"]",
"if",
"params",
".",
"get",
"(",
"\"lemma\"",
")",
":",
"synset_url",
"+=",
"\"lemma={0}\"",
... | this makes the target url that corresponds to the function
params: lemma, id, lang, targetLang, pos, source
lemma; word
id: babelnet synsetids
lang: language
targetLang: target language that is often the same as lang; howerver rarely is not same. | [
"this",
"makes",
"the",
"target",
"url",
"that",
"corresponds",
"to",
"the",
"function",
"params",
":",
"lemma",
"id",
"lang",
"targetLang",
"pos",
"source",
"lemma",
";",
"word",
"id",
":",
"babelnet",
"synsetids",
"lang",
":",
"language",
"targetLang",
":"... | [
"\"\"\"\n this makes the target url that corresponds to the function\n \n params: lemma, id, lang, targetLang, pos, source\n lemma; word\n id: babelnet synsetids\n lang: language\n targetLang: target language that is often the same as lang; howerver rarely is not sam... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
40593296028691cafa352539e098c9ed7b84bac9 | junqueira/aztk | aztk/node_scripts/scheduling/common.py | [
"MIT"
] | Python | load_application | <not_specific> | def load_application(application_file_path):
"""
Read and parse the application from file
"""
with open(application_file_path, encoding="UTF-8") as f:
application = yaml.load(f)
return application |
Read and parse the application from file
| Read and parse the application from file | [
"Read",
"and",
"parse",
"the",
"application",
"from",
"file"
] | def load_application(application_file_path):
with open(application_file_path, encoding="UTF-8") as f:
application = yaml.load(f)
return application | [
"def",
"load_application",
"(",
"application_file_path",
")",
":",
"with",
"open",
"(",
"application_file_path",
",",
"encoding",
"=",
"\"UTF-8\"",
")",
"as",
"f",
":",
"application",
"=",
"yaml",
".",
"load",
"(",
"f",
")",
"return",
"application"
] | Read and parse the application from file | [
"Read",
"and",
"parse",
"the",
"application",
"from",
"file"
] | [
"\"\"\"\n Read and parse the application from file\n \"\"\""
] | [
{
"param": "application_file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "application_file_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
40593296028691cafa352539e098c9ed7b84bac9 | junqueira/aztk | aztk/node_scripts/scheduling/common.py | [
"MIT"
] | Python | upload_log | null | def upload_log(blob_client, application):
"""
upload output.log to storage account
"""
log_file = os.path.join(os.environ["AZ_BATCH_TASK_WORKING_DIR"], os.environ["SPARK_SUBMIT_LOGS_FILE"])
upload_file_to_container(
container_name=os.environ["STORAGE_LOGS_CONTAINER"],
application... |
upload output.log to storage account
| upload output.log to storage account | [
"upload",
"output",
".",
"log",
"to",
"storage",
"account"
] | def upload_log(blob_client, application):
log_file = os.path.join(os.environ["AZ_BATCH_TASK_WORKING_DIR"], os.environ["SPARK_SUBMIT_LOGS_FILE"])
upload_file_to_container(
container_name=os.environ["STORAGE_LOGS_CONTAINER"],
application_name=application.name,
file_path=log_file,
b... | [
"def",
"upload_log",
"(",
"blob_client",
",",
"application",
")",
":",
"log_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"environ",
"[",
"\"AZ_BATCH_TASK_WORKING_DIR\"",
"]",
",",
"os",
".",
"environ",
"[",
"\"SPARK_SUBMIT_LOGS_FILE\"",
"]",
"... | upload output.log to storage account | [
"upload",
"output",
".",
"log",
"to",
"storage",
"account"
] | [
"\"\"\"\n upload output.log to storage account\n \"\"\""
] | [
{
"param": "blob_client",
"type": null
},
{
"param": "application",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "blob_client",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "application",
"type": null,
"docstring": null,
"docstr... |
40593296028691cafa352539e098c9ed7b84bac9 | junqueira/aztk | aztk/node_scripts/scheduling/common.py | [
"MIT"
] | Python | upload_file_to_container | batch_models.ResourceFile | def upload_file_to_container(container_name,
application_name,
file_path,
blob_client=None,
use_full_path=False,
node_path=None) -> batch_models.ResourceFile:
"""
Uplo... |
Uploads a local file to an Azure Blob storage container.
:param blob_client: A blob service client.
:type blocblob_clientk_blob_client: `azure.storage.blob.BlockBlobService`
:param str container_name: The name of the Azure Blob storage container.
:param str file_path: The local path to the file.
... | Uploads a local file to an Azure Blob storage container. | [
"Uploads",
"a",
"local",
"file",
"to",
"an",
"Azure",
"Blob",
"storage",
"container",
"."
] | def upload_file_to_container(container_name,
application_name,
file_path,
blob_client=None,
use_full_path=False,
node_path=None) -> batch_models.ResourceFile:
file_path = ... | [
"def",
"upload_file_to_container",
"(",
"container_name",
",",
"application_name",
",",
"file_path",
",",
"blob_client",
"=",
"None",
",",
"use_full_path",
"=",
"False",
",",
"node_path",
"=",
"None",
")",
"->",
"batch_models",
".",
"ResourceFile",
":",
"file_path... | Uploads a local file to an Azure Blob storage container. | [
"Uploads",
"a",
"local",
"file",
"to",
"an",
"Azure",
"Blob",
"storage",
"container",
"."
] | [
"\"\"\"\n Uploads a local file to an Azure Blob storage container.\n :param blob_client: A blob service client.\n :type blocblob_clientk_blob_client: `azure.storage.blob.BlockBlobService`\n :param str container_name: The name of the Azure Blob storage container.\n :param str file_path: The local path... | [
{
"param": "container_name",
"type": null
},
{
"param": "application_name",
"type": null
},
{
"param": "file_path",
"type": null
},
{
"param": "blob_client",
"type": null
},
{
"param": "use_full_path",
"type": null
},
{
"param": "node_path",
"type"... | {
"returns": [
{
"docstring": "A ResourceFile initialized with a SAS URL appropriate for Batch\ntasks.",
"docstring_tokens": [
"A",
"ResourceFile",
"initialized",
"with",
"a",
"SAS",
"URL",
"appropriate",
"for",
"Batch",
... |
461c3756d4bcb6460aa400c1cbda80d6345abfa2 | junqueira/aztk | aztk/utils/helpers.py | [
"MIT"
] | Python | wait_for_tasks_to_complete | <not_specific> | def wait_for_tasks_to_complete(job_id, batch_client):
"""
Waits for all the tasks in a particular job to complete.
:param batch_client: The batch client to use.
:type batch_client: `batchserviceclient.BatchServiceClient`
:param str job_id: The id of the job to monitor.
"""
while True:
... |
Waits for all the tasks in a particular job to complete.
:param batch_client: The batch client to use.
:type batch_client: `batchserviceclient.BatchServiceClient`
:param str job_id: The id of the job to monitor.
| Waits for all the tasks in a particular job to complete. | [
"Waits",
"for",
"all",
"the",
"tasks",
"in",
"a",
"particular",
"job",
"to",
"complete",
"."
] | def wait_for_tasks_to_complete(job_id, batch_client):
while True:
tasks = batch_client.task.list(job_id)
incomplete_tasks = [task for task in tasks if task.state != batch_models.TaskState.completed]
if not incomplete_tasks:
return
time.sleep(5) | [
"def",
"wait_for_tasks_to_complete",
"(",
"job_id",
",",
"batch_client",
")",
":",
"while",
"True",
":",
"tasks",
"=",
"batch_client",
".",
"task",
".",
"list",
"(",
"job_id",
")",
"incomplete_tasks",
"=",
"[",
"task",
"for",
"task",
"in",
"tasks",
"if",
"... | Waits for all the tasks in a particular job to complete. | [
"Waits",
"for",
"all",
"the",
"tasks",
"in",
"a",
"particular",
"job",
"to",
"complete",
"."
] | [
"\"\"\"\n Waits for all the tasks in a particular job to complete.\n :param batch_client: The batch client to use.\n :type batch_client: `batchserviceclient.BatchServiceClient`\n :param str job_id: The id of the job to monitor.\n \"\"\""
] | [
{
"param": "job_id",
"type": null
},
{
"param": "batch_client",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "job_id",
"type": null,
"docstring": "The id of the job to monitor.",
"docstring_tokens": [
"The",
"id",
"of",
"the",
"job",
"to",
"monitor",
"."
],
"d... |
461c3756d4bcb6460aa400c1cbda80d6345abfa2 | junqueira/aztk | aztk/utils/helpers.py | [
"MIT"
] | Python | wait_for_task_to_complete | <not_specific> | def wait_for_task_to_complete(job_id: str, task_id: str, batch_client):
"""
Waits for a particular task in a job to complete.
:param batch_client: The batch client to use.
:type batch_client: `batchserviceclient.BatchServiceClient`
:param str job_id: The id of the job to monitor.
:param str job_... |
Waits for a particular task in a job to complete.
:param batch_client: The batch client to use.
:type batch_client: `batchserviceclient.BatchServiceClient`
:param str job_id: The id of the job to monitor.
:param str job_id: The id of the task to monitor.
| Waits for a particular task in a job to complete. | [
"Waits",
"for",
"a",
"particular",
"task",
"in",
"a",
"job",
"to",
"complete",
"."
] | def wait_for_task_to_complete(job_id: str, task_id: str, batch_client):
while True:
task = batch_client.task.get(job_id=job_id, task_id=task_id)
if task.state != batch_models.TaskState.completed:
time.sleep(5)
else:
return | [
"def",
"wait_for_task_to_complete",
"(",
"job_id",
":",
"str",
",",
"task_id",
":",
"str",
",",
"batch_client",
")",
":",
"while",
"True",
":",
"task",
"=",
"batch_client",
".",
"task",
".",
"get",
"(",
"job_id",
"=",
"job_id",
",",
"task_id",
"=",
"task... | Waits for a particular task in a job to complete. | [
"Waits",
"for",
"a",
"particular",
"task",
"in",
"a",
"job",
"to",
"complete",
"."
] | [
"\"\"\"\n Waits for a particular task in a job to complete.\n :param batch_client: The batch client to use.\n :type batch_client: `batchserviceclient.BatchServiceClient`\n :param str job_id: The id of the job to monitor.\n :param str job_id: The id of the task to monitor.\n \"\"\""
] | [
{
"param": "job_id",
"type": "str"
},
{
"param": "task_id",
"type": "str"
},
{
"param": "batch_client",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "job_id",
"type": "str",
"docstring": "The id of the task to monitor.",
"docstring_tokens": [
"The",
"id",
"of",
"the",
"task",
"to",
"monitor",
"."
],
... |
461c3756d4bcb6460aa400c1cbda80d6345abfa2 | junqueira/aztk | aztk/utils/helpers.py | [
"MIT"
] | Python | upload_file_to_container | batch_models.ResourceFile | def upload_file_to_container(container_name,
application_name,
file_path,
blob_client=None,
use_full_path=False,
node_path=None) -> batch_models.ResourceFile:
"""
Uplo... |
Uploads a local file to an Azure Blob storage container.
:param blob_client: A blob service client.
:type blocblob_clientk_blob_client: `azure.storage.blob.BlockBlobService`
:param str container_name: The name of the Azure Blob storage container.
:param str file_path: The local path to the file.
... | Uploads a local file to an Azure Blob storage container. | [
"Uploads",
"a",
"local",
"file",
"to",
"an",
"Azure",
"Blob",
"storage",
"container",
"."
] | def upload_file_to_container(container_name,
application_name,
file_path,
blob_client=None,
use_full_path=False,
node_path=None) -> batch_models.ResourceFile:
file_path = ... | [
"def",
"upload_file_to_container",
"(",
"container_name",
",",
"application_name",
",",
"file_path",
",",
"blob_client",
"=",
"None",
",",
"use_full_path",
"=",
"False",
",",
"node_path",
"=",
"None",
")",
"->",
"batch_models",
".",
"ResourceFile",
":",
"file_path... | Uploads a local file to an Azure Blob storage container. | [
"Uploads",
"a",
"local",
"file",
"to",
"an",
"Azure",
"Blob",
"storage",
"container",
"."
] | [
"\"\"\"\n Uploads a local file to an Azure Blob storage container.\n :param blob_client: A blob service client.\n :type blocblob_clientk_blob_client: `azure.storage.blob.BlockBlobService`\n :param str container_name: The name of the Azure Blob storage container.\n :param str file_path: The local path... | [
{
"param": "container_name",
"type": null
},
{
"param": "application_name",
"type": null
},
{
"param": "file_path",
"type": null
},
{
"param": "blob_client",
"type": null
},
{
"param": "use_full_path",
"type": null
},
{
"param": "node_path",
"type"... | {
"returns": [
{
"docstring": "A ResourceFile initialized with a SAS URL appropriate for Batch\ntasks.",
"docstring_tokens": [
"A",
"ResourceFile",
"initialized",
"with",
"a",
"SAS",
"URL",
"appropriate",
"for",
"Batch",
... |
461c3756d4bcb6460aa400c1cbda80d6345abfa2 | junqueira/aztk | aztk/utils/helpers.py | [
"MIT"
] | Python | create_pool_if_not_exist | <not_specific> | def create_pool_if_not_exist(pool, batch_client):
"""
Creates the specified pool if it doesn't already exist
:param batch_client: The batch client to use.
:type batch_client: `batchserviceclient.BatchServiceClient`
:param pool: The pool to create.
:type pool: `batchserviceclient.models.PoolAddPa... |
Creates the specified pool if it doesn't already exist
:param batch_client: The batch client to use.
:type batch_client: `batchserviceclient.BatchServiceClient`
:param pool: The pool to create.
:type pool: `batchserviceclient.models.PoolAddParameter`
| Creates the specified pool if it doesn't already exist | [
"Creates",
"the",
"specified",
"pool",
"if",
"it",
"doesn",
"'",
"t",
"already",
"exist"
] | def create_pool_if_not_exist(pool, batch_client):
try:
batch_client.pool.add(pool)
except batch_models.BatchErrorException as e:
if e.error.code == "PoolExists":
raise error.AztkError(
"A cluster with the same id already exists. Use a different id or delete the existi... | [
"def",
"create_pool_if_not_exist",
"(",
"pool",
",",
"batch_client",
")",
":",
"try",
":",
"batch_client",
".",
"pool",
".",
"add",
"(",
"pool",
")",
"except",
"batch_models",
".",
"BatchErrorException",
"as",
"e",
":",
"if",
"e",
".",
"error",
".",
"code"... | Creates the specified pool if it doesn't already exist | [
"Creates",
"the",
"specified",
"pool",
"if",
"it",
"doesn",
"'",
"t",
"already",
"exist"
] | [
"\"\"\"\n Creates the specified pool if it doesn't already exist\n :param batch_client: The batch client to use.\n :type batch_client: `batchserviceclient.BatchServiceClient`\n :param pool: The pool to create.\n :type pool: `batchserviceclient.models.PoolAddParameter`\n \"\"\""
] | [
{
"param": "pool",
"type": null
},
{
"param": "batch_client",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pool",
"type": null,
"docstring": "The pool to create.",
"docstring_tokens": [
"The",
"pool",
"to",
"create",
"."
],
"default": null,
"is_optional": null
},
{
... |
461c3756d4bcb6460aa400c1cbda80d6345abfa2 | junqueira/aztk | aztk/utils/helpers.py | [
"MIT"
] | Python | wait_for_all_nodes_state | <not_specific> | def wait_for_all_nodes_state(pool, node_state, batch_client):
"""
Waits for all nodes in pool to reach any specified state in set
:param batch_client: The batch client to use.
:type batch_client: `batchserviceclient.BatchServiceClient`
:param pool: The pool containing the node.
:type pool: `batc... |
Waits for all nodes in pool to reach any specified state in set
:param batch_client: The batch client to use.
:type batch_client: `batchserviceclient.BatchServiceClient`
:param pool: The pool containing the node.
:type pool: `batchserviceclient.models.CloudPool`
:param set node_state: node stat... | Waits for all nodes in pool to reach any specified state in set | [
"Waits",
"for",
"all",
"nodes",
"in",
"pool",
"to",
"reach",
"any",
"specified",
"state",
"in",
"set"
] | def wait_for_all_nodes_state(pool, node_state, batch_client):
while True:
pool = batch_client.pool.get(pool.id)
if pool.resize_errors is not None:
raise RuntimeError("resize error encountered for pool {}: {!r}".format(pool.id, pool.resize_errors))
nodes = list(batch_client.comput... | [
"def",
"wait_for_all_nodes_state",
"(",
"pool",
",",
"node_state",
",",
"batch_client",
")",
":",
"while",
"True",
":",
"pool",
"=",
"batch_client",
".",
"pool",
".",
"get",
"(",
"pool",
".",
"id",
")",
"if",
"pool",
".",
"resize_errors",
"is",
"not",
"N... | Waits for all nodes in pool to reach any specified state in set | [
"Waits",
"for",
"all",
"nodes",
"in",
"pool",
"to",
"reach",
"any",
"specified",
"state",
"in",
"set"
] | [
"\"\"\"\n Waits for all nodes in pool to reach any specified state in set\n :param batch_client: The batch client to use.\n :type batch_client: `batchserviceclient.BatchServiceClient`\n :param pool: The pool containing the node.\n :type pool: `batchserviceclient.models.CloudPool`\n :param set node... | [
{
"param": "pool",
"type": null
},
{
"param": "node_state",
"type": null
},
{
"param": "batch_client",
"type": null
}
] | {
"returns": [
{
"docstring": "list of `batchserviceclient.models.ComputeNode`",
"docstring_tokens": [
"list",
"of",
"`",
"batchserviceclient",
".",
"models",
".",
"ComputeNode",
"`"
],
"type": "list"
}
],
"rai... |
461c3756d4bcb6460aa400c1cbda80d6345abfa2 | junqueira/aztk | aztk/utils/helpers.py | [
"MIT"
] | Python | upload_blob_and_create_sas | <not_specific> | def upload_blob_and_create_sas(container_name, blob_name, file_name, expiry, blob_client, timeout=None):
"""
Uploads a file from local disk to Azure Storage and creates a SAS for it.
:param blob_client: The storage block blob client to use.
:type blob_client: `azure.storage.blob.BlockBlobService`
:p... |
Uploads a file from local disk to Azure Storage and creates a SAS for it.
:param blob_client: The storage block blob client to use.
:type blob_client: `azure.storage.blob.BlockBlobService`
:param str container_name: The name of the container to upload the blob to.
:param str blob_name: The name of ... | Uploads a file from local disk to Azure Storage and creates a SAS for it. | [
"Uploads",
"a",
"file",
"from",
"local",
"disk",
"to",
"Azure",
"Storage",
"and",
"creates",
"a",
"SAS",
"for",
"it",
"."
] | def upload_blob_and_create_sas(container_name, blob_name, file_name, expiry, blob_client, timeout=None):
blob_client.create_container(container_name, fail_on_exist=False)
blob_client.create_blob_from_path(container_name, blob_name, file_name)
sas_token = create_sas_token(
container_name,
blo... | [
"def",
"upload_blob_and_create_sas",
"(",
"container_name",
",",
"blob_name",
",",
"file_name",
",",
"expiry",
",",
"blob_client",
",",
"timeout",
"=",
"None",
")",
":",
"blob_client",
".",
"create_container",
"(",
"container_name",
",",
"fail_on_exist",
"=",
"Fal... | Uploads a file from local disk to Azure Storage and creates a SAS for it. | [
"Uploads",
"a",
"file",
"from",
"local",
"disk",
"to",
"Azure",
"Storage",
"and",
"creates",
"a",
"SAS",
"for",
"it",
"."
] | [
"\"\"\"\n Uploads a file from local disk to Azure Storage and creates a SAS for it.\n :param blob_client: The storage block blob client to use.\n :type blob_client: `azure.storage.blob.BlockBlobService`\n :param str container_name: The name of the container to upload the blob to.\n :param str blob_na... | [
{
"param": "container_name",
"type": null
},
{
"param": "blob_name",
"type": null
},
{
"param": "file_name",
"type": null
},
{
"param": "expiry",
"type": null
},
{
"param": "blob_client",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [
{
"docstring": "A SAS URL to the blob with the specified expiry time.",
"docstring_tokens": [
"A",
"SAS",
"URL",
"to",
"the",
"blob",
"with",
"the",
"specified",
"expiry",
"time",
"."
]... |
461c3756d4bcb6460aa400c1cbda80d6345abfa2 | junqueira/aztk | aztk/utils/helpers.py | [
"MIT"
] | Python | normalize_path | str | def normalize_path(path: str) -> str:
"""
Convert a path in a path that will work well with blob storage and unix
It will replace backslashes with forwardslashes and return absolute paths.
"""
path = os.path.abspath(os.path.expanduser(path))
path = path.replace("\\", "/")
if path.startswith(... |
Convert a path in a path that will work well with blob storage and unix
It will replace backslashes with forwardslashes and return absolute paths.
| Convert a path in a path that will work well with blob storage and unix
It will replace backslashes with forwardslashes and return absolute paths. | [
"Convert",
"a",
"path",
"in",
"a",
"path",
"that",
"will",
"work",
"well",
"with",
"blob",
"storage",
"and",
"unix",
"It",
"will",
"replace",
"backslashes",
"with",
"forwardslashes",
"and",
"return",
"absolute",
"paths",
"."
] | def normalize_path(path: str) -> str:
path = os.path.abspath(os.path.expanduser(path))
path = path.replace("\\", "/")
if path.startswith("./"):
return path[2:]
else:
return path | [
"def",
"normalize_path",
"(",
"path",
":",
"str",
")",
"->",
"str",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"path",
")",
")",
"path",
"=",
"path",
".",
"replace",
"(",
"\"\\\\\"",
",",
... | Convert a path in a path that will work well with blob storage and unix
It will replace backslashes with forwardslashes and return absolute paths. | [
"Convert",
"a",
"path",
"in",
"a",
"path",
"that",
"will",
"work",
"well",
"with",
"blob",
"storage",
"and",
"unix",
"It",
"will",
"replace",
"backslashes",
"with",
"forwardslashes",
"and",
"return",
"absolute",
"paths",
"."
] | [
"\"\"\"\n Convert a path in a path that will work well with blob storage and unix\n It will replace backslashes with forwardslashes and return absolute paths.\n \"\"\""
] | [
{
"param": "path",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
461c3756d4bcb6460aa400c1cbda80d6345abfa2 | junqueira/aztk | aztk/utils/helpers.py | [
"MIT"
] | Python | format_batch_exception | <not_specific> | def format_batch_exception(batch_exception):
"""
Returns the contents of the specified Batch exception.
:param batch_exception:
"""
l = []
l.append("-------------------------------------------")
if batch_exception.error and batch_exception.error.message and batch_exception.error.message.valu... |
Returns the contents of the specified Batch exception.
:param batch_exception:
| Returns the contents of the specified Batch exception. | [
"Returns",
"the",
"contents",
"of",
"the",
"specified",
"Batch",
"exception",
"."
] | def format_batch_exception(batch_exception):
l = []
l.append("-------------------------------------------")
if batch_exception.error and batch_exception.error.message and batch_exception.error.message.value:
l.append(batch_exception.error.message.value)
if batch_exception.error.values:
... | [
"def",
"format_batch_exception",
"(",
"batch_exception",
")",
":",
"l",
"=",
"[",
"]",
"l",
".",
"append",
"(",
"\"-------------------------------------------\"",
")",
"if",
"batch_exception",
".",
"error",
"and",
"batch_exception",
".",
"error",
".",
"message",
"... | Returns the contents of the specified Batch exception. | [
"Returns",
"the",
"contents",
"of",
"the",
"specified",
"Batch",
"exception",
"."
] | [
"\"\"\"\n Returns the contents of the specified Batch exception.\n :param batch_exception:\n \"\"\""
] | [
{
"param": "batch_exception",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "batch_exception",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
461c3756d4bcb6460aa400c1cbda80d6345abfa2 | junqueira/aztk | aztk/utils/helpers.py | [
"MIT"
] | Python | bool_env | <not_specific> | def bool_env(value: bool):
"""
Takes a boolean value(or None) and return the serialized version to be used as an environment variable
Examples:
>>> bool_env(True)
"true"
>>> bool_env(False)
"false"
>>> bool_env(None)
"false"
"""
if value is True:
... |
Takes a boolean value(or None) and return the serialized version to be used as an environment variable
Examples:
>>> bool_env(True)
"true"
>>> bool_env(False)
"false"
>>> bool_env(None)
"false"
| Takes a boolean value(or None) and return the serialized version to be used as an environment variable | [
"Takes",
"a",
"boolean",
"value",
"(",
"or",
"None",
")",
"and",
"return",
"the",
"serialized",
"version",
"to",
"be",
"used",
"as",
"an",
"environment",
"variable"
] | def bool_env(value: bool):
if value is True:
return "true"
else:
return "false" | [
"def",
"bool_env",
"(",
"value",
":",
"bool",
")",
":",
"if",
"value",
"is",
"True",
":",
"return",
"\"true\"",
"else",
":",
"return",
"\"false\""
] | Takes a boolean value(or None) and return the serialized version to be used as an environment variable | [
"Takes",
"a",
"boolean",
"value",
"(",
"or",
"None",
")",
"and",
"return",
"the",
"serialized",
"version",
"to",
"be",
"used",
"as",
"an",
"environment",
"variable"
] | [
"\"\"\"\n Takes a boolean value(or None) and return the serialized version to be used as an environment variable\n\n Examples:\n >>> bool_env(True)\n \"true\"\n\n >>> bool_env(False)\n \"false\"\n\n >>> bool_env(None)\n \"false\"\n \"\"\""
] | [
{
"param": "value",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": [
{
"identifier": "examples",
"docstring": ">>>... |
0d95016b89503ae10fc25c6a301a825a2c5c1957 | junqueira/aztk | aztk/spark/client/base/operations.py | [
"MIT"
] | Python | _generate_cluster_start_task | <not_specific> | def _generate_cluster_start_task(
self,
core_base_operations,
zip_resource_file: batch_models.ResourceFile,
id: str,
gpu_enabled: bool,
docker_repo: str = None,
docker_run_options: str = None,
file_shares: List[models.FileSh... | Generate the Azure Batch Start Task to provision a Spark cluster.
Args:
zip_resource_file (:obj:`azure.batch.models.ResourceFile`): a single zip file of all necessary data
to upload to the cluster.
id (:obj:`str`): the id of the cluster.
gpu_enabled (:obj:`bo... | Generate the Azure Batch Start Task to provision a Spark cluster. | [
"Generate",
"the",
"Azure",
"Batch",
"Start",
"Task",
"to",
"provision",
"a",
"Spark",
"cluster",
"."
] | def _generate_cluster_start_task(
self,
core_base_operations,
zip_resource_file: batch_models.ResourceFile,
id: str,
gpu_enabled: bool,
docker_repo: str = None,
docker_run_options: str = None,
file_shares: List[models.FileSh... | [
"def",
"_generate_cluster_start_task",
"(",
"self",
",",
"core_base_operations",
",",
"zip_resource_file",
":",
"batch_models",
".",
"ResourceFile",
",",
"id",
":",
"str",
",",
"gpu_enabled",
":",
"bool",
",",
"docker_repo",
":",
"str",
"=",
"None",
",",
"docker... | Generate the Azure Batch Start Task to provision a Spark cluster. | [
"Generate",
"the",
"Azure",
"Batch",
"Start",
"Task",
"to",
"provision",
"a",
"Spark",
"cluster",
"."
] | [
"\"\"\"Generate the Azure Batch Start Task to provision a Spark cluster.\n\n Args:\n zip_resource_file (:obj:`azure.batch.models.ResourceFile`): a single zip file of all necessary data\n to upload to the cluster.\n id (:obj:`str`): the id of the cluster.\n gpu_... | [
{
"param": "self",
"type": null
},
{
"param": "core_base_operations",
"type": null
},
{
"param": "zip_resource_file",
"type": "batch_models.ResourceFile"
},
{
"param": "id",
"type": "str"
},
{
"param": "gpu_enabled",
"type": "bool"
},
{
"param": "docke... | {
"returns": [
{
"docstring": ":obj:`azure.batch.models.StartTask`: the StartTask definition to provision the cluster.",
"docstring_tokens": [
":",
"obj",
":",
"`",
"azure",
".",
"batch",
".",
"models",
".",
"Start... |
0d95016b89503ae10fc25c6a301a825a2c5c1957 | junqueira/aztk | aztk/spark/client/base/operations.py | [
"MIT"
] | Python | _generate_application_task | <not_specific> | def _generate_application_task(self, core_base_operations, container_id, application, remote=False):
"""Generate the Azure Batch Start Task to provision a Spark cluster.
Args:
container_id (:obj:`str`): the id of the container to run the application in
application (:obj:`aztk.sp... | Generate the Azure Batch Start Task to provision a Spark cluster.
Args:
container_id (:obj:`str`): the id of the container to run the application in
application (:obj:`aztk.spark.models.ApplicationConfiguration): the Application Definition
remote (:obj:`bool`): If True, the ... | Generate the Azure Batch Start Task to provision a Spark cluster. | [
"Generate",
"the",
"Azure",
"Batch",
"Start",
"Task",
"to",
"provision",
"a",
"Spark",
"cluster",
"."
] | def _generate_application_task(self, core_base_operations, container_id, application, remote=False):
return generate_application_task.generate_application_task(core_base_operations, container_id, application,
remote) | [
"def",
"_generate_application_task",
"(",
"self",
",",
"core_base_operations",
",",
"container_id",
",",
"application",
",",
"remote",
"=",
"False",
")",
":",
"return",
"generate_application_task",
".",
"generate_application_task",
"(",
"core_base_operations",
",",
"con... | Generate the Azure Batch Start Task to provision a Spark cluster. | [
"Generate",
"the",
"Azure",
"Batch",
"Start",
"Task",
"to",
"provision",
"a",
"Spark",
"cluster",
"."
] | [
"\"\"\"Generate the Azure Batch Start Task to provision a Spark cluster.\n\n Args:\n container_id (:obj:`str`): the id of the container to run the application in\n application (:obj:`aztk.spark.models.ApplicationConfiguration): the Application Definition\n remote (:obj:`bool`... | [
{
"param": "self",
"type": null
},
{
"param": "core_base_operations",
"type": null
},
{
"param": "container_id",
"type": null
},
{
"param": "application",
"type": null
},
{
"param": "remote",
"type": null
}
] | {
"returns": [
{
"docstring": ":obj:`azure.batch.models.TaskAddParameter`: the Task definition for the Application.",
"docstring_tokens": [
":",
"obj",
":",
"`",
"azure",
".",
"batch",
".",
"models",
".",
"TaskAddP... |
0d95016b89503ae10fc25c6a301a825a2c5c1957 | junqueira/aztk | aztk/spark/client/base/operations.py | [
"MIT"
] | Python | _list_applications | <not_specific> | def _list_applications(self, core_base_operations, id):
"""Get information on tasks submitted to a cluster
Args:
id (:obj:`str`): the name of the cluster the tasks belong to
Returns:
:obj:`[aztk.spark.models.Application]`: list of aztk applications
"""
r... | Get information on tasks submitted to a cluster
Args:
id (:obj:`str`): the name of the cluster the tasks belong to
Returns:
:obj:`[aztk.spark.models.Application]`: list of aztk applications
| Get information on tasks submitted to a cluster | [
"Get",
"information",
"on",
"tasks",
"submitted",
"to",
"a",
"cluster"
] | def _list_applications(self, core_base_operations, id):
return list_applications.list_applications(core_base_operations, id) | [
"def",
"_list_applications",
"(",
"self",
",",
"core_base_operations",
",",
"id",
")",
":",
"return",
"list_applications",
".",
"list_applications",
"(",
"core_base_operations",
",",
"id",
")"
] | Get information on tasks submitted to a cluster | [
"Get",
"information",
"on",
"tasks",
"submitted",
"to",
"a",
"cluster"
] | [
"\"\"\"Get information on tasks submitted to a cluster\n\n Args:\n id (:obj:`str`): the name of the cluster the tasks belong to\n\n Returns:\n :obj:`[aztk.spark.models.Application]`: list of aztk applications\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "core_base_operations",
"type": null
},
{
"param": "id",
"type": null
}
] | {
"returns": [
{
"docstring": ":obj:`[aztk.spark.models.Application]`: list of aztk applications",
"docstring_tokens": [
":",
"obj",
":",
"`",
"[",
"aztk",
".",
"spark",
".",
"models",
".",
"Application",
... |
0dd7dfee077fa596a4131390062776e2955d0aa7 | junqueira/aztk | aztk/spark/client/base/helpers/generate_cluster_start_task.py | [
"MIT"
] | Python | __cluster_install_cmd | <not_specific> | def __cluster_install_cmd(
zip_resource_file: batch_models.ResourceFile,
gpu_enabled: bool,
docker_repo: str = None,
docker_run_options: str = None,
file_mounts=None,
):
"""
For Docker on ubuntu 16.04 - return the command line
to be run on the start task of th... |
For Docker on ubuntu 16.04 - return the command line
to be run on the start task of the pool to setup spark.
| For Docker on ubuntu 16.04 - return the command line
to be run on the start task of the pool to setup spark. | [
"For",
"Docker",
"on",
"ubuntu",
"16",
".",
"04",
"-",
"return",
"the",
"command",
"line",
"to",
"be",
"run",
"on",
"the",
"start",
"task",
"of",
"the",
"pool",
"to",
"setup",
"spark",
"."
] | def __cluster_install_cmd(
zip_resource_file: batch_models.ResourceFile,
gpu_enabled: bool,
docker_repo: str = None,
docker_run_options: str = None,
file_mounts=None,
):
default_docker_repo = constants.DEFAULT_DOCKER_REPO if not gpu_enabled else constants.DEFAULT_DOCKER_REPO_... | [
"def",
"__cluster_install_cmd",
"(",
"zip_resource_file",
":",
"batch_models",
".",
"ResourceFile",
",",
"gpu_enabled",
":",
"bool",
",",
"docker_repo",
":",
"str",
"=",
"None",
",",
"docker_run_options",
":",
"str",
"=",
"None",
",",
"file_mounts",
"=",
"None",... | For Docker on ubuntu 16.04 - return the command line
to be run on the start task of the pool to setup spark. | [
"For",
"Docker",
"on",
"ubuntu",
"16",
".",
"04",
"-",
"return",
"the",
"command",
"line",
"to",
"be",
"run",
"on",
"the",
"start",
"task",
"of",
"the",
"pool",
"to",
"setup",
"spark",
"."
] | [
"\"\"\"\n For Docker on ubuntu 16.04 - return the command line\n to be run on the start task of the pool to setup spark.\n \"\"\"",
"# Create the directory on the node",
"# Mount the file share"
] | [
{
"param": "zip_resource_file",
"type": "batch_models.ResourceFile"
},
{
"param": "gpu_enabled",
"type": "bool"
},
{
"param": "docker_repo",
"type": "str"
},
{
"param": "docker_run_options",
"type": "str"
},
{
"param": "file_mounts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "zip_resource_file",
"type": "batch_models.ResourceFile",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gpu_enabled",
"type": "bool",
"... |
0dd7dfee077fa596a4131390062776e2955d0aa7 | junqueira/aztk | aztk/spark/client/base/helpers/generate_cluster_start_task.py | [
"MIT"
] | Python | generate_cluster_start_task | <not_specific> | def generate_cluster_start_task(
core_base_operations,
zip_resource_file: batch_models.ResourceFile,
cluster_id: str,
gpu_enabled: bool,
docker_repo: str = None,
docker_run_options: str = None,
file_shares: List[models.FileShare] = None,
mixed_mode: bool =... |
This will return the start task object for the pool to be created.
:param cluster_id str: Id of the cluster(Used for uploading the resource files)
:param zip_resource_file: Resource file object pointing to the zip file containing scripts to run on the node
| This will return the start task object for the pool to be created. | [
"This",
"will",
"return",
"the",
"start",
"task",
"object",
"for",
"the",
"pool",
"to",
"be",
"created",
"."
] | def generate_cluster_start_task(
core_base_operations,
zip_resource_file: batch_models.ResourceFile,
cluster_id: str,
gpu_enabled: bool,
docker_repo: str = None,
docker_run_options: str = None,
file_shares: List[models.FileShare] = None,
mixed_mode: bool =... | [
"def",
"generate_cluster_start_task",
"(",
"core_base_operations",
",",
"zip_resource_file",
":",
"batch_models",
".",
"ResourceFile",
",",
"cluster_id",
":",
"str",
",",
"gpu_enabled",
":",
"bool",
",",
"docker_repo",
":",
"str",
"=",
"None",
",",
"docker_run_optio... | This will return the start task object for the pool to be created. | [
"This",
"will",
"return",
"the",
"start",
"task",
"object",
"for",
"the",
"pool",
"to",
"be",
"created",
"."
] | [
"\"\"\"\n This will return the start task object for the pool to be created.\n :param cluster_id str: Id of the cluster(Used for uploading the resource files)\n :param zip_resource_file: Resource file object pointing to the zip file containing scripts to run on the node\n \"\"\"",
"# TODO ... | [
{
"param": "core_base_operations",
"type": null
},
{
"param": "zip_resource_file",
"type": "batch_models.ResourceFile"
},
{
"param": "cluster_id",
"type": "str"
},
{
"param": "gpu_enabled",
"type": "bool"
},
{
"param": "docker_repo",
"type": "str"
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "core_base_operations",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "zip_resource_file",
"type": "batch_models.ResourceFile",
... |
2eb99190704bbfd26787ab691f1e1c22b0ae1fd7 | junqueira/aztk | aztk/models/plugins/internal/plugin_manager.py | [
"MIT"
] | Python | _validate_args | null | def _validate_args(self, plugin_cls, args: dict):
"""
Validate the given args are valid for the plugin
"""
plugin_args = self.get_args_for(plugin_cls)
self._validate_no_extra_args(plugin_cls, plugin_args, args)
for arg in plugin_args.values():
if args.get(ar... |
Validate the given args are valid for the plugin
| Validate the given args are valid for the plugin | [
"Validate",
"the",
"given",
"args",
"are",
"valid",
"for",
"the",
"plugin"
] | def _validate_args(self, plugin_cls, args: dict):
plugin_args = self.get_args_for(plugin_cls)
self._validate_no_extra_args(plugin_cls, plugin_args, args)
for arg in plugin_args.values():
if args.get(arg.name) is None:
if arg.required:
message = "Mi... | [
"def",
"_validate_args",
"(",
"self",
",",
"plugin_cls",
",",
"args",
":",
"dict",
")",
":",
"plugin_args",
"=",
"self",
".",
"get_args_for",
"(",
"plugin_cls",
")",
"self",
".",
"_validate_no_extra_args",
"(",
"plugin_cls",
",",
"plugin_args",
",",
"args",
... | Validate the given args are valid for the plugin | [
"Validate",
"the",
"given",
"args",
"are",
"valid",
"for",
"the",
"plugin"
] | [
"\"\"\"\n Validate the given args are valid for the plugin\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "plugin_cls",
"type": null
},
{
"param": "args",
"type": "dict"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "plugin_cls",
"type": null,
"docstring": null,
"docstring_toke... |
efac874e33d3f2f18ddc48e8aa3e13aec28b9096 | junqueira/aztk | aztk/client/cluster/operations.py | [
"MIT"
] | Python | copy | <not_specific> | def copy(self, id, source_path, destination_path=None, container_name=None, internal=False, get=False,
timeout=None):
"""Copy files to or from every node in a cluster.
Args:
id (:obj:`str`): the id of the cluster to copy files with.
source_path (:obj:`str`): the pat... | Copy files to or from every node in a cluster.
Args:
id (:obj:`str`): the id of the cluster to copy files with.
source_path (:obj:`str`): the path of the file to copy from.
destination_path (:obj:`str`, optional): the local directory path where the output should be written.
... | Copy files to or from every node in a cluster. | [
"Copy",
"files",
"to",
"or",
"from",
"every",
"node",
"in",
"a",
"cluster",
"."
] | def copy(self, id, source_path, destination_path=None, container_name=None, internal=False, get=False,
timeout=None):
return copy.cluster_copy(self, id, source_path, destination_path, container_name, internal, get, timeout) | [
"def",
"copy",
"(",
"self",
",",
"id",
",",
"source_path",
",",
"destination_path",
"=",
"None",
",",
"container_name",
"=",
"None",
",",
"internal",
"=",
"False",
",",
"get",
"=",
"False",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"copy",
".",
... | Copy files to or from every node in a cluster. | [
"Copy",
"files",
"to",
"or",
"from",
"every",
"node",
"in",
"a",
"cluster",
"."
] | [
"\"\"\"Copy files to or from every node in a cluster.\n\n Args:\n id (:obj:`str`): the id of the cluster to copy files with.\n source_path (:obj:`str`): the path of the file to copy from.\n destination_path (:obj:`str`, optional): the local directory path where the output sho... | [
{
"param": "self",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "source_path",
"type": null
},
{
"param": "destination_path",
"type": null
},
{
"param": "container_name",
"type": null
},
{
"param": "internal",
"type": null
},
{
... | {
"returns": [
{
"docstring": ":obj:`List[aztk.models.NodeOutput]`:\nA list of NodeOutput objects representing the output of the copy command.",
"docstring_tokens": [
":",
"obj",
":",
"`",
"List",
"[",
"aztk",
".",
"models",
... |
efac874e33d3f2f18ddc48e8aa3e13aec28b9096 | junqueira/aztk | aztk/client/cluster/operations.py | [
"MIT"
] | Python | list | <not_specific> | def list(self, software_metadata_key):
"""List clusters running the specified software.
Args:
software_metadata_key(:obj:`str`): the key of the primary softare running on the cluster.
This filters out non-aztk clusters and aztk clusters running other software.
Retur... | List clusters running the specified software.
Args:
software_metadata_key(:obj:`str`): the key of the primary softare running on the cluster.
This filters out non-aztk clusters and aztk clusters running other software.
Returns:
:obj:`List[aztk.models.Cluster]`: ... | List clusters running the specified software. | [
"List",
"clusters",
"running",
"the",
"specified",
"software",
"."
] | def list(self, software_metadata_key):
return list.list_clusters(self, software_metadata_key) | [
"def",
"list",
"(",
"self",
",",
"software_metadata_key",
")",
":",
"return",
"list",
".",
"list_clusters",
"(",
"self",
",",
"software_metadata_key",
")"
] | List clusters running the specified software. | [
"List",
"clusters",
"running",
"the",
"specified",
"software",
"."
] | [
"\"\"\"List clusters running the specified software.\n\n Args:\n software_metadata_key(:obj:`str`): the key of the primary softare running on the cluster.\n This filters out non-aztk clusters and aztk clusters running other software.\n\n Returns:\n :obj:`List[aztk.... | [
{
"param": "self",
"type": null
},
{
"param": "software_metadata_key",
"type": null
}
] | {
"returns": [
{
"docstring": ":obj:`List[aztk.models.Cluster]`: list of clusters running the software defined by software_metadata_key",
"docstring_tokens": [
":",
"obj",
":",
"`",
"List",
"[",
"aztk",
".",
"models",
".",... |
efac874e33d3f2f18ddc48e8aa3e13aec28b9096 | junqueira/aztk | aztk/client/cluster/operations.py | [
"MIT"
] | Python | wait | <not_specific> | def wait(self, id, task_name):
"""Wait until the task has completed
Args:
id (:obj:`str`): the id of the job the task was submitted to
task_name (:obj:`str`): the name of the task to wait for
Returns:
:obj:`None`
"""
return wait_for_task_to_c... | Wait until the task has completed
Args:
id (:obj:`str`): the id of the job the task was submitted to
task_name (:obj:`str`): the name of the task to wait for
Returns:
:obj:`None`
| Wait until the task has completed | [
"Wait",
"until",
"the",
"task",
"has",
"completed"
] | def wait(self, id, task_name):
return wait_for_task_to_complete.wait_for_task_to_complete(self, id, task_name) | [
"def",
"wait",
"(",
"self",
",",
"id",
",",
"task_name",
")",
":",
"return",
"wait_for_task_to_complete",
".",
"wait_for_task_to_complete",
"(",
"self",
",",
"id",
",",
"task_name",
")"
] | Wait until the task has completed | [
"Wait",
"until",
"the",
"task",
"has",
"completed"
] | [
"\"\"\"Wait until the task has completed\n\n Args:\n id (:obj:`str`): the id of the job the task was submitted to\n task_name (:obj:`str`): the name of the task to wait for\n\n Returns:\n :obj:`None`\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "id",
"type": null
},
{
"param": "task_name",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
f6eb26edd83eb2d38fa9e29c3b7bdc070e6906b9 | junqueira/aztk | aztk/node_scripts/scheduling/submit.py | [
"MIT"
] | Python | receive_submit_request | <not_specific> | def receive_submit_request(application_file_path):
"""
Handle the request to submit a task
"""
blob_client = config.blob_client
application = common.load_application(application_file_path)
cmd = __app_submit_cmd(application)
exit_code = -1
try:
exit_code = subprocess.call(cm... |
Handle the request to submit a task
| Handle the request to submit a task | [
"Handle",
"the",
"request",
"to",
"submit",
"a",
"task"
] | def receive_submit_request(application_file_path):
blob_client = config.blob_client
application = common.load_application(application_file_path)
cmd = __app_submit_cmd(application)
exit_code = -1
try:
exit_code = subprocess.call(cmd.to_str(), shell=True)
common.upload_log(blob_client... | [
"def",
"receive_submit_request",
"(",
"application_file_path",
")",
":",
"blob_client",
"=",
"config",
".",
"blob_client",
"application",
"=",
"common",
".",
"load_application",
"(",
"application_file_path",
")",
"cmd",
"=",
"__app_submit_cmd",
"(",
"application",
")"... | Handle the request to submit a task | [
"Handle",
"the",
"request",
"to",
"submit",
"a",
"task"
] | [
"\"\"\"\n Handle the request to submit a task\n \"\"\""
] | [
{
"param": "application_file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "application_file_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b184765bffc96e1f51b0683f5fde1585e4c8b826 | junqueira/aztk | aztk/utils/command_builder.py | [
"MIT"
] | Python | add_option | <not_specific> | def add_option(self, name: str, value: str = None, enable: bool = None):
"""
Add an option to the command line.
:param name: Option name (with the dash(es))
:param value: Value for the option(If null and enable is not provided it won't add the option)
:param enab... |
Add an option to the command line.
:param name: Option name (with the dash(es))
:param value: Value for the option(If null and enable is not provided it won't add the option)
:param enable: To explicitly add or ignore the option
Usage:
>>> comma... | Add an option to the command line. | [
"Add",
"an",
"option",
"to",
"the",
"command",
"line",
"."
] | def add_option(self, name: str, value: str = None, enable: bool = None):
if enable is None:
enable = value
if enable:
self.options.append(CommandOption(name=name, value=value))
return True
return False | [
"def",
"add_option",
"(",
"self",
",",
"name",
":",
"str",
",",
"value",
":",
"str",
"=",
"None",
",",
"enable",
":",
"bool",
"=",
"None",
")",
":",
"if",
"enable",
"is",
"None",
":",
"enable",
"=",
"value",
"if",
"enable",
":",
"self",
".",
"opt... | Add an option to the command line. | [
"Add",
"an",
"option",
"to",
"the",
"command",
"line",
"."
] | [
"\"\"\"\n Add an option to the command line.\n\n :param name: Option name (with the dash(es))\n :param value: Value for the option(If null and enable is not provided it won't add the option)\n :param enable: To explicitly add or ignore the option\n\n Usage:\n ... | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": "str"
},
{
"param": "value",
"type": "str"
},
{
"param": "enable",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "str",
"docstring": "Option name (with the dash(es))... |
72dc36202a8374c586aacb7d2cbe9279f63b2378 | junqueira/aztk | aztk/spark/client/cluster/operations.py | [
"MIT"
] | Python | submit | <not_specific> | def submit(
self,
id: str,
application: models.ApplicationConfiguration,
remote: bool = False,
wait: bool = False,
internal: bool = False,
):
"""Submit an application to a cluster.
Args:
id (:obj:`str`): the id of t... | Submit an application to a cluster.
Args:
id (:obj:`str`): the id of the cluster to submit the application to.
application (:obj:`aztk.spark.models.ApplicationConfiguration`): Application definition
remote (:obj:`bool`): If True, the application file will not be uploaded, it... | Submit an application to a cluster. | [
"Submit",
"an",
"application",
"to",
"a",
"cluster",
"."
] | def submit(
self,
id: str,
application: models.ApplicationConfiguration,
remote: bool = False,
wait: bool = False,
internal: bool = False,
):
return submit.submit(self._core_cluster_operations, self, id, application, remote, wait, inter... | [
"def",
"submit",
"(",
"self",
",",
"id",
":",
"str",
",",
"application",
":",
"models",
".",
"ApplicationConfiguration",
",",
"remote",
":",
"bool",
"=",
"False",
",",
"wait",
":",
"bool",
"=",
"False",
",",
"internal",
":",
"bool",
"=",
"False",
",",
... | Submit an application to a cluster. | [
"Submit",
"an",
"application",
"to",
"a",
"cluster",
"."
] | [
"\"\"\"Submit an application to a cluster.\n\n Args:\n id (:obj:`str`): the id of the cluster to submit the application to.\n application (:obj:`aztk.spark.models.ApplicationConfiguration`): Application definition\n remote (:obj:`bool`): If True, the application file will not... | [
{
"param": "self",
"type": null
},
{
"param": "id",
"type": "str"
},
{
"param": "application",
"type": "models.ApplicationConfiguration"
},
{
"param": "remote",
"type": "bool"
},
{
"param": "wait",
"type": "bool"
},
{
"param": "internal",
"type": "... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
72dc36202a8374c586aacb7d2cbe9279f63b2378 | junqueira/aztk | aztk/spark/client/cluster/operations.py | [
"MIT"
] | Python | create_user | <not_specific> | def create_user(self, id: str, username: str, password: str = None, ssh_key: str = None):
"""Create a user on every node in the cluster
Args:
username (:obj:`str`): name of the user to create.
pool_id (:obj:`str`): id of the cluster to create the user on.
ssh_key (:o... | Create a user on every node in the cluster
Args:
username (:obj:`str`): name of the user to create.
pool_id (:obj:`str`): id of the cluster to create the user on.
ssh_key (:obj:`str`, optional): ssh public key to create the user with, must use ssh_key or password.
... | Create a user on every node in the cluster | [
"Create",
"a",
"user",
"on",
"every",
"node",
"in",
"the",
"cluster"
] | def create_user(self, id: str, username: str, password: str = None, ssh_key: str = None):
return create_user.create_user(self._core_cluster_operations, self, id, username, ssh_key, password) | [
"def",
"create_user",
"(",
"self",
",",
"id",
":",
"str",
",",
"username",
":",
"str",
",",
"password",
":",
"str",
"=",
"None",
",",
"ssh_key",
":",
"str",
"=",
"None",
")",
":",
"return",
"create_user",
".",
"create_user",
"(",
"self",
".",
"_core_... | Create a user on every node in the cluster | [
"Create",
"a",
"user",
"on",
"every",
"node",
"in",
"the",
"cluster"
] | [
"\"\"\"Create a user on every node in the cluster\n\n Args:\n username (:obj:`str`): name of the user to create.\n pool_id (:obj:`str`): id of the cluster to create the user on.\n ssh_key (:obj:`str`, optional): ssh public key to create the user with, must use ssh_key or pass... | [
{
"param": "self",
"type": null
},
{
"param": "id",
"type": "str"
},
{
"param": "username",
"type": "str"
},
{
"param": "password",
"type": "str"
},
{
"param": "ssh_key",
"type": "str"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
72dc36202a8374c586aacb7d2cbe9279f63b2378 | junqueira/aztk | aztk/spark/client/cluster/operations.py | [
"MIT"
] | Python | list_applications | <not_specific> | def list_applications(self, id: str):
"""Get all tasks that have been submitted to the cluster
Args:
id (:obj:`str`): the name of the cluster the tasks belong to
Returns:
:obj:`[aztk.spark.models.Application]`: list of aztk applications
"""
return self._... | Get all tasks that have been submitted to the cluster
Args:
id (:obj:`str`): the name of the cluster the tasks belong to
Returns:
:obj:`[aztk.spark.models.Application]`: list of aztk applications
| Get all tasks that have been submitted to the cluster | [
"Get",
"all",
"tasks",
"that",
"have",
"been",
"submitted",
"to",
"the",
"cluster"
] | def list_applications(self, id: str):
return self._list_applications(self._core_cluster_operations, id) | [
"def",
"list_applications",
"(",
"self",
",",
"id",
":",
"str",
")",
":",
"return",
"self",
".",
"_list_applications",
"(",
"self",
".",
"_core_cluster_operations",
",",
"id",
")"
] | Get all tasks that have been submitted to the cluster | [
"Get",
"all",
"tasks",
"that",
"have",
"been",
"submitted",
"to",
"the",
"cluster"
] | [
"\"\"\"Get all tasks that have been submitted to the cluster\n\n Args:\n id (:obj:`str`): the name of the cluster the tasks belong to\n\n Returns:\n :obj:`[aztk.spark.models.Application]`: list of aztk applications\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "id",
"type": "str"
}
] | {
"returns": [
{
"docstring": ":obj:`[aztk.spark.models.Application]`: list of aztk applications",
"docstring_tokens": [
":",
"obj",
":",
"`",
"[",
"aztk",
".",
"spark",
".",
"models",
".",
"Application",
... |
72dc36202a8374c586aacb7d2cbe9279f63b2378 | junqueira/aztk | aztk/spark/client/cluster/operations.py | [
"MIT"
] | Python | run | <not_specific> | def run(self, id: str, command: str, host=False, internal: bool = False, timeout=None):
"""Run a bash command on every node in the cluster
Args:
id (:obj:`str`): the id of the cluster to run the command on.
command (:obj:`str`): the bash command to execute on the node.
... | Run a bash command on every node in the cluster
Args:
id (:obj:`str`): the id of the cluster to run the command on.
command (:obj:`str`): the bash command to execute on the node.
internal (:obj:`bool`): if true, this will connect to the node using its internal IP.
... | Run a bash command on every node in the cluster | [
"Run",
"a",
"bash",
"command",
"on",
"every",
"node",
"in",
"the",
"cluster"
] | def run(self, id: str, command: str, host=False, internal: bool = False, timeout=None):
return run.cluster_run(self._core_cluster_operations, id, command, host, internal, timeout) | [
"def",
"run",
"(",
"self",
",",
"id",
":",
"str",
",",
"command",
":",
"str",
",",
"host",
"=",
"False",
",",
"internal",
":",
"bool",
"=",
"False",
",",
"timeout",
"=",
"None",
")",
":",
"return",
"run",
".",
"cluster_run",
"(",
"self",
".",
"_c... | Run a bash command on every node in the cluster | [
"Run",
"a",
"bash",
"command",
"on",
"every",
"node",
"in",
"the",
"cluster"
] | [
"\"\"\"Run a bash command on every node in the cluster\n\n Args:\n id (:obj:`str`): the id of the cluster to run the command on.\n command (:obj:`str`): the bash command to execute on the node.\n internal (:obj:`bool`): if true, this will connect to the node using its interna... | [
{
"param": "self",
"type": null
},
{
"param": "id",
"type": "str"
},
{
"param": "command",
"type": "str"
},
{
"param": "host",
"type": null
},
{
"param": "internal",
"type": "bool"
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [
{
"docstring": ":obj:`List[aztk.spark.models.NodeOutput]`:\nlist of NodeOutput objects containing the output of the run command",
"docstring_tokens": [
":",
"obj",
":",
"`",
"List",
"[",
"aztk",
".",
"spark",
... |
72dc36202a8374c586aacb7d2cbe9279f63b2378 | junqueira/aztk | aztk/spark/client/cluster/operations.py | [
"MIT"
] | Python | node_run | <not_specific> | def node_run(
self,
id: str,
node_id: str,
command: str,
host=False,
internal: bool = False,
timeout=None,
block=True,
):
"""Run a bash command on the given node
Args:
id (:obj:`str`): the id... | Run a bash command on the given node
Args:
id (:obj:`str`): the id of the cluster to run the command on.
node_id (:obj:`str`): the id of the node in the cluster to run the command on.
command (:obj:`str`): the bash command to execute on the node.
internal (:obj:`... | Run a bash command on the given node | [
"Run",
"a",
"bash",
"command",
"on",
"the",
"given",
"node"
] | def node_run(
self,
id: str,
node_id: str,
command: str,
host=False,
internal: bool = False,
timeout=None,
block=True,
):
return node_run.node_run(self._core_cluster_operations, id, node_id, command, host, intern... | [
"def",
"node_run",
"(",
"self",
",",
"id",
":",
"str",
",",
"node_id",
":",
"str",
",",
"command",
":",
"str",
",",
"host",
"=",
"False",
",",
"internal",
":",
"bool",
"=",
"False",
",",
"timeout",
"=",
"None",
",",
"block",
"=",
"True",
",",
")"... | Run a bash command on the given node | [
"Run",
"a",
"bash",
"command",
"on",
"the",
"given",
"node"
] | [
"\"\"\"Run a bash command on the given node\n\n Args:\n id (:obj:`str`): the id of the cluster to run the command on.\n node_id (:obj:`str`): the id of the node in the cluster to run the command on.\n command (:obj:`str`): the bash command to execute on the node.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "id",
"type": "str"
},
{
"param": "node_id",
"type": "str"
},
{
"param": "command",
"type": "str"
},
{
"param": "host",
"type": null
},
{
"param": "internal",
"type": "bool"
},
{
"param": "timeo... | {
"returns": [
{
"docstring": ":obj:`aztk.spark.models.NodeOutput`: object containing the output of the run command",
"docstring_tokens": [
":",
"obj",
":",
"`",
"aztk",
".",
"spark",
".",
"models",
".",
"NodeOutpu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.