partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | Adversarial.normalized_distance | Calculates the distance of a given image to the
original image.
Parameters
----------
image : `numpy.ndarray`
The image that should be compared to the original image.
Returns
-------
:class:`Distance`
The distance between the given image ... | foolbox/adversarial.py | def normalized_distance(self, image):
"""Calculates the distance of a given image to the
original image.
Parameters
----------
image : `numpy.ndarray`
The image that should be compared to the original image.
Returns
-------
:class:`Distance`
... | def normalized_distance(self, image):
"""Calculates the distance of a given image to the
original image.
Parameters
----------
image : `numpy.ndarray`
The image that should be compared to the original image.
Returns
-------
:class:`Distance`
... | [
"Calculates",
"the",
"distance",
"of",
"a",
"given",
"image",
"to",
"the",
"original",
"image",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L165-L183 | [
"def",
"normalized_distance",
"(",
"self",
",",
"image",
")",
":",
"return",
"self",
".",
"__distance",
"(",
"self",
".",
"__original_image_for_distance",
",",
"image",
",",
"bounds",
"=",
"self",
".",
"bounds",
"(",
")",
")"
] | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | Adversarial.__is_adversarial | Interface to criterion.is_adverarial that calls
__new_adversarial if necessary.
Parameters
----------
predictions : :class:`numpy.ndarray`
A vector with the pre-softmax predictions for some image.
label : int
The label of the unperturbed reference image. | foolbox/adversarial.py | def __is_adversarial(self, image, predictions, in_bounds):
"""Interface to criterion.is_adverarial that calls
__new_adversarial if necessary.
Parameters
----------
predictions : :class:`numpy.ndarray`
A vector with the pre-softmax predictions for some image.
... | def __is_adversarial(self, image, predictions, in_bounds):
"""Interface to criterion.is_adverarial that calls
__new_adversarial if necessary.
Parameters
----------
predictions : :class:`numpy.ndarray`
A vector with the pre-softmax predictions for some image.
... | [
"Interface",
"to",
"criterion",
".",
"is_adverarial",
"that",
"calls",
"__new_adversarial",
"if",
"necessary",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L212-L234 | [
"def",
"__is_adversarial",
"(",
"self",
",",
"image",
",",
"predictions",
",",
"in_bounds",
")",
":",
"is_adversarial",
"=",
"self",
".",
"__criterion",
".",
"is_adversarial",
"(",
"predictions",
",",
"self",
".",
"__original_class",
")",
"assert",
"isinstance",... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | Adversarial.channel_axis | Interface to model.channel_axis for attacks.
Parameters
----------
batch : bool
Controls whether the index of the axis for a batch of images
(4 dimensions) or a single image (3 dimensions) should be returned. | foolbox/adversarial.py | def channel_axis(self, batch):
"""Interface to model.channel_axis for attacks.
Parameters
----------
batch : bool
Controls whether the index of the axis for a batch of images
(4 dimensions) or a single image (3 dimensions) should be returned.
"""
... | def channel_axis(self, batch):
"""Interface to model.channel_axis for attacks.
Parameters
----------
batch : bool
Controls whether the index of the axis for a batch of images
(4 dimensions) or a single image (3 dimensions) should be returned.
"""
... | [
"Interface",
"to",
"model",
".",
"channel_axis",
"for",
"attacks",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L262-L275 | [
"def",
"channel_axis",
"(",
"self",
",",
"batch",
")",
":",
"axis",
"=",
"self",
".",
"__model",
".",
"channel_axis",
"(",
")",
"if",
"not",
"batch",
":",
"axis",
"=",
"axis",
"-",
"1",
"return",
"axis"
] | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | Adversarial.has_gradient | Returns true if _backward and _forward_backward can be called
by an attack, False otherwise. | foolbox/adversarial.py | def has_gradient(self):
"""Returns true if _backward and _forward_backward can be called
by an attack, False otherwise.
"""
try:
self.__model.gradient
self.__model.predictions_and_gradient
except AttributeError:
return False
else:
... | def has_gradient(self):
"""Returns true if _backward and _forward_backward can be called
by an attack, False otherwise.
"""
try:
self.__model.gradient
self.__model.predictions_and_gradient
except AttributeError:
return False
else:
... | [
"Returns",
"true",
"if",
"_backward",
"and",
"_forward_backward",
"can",
"be",
"called",
"by",
"an",
"attack",
"False",
"otherwise",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L277-L288 | [
"def",
"has_gradient",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"__model",
".",
"gradient",
"self",
".",
"__model",
".",
"predictions_and_gradient",
"except",
"AttributeError",
":",
"return",
"False",
"else",
":",
"return",
"True"
] | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | Adversarial.predictions | Interface to model.predictions for attacks.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
strict : bool
Controls if the bounds for the pixel values should be checked. | foolbox/adversarial.py | def predictions(self, image, strict=True, return_details=False):
"""Interface to model.predictions for attacks.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
strict : bool
... | def predictions(self, image, strict=True, return_details=False):
"""Interface to model.predictions for attacks.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
strict : bool
... | [
"Interface",
"to",
"model",
".",
"predictions",
"for",
"attacks",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L290-L314 | [
"def",
"predictions",
"(",
"self",
",",
"image",
",",
"strict",
"=",
"True",
",",
"return_details",
"=",
"False",
")",
":",
"in_bounds",
"=",
"self",
".",
"in_bounds",
"(",
"image",
")",
"assert",
"not",
"strict",
"or",
"in_bounds",
"self",
".",
"_total_... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | Adversarial.batch_predictions | Interface to model.batch_predictions for attacks.
Parameters
----------
images : `numpy.ndarray`
Batch of inputs with shape as expected by the model.
greedy : bool
Whether the first adversarial should be returned.
strict : bool
Controls if the... | foolbox/adversarial.py | def batch_predictions(
self, images, greedy=False, strict=True, return_details=False):
"""Interface to model.batch_predictions for attacks.
Parameters
----------
images : `numpy.ndarray`
Batch of inputs with shape as expected by the model.
greedy : bool
... | def batch_predictions(
self, images, greedy=False, strict=True, return_details=False):
"""Interface to model.batch_predictions for attacks.
Parameters
----------
images : `numpy.ndarray`
Batch of inputs with shape as expected by the model.
greedy : bool
... | [
"Interface",
"to",
"model",
".",
"batch_predictions",
"for",
"attacks",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L316-L369 | [
"def",
"batch_predictions",
"(",
"self",
",",
"images",
",",
"greedy",
"=",
"False",
",",
"strict",
"=",
"True",
",",
"return_details",
"=",
"False",
")",
":",
"if",
"strict",
":",
"in_bounds",
"=",
"self",
".",
"in_bounds",
"(",
"images",
")",
"assert",... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | Adversarial.gradient | Interface to model.gradient for attacks.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
Defaults to the original image.
label : int
Label used to calculate the ... | foolbox/adversarial.py | def gradient(self, image=None, label=None, strict=True):
"""Interface to model.gradient for attacks.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
Defaults to the original... | def gradient(self, image=None, label=None, strict=True):
"""Interface to model.gradient for attacks.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
Defaults to the original... | [
"Interface",
"to",
"model",
".",
"gradient",
"for",
"attacks",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L371-L400 | [
"def",
"gradient",
"(",
"self",
",",
"image",
"=",
"None",
",",
"label",
"=",
"None",
",",
"strict",
"=",
"True",
")",
":",
"assert",
"self",
".",
"has_gradient",
"(",
")",
"if",
"image",
"is",
"None",
":",
"image",
"=",
"self",
".",
"__original_imag... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | Adversarial.predictions_and_gradient | Interface to model.predictions_and_gradient for attacks.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
Defaults to the original image.
label : int
Label used t... | foolbox/adversarial.py | def predictions_and_gradient(
self, image=None, label=None, strict=True, return_details=False):
"""Interface to model.predictions_and_gradient for attacks.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
... | def predictions_and_gradient(
self, image=None, label=None, strict=True, return_details=False):
"""Interface to model.predictions_and_gradient for attacks.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
... | [
"Interface",
"to",
"model",
".",
"predictions_and_gradient",
"for",
"attacks",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L402-L440 | [
"def",
"predictions_and_gradient",
"(",
"self",
",",
"image",
"=",
"None",
",",
"label",
"=",
"None",
",",
"strict",
"=",
"True",
",",
"return_details",
"=",
"False",
")",
":",
"assert",
"self",
".",
"has_gradient",
"(",
")",
"if",
"image",
"is",
"None",... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | Adversarial.backward | Interface to model.backward for attacks.
Parameters
----------
gradient : `numpy.ndarray`
Gradient of some loss w.r.t. the logits.
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
Returns... | foolbox/adversarial.py | def backward(self, gradient, image=None, strict=True):
"""Interface to model.backward for attacks.
Parameters
----------
gradient : `numpy.ndarray`
Gradient of some loss w.r.t. the logits.
image : `numpy.ndarray`
Single input with shape as expected by the... | def backward(self, gradient, image=None, strict=True):
"""Interface to model.backward for attacks.
Parameters
----------
gradient : `numpy.ndarray`
Gradient of some loss w.r.t. the logits.
image : `numpy.ndarray`
Single input with shape as expected by the... | [
"Interface",
"to",
"model",
".",
"backward",
"for",
"attacks",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/adversarial.py#L442-L475 | [
"def",
"backward",
"(",
"self",
",",
"gradient",
",",
"image",
"=",
"None",
",",
"strict",
"=",
"True",
")",
":",
"assert",
"self",
".",
"has_gradient",
"(",
")",
"assert",
"gradient",
".",
"ndim",
"==",
"1",
"if",
"image",
"is",
"None",
":",
"image"... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | CarliniWagnerL2Attack.loss_function | Returns the loss and the gradient of the loss w.r.t. x,
assuming that logits = model(x). | foolbox/attacks/carlini_wagner.py | def loss_function(cls, const, a, x, logits, reconstructed_original,
confidence, min_, max_):
"""Returns the loss and the gradient of the loss w.r.t. x,
assuming that logits = model(x)."""
targeted = a.target_class() is not None
if targeted:
c_minimize =... | def loss_function(cls, const, a, x, logits, reconstructed_original,
confidence, min_, max_):
"""Returns the loss and the gradient of the loss w.r.t. x,
assuming that logits = model(x)."""
targeted = a.target_class() is not None
if targeted:
c_minimize =... | [
"Returns",
"the",
"loss",
"and",
"the",
"gradient",
"of",
"the",
"loss",
"w",
".",
"r",
".",
"t",
".",
"x",
"assuming",
"that",
"logits",
"=",
"model",
"(",
"x",
")",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/attacks/carlini_wagner.py#L194-L230 | [
"def",
"loss_function",
"(",
"cls",
",",
"const",
",",
"a",
",",
"x",
",",
"logits",
",",
"reconstructed_original",
",",
"confidence",
",",
"min_",
",",
"max_",
")",
":",
"targeted",
"=",
"a",
".",
"target_class",
"(",
")",
"is",
"not",
"None",
"if",
... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | CarliniWagnerL2Attack.best_other_class | Returns the index of the largest logit, ignoring the class that
is passed as `exclude`. | foolbox/attacks/carlini_wagner.py | def best_other_class(logits, exclude):
"""Returns the index of the largest logit, ignoring the class that
is passed as `exclude`."""
other_logits = logits - onehot_like(logits, exclude, value=np.inf)
return np.argmax(other_logits) | def best_other_class(logits, exclude):
"""Returns the index of the largest logit, ignoring the class that
is passed as `exclude`."""
other_logits = logits - onehot_like(logits, exclude, value=np.inf)
return np.argmax(other_logits) | [
"Returns",
"the",
"index",
"of",
"the",
"largest",
"logit",
"ignoring",
"the",
"class",
"that",
"is",
"passed",
"as",
"exclude",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/attacks/carlini_wagner.py#L233-L237 | [
"def",
"best_other_class",
"(",
"logits",
",",
"exclude",
")",
":",
"other_logits",
"=",
"logits",
"-",
"onehot_like",
"(",
"logits",
",",
"exclude",
",",
"value",
"=",
"np",
".",
"inf",
")",
"return",
"np",
".",
"argmax",
"(",
"other_logits",
")"
] | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | CombinedCriteria.name | Concatenates the names of the given criteria in alphabetical order.
If a sub-criterion is itself a combined criterion, its name is
first split into the individual names and the names of the
sub-sub criteria is used instead of the name of the sub-criterion.
This is done recursively to en... | foolbox/criteria.py | def name(self):
"""Concatenates the names of the given criteria in alphabetical order.
If a sub-criterion is itself a combined criterion, its name is
first split into the individual names and the names of the
sub-sub criteria is used instead of the name of the sub-criterion.
Thi... | def name(self):
"""Concatenates the names of the given criteria in alphabetical order.
If a sub-criterion is itself a combined criterion, its name is
first split into the individual names and the names of the
sub-sub criteria is used instead of the name of the sub-criterion.
Thi... | [
"Concatenates",
"the",
"names",
"of",
"the",
"given",
"criteria",
"in",
"alphabetical",
"order",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/criteria.py#L140-L157 | [
"def",
"name",
"(",
"self",
")",
":",
"names",
"=",
"(",
"criterion",
".",
"name",
"(",
")",
"for",
"criterion",
"in",
"self",
".",
"_criteria",
")",
"return",
"'__'",
".",
"join",
"(",
"sorted",
"(",
"names",
")",
")"
] | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | _difference_map | Difference map of the image.
Approximate derivatives of the function image[c, :, :]
(e.g. PyTorch) or image[:, :, c] (e.g. Keras).
dfdx, dfdy = difference_map(image)
In:
image: numpy.ndarray
of shape C x h x w or h x w x C, with C = 1 or C = 3
(color channels), h, w >= 3, and [type] ... | foolbox/attacks/adef_attack.py | def _difference_map(image, color_axis):
"""Difference map of the image.
Approximate derivatives of the function image[c, :, :]
(e.g. PyTorch) or image[:, :, c] (e.g. Keras).
dfdx, dfdy = difference_map(image)
In:
image: numpy.ndarray
of shape C x h x w or h x w x C, with C = 1 or C = 3
... | def _difference_map(image, color_axis):
"""Difference map of the image.
Approximate derivatives of the function image[c, :, :]
(e.g. PyTorch) or image[:, :, c] (e.g. Keras).
dfdx, dfdy = difference_map(image)
In:
image: numpy.ndarray
of shape C x h x w or h x w x C, with C = 1 or C = 3
... | [
"Difference",
"map",
"of",
"the",
"image",
".",
"Approximate",
"derivatives",
"of",
"the",
"function",
"image",
"[",
"c",
":",
":",
"]",
"(",
"e",
".",
"g",
".",
"PyTorch",
")",
"or",
"image",
"[",
":",
":",
"c",
"]",
"(",
"e",
".",
"g",
".",
"... | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/attacks/adef_attack.py#L23-L73 | [
"def",
"_difference_map",
"(",
"image",
",",
"color_axis",
")",
":",
"if",
"color_axis",
"==",
"2",
":",
"image",
"=",
"_transpose_image",
"(",
"image",
")",
"# Derivative in x direction (rows from left to right)",
"dfdx",
"=",
"np",
".",
"zeros_like",
"(",
"image... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | _compose | Calculate the composition of the function image with the vector
field vec_field by interpolation.
new_func = compose(image, vec_field)
In:
image: numpy.ndarray
of shape C x h x w with C = 3 or C = 1 (color channels),
h, w >= 2, and [type] = 'Float' or 'Double'.
Contains the value... | foolbox/attacks/adef_attack.py | def _compose(image, vec_field, color_axis):
"""Calculate the composition of the function image with the vector
field vec_field by interpolation.
new_func = compose(image, vec_field)
In:
image: numpy.ndarray
of shape C x h x w with C = 3 or C = 1 (color channels),
h, w >= 2, and [type... | def _compose(image, vec_field, color_axis):
"""Calculate the composition of the function image with the vector
field vec_field by interpolation.
new_func = compose(image, vec_field)
In:
image: numpy.ndarray
of shape C x h x w with C = 3 or C = 1 (color channels),
h, w >= 2, and [type... | [
"Calculate",
"the",
"composition",
"of",
"the",
"function",
"image",
"with",
"the",
"vector",
"field",
"vec_field",
"by",
"interpolation",
".",
"new_func",
"=",
"compose",
"(",
"image",
"vec_field",
")",
"In",
":",
"image",
":",
"numpy",
".",
"ndarray",
"of"... | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/attacks/adef_attack.py#L76-L117 | [
"def",
"_compose",
"(",
"image",
",",
"vec_field",
",",
"color_axis",
")",
":",
"if",
"color_axis",
"==",
"2",
":",
"image",
"=",
"_transpose_image",
"(",
"image",
")",
"c",
",",
"h",
",",
"w",
"=",
"image",
".",
"shape",
"# colors, height, width",
"hran... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | _create_vec_field | Calculate the deformation vector field
In:
fval: float
gradf: numpy.ndarray
of shape C x h x w with C = 3 or C = 1
(color channels), h, w >= 1.
d1x: numpy.ndarray
of shape C x h x w and [type] = 'Float' or 'Double'.
d2x: numpy.ndarray
of shape C x h x w and [type] = '... | foolbox/attacks/adef_attack.py | def _create_vec_field(fval, gradf, d1x, d2x, color_axis, smooth=0):
"""Calculate the deformation vector field
In:
fval: float
gradf: numpy.ndarray
of shape C x h x w with C = 3 or C = 1
(color channels), h, w >= 1.
d1x: numpy.ndarray
of shape C x h x w and [type] = 'Float' or... | def _create_vec_field(fval, gradf, d1x, d2x, color_axis, smooth=0):
"""Calculate the deformation vector field
In:
fval: float
gradf: numpy.ndarray
of shape C x h x w with C = 3 or C = 1
(color channels), h, w >= 1.
d1x: numpy.ndarray
of shape C x h x w and [type] = 'Float' or... | [
"Calculate",
"the",
"deformation",
"vector",
"field",
"In",
":",
"fval",
":",
"float",
"gradf",
":",
"numpy",
".",
"ndarray",
"of",
"shape",
"C",
"x",
"h",
"x",
"w",
"with",
"C",
"=",
"3",
"or",
"C",
"=",
"1",
"(",
"color",
"channels",
")",
"h",
... | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/attacks/adef_attack.py#L120-L163 | [
"def",
"_create_vec_field",
"(",
"fval",
",",
"gradf",
",",
"d1x",
",",
"d2x",
",",
"color_axis",
",",
"smooth",
"=",
"0",
")",
":",
"if",
"color_axis",
"==",
"2",
":",
"gradf",
"=",
"_transpose_image",
"(",
"gradf",
")",
"c",
",",
"h",
",",
"w",
"... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | softmax | Transforms predictions into probability values.
Parameters
----------
logits : array_like
The logits predicted by the model.
Returns
-------
`numpy.ndarray`
Probability values corresponding to the logits. | foolbox/utils.py | def softmax(logits):
"""Transforms predictions into probability values.
Parameters
----------
logits : array_like
The logits predicted by the model.
Returns
-------
`numpy.ndarray`
Probability values corresponding to the logits.
"""
assert logits.ndim == 1
# f... | def softmax(logits):
"""Transforms predictions into probability values.
Parameters
----------
logits : array_like
The logits predicted by the model.
Returns
-------
`numpy.ndarray`
Probability values corresponding to the logits.
"""
assert logits.ndim == 1
# f... | [
"Transforms",
"predictions",
"into",
"probability",
"values",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L6-L27 | [
"def",
"softmax",
"(",
"logits",
")",
":",
"assert",
"logits",
".",
"ndim",
"==",
"1",
"# for numerical reasons we subtract the max logit",
"# (mathematically it doesn't matter!)",
"# otherwise exp(logits) might become too large or too small",
"logits",
"=",
"logits",
"-",
"np"... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | crossentropy | Calculates the cross-entropy.
Parameters
----------
logits : array_like
The logits predicted by the model.
label : int
The label describing the target distribution.
Returns
-------
float
The cross-entropy between softmax(logits) and onehot(label). | foolbox/utils.py | def crossentropy(label, logits):
"""Calculates the cross-entropy.
Parameters
----------
logits : array_like
The logits predicted by the model.
label : int
The label describing the target distribution.
Returns
-------
float
The cross-entropy between softmax(logit... | def crossentropy(label, logits):
"""Calculates the cross-entropy.
Parameters
----------
logits : array_like
The logits predicted by the model.
label : int
The label describing the target distribution.
Returns
-------
float
The cross-entropy between softmax(logit... | [
"Calculates",
"the",
"cross",
"-",
"entropy",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L30-L56 | [
"def",
"crossentropy",
"(",
"label",
",",
"logits",
")",
":",
"assert",
"logits",
".",
"ndim",
"==",
"1",
"# for numerical reasons we subtract the max logit",
"# (mathematically it doesn't matter!)",
"# otherwise exp(logits) might become too large or too small",
"logits",
"=",
... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | batch_crossentropy | Calculates the cross-entropy for a batch of logits.
Parameters
----------
logits : array_like
The logits predicted by the model for a batch of inputs.
label : int
The label describing the target distribution.
Returns
-------
np.ndarray
The cross-entropy between soft... | foolbox/utils.py | def batch_crossentropy(label, logits):
"""Calculates the cross-entropy for a batch of logits.
Parameters
----------
logits : array_like
The logits predicted by the model for a batch of inputs.
label : int
The label describing the target distribution.
Returns
-------
np.... | def batch_crossentropy(label, logits):
"""Calculates the cross-entropy for a batch of logits.
Parameters
----------
logits : array_like
The logits predicted by the model for a batch of inputs.
label : int
The label describing the target distribution.
Returns
-------
np.... | [
"Calculates",
"the",
"cross",
"-",
"entropy",
"for",
"a",
"batch",
"of",
"logits",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L59-L86 | [
"def",
"batch_crossentropy",
"(",
"label",
",",
"logits",
")",
":",
"assert",
"logits",
".",
"ndim",
"==",
"2",
"# for numerical reasons we subtract the max logit",
"# (mathematically it doesn't matter!)",
"# otherwise exp(logits) might become too large or too small",
"logits",
"... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | binarize | Binarizes the values of x.
Parameters
----------
values : tuple of two floats
The lower and upper value to which the inputs are mapped.
threshold : float
The threshold; defaults to (values[0] + values[1]) / 2 if None.
included_in : str
Whether the threshold value itself belo... | foolbox/utils.py | def binarize(x, values, threshold=None, included_in='upper'):
"""Binarizes the values of x.
Parameters
----------
values : tuple of two floats
The lower and upper value to which the inputs are mapped.
threshold : float
The threshold; defaults to (values[0] + values[1]) / 2 if None.
... | def binarize(x, values, threshold=None, included_in='upper'):
"""Binarizes the values of x.
Parameters
----------
values : tuple of two floats
The lower and upper value to which the inputs are mapped.
threshold : float
The threshold; defaults to (values[0] + values[1]) / 2 if None.
... | [
"Binarizes",
"the",
"values",
"of",
"x",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L89-L117 | [
"def",
"binarize",
"(",
"x",
",",
"values",
",",
"threshold",
"=",
"None",
",",
"included_in",
"=",
"'upper'",
")",
":",
"lower",
",",
"upper",
"=",
"values",
"if",
"threshold",
"is",
"None",
":",
"threshold",
"=",
"(",
"lower",
"+",
"upper",
")",
"/... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | imagenet_example | Returns an example image and its imagenet class label.
Parameters
----------
shape : list of integers
The shape of the returned image.
data_format : str
"channels_first" or "channels_last"
Returns
-------
image : array_like
The example image.
label : int
... | foolbox/utils.py | def imagenet_example(shape=(224, 224), data_format='channels_last'):
""" Returns an example image and its imagenet class label.
Parameters
----------
shape : list of integers
The shape of the returned image.
data_format : str
"channels_first" or "channels_last"
Returns
----... | def imagenet_example(shape=(224, 224), data_format='channels_last'):
""" Returns an example image and its imagenet class label.
Parameters
----------
shape : list of integers
The shape of the returned image.
data_format : str
"channels_first" or "channels_last"
Returns
----... | [
"Returns",
"an",
"example",
"image",
"and",
"its",
"imagenet",
"class",
"label",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L120-L152 | [
"def",
"imagenet_example",
"(",
"shape",
"=",
"(",
"224",
",",
"224",
")",
",",
"data_format",
"=",
"'channels_last'",
")",
":",
"assert",
"len",
"(",
"shape",
")",
"==",
"2",
"assert",
"data_format",
"in",
"[",
"'channels_first'",
",",
"'channels_last'",
... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | samples | Returns a batch of example images and the corresponding labels
Parameters
----------
dataset : string
The data set to load (options: imagenet, mnist, cifar10,
cifar100, fashionMNIST)
index : int
For each data set 20 example images exist. The returned batch
contains the i... | foolbox/utils.py | def samples(dataset='imagenet', index=0, batchsize=1, shape=(224, 224),
data_format='channels_last'):
''' Returns a batch of example images and the corresponding labels
Parameters
----------
dataset : string
The data set to load (options: imagenet, mnist, cifar10,
cifar100, ... | def samples(dataset='imagenet', index=0, batchsize=1, shape=(224, 224),
data_format='channels_last'):
''' Returns a batch of example images and the corresponding labels
Parameters
----------
dataset : string
The data set to load (options: imagenet, mnist, cifar10,
cifar100, ... | [
"Returns",
"a",
"batch",
"of",
"example",
"images",
"and",
"the",
"corresponding",
"labels"
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L155-L214 | [
"def",
"samples",
"(",
"dataset",
"=",
"'imagenet'",
",",
"index",
"=",
"0",
",",
"batchsize",
"=",
"1",
",",
"shape",
"=",
"(",
"224",
",",
"224",
")",
",",
"data_format",
"=",
"'channels_last'",
")",
":",
"from",
"PIL",
"import",
"Image",
"images",
... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | onehot_like | Creates an array like a, with all values
set to 0 except one.
Parameters
----------
a : array_like
The returned one-hot array will have the same shape
and dtype as this array
index : int
The index that should be set to `value`
value : single value compatible with a.dtype... | foolbox/utils.py | def onehot_like(a, index, value=1):
"""Creates an array like a, with all values
set to 0 except one.
Parameters
----------
a : array_like
The returned one-hot array will have the same shape
and dtype as this array
index : int
The index that should be set to `value`
v... | def onehot_like(a, index, value=1):
"""Creates an array like a, with all values
set to 0 except one.
Parameters
----------
a : array_like
The returned one-hot array will have the same shape
and dtype as this array
index : int
The index that should be set to `value`
v... | [
"Creates",
"an",
"array",
"like",
"a",
"with",
"all",
"values",
"set",
"to",
"0",
"except",
"one",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/utils.py#L217-L241 | [
"def",
"onehot_like",
"(",
"a",
",",
"index",
",",
"value",
"=",
"1",
")",
":",
"x",
"=",
"np",
".",
"zeros_like",
"(",
"a",
")",
"x",
"[",
"index",
"]",
"=",
"value",
"return",
"x"
] | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | PrecomputedImagesAttack._get_output | Looks up the precomputed adversarial image for a given image. | foolbox/attacks/precomputed.py | def _get_output(self, a, image):
""" Looks up the precomputed adversarial image for a given image.
"""
sd = np.square(self._input_images - image)
mses = np.mean(sd, axis=tuple(range(1, sd.ndim)))
index = np.argmin(mses)
# if we run into numerical problems with this appr... | def _get_output(self, a, image):
""" Looks up the precomputed adversarial image for a given image.
"""
sd = np.square(self._input_images - image)
mses = np.mean(sd, axis=tuple(range(1, sd.ndim)))
index = np.argmin(mses)
# if we run into numerical problems with this appr... | [
"Looks",
"up",
"the",
"precomputed",
"adversarial",
"image",
"for",
"a",
"given",
"image",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/attacks/precomputed.py#L30-L42 | [
"def",
"_get_output",
"(",
"self",
",",
"a",
",",
"image",
")",
":",
"sd",
"=",
"np",
".",
"square",
"(",
"self",
".",
"_input_images",
"-",
"image",
")",
"mses",
"=",
"np",
".",
"mean",
"(",
"sd",
",",
"axis",
"=",
"tuple",
"(",
"range",
"(",
... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | Model._process_gradient | backward: `callable`
callable that backpropagates the gradient of the model w.r.t to
preprocessed input through the preprocessing to get the gradient
of the model's output w.r.t. the input before preprocessing
dmdp: gradient of model w.r.t. preprocessed input | foolbox/models/base.py | def _process_gradient(self, backward, dmdp):
"""
backward: `callable`
callable that backpropagates the gradient of the model w.r.t to
preprocessed input through the preprocessing to get the gradient
of the model's output w.r.t. the input before preprocessing
d... | def _process_gradient(self, backward, dmdp):
"""
backward: `callable`
callable that backpropagates the gradient of the model w.r.t to
preprocessed input through the preprocessing to get the gradient
of the model's output w.r.t. the input before preprocessing
d... | [
"backward",
":",
"callable",
"callable",
"that",
"backpropagates",
"the",
"gradient",
"of",
"the",
"model",
"w",
".",
"r",
".",
"t",
"to",
"preprocessed",
"input",
"through",
"the",
"preprocessing",
"to",
"get",
"the",
"gradient",
"of",
"the",
"model",
"s",
... | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/models/base.py#L104-L117 | [
"def",
"_process_gradient",
"(",
"self",
",",
"backward",
",",
"dmdp",
")",
":",
"if",
"backward",
"is",
"None",
":",
"# pragma: no cover",
"raise",
"ValueError",
"(",
"'Your preprocessing function does not provide'",
"' an (approximate) gradient'",
")",
"dmdx",
"=",
... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | Model.predictions | Convenience method that calculates predictions for a single image.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
Returns
-------
`numpy.ndarray`
Vector of... | foolbox/models/base.py | def predictions(self, image):
"""Convenience method that calculates predictions for a single image.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
Returns
-------
... | def predictions(self, image):
"""Convenience method that calculates predictions for a single image.
Parameters
----------
image : `numpy.ndarray`
Single input with shape as expected by the model
(without the batch dimension).
Returns
-------
... | [
"Convenience",
"method",
"that",
"calculates",
"predictions",
"for",
"a",
"single",
"image",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/models/base.py#L141-L161 | [
"def",
"predictions",
"(",
"self",
",",
"image",
")",
":",
"return",
"np",
".",
"squeeze",
"(",
"self",
".",
"batch_predictions",
"(",
"image",
"[",
"np",
".",
"newaxis",
"]",
")",
",",
"axis",
"=",
"0",
")"
] | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | DifferentiableModel.gradient | Calculates the gradient of the cross-entropy loss w.r.t. the image.
The default implementation calls predictions_and_gradient.
Subclasses can provide more efficient implementations that
only calculate the gradient.
Parameters
----------
image : `numpy.ndarray`
... | foolbox/models/base.py | def gradient(self, image, label):
"""Calculates the gradient of the cross-entropy loss w.r.t. the image.
The default implementation calls predictions_and_gradient.
Subclasses can provide more efficient implementations that
only calculate the gradient.
Parameters
-------... | def gradient(self, image, label):
"""Calculates the gradient of the cross-entropy loss w.r.t. the image.
The default implementation calls predictions_and_gradient.
Subclasses can provide more efficient implementations that
only calculate the gradient.
Parameters
-------... | [
"Calculates",
"the",
"gradient",
"of",
"the",
"cross",
"-",
"entropy",
"loss",
"w",
".",
"r",
".",
"t",
".",
"the",
"image",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/models/base.py#L223-L250 | [
"def",
"gradient",
"(",
"self",
",",
"image",
",",
"label",
")",
":",
"_",
",",
"gradient",
"=",
"self",
".",
"predictions_and_gradient",
"(",
"image",
",",
"label",
")",
"return",
"gradient"
] | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | clone | Clone a remote git repository to a local path.
:param git_uri: the URI to the git repository to be cloned
:return: the generated local path where the repository has been cloned to | foolbox/zoo/git_cloner.py | def clone(git_uri):
"""
Clone a remote git repository to a local path.
:param git_uri: the URI to the git repository to be cloned
:return: the generated local path where the repository has been cloned to
"""
hash_digest = sha256_hash(git_uri)
local_path = home_directory_path(FOLDER, hash_di... | def clone(git_uri):
"""
Clone a remote git repository to a local path.
:param git_uri: the URI to the git repository to be cloned
:return: the generated local path where the repository has been cloned to
"""
hash_digest = sha256_hash(git_uri)
local_path = home_directory_path(FOLDER, hash_di... | [
"Clone",
"a",
"remote",
"git",
"repository",
"to",
"a",
"local",
"path",
"."
] | bethgelab/foolbox | python | https://github.com/bethgelab/foolbox/blob/8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a/foolbox/zoo/git_cloner.py#L12-L29 | [
"def",
"clone",
"(",
"git_uri",
")",
":",
"hash_digest",
"=",
"sha256_hash",
"(",
"git_uri",
")",
"local_path",
"=",
"home_directory_path",
"(",
"FOLDER",
",",
"hash_digest",
")",
"exists_locally",
"=",
"path_exists",
"(",
"local_path",
")",
"if",
"not",
"exis... | 8ab54248c70e45d8580a7d9ee44c9c0fb5755c4a |
valid | run | :param command:
:param parser:
:param cl_args:
:param unknown_args:
:return: | heron/tools/cli/src/python/deactivate.py | def run(command, parser, cl_args, unknown_args):
'''
:param command:
:param parser:
:param cl_args:
:param unknown_args:
:return:
'''
Log.debug("Deactivate Args: %s", cl_args)
return cli_helper.run(command, cl_args, "deactivate topology") | def run(command, parser, cl_args, unknown_args):
'''
:param command:
:param parser:
:param cl_args:
:param unknown_args:
:return:
'''
Log.debug("Deactivate Args: %s", cl_args)
return cli_helper.run(command, cl_args, "deactivate topology") | [
":",
"param",
"command",
":",
":",
"param",
"parser",
":",
":",
"param",
"cl_args",
":",
":",
"param",
"unknown_args",
":",
":",
"return",
":"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/deactivate.py#L34-L43 | [
"def",
"run",
"(",
"command",
",",
"parser",
",",
"cl_args",
",",
"unknown_args",
")",
":",
"Log",
".",
"debug",
"(",
"\"Deactivate Args: %s\"",
",",
"cl_args",
")",
"return",
"cli_helper",
".",
"run",
"(",
"command",
",",
"cl_args",
",",
"\"deactivate topol... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | GatewayLooper.poll | Modified version of poll() from asyncore module | heron/instance/src/python/network/gateway_looper.py | def poll(self, timeout=0.0):
"""Modified version of poll() from asyncore module"""
if self.sock_map is None:
Log.warning("Socket map is not registered to Gateway Looper")
readable_lst = []
writable_lst = []
error_lst = []
if self.sock_map is not None:
for fd, obj in self.sock_map.it... | def poll(self, timeout=0.0):
"""Modified version of poll() from asyncore module"""
if self.sock_map is None:
Log.warning("Socket map is not registered to Gateway Looper")
readable_lst = []
writable_lst = []
error_lst = []
if self.sock_map is not None:
for fd, obj in self.sock_map.it... | [
"Modified",
"version",
"of",
"poll",
"()",
"from",
"asyncore",
"module"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/gateway_looper.py#L77-L135 | [
"def",
"poll",
"(",
"self",
",",
"timeout",
"=",
"0.0",
")",
":",
"if",
"self",
".",
"sock_map",
"is",
"None",
":",
"Log",
".",
"warning",
"(",
"\"Socket map is not registered to Gateway Looper\"",
")",
"readable_lst",
"=",
"[",
"]",
"writable_lst",
"=",
"["... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | configure | configure logging | heron/statemgrs/src/python/log.py | def configure(level, logfile=None):
""" configure logging """
log_format = "%(asctime)s-%(levelname)s: %(message)s"
date_format = '%a, %d %b %Y %H:%M:%S'
logging.basicConfig(format=log_format, datefmt=date_format)
Log.setLevel(level)
if logfile is not None:
fh = logging.FileHandler(logfile)
fh.set... | def configure(level, logfile=None):
""" configure logging """
log_format = "%(asctime)s-%(levelname)s: %(message)s"
date_format = '%a, %d %b %Y %H:%M:%S'
logging.basicConfig(format=log_format, datefmt=date_format)
Log.setLevel(level)
if logfile is not None:
fh = logging.FileHandler(logfile)
fh.set... | [
"configure",
"logging"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/log.py#L28-L39 | [
"def",
"configure",
"(",
"level",
",",
"logfile",
"=",
"None",
")",
":",
"log_format",
"=",
"\"%(asctime)s-%(levelname)s: %(message)s\"",
"date_format",
"=",
"'%a, %d %b %Y %H:%M:%S'",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"log_format",
",",
"datefmt",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.write_success_response | Result may be a python dictionary, array or a primitive type
that can be converted to JSON for writing back the result. | heron/tools/tracker/src/python/handlers/basehandler.py | def write_success_response(self, result):
"""
Result may be a python dictionary, array or a primitive type
that can be converted to JSON for writing back the result.
"""
response = self.make_success_response(result)
now = time.time()
spent = now - self.basehandler_starttime
response[cons... | def write_success_response(self, result):
"""
Result may be a python dictionary, array or a primitive type
that can be converted to JSON for writing back the result.
"""
response = self.make_success_response(result)
now = time.time()
spent = now - self.basehandler_starttime
response[cons... | [
"Result",
"may",
"be",
"a",
"python",
"dictionary",
"array",
"or",
"a",
"primitive",
"type",
"that",
"can",
"be",
"converted",
"to",
"JSON",
"for",
"writing",
"back",
"the",
"result",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L53-L62 | [
"def",
"write_success_response",
"(",
"self",
",",
"result",
")",
":",
"response",
"=",
"self",
".",
"make_success_response",
"(",
"result",
")",
"now",
"=",
"time",
".",
"time",
"(",
")",
"spent",
"=",
"now",
"-",
"self",
".",
"basehandler_starttime",
"re... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.write_error_response | Writes the message as part of the response and sets 404 status. | heron/tools/tracker/src/python/handlers/basehandler.py | def write_error_response(self, message):
"""
Writes the message as part of the response and sets 404 status.
"""
self.set_status(404)
response = self.make_error_response(str(message))
now = time.time()
spent = now - self.basehandler_starttime
response[constants.RESPONSE_KEY_EXECUTION_TIM... | def write_error_response(self, message):
"""
Writes the message as part of the response and sets 404 status.
"""
self.set_status(404)
response = self.make_error_response(str(message))
now = time.time()
spent = now - self.basehandler_starttime
response[constants.RESPONSE_KEY_EXECUTION_TIM... | [
"Writes",
"the",
"message",
"as",
"part",
"of",
"the",
"response",
"and",
"sets",
"404",
"status",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L64-L73 | [
"def",
"write_error_response",
"(",
"self",
",",
"message",
")",
":",
"self",
".",
"set_status",
"(",
"404",
")",
"response",
"=",
"self",
".",
"make_error_response",
"(",
"str",
"(",
"message",
")",
")",
"now",
"=",
"time",
".",
"time",
"(",
")",
"spe... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.write_json_response | write back json response | heron/tools/tracker/src/python/handlers/basehandler.py | def write_json_response(self, response):
""" write back json response """
self.write(tornado.escape.json_encode(response))
self.set_header("Content-Type", "application/json") | def write_json_response(self, response):
""" write back json response """
self.write(tornado.escape.json_encode(response))
self.set_header("Content-Type", "application/json") | [
"write",
"back",
"json",
"response"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L75-L78 | [
"def",
"write_json_response",
"(",
"self",
",",
"response",
")",
":",
"self",
".",
"write",
"(",
"tornado",
".",
"escape",
".",
"json_encode",
"(",
"response",
")",
")",
"self",
".",
"set_header",
"(",
"\"Content-Type\"",
",",
"\"application/json\"",
")"
] | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.make_response | Makes the base dict for the response.
The status is the string value for
the key "status" of the response. This
should be "success" or "failure". | heron/tools/tracker/src/python/handlers/basehandler.py | def make_response(self, status):
"""
Makes the base dict for the response.
The status is the string value for
the key "status" of the response. This
should be "success" or "failure".
"""
response = {
constants.RESPONSE_KEY_STATUS: status,
constants.RESPONSE_KEY_VERSION: const... | def make_response(self, status):
"""
Makes the base dict for the response.
The status is the string value for
the key "status" of the response. This
should be "success" or "failure".
"""
response = {
constants.RESPONSE_KEY_STATUS: status,
constants.RESPONSE_KEY_VERSION: const... | [
"Makes",
"the",
"base",
"dict",
"for",
"the",
"response",
".",
"The",
"status",
"is",
"the",
"string",
"value",
"for",
"the",
"key",
"status",
"of",
"the",
"response",
".",
"This",
"should",
"be",
"success",
"or",
"failure",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L81-L94 | [
"def",
"make_response",
"(",
"self",
",",
"status",
")",
":",
"response",
"=",
"{",
"constants",
".",
"RESPONSE_KEY_STATUS",
":",
"status",
",",
"constants",
".",
"RESPONSE_KEY_VERSION",
":",
"constants",
".",
"API_VERSION",
",",
"constants",
".",
"RESPONSE_KEY_... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.make_success_response | Makes the python dict corresponding to the
JSON that needs to be sent for a successful
response. Result is the actual payload
that gets sent. | heron/tools/tracker/src/python/handlers/basehandler.py | def make_success_response(self, result):
"""
Makes the python dict corresponding to the
JSON that needs to be sent for a successful
response. Result is the actual payload
that gets sent.
"""
response = self.make_response(constants.RESPONSE_STATUS_SUCCESS)
response[constants.RESPONSE_KEY_... | def make_success_response(self, result):
"""
Makes the python dict corresponding to the
JSON that needs to be sent for a successful
response. Result is the actual payload
that gets sent.
"""
response = self.make_response(constants.RESPONSE_STATUS_SUCCESS)
response[constants.RESPONSE_KEY_... | [
"Makes",
"the",
"python",
"dict",
"corresponding",
"to",
"the",
"JSON",
"that",
"needs",
"to",
"be",
"sent",
"for",
"a",
"successful",
"response",
".",
"Result",
"is",
"the",
"actual",
"payload",
"that",
"gets",
"sent",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L96-L105 | [
"def",
"make_success_response",
"(",
"self",
",",
"result",
")",
":",
"response",
"=",
"self",
".",
"make_response",
"(",
"constants",
".",
"RESPONSE_STATUS_SUCCESS",
")",
"response",
"[",
"constants",
".",
"RESPONSE_KEY_RESULT",
"]",
"=",
"result",
"return",
"r... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.make_error_response | Makes the python dict corresponding to the
JSON that needs to be sent for a failed
response. Message is the message that is
sent as the reason for failure. | heron/tools/tracker/src/python/handlers/basehandler.py | def make_error_response(self, message):
"""
Makes the python dict corresponding to the
JSON that needs to be sent for a failed
response. Message is the message that is
sent as the reason for failure.
"""
response = self.make_response(constants.RESPONSE_STATUS_FAILURE)
response[constants.... | def make_error_response(self, message):
"""
Makes the python dict corresponding to the
JSON that needs to be sent for a failed
response. Message is the message that is
sent as the reason for failure.
"""
response = self.make_response(constants.RESPONSE_STATUS_FAILURE)
response[constants.... | [
"Makes",
"the",
"python",
"dict",
"corresponding",
"to",
"the",
"JSON",
"that",
"needs",
"to",
"be",
"sent",
"for",
"a",
"failed",
"response",
".",
"Message",
"is",
"the",
"message",
"that",
"is",
"sent",
"as",
"the",
"reason",
"for",
"failure",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L107-L116 | [
"def",
"make_error_response",
"(",
"self",
",",
"message",
")",
":",
"response",
"=",
"self",
".",
"make_response",
"(",
"constants",
".",
"RESPONSE_STATUS_FAILURE",
")",
"response",
"[",
"constants",
".",
"RESPONSE_KEY_MESSAGE",
"]",
"=",
"message",
"return",
"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_cluster | Helper function to get request argument.
Raises exception if argument is missing.
Returns the cluster argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_cluster(self):
"""
Helper function to get request argument.
Raises exception if argument is missing.
Returns the cluster argument.
"""
try:
return self.get_argument(constants.PARAM_CLUSTER)
except tornado.web.MissingArgumentError as e:
raise Exception(e.log_messa... | def get_argument_cluster(self):
"""
Helper function to get request argument.
Raises exception if argument is missing.
Returns the cluster argument.
"""
try:
return self.get_argument(constants.PARAM_CLUSTER)
except tornado.web.MissingArgumentError as e:
raise Exception(e.log_messa... | [
"Helper",
"function",
"to",
"get",
"request",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"cluster",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L118-L127 | [
"def",
"get_argument_cluster",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_CLUSTER",
")",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":",
"raise",
"Exception",
"(",
"e"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_role | Helper function to get request argument.
Raises exception if argument is missing.
Returns the role argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_role(self):
"""
Helper function to get request argument.
Raises exception if argument is missing.
Returns the role argument.
"""
try:
return self.get_argument(constants.PARAM_ROLE, default=None)
except tornado.web.MissingArgumentError as e:
raise Exception(e.log_... | def get_argument_role(self):
"""
Helper function to get request argument.
Raises exception if argument is missing.
Returns the role argument.
"""
try:
return self.get_argument(constants.PARAM_ROLE, default=None)
except tornado.web.MissingArgumentError as e:
raise Exception(e.log_... | [
"Helper",
"function",
"to",
"get",
"request",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"role",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L129-L138 | [
"def",
"get_argument_role",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_ROLE",
",",
"default",
"=",
"None",
")",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":",
"rais... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_environ | Helper function to get request argument.
Raises exception if argument is missing.
Returns the environ argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_environ(self):
"""
Helper function to get request argument.
Raises exception if argument is missing.
Returns the environ argument.
"""
try:
return self.get_argument(constants.PARAM_ENVIRON)
except tornado.web.MissingArgumentError as e:
raise Exception(e.log_messa... | def get_argument_environ(self):
"""
Helper function to get request argument.
Raises exception if argument is missing.
Returns the environ argument.
"""
try:
return self.get_argument(constants.PARAM_ENVIRON)
except tornado.web.MissingArgumentError as e:
raise Exception(e.log_messa... | [
"Helper",
"function",
"to",
"get",
"request",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"environ",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L141-L150 | [
"def",
"get_argument_environ",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_ENVIRON",
")",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":",
"raise",
"Exception",
"(",
"e"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_topology | Helper function to get topology argument.
Raises exception if argument is missing.
Returns the topology argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_topology(self):
"""
Helper function to get topology argument.
Raises exception if argument is missing.
Returns the topology argument.
"""
try:
topology = self.get_argument(constants.PARAM_TOPOLOGY)
return topology
except tornado.web.MissingArgumentError as e:
... | def get_argument_topology(self):
"""
Helper function to get topology argument.
Raises exception if argument is missing.
Returns the topology argument.
"""
try:
topology = self.get_argument(constants.PARAM_TOPOLOGY)
return topology
except tornado.web.MissingArgumentError as e:
... | [
"Helper",
"function",
"to",
"get",
"topology",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"topology",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L152-L162 | [
"def",
"get_argument_topology",
"(",
"self",
")",
":",
"try",
":",
"topology",
"=",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_TOPOLOGY",
")",
"return",
"topology",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_component | Helper function to get component argument.
Raises exception if argument is missing.
Returns the component argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_component(self):
"""
Helper function to get component argument.
Raises exception if argument is missing.
Returns the component argument.
"""
try:
component = self.get_argument(constants.PARAM_COMPONENT)
return component
except tornado.web.MissingArgumentError as ... | def get_argument_component(self):
"""
Helper function to get component argument.
Raises exception if argument is missing.
Returns the component argument.
"""
try:
component = self.get_argument(constants.PARAM_COMPONENT)
return component
except tornado.web.MissingArgumentError as ... | [
"Helper",
"function",
"to",
"get",
"component",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"component",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L164-L174 | [
"def",
"get_argument_component",
"(",
"self",
")",
":",
"try",
":",
"component",
"=",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_COMPONENT",
")",
"return",
"component",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_instance | Helper function to get instance argument.
Raises exception if argument is missing.
Returns the instance argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_instance(self):
"""
Helper function to get instance argument.
Raises exception if argument is missing.
Returns the instance argument.
"""
try:
instance = self.get_argument(constants.PARAM_INSTANCE)
return instance
except tornado.web.MissingArgumentError as e:
... | def get_argument_instance(self):
"""
Helper function to get instance argument.
Raises exception if argument is missing.
Returns the instance argument.
"""
try:
instance = self.get_argument(constants.PARAM_INSTANCE)
return instance
except tornado.web.MissingArgumentError as e:
... | [
"Helper",
"function",
"to",
"get",
"instance",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"instance",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L176-L186 | [
"def",
"get_argument_instance",
"(",
"self",
")",
":",
"try",
":",
"instance",
"=",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_INSTANCE",
")",
"return",
"instance",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_starttime | Helper function to get starttime argument.
Raises exception if argument is missing.
Returns the starttime argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_starttime(self):
"""
Helper function to get starttime argument.
Raises exception if argument is missing.
Returns the starttime argument.
"""
try:
starttime = self.get_argument(constants.PARAM_STARTTIME)
return starttime
except tornado.web.MissingArgumentError as ... | def get_argument_starttime(self):
"""
Helper function to get starttime argument.
Raises exception if argument is missing.
Returns the starttime argument.
"""
try:
starttime = self.get_argument(constants.PARAM_STARTTIME)
return starttime
except tornado.web.MissingArgumentError as ... | [
"Helper",
"function",
"to",
"get",
"starttime",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"starttime",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L188-L198 | [
"def",
"get_argument_starttime",
"(",
"self",
")",
":",
"try",
":",
"starttime",
"=",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_STARTTIME",
")",
"return",
"starttime",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_endtime | Helper function to get endtime argument.
Raises exception if argument is missing.
Returns the endtime argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_endtime(self):
"""
Helper function to get endtime argument.
Raises exception if argument is missing.
Returns the endtime argument.
"""
try:
endtime = self.get_argument(constants.PARAM_ENDTIME)
return endtime
except tornado.web.MissingArgumentError as e:
rai... | def get_argument_endtime(self):
"""
Helper function to get endtime argument.
Raises exception if argument is missing.
Returns the endtime argument.
"""
try:
endtime = self.get_argument(constants.PARAM_ENDTIME)
return endtime
except tornado.web.MissingArgumentError as e:
rai... | [
"Helper",
"function",
"to",
"get",
"endtime",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"endtime",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L200-L210 | [
"def",
"get_argument_endtime",
"(",
"self",
")",
":",
"try",
":",
"endtime",
"=",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_ENDTIME",
")",
"return",
"endtime",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":",
"ra... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_query | Helper function to get query argument.
Raises exception if argument is missing.
Returns the query argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_query(self):
"""
Helper function to get query argument.
Raises exception if argument is missing.
Returns the query argument.
"""
try:
query = self.get_argument(constants.PARAM_QUERY)
return query
except tornado.web.MissingArgumentError as e:
raise Exception... | def get_argument_query(self):
"""
Helper function to get query argument.
Raises exception if argument is missing.
Returns the query argument.
"""
try:
query = self.get_argument(constants.PARAM_QUERY)
return query
except tornado.web.MissingArgumentError as e:
raise Exception... | [
"Helper",
"function",
"to",
"get",
"query",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"query",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L212-L222 | [
"def",
"get_argument_query",
"(",
"self",
")",
":",
"try",
":",
"query",
"=",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_QUERY",
")",
"return",
"query",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":",
"raise",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_offset | Helper function to get offset argument.
Raises exception if argument is missing.
Returns the offset argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_offset(self):
"""
Helper function to get offset argument.
Raises exception if argument is missing.
Returns the offset argument.
"""
try:
offset = self.get_argument(constants.PARAM_OFFSET)
return offset
except tornado.web.MissingArgumentError as e:
raise Exc... | def get_argument_offset(self):
"""
Helper function to get offset argument.
Raises exception if argument is missing.
Returns the offset argument.
"""
try:
offset = self.get_argument(constants.PARAM_OFFSET)
return offset
except tornado.web.MissingArgumentError as e:
raise Exc... | [
"Helper",
"function",
"to",
"get",
"offset",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"offset",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L224-L234 | [
"def",
"get_argument_offset",
"(",
"self",
")",
":",
"try",
":",
"offset",
"=",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_OFFSET",
")",
"return",
"offset",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":",
"raise"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_argument_length | Helper function to get length argument.
Raises exception if argument is missing.
Returns the length argument. | heron/tools/tracker/src/python/handlers/basehandler.py | def get_argument_length(self):
"""
Helper function to get length argument.
Raises exception if argument is missing.
Returns the length argument.
"""
try:
length = self.get_argument(constants.PARAM_LENGTH)
return length
except tornado.web.MissingArgumentError as e:
raise Exc... | def get_argument_length(self):
"""
Helper function to get length argument.
Raises exception if argument is missing.
Returns the length argument.
"""
try:
length = self.get_argument(constants.PARAM_LENGTH)
return length
except tornado.web.MissingArgumentError as e:
raise Exc... | [
"Helper",
"function",
"to",
"get",
"length",
"argument",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
"Returns",
"the",
"length",
"argument",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L236-L246 | [
"def",
"get_argument_length",
"(",
"self",
")",
":",
"try",
":",
"length",
"=",
"self",
".",
"get_argument",
"(",
"constants",
".",
"PARAM_LENGTH",
")",
"return",
"length",
"except",
"tornado",
".",
"web",
".",
"MissingArgumentError",
"as",
"e",
":",
"raise"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.get_required_arguments_metricnames | Helper function to get metricname arguments.
Notice that it is get_argument"s" variation, which means that this can be repeated.
Raises exception if argument is missing.
Returns a list of metricname arguments | heron/tools/tracker/src/python/handlers/basehandler.py | def get_required_arguments_metricnames(self):
"""
Helper function to get metricname arguments.
Notice that it is get_argument"s" variation, which means that this can be repeated.
Raises exception if argument is missing.
Returns a list of metricname arguments
"""
try:
metricnames = self... | def get_required_arguments_metricnames(self):
"""
Helper function to get metricname arguments.
Notice that it is get_argument"s" variation, which means that this can be repeated.
Raises exception if argument is missing.
Returns a list of metricname arguments
"""
try:
metricnames = self... | [
"Helper",
"function",
"to",
"get",
"metricname",
"arguments",
".",
"Notice",
"that",
"it",
"is",
"get_argument",
"s",
"variation",
"which",
"means",
"that",
"this",
"can",
"be",
"repeated",
".",
"Raises",
"exception",
"if",
"argument",
"is",
"missing",
".",
... | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L248-L261 | [
"def",
"get_required_arguments_metricnames",
"(",
"self",
")",
":",
"try",
":",
"metricnames",
"=",
"self",
".",
"get_arguments",
"(",
"constants",
".",
"PARAM_METRICNAME",
")",
"if",
"not",
"metricnames",
":",
"raise",
"tornado",
".",
"web",
".",
"MissingArgume... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | BaseHandler.validateInterval | Helper function to validate interval.
An interval is valid if starttime and endtime are integrals,
and starttime is less than the endtime.
Raises exception if interval is not valid. | heron/tools/tracker/src/python/handlers/basehandler.py | def validateInterval(self, startTime, endTime):
"""
Helper function to validate interval.
An interval is valid if starttime and endtime are integrals,
and starttime is less than the endtime.
Raises exception if interval is not valid.
"""
start = int(startTime)
end = int(endTime)
if s... | def validateInterval(self, startTime, endTime):
"""
Helper function to validate interval.
An interval is valid if starttime and endtime are integrals,
and starttime is less than the endtime.
Raises exception if interval is not valid.
"""
start = int(startTime)
end = int(endTime)
if s... | [
"Helper",
"function",
"to",
"validate",
"interval",
".",
"An",
"interval",
"is",
"valid",
"if",
"starttime",
"and",
"endtime",
"are",
"integrals",
"and",
"starttime",
"is",
"less",
"than",
"the",
"endtime",
".",
"Raises",
"exception",
"if",
"interval",
"is",
... | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/basehandler.py#L263-L273 | [
"def",
"validateInterval",
"(",
"self",
",",
"startTime",
",",
"endTime",
")",
":",
"start",
"=",
"int",
"(",
"startTime",
")",
"end",
"=",
"int",
"(",
"endTime",
")",
"if",
"start",
">",
"end",
":",
"raise",
"Exception",
"(",
"\"starttime is greater than ... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | HeronClient.start_connect | Tries to connect to the Heron Server
``loop()`` method needs to be called after this. | heron/instance/src/python/network/heron_client.py | def start_connect(self):
"""Tries to connect to the Heron Server
``loop()`` method needs to be called after this.
"""
Log.debug("In start_connect() of %s" % self._get_classname())
# TODO: specify buffer size, exception handling
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
# when ... | def start_connect(self):
"""Tries to connect to the Heron Server
``loop()`` method needs to be called after this.
"""
Log.debug("In start_connect() of %s" % self._get_classname())
# TODO: specify buffer size, exception handling
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
# when ... | [
"Tries",
"to",
"connect",
"to",
"the",
"Heron",
"Server"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/heron_client.py#L186-L197 | [
"def",
"start_connect",
"(",
"self",
")",
":",
"Log",
".",
"debug",
"(",
"\"In start_connect() of %s\"",
"%",
"self",
".",
"_get_classname",
"(",
")",
")",
"# TODO: specify buffer size, exception handling",
"self",
".",
"create_socket",
"(",
"socket",
".",
"AF_INET"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | HeronClient.register_on_message | Registers protobuf message builders that this client wants to receive
:param msg_builder: callable to create a protobuf message that this client wants to receive | heron/instance/src/python/network/heron_client.py | def register_on_message(self, msg_builder):
"""Registers protobuf message builders that this client wants to receive
:param msg_builder: callable to create a protobuf message that this client wants to receive
"""
message = msg_builder()
Log.debug("In register_on_message(): %s" % message.DESCRIPTOR.... | def register_on_message(self, msg_builder):
"""Registers protobuf message builders that this client wants to receive
:param msg_builder: callable to create a protobuf message that this client wants to receive
"""
message = msg_builder()
Log.debug("In register_on_message(): %s" % message.DESCRIPTOR.... | [
"Registers",
"protobuf",
"message",
"builders",
"that",
"this",
"client",
"wants",
"to",
"receive"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/heron_client.py#L204-L211 | [
"def",
"register_on_message",
"(",
"self",
",",
"msg_builder",
")",
":",
"message",
"=",
"msg_builder",
"(",
")",
"Log",
".",
"debug",
"(",
"\"In register_on_message(): %s\"",
"%",
"message",
".",
"DESCRIPTOR",
".",
"full_name",
")",
"self",
".",
"registered_mes... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | HeronClient.send_request | Sends a request message (REQID is non-zero) | heron/instance/src/python/network/heron_client.py | def send_request(self, request, context, response_type, timeout_sec):
"""Sends a request message (REQID is non-zero)"""
# generates a unique request id
reqid = REQID.generate()
Log.debug("%s: In send_request() with REQID: %s" % (self._get_classname(), str(reqid)))
# register response message type
... | def send_request(self, request, context, response_type, timeout_sec):
"""Sends a request message (REQID is non-zero)"""
# generates a unique request id
reqid = REQID.generate()
Log.debug("%s: In send_request() with REQID: %s" % (self._get_classname(), str(reqid)))
# register response message type
... | [
"Sends",
"a",
"request",
"message",
"(",
"REQID",
"is",
"non",
"-",
"zero",
")"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/heron_client.py#L213-L229 | [
"def",
"send_request",
"(",
"self",
",",
"request",
",",
"context",
",",
"response_type",
",",
"timeout_sec",
")",
":",
"# generates a unique request id",
"reqid",
"=",
"REQID",
".",
"generate",
"(",
")",
"Log",
".",
"debug",
"(",
"\"%s: In send_request() with REQ... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | HeronClient.send_message | Sends a message (REQID is zero) | heron/instance/src/python/network/heron_client.py | def send_message(self, message):
"""Sends a message (REQID is zero)"""
Log.debug("In send_message() of %s" % self._get_classname())
outgoing_pkt = OutgoingPacket.create_packet(REQID.generate_zero(), message)
self._send_packet(outgoing_pkt) | def send_message(self, message):
"""Sends a message (REQID is zero)"""
Log.debug("In send_message() of %s" % self._get_classname())
outgoing_pkt = OutgoingPacket.create_packet(REQID.generate_zero(), message)
self._send_packet(outgoing_pkt) | [
"Sends",
"a",
"message",
"(",
"REQID",
"is",
"zero",
")"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/heron_client.py#L231-L235 | [
"def",
"send_message",
"(",
"self",
",",
"message",
")",
":",
"Log",
".",
"debug",
"(",
"\"In send_message() of %s\"",
"%",
"self",
".",
"_get_classname",
"(",
")",
")",
"outgoing_pkt",
"=",
"OutgoingPacket",
".",
"create_packet",
"(",
"REQID",
".",
"generate_... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | HeronClient.handle_timeout | Handles timeout | heron/instance/src/python/network/heron_client.py | def handle_timeout(self, reqid):
"""Handles timeout"""
if reqid in self.context_map:
context = self.context_map.pop(reqid)
self.response_message_map.pop(reqid)
self.on_response(StatusCode.TIMEOUT_ERROR, context, None) | def handle_timeout(self, reqid):
"""Handles timeout"""
if reqid in self.context_map:
context = self.context_map.pop(reqid)
self.response_message_map.pop(reqid)
self.on_response(StatusCode.TIMEOUT_ERROR, context, None) | [
"Handles",
"timeout"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/heron_client.py#L237-L242 | [
"def",
"handle_timeout",
"(",
"self",
",",
"reqid",
")",
":",
"if",
"reqid",
"in",
"self",
".",
"context_map",
":",
"context",
"=",
"self",
".",
"context_map",
".",
"pop",
"(",
"reqid",
")",
"self",
".",
"response_message_map",
".",
"pop",
"(",
"reqid",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | create_tar | Create a tar file with a given set of files | heron/tools/common/src/python/utils/config.py | def create_tar(tar_filename, files, config_dir, config_files):
'''
Create a tar file with a given set of files
'''
with contextlib.closing(tarfile.open(tar_filename, 'w:gz', dereference=True)) as tar:
for filename in files:
if os.path.isfile(filename):
tar.add(filename, arcname=os.path.basenam... | def create_tar(tar_filename, files, config_dir, config_files):
'''
Create a tar file with a given set of files
'''
with contextlib.closing(tarfile.open(tar_filename, 'w:gz', dereference=True)) as tar:
for filename in files:
if os.path.isfile(filename):
tar.add(filename, arcname=os.path.basenam... | [
"Create",
"a",
"tar",
"file",
"with",
"a",
"given",
"set",
"of",
"files"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L68-L89 | [
"def",
"create_tar",
"(",
"tar_filename",
",",
"files",
",",
"config_dir",
",",
"config_files",
")",
":",
"with",
"contextlib",
".",
"closing",
"(",
"tarfile",
".",
"open",
"(",
"tar_filename",
",",
"'w:gz'",
",",
"dereference",
"=",
"True",
")",
")",
"as"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | get_subparser | Retrieve the given subparser from parser | heron/tools/common/src/python/utils/config.py | def get_subparser(parser, command):
'''
Retrieve the given subparser from parser
'''
# pylint: disable=protected-access
subparsers_actions = [action for action in parser._actions
if isinstance(action, argparse._SubParsersAction)]
# there will probably only be one subparser_action,
... | def get_subparser(parser, command):
'''
Retrieve the given subparser from parser
'''
# pylint: disable=protected-access
subparsers_actions = [action for action in parser._actions
if isinstance(action, argparse._SubParsersAction)]
# there will probably only be one subparser_action,
... | [
"Retrieve",
"the",
"given",
"subparser",
"from",
"parser"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L92-L107 | [
"def",
"get_subparser",
"(",
"parser",
",",
"command",
")",
":",
"# pylint: disable=protected-access",
"subparsers_actions",
"=",
"[",
"action",
"for",
"action",
"in",
"parser",
".",
"_actions",
"if",
"isinstance",
"(",
"action",
",",
"argparse",
".",
"_SubParsers... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | get_heron_dir | This will extract heron directory from .pex file.
For example,
when __file__ is '/Users/heron-user/bin/heron/heron/tools/common/src/python/utils/config.pyc', and
its real path is '/Users/heron-user/.heron/bin/heron/tools/common/src/python/utils/config.pyc',
the internal variable ``path`` would be '/Users/heron... | heron/tools/common/src/python/utils/config.py | def get_heron_dir():
"""
This will extract heron directory from .pex file.
For example,
when __file__ is '/Users/heron-user/bin/heron/heron/tools/common/src/python/utils/config.pyc', and
its real path is '/Users/heron-user/.heron/bin/heron/tools/common/src/python/utils/config.pyc',
the internal variable ``... | def get_heron_dir():
"""
This will extract heron directory from .pex file.
For example,
when __file__ is '/Users/heron-user/bin/heron/heron/tools/common/src/python/utils/config.pyc', and
its real path is '/Users/heron-user/.heron/bin/heron/tools/common/src/python/utils/config.pyc',
the internal variable ``... | [
"This",
"will",
"extract",
"heron",
"directory",
"from",
".",
"pex",
"file",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L145-L160 | [
"def",
"get_heron_dir",
"(",
")",
":",
"go_above_dirs",
"=",
"9",
"path",
"=",
"\"/\"",
".",
"join",
"(",
"os",
".",
"path",
".",
"realpath",
"(",
"__file__",
")",
".",
"split",
"(",
"'/'",
")",
"[",
":",
"-",
"go_above_dirs",
"]",
")",
"return",
"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | get_heron_libs | Get all the heron lib jars with the absolute paths | heron/tools/common/src/python/utils/config.py | def get_heron_libs(local_jars):
"""Get all the heron lib jars with the absolute paths"""
heron_lib_dir = get_heron_lib_dir()
heron_libs = [os.path.join(heron_lib_dir, f) for f in local_jars]
return heron_libs | def get_heron_libs(local_jars):
"""Get all the heron lib jars with the absolute paths"""
heron_lib_dir = get_heron_lib_dir()
heron_libs = [os.path.join(heron_lib_dir, f) for f in local_jars]
return heron_libs | [
"Get",
"all",
"the",
"heron",
"lib",
"jars",
"with",
"the",
"absolute",
"paths"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L246-L250 | [
"def",
"get_heron_libs",
"(",
"local_jars",
")",
":",
"heron_lib_dir",
"=",
"get_heron_lib_dir",
"(",
")",
"heron_libs",
"=",
"[",
"os",
".",
"path",
".",
"join",
"(",
"heron_lib_dir",
",",
"f",
")",
"for",
"f",
"in",
"local_jars",
"]",
"return",
"heron_li... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | parse_cluster_role_env | Parse cluster/[role]/[environ], supply default, if not provided, not required | heron/tools/common/src/python/utils/config.py | def parse_cluster_role_env(cluster_role_env, config_path):
"""Parse cluster/[role]/[environ], supply default, if not provided, not required"""
parts = cluster_role_env.split('/')[:3]
if not os.path.isdir(config_path):
Log.error("Config path cluster directory does not exist: %s" % config_path)
raise Except... | def parse_cluster_role_env(cluster_role_env, config_path):
"""Parse cluster/[role]/[environ], supply default, if not provided, not required"""
parts = cluster_role_env.split('/')[:3]
if not os.path.isdir(config_path):
Log.error("Config path cluster directory does not exist: %s" % config_path)
raise Except... | [
"Parse",
"cluster",
"/",
"[",
"role",
"]",
"/",
"[",
"environ",
"]",
"supply",
"default",
"if",
"not",
"provided",
"not",
"required"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L259-L308 | [
"def",
"parse_cluster_role_env",
"(",
"cluster_role_env",
",",
"config_path",
")",
":",
"parts",
"=",
"cluster_role_env",
".",
"split",
"(",
"'/'",
")",
"[",
":",
"3",
"]",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"config_path",
")",
":",
"Log"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | get_cluster_role_env | Parse cluster/[role]/[environ], supply empty string, if not provided | heron/tools/common/src/python/utils/config.py | def get_cluster_role_env(cluster_role_env):
"""Parse cluster/[role]/[environ], supply empty string, if not provided"""
parts = cluster_role_env.split('/')[:3]
if len(parts) == 3:
return (parts[0], parts[1], parts[2])
if len(parts) == 2:
return (parts[0], parts[1], "")
if len(parts) == 1:
return ... | def get_cluster_role_env(cluster_role_env):
"""Parse cluster/[role]/[environ], supply empty string, if not provided"""
parts = cluster_role_env.split('/')[:3]
if len(parts) == 3:
return (parts[0], parts[1], parts[2])
if len(parts) == 2:
return (parts[0], parts[1], "")
if len(parts) == 1:
return ... | [
"Parse",
"cluster",
"/",
"[",
"role",
"]",
"/",
"[",
"environ",
"]",
"supply",
"empty",
"string",
"if",
"not",
"provided"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L311-L323 | [
"def",
"get_cluster_role_env",
"(",
"cluster_role_env",
")",
":",
"parts",
"=",
"cluster_role_env",
".",
"split",
"(",
"'/'",
")",
"[",
":",
"3",
"]",
"if",
"len",
"(",
"parts",
")",
"==",
"3",
":",
"return",
"(",
"parts",
"[",
"0",
"]",
",",
"parts"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | direct_mode_cluster_role_env | Check cluster/[role]/[environ], if they are required | heron/tools/common/src/python/utils/config.py | def direct_mode_cluster_role_env(cluster_role_env, config_path):
"""Check cluster/[role]/[environ], if they are required"""
# otherwise, get the client.yaml file
cli_conf_file = os.path.join(config_path, CLIENT_YAML)
# if client conf doesn't exist, use default value
if not os.path.isfile(cli_conf_file):
... | def direct_mode_cluster_role_env(cluster_role_env, config_path):
"""Check cluster/[role]/[environ], if they are required"""
# otherwise, get the client.yaml file
cli_conf_file = os.path.join(config_path, CLIENT_YAML)
# if client conf doesn't exist, use default value
if not os.path.isfile(cli_conf_file):
... | [
"Check",
"cluster",
"/",
"[",
"role",
"]",
"/",
"[",
"environ",
"]",
"if",
"they",
"are",
"required"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L326-L356 | [
"def",
"direct_mode_cluster_role_env",
"(",
"cluster_role_env",
",",
"config_path",
")",
":",
"# otherwise, get the client.yaml file",
"cli_conf_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"config_path",
",",
"CLIENT_YAML",
")",
"# if client conf doesn't exist, use def... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | server_mode_cluster_role_env | Check cluster/[role]/[environ], if they are required | heron/tools/common/src/python/utils/config.py | def server_mode_cluster_role_env(cluster_role_env, config_map):
"""Check cluster/[role]/[environ], if they are required"""
cmap = config_map[cluster_role_env[0]]
# if role is required but not provided, raise exception
role_present = True if len(cluster_role_env[1]) > 0 else False
if ROLE_KEY in cmap and cma... | def server_mode_cluster_role_env(cluster_role_env, config_map):
"""Check cluster/[role]/[environ], if they are required"""
cmap = config_map[cluster_role_env[0]]
# if role is required but not provided, raise exception
role_present = True if len(cluster_role_env[1]) > 0 else False
if ROLE_KEY in cmap and cma... | [
"Check",
"cluster",
"/",
"[",
"role",
"]",
"/",
"[",
"environ",
"]",
"if",
"they",
"are",
"required"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L359-L376 | [
"def",
"server_mode_cluster_role_env",
"(",
"cluster_role_env",
",",
"config_map",
")",
":",
"cmap",
"=",
"config_map",
"[",
"cluster_role_env",
"[",
"0",
"]",
"]",
"# if role is required but not provided, raise exception",
"role_present",
"=",
"True",
"if",
"len",
"(",... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | defaults_cluster_role_env | if role is not provided, supply userid
if environ is not provided, supply 'default' | heron/tools/common/src/python/utils/config.py | def defaults_cluster_role_env(cluster_role_env):
"""
if role is not provided, supply userid
if environ is not provided, supply 'default'
"""
if len(cluster_role_env[1]) == 0 and len(cluster_role_env[2]) == 0:
return (cluster_role_env[0], getpass.getuser(), ENVIRON)
return (cluster_role_env[0], cluster_... | def defaults_cluster_role_env(cluster_role_env):
"""
if role is not provided, supply userid
if environ is not provided, supply 'default'
"""
if len(cluster_role_env[1]) == 0 and len(cluster_role_env[2]) == 0:
return (cluster_role_env[0], getpass.getuser(), ENVIRON)
return (cluster_role_env[0], cluster_... | [
"if",
"role",
"is",
"not",
"provided",
"supply",
"userid",
"if",
"environ",
"is",
"not",
"provided",
"supply",
"default"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L379-L387 | [
"def",
"defaults_cluster_role_env",
"(",
"cluster_role_env",
")",
":",
"if",
"len",
"(",
"cluster_role_env",
"[",
"1",
"]",
")",
"==",
"0",
"and",
"len",
"(",
"cluster_role_env",
"[",
"2",
"]",
")",
"==",
"0",
":",
"return",
"(",
"cluster_role_env",
"[",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | parse_override_config_and_write_file | Parse the command line for overriding the defaults and
create an override file. | heron/tools/common/src/python/utils/config.py | def parse_override_config_and_write_file(namespace):
"""
Parse the command line for overriding the defaults and
create an override file.
"""
overrides = parse_override_config(namespace)
try:
tmp_dir = tempfile.mkdtemp()
override_config_file = os.path.join(tmp_dir, OVERRIDE_YAML)
with open(overri... | def parse_override_config_and_write_file(namespace):
"""
Parse the command line for overriding the defaults and
create an override file.
"""
overrides = parse_override_config(namespace)
try:
tmp_dir = tempfile.mkdtemp()
override_config_file = os.path.join(tmp_dir, OVERRIDE_YAML)
with open(overri... | [
"Parse",
"the",
"command",
"line",
"for",
"overriding",
"the",
"defaults",
"and",
"create",
"an",
"override",
"file",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L392-L406 | [
"def",
"parse_override_config_and_write_file",
"(",
"namespace",
")",
":",
"overrides",
"=",
"parse_override_config",
"(",
"namespace",
")",
"try",
":",
"tmp_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
"override_config_file",
"=",
"os",
".",
"path",
".",
"j... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | parse_override_config | Parse the command line for overriding the defaults | heron/tools/common/src/python/utils/config.py | def parse_override_config(namespace):
"""Parse the command line for overriding the defaults"""
overrides = dict()
for config in namespace:
kv = config.split("=")
if len(kv) != 2:
raise Exception("Invalid config property format (%s) expected key=value" % config)
if kv[1] in ['true', 'True', 'TRUE... | def parse_override_config(namespace):
"""Parse the command line for overriding the defaults"""
overrides = dict()
for config in namespace:
kv = config.split("=")
if len(kv) != 2:
raise Exception("Invalid config property format (%s) expected key=value" % config)
if kv[1] in ['true', 'True', 'TRUE... | [
"Parse",
"the",
"command",
"line",
"for",
"overriding",
"the",
"defaults"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L409-L422 | [
"def",
"parse_override_config",
"(",
"namespace",
")",
":",
"overrides",
"=",
"dict",
"(",
")",
"for",
"config",
"in",
"namespace",
":",
"kv",
"=",
"config",
".",
"split",
"(",
"\"=\"",
")",
"if",
"len",
"(",
"kv",
")",
"!=",
"2",
":",
"raise",
"Exce... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | get_java_path | Get the path of java executable | heron/tools/common/src/python/utils/config.py | def get_java_path():
"""Get the path of java executable"""
java_home = os.environ.get("JAVA_HOME")
return os.path.join(java_home, BIN_DIR, "java") | def get_java_path():
"""Get the path of java executable"""
java_home = os.environ.get("JAVA_HOME")
return os.path.join(java_home, BIN_DIR, "java") | [
"Get",
"the",
"path",
"of",
"java",
"executable"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L425-L428 | [
"def",
"get_java_path",
"(",
")",
":",
"java_home",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"JAVA_HOME\"",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"java_home",
",",
"BIN_DIR",
",",
"\"java\"",
")"
] | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | check_java_home_set | Check if the java home set | heron/tools/common/src/python/utils/config.py | def check_java_home_set():
"""Check if the java home set"""
# check if environ variable is set
if "JAVA_HOME" not in os.environ:
Log.error("JAVA_HOME not set")
return False
# check if the value set is correct
java_path = get_java_path()
if os.path.isfile(java_path) and os.access(java_path, os.X_OK)... | def check_java_home_set():
"""Check if the java home set"""
# check if environ variable is set
if "JAVA_HOME" not in os.environ:
Log.error("JAVA_HOME not set")
return False
# check if the value set is correct
java_path = get_java_path()
if os.path.isfile(java_path) and os.access(java_path, os.X_OK)... | [
"Check",
"if",
"the",
"java",
"home",
"set"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L431-L444 | [
"def",
"check_java_home_set",
"(",
")",
":",
"# check if environ variable is set",
"if",
"\"JAVA_HOME\"",
"not",
"in",
"os",
".",
"environ",
":",
"Log",
".",
"error",
"(",
"\"JAVA_HOME not set\"",
")",
"return",
"False",
"# check if the value set is correct",
"java_path... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | check_release_file_exists | Check if the release.yaml file exists | heron/tools/common/src/python/utils/config.py | def check_release_file_exists():
"""Check if the release.yaml file exists"""
release_file = get_heron_release_file()
# if the file does not exist and is not a file
if not os.path.isfile(release_file):
Log.error("Required file not found: %s" % release_file)
return False
return True | def check_release_file_exists():
"""Check if the release.yaml file exists"""
release_file = get_heron_release_file()
# if the file does not exist and is not a file
if not os.path.isfile(release_file):
Log.error("Required file not found: %s" % release_file)
return False
return True | [
"Check",
"if",
"the",
"release",
".",
"yaml",
"file",
"exists"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L447-L456 | [
"def",
"check_release_file_exists",
"(",
")",
":",
"release_file",
"=",
"get_heron_release_file",
"(",
")",
"# if the file does not exist and is not a file",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"release_file",
")",
":",
"Log",
".",
"error",
"(",
"\... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | print_build_info | Print build_info from release.yaml
:param zipped_pex: True if the PEX file is built with flag `zip_safe=False'. | heron/tools/common/src/python/utils/config.py | def print_build_info(zipped_pex=False):
"""Print build_info from release.yaml
:param zipped_pex: True if the PEX file is built with flag `zip_safe=False'.
"""
if zipped_pex:
release_file = get_zipped_heron_release_file()
else:
release_file = get_heron_release_file()
with open(release_file) as rele... | def print_build_info(zipped_pex=False):
"""Print build_info from release.yaml
:param zipped_pex: True if the PEX file is built with flag `zip_safe=False'.
"""
if zipped_pex:
release_file = get_zipped_heron_release_file()
else:
release_file = get_heron_release_file()
with open(release_file) as rele... | [
"Print",
"build_info",
"from",
"release",
".",
"yaml"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L458-L472 | [
"def",
"print_build_info",
"(",
"zipped_pex",
"=",
"False",
")",
":",
"if",
"zipped_pex",
":",
"release_file",
"=",
"get_zipped_heron_release_file",
"(",
")",
"else",
":",
"release_file",
"=",
"get_heron_release_file",
"(",
")",
"with",
"open",
"(",
"release_file"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | get_version_number | Print version from release.yaml
:param zipped_pex: True if the PEX file is built with flag `zip_safe=False'. | heron/tools/common/src/python/utils/config.py | def get_version_number(zipped_pex=False):
"""Print version from release.yaml
:param zipped_pex: True if the PEX file is built with flag `zip_safe=False'.
"""
if zipped_pex:
release_file = get_zipped_heron_release_file()
else:
release_file = get_heron_release_file()
with open(release_file) as releas... | def get_version_number(zipped_pex=False):
"""Print version from release.yaml
:param zipped_pex: True if the PEX file is built with flag `zip_safe=False'.
"""
if zipped_pex:
release_file = get_zipped_heron_release_file()
else:
release_file = get_heron_release_file()
with open(release_file) as releas... | [
"Print",
"version",
"from",
"release",
".",
"yaml"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L474-L488 | [
"def",
"get_version_number",
"(",
"zipped_pex",
"=",
"False",
")",
":",
"if",
"zipped_pex",
":",
"release_file",
"=",
"get_zipped_heron_release_file",
"(",
")",
"else",
":",
"release_file",
"=",
"get_heron_release_file",
"(",
")",
"with",
"open",
"(",
"release_fil... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | insert_bool | :param param:
:param command_args:
:return: | heron/tools/common/src/python/utils/config.py | def insert_bool(param, command_args):
'''
:param param:
:param command_args:
:return:
'''
index = 0
found = False
for lelem in command_args:
if lelem == '--' and not found:
break
if lelem == param:
found = True
break
index = index + 1
if found:
command_args.insert(in... | def insert_bool(param, command_args):
'''
:param param:
:param command_args:
:return:
'''
index = 0
found = False
for lelem in command_args:
if lelem == '--' and not found:
break
if lelem == param:
found = True
break
index = index + 1
if found:
command_args.insert(in... | [
":",
"param",
"param",
":",
":",
"param",
"command_args",
":",
":",
"return",
":"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/utils/config.py#L491-L509 | [
"def",
"insert_bool",
"(",
"param",
",",
"command_args",
")",
":",
"index",
"=",
"0",
"found",
"=",
"False",
"for",
"lelem",
"in",
"command_args",
":",
"if",
"lelem",
"==",
"'--'",
"and",
"not",
"found",
":",
"break",
"if",
"lelem",
"==",
"param",
":",... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | run | run command | heron/tools/explorer/src/python/help.py | def run(command, parser, args, unknown_args):
""" run command """
# get the command for detailed help
command_help = args['help-command']
# if no command is provided, just print main help
if command_help == 'help':
parser.print_help()
return True
# get the subparser for the specific command
subp... | def run(command, parser, args, unknown_args):
""" run command """
# get the command for detailed help
command_help = args['help-command']
# if no command is provided, just print main help
if command_help == 'help':
parser.print_help()
return True
# get the subparser for the specific command
subp... | [
"run",
"command"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/explorer/src/python/help.py#L48-L65 | [
"def",
"run",
"(",
"command",
",",
"parser",
",",
"args",
",",
"unknown_args",
")",
":",
"# get the command for detailed help",
"command_help",
"=",
"args",
"[",
"'help-command'",
"]",
"# if no command is provided, just print main help",
"if",
"command_help",
"==",
"'he... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | ExceptionSummaryHandler.get | get | heron/tools/tracker/src/python/handlers/exceptionsummaryhandler.py | def get(self):
""" get """
try:
cluster = self.get_argument_cluster()
environ = self.get_argument_environ()
role = self.get_argument_role()
topology_name = self.get_argument_topology()
component = self.get_argument_component()
topology = self.tracker.getTopologyByClusterRoleE... | def get(self):
""" get """
try:
cluster = self.get_argument_cluster()
environ = self.get_argument_environ()
role = self.get_argument_role()
topology_name = self.get_argument_topology()
component = self.get_argument_component()
topology = self.tracker.getTopologyByClusterRoleE... | [
"get"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/exceptionsummaryhandler.py#L55-L71 | [
"def",
"get",
"(",
"self",
")",
":",
"try",
":",
"cluster",
"=",
"self",
".",
"get_argument_cluster",
"(",
")",
"environ",
"=",
"self",
".",
"get_argument_environ",
"(",
")",
"role",
"=",
"self",
".",
"get_argument_role",
"(",
")",
"topology_name",
"=",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | ExceptionSummaryHandler.getComponentExceptionSummary | Get the summary of exceptions for component_name and list of instances.
Empty instance list will fetch all exceptions. | heron/tools/tracker/src/python/handlers/exceptionsummaryhandler.py | def getComponentExceptionSummary(self, tmaster, component_name, instances=[], callback=None):
"""
Get the summary of exceptions for component_name and list of instances.
Empty instance list will fetch all exceptions.
"""
if not tmaster or not tmaster.host or not tmaster.stats_port:
return
... | def getComponentExceptionSummary(self, tmaster, component_name, instances=[], callback=None):
"""
Get the summary of exceptions for component_name and list of instances.
Empty instance list will fetch all exceptions.
"""
if not tmaster or not tmaster.host or not tmaster.stats_port:
return
... | [
"Get",
"the",
"summary",
"of",
"exceptions",
"for",
"component_name",
"and",
"list",
"of",
"instances",
".",
"Empty",
"instance",
"list",
"will",
"fetch",
"all",
"exceptions",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/exceptionsummaryhandler.py#L75-L129 | [
"def",
"getComponentExceptionSummary",
"(",
"self",
",",
"tmaster",
",",
"component_name",
",",
"instances",
"=",
"[",
"]",
",",
"callback",
"=",
"None",
")",
":",
"if",
"not",
"tmaster",
"or",
"not",
"tmaster",
".",
"host",
"or",
"not",
"tmaster",
".",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | TopologyConfigHandler.get | :param cluster:
:param environ:
:param topology:
:return: | heron/tools/ui/src/python/handlers/topology.py | def get(self, cluster, environ, topology):
'''
:param cluster:
:param environ:
:param topology:
:return:
'''
# pylint: disable=no-member
options = dict(
cluster=cluster,
environ=environ,
topology=topology,
active="topologies",
function=common.class... | def get(self, cluster, environ, topology):
'''
:param cluster:
:param environ:
:param topology:
:return:
'''
# pylint: disable=no-member
options = dict(
cluster=cluster,
environ=environ,
topology=topology,
active="topologies",
function=common.class... | [
":",
"param",
"cluster",
":",
":",
"param",
"environ",
":",
":",
"param",
"topology",
":",
":",
"return",
":"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/ui/src/python/handlers/topology.py#L44-L59 | [
"def",
"get",
"(",
"self",
",",
"cluster",
",",
"environ",
",",
"topology",
")",
":",
"# pylint: disable=no-member",
"options",
"=",
"dict",
"(",
"cluster",
"=",
"cluster",
",",
"environ",
"=",
"environ",
",",
"topology",
"=",
"topology",
",",
"active",
"=... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | ListTopologiesHandler.get | :return: | heron/tools/ui/src/python/handlers/topology.py | def get(self):
'''
:return:
'''
clusters = yield access.get_clusters()
# pylint: disable=no-member
options = dict(
topologies=[], # no topologies
clusters=[str(cluster) for cluster in clusters],
active="topologies", # active icon the nav bar
function=common.cla... | def get(self):
'''
:return:
'''
clusters = yield access.get_clusters()
# pylint: disable=no-member
options = dict(
topologies=[], # no topologies
clusters=[str(cluster) for cluster in clusters],
active="topologies", # active icon the nav bar
function=common.cla... | [
":",
"return",
":"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/ui/src/python/handlers/topology.py#L99-L115 | [
"def",
"get",
"(",
"self",
")",
":",
"clusters",
"=",
"yield",
"access",
".",
"get_clusters",
"(",
")",
"# pylint: disable=no-member",
"options",
"=",
"dict",
"(",
"topologies",
"=",
"[",
"]",
",",
"# no topologies",
"clusters",
"=",
"[",
"str",
"(",
"clus... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | TopologyPlanHandler.get | :param cluster:
:param environ:
:param topology:
:return: | heron/tools/ui/src/python/handlers/topology.py | def get(self, cluster, environ, topology):
'''
:param cluster:
:param environ:
:param topology:
:return:
'''
# fetch the execution of the topology asynchronously
execution_state = yield access.get_execution_state(cluster, environ, topology)
# fetch scheduler location of the topolog... | def get(self, cluster, environ, topology):
'''
:param cluster:
:param environ:
:param topology:
:return:
'''
# fetch the execution of the topology asynchronously
execution_state = yield access.get_execution_state(cluster, environ, topology)
# fetch scheduler location of the topolog... | [
":",
"param",
"cluster",
":",
":",
"param",
"environ",
":",
":",
"param",
"topology",
":",
":",
"return",
":"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/ui/src/python/handlers/topology.py#L126-L161 | [
"def",
"get",
"(",
"self",
",",
"cluster",
",",
"environ",
",",
"topology",
")",
":",
"# fetch the execution of the topology asynchronously",
"execution_state",
"=",
"yield",
"access",
".",
"get_execution_state",
"(",
"cluster",
",",
"environ",
",",
"topology",
")",... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | ContainerFileHandler.get | :param cluster:
:param environ:
:param topology:
:param container:
:return: | heron/tools/ui/src/python/handlers/topology.py | def get(self, cluster, environ, topology, container):
'''
:param cluster:
:param environ:
:param topology:
:param container:
:return:
'''
path = self.get_argument("path")
options = dict(
cluster=cluster,
environ=environ,
topology=topology,
container=c... | def get(self, cluster, environ, topology, container):
'''
:param cluster:
:param environ:
:param topology:
:param container:
:return:
'''
path = self.get_argument("path")
options = dict(
cluster=cluster,
environ=environ,
topology=topology,
container=c... | [
":",
"param",
"cluster",
":",
":",
"param",
"environ",
":",
":",
"param",
"topology",
":",
":",
"param",
"container",
":",
":",
"return",
":"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/ui/src/python/handlers/topology.py#L176-L195 | [
"def",
"get",
"(",
"self",
",",
"cluster",
",",
"environ",
",",
"topology",
",",
"container",
")",
":",
"path",
"=",
"self",
".",
"get_argument",
"(",
"\"path\"",
")",
"options",
"=",
"dict",
"(",
"cluster",
"=",
"cluster",
",",
"environ",
"=",
"enviro... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | ContainerFileDataHandler.get | :param cluster:
:param environ:
:param topology:
:param container:
:return: | heron/tools/ui/src/python/handlers/topology.py | def get(self, cluster, environ, topology, container):
'''
:param cluster:
:param environ:
:param topology:
:param container:
:return:
'''
offset = self.get_argument("offset")
length = self.get_argument("length")
path = self.get_argument("path")
data = yield access.get_contai... | def get(self, cluster, environ, topology, container):
'''
:param cluster:
:param environ:
:param topology:
:param container:
:return:
'''
offset = self.get_argument("offset")
length = self.get_argument("length")
path = self.get_argument("path")
data = yield access.get_contai... | [
":",
"param",
"cluster",
":",
":",
"param",
"environ",
":",
":",
"param",
"topology",
":",
":",
"param",
"container",
":",
":",
"return",
":"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/ui/src/python/handlers/topology.py#L209-L225 | [
"def",
"get",
"(",
"self",
",",
"cluster",
",",
"environ",
",",
"topology",
",",
"container",
")",
":",
"offset",
"=",
"self",
".",
"get_argument",
"(",
"\"offset\"",
")",
"length",
"=",
"self",
".",
"get_argument",
"(",
"\"length\"",
")",
"path",
"=",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | ContainerFileStatsHandler.get | :param cluster:
:param environ:
:param topology:
:param container:
:return: | heron/tools/ui/src/python/handlers/topology.py | def get(self, cluster, environ, topology, container):
'''
:param cluster:
:param environ:
:param topology:
:param container:
:return:
'''
path = self.get_argument("path", default=".")
data = yield access.get_filestats(cluster, environ, topology, container, path)
options = dict(
... | def get(self, cluster, environ, topology, container):
'''
:param cluster:
:param environ:
:param topology:
:param container:
:return:
'''
path = self.get_argument("path", default=".")
data = yield access.get_filestats(cluster, environ, topology, container, path)
options = dict(
... | [
":",
"param",
"cluster",
":",
":",
"param",
"environ",
":",
":",
"param",
"topology",
":",
":",
"param",
"container",
":",
":",
"return",
":"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/ui/src/python/handlers/topology.py#L239-L258 | [
"def",
"get",
"(",
"self",
",",
"cluster",
",",
"environ",
",",
"topology",
",",
"container",
")",
":",
"path",
"=",
"self",
".",
"get_argument",
"(",
"\"path\"",
",",
"default",
"=",
"\".\"",
")",
"data",
"=",
"yield",
"access",
".",
"get_filestats",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | ContainerFileDownloadHandler.get | :param cluster:
:param environ:
:param topology:
:param container:
:return: | heron/tools/ui/src/python/handlers/topology.py | def get(self, cluster, environ, topology, container):
'''
:param cluster:
:param environ:
:param topology:
:param container:
:return:
'''
# If the file is large, we want to abandon downloading
# if user cancels the requests.
# pylint: disable=attribute-defined-outside-init
se... | def get(self, cluster, environ, topology, container):
'''
:param cluster:
:param environ:
:param topology:
:param container:
:return:
'''
# If the file is large, we want to abandon downloading
# if user cancels the requests.
# pylint: disable=attribute-defined-outside-init
se... | [
":",
"param",
"cluster",
":",
":",
"param",
"environ",
":",
":",
"param",
"topology",
":",
":",
"param",
"container",
":",
":",
"return",
":"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/ui/src/python/handlers/topology.py#L271-L307 | [
"def",
"get",
"(",
"self",
",",
"cluster",
",",
"environ",
",",
"topology",
",",
"container",
")",
":",
"# If the file is large, we want to abandon downloading",
"# if user cancels the requests.",
"# pylint: disable=attribute-defined-outside-init",
"self",
".",
"connection_clos... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | FileStatsHandler.get | get method | heron/shell/src/python/handlers/filestatshandler.py | def get(self, path):
''' get method '''
path = tornado.escape.url_unescape(path)
if not path:
path = "."
# User should not be able to access anything outside
# of the dir that heron-shell is running in. This ensures
# sandboxing. So we don't allow absolute paths and parent
# accessing... | def get(self, path):
''' get method '''
path = tornado.escape.url_unescape(path)
if not path:
path = "."
# User should not be able to access anything outside
# of the dir that heron-shell is running in. This ensures
# sandboxing. So we don't allow absolute paths and parent
# accessing... | [
"get",
"method"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/shell/src/python/handlers/filestatshandler.py#L35-L73 | [
"def",
"get",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"tornado",
".",
"escape",
".",
"url_unescape",
"(",
"path",
")",
"if",
"not",
"path",
":",
"path",
"=",
"\".\"",
"# User should not be able to access anything outside",
"# of the dir that heron-shell i... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Topology.register_watch | Returns the UUID with which the watch is
registered. This UUID can be used to unregister
the watch.
Returns None if watch could not be registered.
The argument 'callback' must be a function that takes
exactly one argument, the topology on which
the watch was triggered.
Note that the watch w... | heron/tools/tracker/src/python/topology.py | def register_watch(self, callback):
"""
Returns the UUID with which the watch is
registered. This UUID can be used to unregister
the watch.
Returns None if watch could not be registered.
The argument 'callback' must be a function that takes
exactly one argument, the topology on which
th... | def register_watch(self, callback):
"""
Returns the UUID with which the watch is
registered. This UUID can be used to unregister
the watch.
Returns None if watch could not be registered.
The argument 'callback' must be a function that takes
exactly one argument, the topology on which
th... | [
"Returns",
"the",
"UUID",
"with",
"which",
"the",
"watch",
"is",
"registered",
".",
"This",
"UUID",
"can",
"be",
"used",
"to",
"unregister",
"the",
"watch",
".",
"Returns",
"None",
"if",
"watch",
"could",
"not",
"be",
"registered",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/topology.py#L61-L93 | [
"def",
"register_watch",
"(",
"self",
",",
"callback",
")",
":",
"RETRY_COUNT",
"=",
"5",
"# Retry in case UID is previously",
"# generated, just in case...",
"for",
"_",
"in",
"range",
"(",
"RETRY_COUNT",
")",
":",
"# Generate a random UUID.",
"uid",
"=",
"uuid",
"... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Topology.unregister_watch | Unregister the watch with the given UUID. | heron/tools/tracker/src/python/topology.py | def unregister_watch(self, uid):
"""
Unregister the watch with the given UUID.
"""
# Do not raise an error if UUID is
# not present in the watches.
Log.info("Unregister a watch with uid: " + str(uid))
self.watches.pop(uid, None) | def unregister_watch(self, uid):
"""
Unregister the watch with the given UUID.
"""
# Do not raise an error if UUID is
# not present in the watches.
Log.info("Unregister a watch with uid: " + str(uid))
self.watches.pop(uid, None) | [
"Unregister",
"the",
"watch",
"with",
"the",
"given",
"UUID",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/topology.py#L95-L102 | [
"def",
"unregister_watch",
"(",
"self",
",",
"uid",
")",
":",
"# Do not raise an error if UUID is",
"# not present in the watches.",
"Log",
".",
"info",
"(",
"\"Unregister a watch with uid: \"",
"+",
"str",
"(",
"uid",
")",
")",
"self",
".",
"watches",
".",
"pop",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Topology.trigger_watches | Call all the callbacks.
If any callback raises an Exception,
unregister the corresponding watch. | heron/tools/tracker/src/python/topology.py | def trigger_watches(self):
"""
Call all the callbacks.
If any callback raises an Exception,
unregister the corresponding watch.
"""
to_remove = []
for uid, callback in self.watches.items():
try:
callback(self)
except Exception as e:
Log.error("Caught exception whi... | def trigger_watches(self):
"""
Call all the callbacks.
If any callback raises an Exception,
unregister the corresponding watch.
"""
to_remove = []
for uid, callback in self.watches.items():
try:
callback(self)
except Exception as e:
Log.error("Caught exception whi... | [
"Call",
"all",
"the",
"callbacks",
".",
"If",
"any",
"callback",
"raises",
"an",
"Exception",
"unregister",
"the",
"corresponding",
"watch",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/topology.py#L104-L120 | [
"def",
"trigger_watches",
"(",
"self",
")",
":",
"to_remove",
"=",
"[",
"]",
"for",
"uid",
",",
"callback",
"in",
"self",
".",
"watches",
".",
"items",
"(",
")",
":",
"try",
":",
"callback",
"(",
"self",
")",
"except",
"Exception",
"as",
"e",
":",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Topology.set_physical_plan | set physical plan | heron/tools/tracker/src/python/topology.py | def set_physical_plan(self, physical_plan):
""" set physical plan """
if not physical_plan:
self.physical_plan = None
self.id = None
else:
self.physical_plan = physical_plan
self.id = physical_plan.topology.id
self.trigger_watches() | def set_physical_plan(self, physical_plan):
""" set physical plan """
if not physical_plan:
self.physical_plan = None
self.id = None
else:
self.physical_plan = physical_plan
self.id = physical_plan.topology.id
self.trigger_watches() | [
"set",
"physical",
"plan"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/topology.py#L122-L130 | [
"def",
"set_physical_plan",
"(",
"self",
",",
"physical_plan",
")",
":",
"if",
"not",
"physical_plan",
":",
"self",
".",
"physical_plan",
"=",
"None",
"self",
".",
"id",
"=",
"None",
"else",
":",
"self",
".",
"physical_plan",
"=",
"physical_plan",
"self",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Topology.set_packing_plan | set packing plan | heron/tools/tracker/src/python/topology.py | def set_packing_plan(self, packing_plan):
""" set packing plan """
if not packing_plan:
self.packing_plan = None
self.id = None
else:
self.packing_plan = packing_plan
self.id = packing_plan.id
self.trigger_watches() | def set_packing_plan(self, packing_plan):
""" set packing plan """
if not packing_plan:
self.packing_plan = None
self.id = None
else:
self.packing_plan = packing_plan
self.id = packing_plan.id
self.trigger_watches() | [
"set",
"packing",
"plan"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/topology.py#L132-L140 | [
"def",
"set_packing_plan",
"(",
"self",
",",
"packing_plan",
")",
":",
"if",
"not",
"packing_plan",
":",
"self",
".",
"packing_plan",
"=",
"None",
"self",
".",
"id",
"=",
"None",
"else",
":",
"self",
".",
"packing_plan",
"=",
"packing_plan",
"self",
".",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Topology.set_execution_state | set exectuion state | heron/tools/tracker/src/python/topology.py | def set_execution_state(self, execution_state):
""" set exectuion state """
if not execution_state:
self.execution_state = None
self.cluster = None
self.environ = None
else:
self.execution_state = execution_state
cluster, environ = self.get_execution_state_dc_environ(execution_... | def set_execution_state(self, execution_state):
""" set exectuion state """
if not execution_state:
self.execution_state = None
self.cluster = None
self.environ = None
else:
self.execution_state = execution_state
cluster, environ = self.get_execution_state_dc_environ(execution_... | [
"set",
"exectuion",
"state"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/topology.py#L150-L162 | [
"def",
"set_execution_state",
"(",
"self",
",",
"execution_state",
")",
":",
"if",
"not",
"execution_state",
":",
"self",
".",
"execution_state",
"=",
"None",
"self",
".",
"cluster",
"=",
"None",
"self",
".",
"environ",
"=",
"None",
"else",
":",
"self",
".... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Topology.num_instances | Number of spouts + bolts | heron/tools/tracker/src/python/topology.py | def num_instances(self):
"""
Number of spouts + bolts
"""
num = 0
# Get all the components
components = self.spouts() + self.bolts()
# Get instances for each worker
for component in components:
config = component.comp.config
for kvs in config.kvs:
if kvs.key == api_... | def num_instances(self):
"""
Number of spouts + bolts
"""
num = 0
# Get all the components
components = self.spouts() + self.bolts()
# Get instances for each worker
for component in components:
config = component.comp.config
for kvs in config.kvs:
if kvs.key == api_... | [
"Number",
"of",
"spouts",
"+",
"bolts"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/topology.py#L174-L191 | [
"def",
"num_instances",
"(",
"self",
")",
":",
"num",
"=",
"0",
"# Get all the components",
"components",
"=",
"self",
".",
"spouts",
"(",
")",
"+",
"self",
".",
"bolts",
"(",
")",
"# Get instances for each worker",
"for",
"component",
"in",
"components",
":",... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Topology.get_machines | Get all the machines that this topology is running on.
These are the hosts of all the stmgrs. | heron/tools/tracker/src/python/topology.py | def get_machines(self):
"""
Get all the machines that this topology is running on.
These are the hosts of all the stmgrs.
"""
if self.physical_plan:
stmgrs = list(self.physical_plan.stmgrs)
return map(lambda s: s.host_name, stmgrs)
return [] | def get_machines(self):
"""
Get all the machines that this topology is running on.
These are the hosts of all the stmgrs.
"""
if self.physical_plan:
stmgrs = list(self.physical_plan.stmgrs)
return map(lambda s: s.host_name, stmgrs)
return [] | [
"Get",
"all",
"the",
"machines",
"that",
"this",
"topology",
"is",
"running",
"on",
".",
"These",
"are",
"the",
"hosts",
"of",
"all",
"the",
"stmgrs",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/topology.py#L221-L229 | [
"def",
"get_machines",
"(",
"self",
")",
":",
"if",
"self",
".",
"physical_plan",
":",
"stmgrs",
"=",
"list",
"(",
"self",
".",
"physical_plan",
".",
"stmgrs",
")",
"return",
"map",
"(",
"lambda",
"s",
":",
"s",
".",
"host_name",
",",
"stmgrs",
")",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Topology.get_status | Get the current state of this topology.
The state values are from the topology.proto
RUNNING = 1, PAUSED = 2, KILLED = 3
if the state is None "Unknown" is returned. | heron/tools/tracker/src/python/topology.py | def get_status(self):
"""
Get the current state of this topology.
The state values are from the topology.proto
RUNNING = 1, PAUSED = 2, KILLED = 3
if the state is None "Unknown" is returned.
"""
status = None
if self.physical_plan and self.physical_plan.topology:
status = self.phys... | def get_status(self):
"""
Get the current state of this topology.
The state values are from the topology.proto
RUNNING = 1, PAUSED = 2, KILLED = 3
if the state is None "Unknown" is returned.
"""
status = None
if self.physical_plan and self.physical_plan.topology:
status = self.phys... | [
"Get",
"the",
"current",
"state",
"of",
"this",
"topology",
".",
"The",
"state",
"values",
"are",
"from",
"the",
"topology",
".",
"proto",
"RUNNING",
"=",
"1",
"PAUSED",
"=",
"2",
"KILLED",
"=",
"3",
"if",
"the",
"state",
"is",
"None",
"Unknown",
"is",... | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/topology.py#L231-L249 | [
"def",
"get_status",
"(",
"self",
")",
":",
"status",
"=",
"None",
"if",
"self",
".",
"physical_plan",
"and",
"self",
".",
"physical_plan",
".",
"topology",
":",
"status",
"=",
"self",
".",
"physical_plan",
".",
"topology",
".",
"state",
"if",
"status",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | convert_pb_kvs | converts pb kvs to dict | heron/tools/tracker/src/python/tracker.py | def convert_pb_kvs(kvs, include_non_primitives=True):
"""
converts pb kvs to dict
"""
config = {}
for kv in kvs:
if kv.value:
config[kv.key] = kv.value
elif kv.serialized_value:
# add serialized_value support for python values (fixme)
# is this a serialized java object
if topo... | def convert_pb_kvs(kvs, include_non_primitives=True):
"""
converts pb kvs to dict
"""
config = {}
for kv in kvs:
if kv.value:
config[kv.key] = kv.value
elif kv.serialized_value:
# add serialized_value support for python values (fixme)
# is this a serialized java object
if topo... | [
"converts",
"pb",
"kvs",
"to",
"dict"
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L39-L57 | [
"def",
"convert_pb_kvs",
"(",
"kvs",
",",
"include_non_primitives",
"=",
"True",
")",
":",
"config",
"=",
"{",
"}",
"for",
"kv",
"in",
"kvs",
":",
"if",
"kv",
".",
"value",
":",
"config",
"[",
"kv",
".",
"key",
"]",
"=",
"kv",
".",
"value",
"elif",... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Tracker.synch_topologies | Sync the topologies with the statemgrs. | heron/tools/tracker/src/python/tracker.py | def synch_topologies(self):
"""
Sync the topologies with the statemgrs.
"""
self.state_managers = statemanagerfactory.get_all_state_managers(self.config.statemgr_config)
try:
for state_manager in self.state_managers:
state_manager.start()
except Exception as ex:
Log.error("Fo... | def synch_topologies(self):
"""
Sync the topologies with the statemgrs.
"""
self.state_managers = statemanagerfactory.get_all_state_managers(self.config.statemgr_config)
try:
for state_manager in self.state_managers:
state_manager.start()
except Exception as ex:
Log.error("Fo... | [
"Sync",
"the",
"topologies",
"with",
"the",
"statemgrs",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L119-L154 | [
"def",
"synch_topologies",
"(",
"self",
")",
":",
"self",
".",
"state_managers",
"=",
"statemanagerfactory",
".",
"get_all_state_managers",
"(",
"self",
".",
"config",
".",
"statemgr_config",
")",
"try",
":",
"for",
"state_manager",
"in",
"self",
".",
"state_man... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Tracker.getTopologyByClusterRoleEnvironAndName | Find and return the topology given its cluster, environ, topology name, and
an optional role.
Raises exception if topology is not found, or more than one are found. | heron/tools/tracker/src/python/tracker.py | def getTopologyByClusterRoleEnvironAndName(self, cluster, role, environ, topologyName):
"""
Find and return the topology given its cluster, environ, topology name, and
an optional role.
Raises exception if topology is not found, or more than one are found.
"""
topologies = list(filter(lambda t: ... | def getTopologyByClusterRoleEnvironAndName(self, cluster, role, environ, topologyName):
"""
Find and return the topology given its cluster, environ, topology name, and
an optional role.
Raises exception if topology is not found, or more than one are found.
"""
topologies = list(filter(lambda t: ... | [
"Find",
"and",
"return",
"the",
"topology",
"given",
"its",
"cluster",
"environ",
"topology",
"name",
"and",
"an",
"optional",
"role",
".",
"Raises",
"exception",
"if",
"topology",
"is",
"not",
"found",
"or",
"more",
"than",
"one",
"are",
"found",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L161-L180 | [
"def",
"getTopologyByClusterRoleEnvironAndName",
"(",
"self",
",",
"cluster",
",",
"role",
",",
"environ",
",",
"topologyName",
")",
":",
"topologies",
"=",
"list",
"(",
"filter",
"(",
"lambda",
"t",
":",
"t",
".",
"name",
"==",
"topologyName",
"and",
"t",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Tracker.getTopologiesForStateLocation | Returns all the topologies for a given state manager. | heron/tools/tracker/src/python/tracker.py | def getTopologiesForStateLocation(self, name):
"""
Returns all the topologies for a given state manager.
"""
return filter(lambda t: t.state_manager_name == name, self.topologies) | def getTopologiesForStateLocation(self, name):
"""
Returns all the topologies for a given state manager.
"""
return filter(lambda t: t.state_manager_name == name, self.topologies) | [
"Returns",
"all",
"the",
"topologies",
"for",
"a",
"given",
"state",
"manager",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L182-L186 | [
"def",
"getTopologiesForStateLocation",
"(",
"self",
",",
"name",
")",
":",
"return",
"filter",
"(",
"lambda",
"t",
":",
"t",
".",
"state_manager_name",
"==",
"name",
",",
"self",
".",
"topologies",
")"
] | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Tracker.addNewTopology | Adds a topology in the local cache, and sets a watch
on any changes on the topology. | heron/tools/tracker/src/python/tracker.py | def addNewTopology(self, state_manager, topologyName):
"""
Adds a topology in the local cache, and sets a watch
on any changes on the topology.
"""
topology = Topology(topologyName, state_manager.name)
Log.info("Adding new topology: %s, state_manager: %s",
topologyName, state_manage... | def addNewTopology(self, state_manager, topologyName):
"""
Adds a topology in the local cache, and sets a watch
on any changes on the topology.
"""
topology = Topology(topologyName, state_manager.name)
Log.info("Adding new topology: %s, state_manager: %s",
topologyName, state_manage... | [
"Adds",
"a",
"topology",
"in",
"the",
"local",
"cache",
"and",
"sets",
"a",
"watch",
"on",
"any",
"changes",
"on",
"the",
"topology",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L188-L242 | [
"def",
"addNewTopology",
"(",
"self",
",",
"state_manager",
",",
"topologyName",
")",
":",
"topology",
"=",
"Topology",
"(",
"topologyName",
",",
"state_manager",
".",
"name",
")",
"Log",
".",
"info",
"(",
"\"Adding new topology: %s, state_manager: %s\"",
",",
"to... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Tracker.removeTopology | Removes the topology from the local cache. | heron/tools/tracker/src/python/tracker.py | def removeTopology(self, topology_name, state_manager_name):
"""
Removes the topology from the local cache.
"""
topologies = []
for top in self.topologies:
if (top.name == topology_name and
top.state_manager_name == state_manager_name):
# Remove topologyInfo
if (topol... | def removeTopology(self, topology_name, state_manager_name):
"""
Removes the topology from the local cache.
"""
topologies = []
for top in self.topologies:
if (top.name == topology_name and
top.state_manager_name == state_manager_name):
# Remove topologyInfo
if (topol... | [
"Removes",
"the",
"topology",
"from",
"the",
"local",
"cache",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L244-L258 | [
"def",
"removeTopology",
"(",
"self",
",",
"topology_name",
",",
"state_manager_name",
")",
":",
"topologies",
"=",
"[",
"]",
"for",
"top",
"in",
"self",
".",
"topologies",
":",
"if",
"(",
"top",
".",
"name",
"==",
"topology_name",
"and",
"top",
".",
"st... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Tracker.extract_execution_state | Returns the repesentation of execution state that will
be returned from Tracker. | heron/tools/tracker/src/python/tracker.py | def extract_execution_state(self, topology):
"""
Returns the repesentation of execution state that will
be returned from Tracker.
"""
execution_state = topology.execution_state
executionState = {
"cluster": execution_state.cluster,
"environ": execution_state.environ,
"ro... | def extract_execution_state(self, topology):
"""
Returns the repesentation of execution state that will
be returned from Tracker.
"""
execution_state = topology.execution_state
executionState = {
"cluster": execution_state.cluster,
"environ": execution_state.environ,
"ro... | [
"Returns",
"the",
"repesentation",
"of",
"execution",
"state",
"that",
"will",
"be",
"returned",
"from",
"Tracker",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L260-L288 | [
"def",
"extract_execution_state",
"(",
"self",
",",
"topology",
")",
":",
"execution_state",
"=",
"topology",
".",
"execution_state",
"executionState",
"=",
"{",
"\"cluster\"",
":",
"execution_state",
".",
"cluster",
",",
"\"environ\"",
":",
"execution_state",
".",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Tracker.extract_scheduler_location | Returns the representation of scheduler location that will
be returned from Tracker. | heron/tools/tracker/src/python/tracker.py | def extract_scheduler_location(self, topology):
"""
Returns the representation of scheduler location that will
be returned from Tracker.
"""
schedulerLocation = {
"name": None,
"http_endpoint": None,
"job_page_link": None,
}
if topology.scheduler_location:
sche... | def extract_scheduler_location(self, topology):
"""
Returns the representation of scheduler location that will
be returned from Tracker.
"""
schedulerLocation = {
"name": None,
"http_endpoint": None,
"job_page_link": None,
}
if topology.scheduler_location:
sche... | [
"Returns",
"the",
"representation",
"of",
"scheduler",
"location",
"that",
"will",
"be",
"returned",
"from",
"Tracker",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L335-L353 | [
"def",
"extract_scheduler_location",
"(",
"self",
",",
"topology",
")",
":",
"schedulerLocation",
"=",
"{",
"\"name\"",
":",
"None",
",",
"\"http_endpoint\"",
":",
"None",
",",
"\"job_page_link\"",
":",
"None",
",",
"}",
"if",
"topology",
".",
"scheduler_locatio... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
valid | Tracker.extract_tmaster | Returns the representation of tmaster that will
be returned from Tracker. | heron/tools/tracker/src/python/tracker.py | def extract_tmaster(self, topology):
"""
Returns the representation of tmaster that will
be returned from Tracker.
"""
tmasterLocation = {
"name": None,
"id": None,
"host": None,
"controller_port": None,
"master_port": None,
"stats_port": None,
}
... | def extract_tmaster(self, topology):
"""
Returns the representation of tmaster that will
be returned from Tracker.
"""
tmasterLocation = {
"name": None,
"id": None,
"host": None,
"controller_port": None,
"master_port": None,
"stats_port": None,
}
... | [
"Returns",
"the",
"representation",
"of",
"tmaster",
"that",
"will",
"be",
"returned",
"from",
"Tracker",
"."
] | apache/incubator-heron | python | https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/tracker.py#L355-L376 | [
"def",
"extract_tmaster",
"(",
"self",
",",
"topology",
")",
":",
"tmasterLocation",
"=",
"{",
"\"name\"",
":",
"None",
",",
"\"id\"",
":",
"None",
",",
"\"host\"",
":",
"None",
",",
"\"controller_port\"",
":",
"None",
",",
"\"master_port\"",
":",
"None",
... | ad10325a0febe89ad337e561ebcbe37ec5d9a5ac |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.