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
load_pex
Loads pex file and its dependencies to the current python path
heron/common/src/python/pex_loader.py
def load_pex(path_to_pex, include_deps=True): """Loads pex file and its dependencies to the current python path""" abs_path_to_pex = os.path.abspath(path_to_pex) Log.debug("Add a pex to the path: %s" % abs_path_to_pex) if abs_path_to_pex not in sys.path: sys.path.insert(0, os.path.dirname(abs_path_to_pex)) ...
def load_pex(path_to_pex, include_deps=True): """Loads pex file and its dependencies to the current python path""" abs_path_to_pex = os.path.abspath(path_to_pex) Log.debug("Add a pex to the path: %s" % abs_path_to_pex) if abs_path_to_pex not in sys.path: sys.path.insert(0, os.path.dirname(abs_path_to_pex)) ...
[ "Loads", "pex", "file", "and", "its", "dependencies", "to", "the", "current", "python", "path" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/common/src/python/pex_loader.py#L43-L58
[ "def", "load_pex", "(", "path_to_pex", ",", "include_deps", "=", "True", ")", ":", "abs_path_to_pex", "=", "os", ".", "path", ".", "abspath", "(", "path_to_pex", ")", "Log", ".", "debug", "(", "\"Add a pex to the path: %s\"", "%", "abs_path_to_pex", ")", "if",...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
resolve_heron_suffix_issue
Resolves duplicate package suffix problems When dynamically loading a pex file and a corresponding python class (bolt/spout/topology), if the top level package in which to-be-loaded classes reside is named 'heron', the path conflicts with this Heron Instance pex package (heron.instance.src.python...), making the...
heron/common/src/python/pex_loader.py
def resolve_heron_suffix_issue(abs_pex_path, class_path): """Resolves duplicate package suffix problems When dynamically loading a pex file and a corresponding python class (bolt/spout/topology), if the top level package in which to-be-loaded classes reside is named 'heron', the path conflicts with this Heron ...
def resolve_heron_suffix_issue(abs_pex_path, class_path): """Resolves duplicate package suffix problems When dynamically loading a pex file and a corresponding python class (bolt/spout/topology), if the top level package in which to-be-loaded classes reside is named 'heron', the path conflicts with this Heron ...
[ "Resolves", "duplicate", "package", "suffix", "problems" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/common/src/python/pex_loader.py#L60-L96
[ "def", "resolve_heron_suffix_issue", "(", "abs_pex_path", ",", "class_path", ")", ":", "# import top-level package named `heron` of a given pex file", "importer", "=", "zipimport", ".", "zipimporter", "(", "abs_pex_path", ")", "importer", ".", "load_module", "(", "\"heron\"...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
import_and_get_class
Imports and load a class from a given pex file path and python class name For example, if you want to get a class called `Sample` in /some-path/sample.pex/heron/examples/src/python/sample.py, ``path_to_pex`` needs to be ``/some-path/sample.pex``, and ``python_class_name`` needs to be ``heron.examples.src.pytho...
heron/common/src/python/pex_loader.py
def import_and_get_class(path_to_pex, python_class_name): """Imports and load a class from a given pex file path and python class name For example, if you want to get a class called `Sample` in /some-path/sample.pex/heron/examples/src/python/sample.py, ``path_to_pex`` needs to be ``/some-path/sample.pex``, and...
def import_and_get_class(path_to_pex, python_class_name): """Imports and load a class from a given pex file path and python class name For example, if you want to get a class called `Sample` in /some-path/sample.pex/heron/examples/src/python/sample.py, ``path_to_pex`` needs to be ``/some-path/sample.pex``, and...
[ "Imports", "and", "load", "a", "class", "from", "a", "given", "pex", "file", "path", "and", "python", "class", "name" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/common/src/python/pex_loader.py#L99-L127
[ "def", "import_and_get_class", "(", "path_to_pex", ",", "python_class_name", ")", ":", "abs_path_to_pex", "=", "os", ".", "path", ".", "abspath", "(", "path_to_pex", ")", "Log", ".", "debug", "(", "\"Add a pex to the path: %s\"", "%", "abs_path_to_pex", ")", "Log"...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
Builder.new_source
Adds a new source to the computation DAG
heronpy/streamlet/builder.py
def new_source(self, source): """Adds a new source to the computation DAG""" source_streamlet = None if callable(source): source_streamlet = SupplierStreamlet(source) elif isinstance(source, Generator): source_streamlet = GeneratorStreamlet(source) else: raise RuntimeError("Builde...
def new_source(self, source): """Adds a new source to the computation DAG""" source_streamlet = None if callable(source): source_streamlet = SupplierStreamlet(source) elif isinstance(source, Generator): source_streamlet = GeneratorStreamlet(source) else: raise RuntimeError("Builde...
[ "Adds", "a", "new", "source", "to", "the", "computation", "DAG" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/streamlet/builder.py#L36-L48
[ "def", "new_source", "(", "self", ",", "source", ")", ":", "source_streamlet", "=", "None", "if", "callable", "(", "source", ")", ":", "source_streamlet", "=", "SupplierStreamlet", "(", "source", ")", "elif", "isinstance", "(", "source", ",", "Generator", ")...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
Builder.build
Builds the topology and returns the builder
heronpy/streamlet/builder.py
def build(self, bldr): """Builds the topology and returns the builder""" stage_names = sets.Set() for source in self._sources: source._build(bldr, stage_names) for source in self._sources: if not source._all_built(): raise RuntimeError("Topology cannot be fully built! Are all sources...
def build(self, bldr): """Builds the topology and returns the builder""" stage_names = sets.Set() for source in self._sources: source._build(bldr, stage_names) for source in self._sources: if not source._all_built(): raise RuntimeError("Topology cannot be fully built! Are all sources...
[ "Builds", "the", "topology", "and", "returns", "the", "builder" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/streamlet/builder.py#L51-L58
[ "def", "build", "(", "self", ",", "bldr", ")", ":", "stage_names", "=", "sets", ".", "Set", "(", ")", "for", "source", "in", "self", ".", "_sources", ":", "source", ".", "_build", "(", "bldr", ",", "stage_names", ")", "for", "source", "in", "self", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
FileHandler.get
get method
heron/shell/src/python/handlers/filehandler.py
def get(self, path): """ get method """ t = Template(utils.get_asset("file.html")) if path is None: self.set_status(404) self.write("No such file") self.finish() return if not utils.check_path(path): self.write("Only relative paths are allowed") self.set_status(403) ...
def get(self, path): """ get method """ t = Template(utils.get_asset("file.html")) if path is None: self.set_status(404) self.write("No such file") self.finish() return if not utils.check_path(path): self.write("Only relative paths are allowed") self.set_status(403) ...
[ "get", "method" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/shell/src/python/handlers/filehandler.py#L34-L56
[ "def", "get", "(", "self", ",", "path", ")", ":", "t", "=", "Template", "(", "utils", ".", "get_asset", "(", "\"file.html\"", ")", ")", "if", "path", "is", "None", ":", "self", ".", "set_status", "(", "404", ")", "self", ".", "write", "(", "\"No su...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
load_state_manager_locations
Reads configs to determine which state manager to use and converts them to state manager locations. Handles a subset of config wildcard substitution supported in the substitute method in org.apache.heron.spi.common.Misc.java
heron/statemgrs/src/python/configloader.py
def load_state_manager_locations(cluster, state_manager_config_file='heron-conf/statemgr.yaml', overrides={}): """ Reads configs to determine which state manager to use and converts them to state manager locations. Handles a subset of config wildcard substitution supported in the su...
def load_state_manager_locations(cluster, state_manager_config_file='heron-conf/statemgr.yaml', overrides={}): """ Reads configs to determine which state manager to use and converts them to state manager locations. Handles a subset of config wildcard substitution supported in the su...
[ "Reads", "configs", "to", "determine", "which", "state", "manager", "to", "use", "and", "converts", "them", "to", "state", "manager", "locations", ".", "Handles", "a", "subset", "of", "config", "wildcard", "substitution", "supported", "in", "the", "substitute", ...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/configloader.py#L30-L77
[ "def", "load_state_manager_locations", "(", "cluster", ",", "state_manager_config_file", "=", "'heron-conf/statemgr.yaml'", ",", "overrides", "=", "{", "}", ")", ":", "with", "open", "(", "state_manager_config_file", ",", "'r'", ")", "as", "stream", ":", "config", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
__replace
For each kvp in config, do wildcard substitution on the values
heron/statemgrs/src/python/configloader.py
def __replace(config, wildcards, config_file): """For each kvp in config, do wildcard substitution on the values""" for config_key in config: config_value = config[config_key] original_value = config_value if isinstance(config_value, str): for token in wildcards: if wildcards[token]: ...
def __replace(config, wildcards, config_file): """For each kvp in config, do wildcard substitution on the values""" for config_key in config: config_value = config[config_key] original_value = config_value if isinstance(config_value, str): for token in wildcards: if wildcards[token]: ...
[ "For", "each", "kvp", "in", "config", "do", "wildcard", "substitution", "on", "the", "values" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/statemgrs/src/python/configloader.py#L79-L93
[ "def", "__replace", "(", "config", ",", "wildcards", ",", "config_file", ")", ":", "for", "config_key", "in", "config", ":", "config_value", "=", "config", "[", "config_key", "]", "original_value", "=", "config_value", "if", "isinstance", "(", "config_value", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
get_command_handlers
Create a map of command names and handlers
heron/tools/cli/src/python/main.py
def get_command_handlers(): ''' Create a map of command names and handlers ''' return { 'activate': activate, 'config': hconfig, 'deactivate': deactivate, 'help': cli_help, 'kill': kill, 'restart': restart, 'submit': submit, 'update': update, 'version': vers...
def get_command_handlers(): ''' Create a map of command names and handlers ''' return { 'activate': activate, 'config': hconfig, 'deactivate': deactivate, 'help': cli_help, 'kill': kill, 'restart': restart, 'submit': submit, 'update': update, 'version': vers...
[ "Create", "a", "map", "of", "command", "names", "and", "handlers" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/main.py#L78-L92
[ "def", "get_command_handlers", "(", ")", ":", "return", "{", "'activate'", ":", "activate", ",", "'config'", ":", "hconfig", ",", "'deactivate'", ":", "deactivate", ",", "'help'", ":", "cli_help", ",", "'kill'", ":", "kill", ",", "'restart'", ":", "restart",...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
create_parser
Main parser :return:
heron/tools/cli/src/python/main.py
def create_parser(command_handlers): ''' Main parser :return: ''' parser = argparse.ArgumentParser( prog='heron', epilog=HELP_EPILOG, formatter_class=config.SubcommandHelpFormatter, add_help=True) subparsers = parser.add_subparsers( title="Available commands", metavar='<...
def create_parser(command_handlers): ''' Main parser :return: ''' parser = argparse.ArgumentParser( prog='heron', epilog=HELP_EPILOG, formatter_class=config.SubcommandHelpFormatter, add_help=True) subparsers = parser.add_subparsers( title="Available commands", metavar='<...
[ "Main", "parser", ":", "return", ":" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/main.py#L95-L114
[ "def", "create_parser", "(", "command_handlers", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'heron'", ",", "epilog", "=", "HELP_EPILOG", ",", "formatter_class", "=", "config", ".", "SubcommandHelpFormatter", ",", "add_help", "...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
run
Run the command :param command: :param parser: :param command_args: :param unknown_args: :return:
heron/tools/cli/src/python/main.py
def run(handlers, command, parser, command_args, unknown_args): ''' Run the command :param command: :param parser: :param command_args: :param unknown_args: :return: ''' if command in handlers: return handlers[command].run(command, parser, command_args, unknown_args) else: err_context = 'Un...
def run(handlers, command, parser, command_args, unknown_args): ''' Run the command :param command: :param parser: :param command_args: :param unknown_args: :return: ''' if command in handlers: return handlers[command].run(command, parser, command_args, unknown_args) else: err_context = 'Un...
[ "Run", "the", "command", ":", "param", "command", ":", ":", "param", "parser", ":", ":", "param", "command_args", ":", ":", "param", "unknown_args", ":", ":", "return", ":" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/main.py#L118-L132
[ "def", "run", "(", "handlers", ",", "command", ",", "parser", ",", "command_args", ",", "unknown_args", ")", ":", "if", "command", "in", "handlers", ":", "return", "handlers", "[", "command", "]", ".", "run", "(", "command", ",", "parser", ",", "command_...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
cleanup
:param files: :return:
heron/tools/cli/src/python/main.py
def cleanup(files): ''' :param files: :return: ''' for cur_file in files: if os.path.isdir(cur_file): shutil.rmtree(cur_file) else: shutil.rmtree(os.path.dirname(cur_file))
def cleanup(files): ''' :param files: :return: ''' for cur_file in files: if os.path.isdir(cur_file): shutil.rmtree(cur_file) else: shutil.rmtree(os.path.dirname(cur_file))
[ ":", "param", "files", ":", ":", "return", ":" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/main.py#L134-L143
[ "def", "cleanup", "(", "files", ")", ":", "for", "cur_file", "in", "files", ":", "if", "os", ".", "path", ".", "isdir", "(", "cur_file", ")", ":", "shutil", ".", "rmtree", "(", "cur_file", ")", "else", ":", "shutil", ".", "rmtree", "(", "os", ".", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
server_deployment_mode
check the server deployment mode for the given cluster if it is valid return the valid set of args :param cluster: :param cl_args: :return:
heron/tools/cli/src/python/main.py
def server_deployment_mode(command, parser, cluster, cl_args): ''' check the server deployment mode for the given cluster if it is valid return the valid set of args :param cluster: :param cl_args: :return: ''' # Read the cluster definition, if not found client_confs = cdefs.read_server_mode_cluster_d...
def server_deployment_mode(command, parser, cluster, cl_args): ''' check the server deployment mode for the given cluster if it is valid return the valid set of args :param cluster: :param cl_args: :return: ''' # Read the cluster definition, if not found client_confs = cdefs.read_server_mode_cluster_d...
[ "check", "the", "server", "deployment", "mode", "for", "the", "given", "cluster", "if", "it", "is", "valid", "return", "the", "valid", "set", "of", "args", ":", "param", "cluster", ":", ":", "param", "cl_args", ":", ":", "return", ":" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/main.py#L160-L207
[ "def", "server_deployment_mode", "(", "command", ",", "parser", ",", "cluster", ",", "cl_args", ")", ":", "# Read the cluster definition, if not found", "client_confs", "=", "cdefs", ".", "read_server_mode_cluster_definition", "(", "cluster", ",", "cl_args", ")", "if", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
direct_deployment_mode
check the direct deployment mode for the given cluster if it is valid return the valid set of args :param command: :param parser: :param cluster: :param cl_args: :return:
heron/tools/cli/src/python/main.py
def direct_deployment_mode(command, parser, cluster, cl_args): ''' check the direct deployment mode for the given cluster if it is valid return the valid set of args :param command: :param parser: :param cluster: :param cl_args: :return: ''' cluster = cl_args['cluster'] try: config_path = cl_...
def direct_deployment_mode(command, parser, cluster, cl_args): ''' check the direct deployment mode for the given cluster if it is valid return the valid set of args :param command: :param parser: :param cluster: :param cl_args: :return: ''' cluster = cl_args['cluster'] try: config_path = cl_...
[ "check", "the", "direct", "deployment", "mode", "for", "the", "given", "cluster", "if", "it", "is", "valid", "return", "the", "valid", "set", "of", "args", ":", "param", "command", ":", ":", "param", "parser", ":", ":", "param", "cluster", ":", ":", "p...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/main.py#L211-L261
[ "def", "direct_deployment_mode", "(", "command", ",", "parser", ",", "cluster", ",", "cl_args", ")", ":", "cluster", "=", "cl_args", "[", "'cluster'", "]", "try", ":", "config_path", "=", "cl_args", "[", "'config_path'", "]", "override_config_file", "=", "conf...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
extract_common_args
Extract all the common args for all commands :param command: :param parser: :param cl_args: :return:
heron/tools/cli/src/python/main.py
def extract_common_args(command, parser, cl_args): ''' Extract all the common args for all commands :param command: :param parser: :param cl_args: :return: ''' try: cluster_role_env = cl_args.pop('cluster/[role]/[env]') except KeyError: try: cluster_role_env = cl_args.pop('cluster') # f...
def extract_common_args(command, parser, cl_args): ''' Extract all the common args for all commands :param command: :param parser: :param cl_args: :return: ''' try: cluster_role_env = cl_args.pop('cluster/[role]/[env]') except KeyError: try: cluster_role_env = cl_args.pop('cluster') # f...
[ "Extract", "all", "the", "common", "args", "for", "all", "commands", ":", "param", "command", ":", ":", "param", "parser", ":", ":", "param", "cl_args", ":", ":", "return", ":" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/main.py#L279-L306
[ "def", "extract_common_args", "(", "command", ",", "parser", ",", "cl_args", ")", ":", "try", ":", "cluster_role_env", "=", "cl_args", ".", "pop", "(", "'cluster/[role]/[env]'", ")", "except", "KeyError", ":", "try", ":", "cluster_role_env", "=", "cl_args", "....
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
execute
Run the command :return:
heron/tools/cli/src/python/main.py
def execute(handlers, local_commands): ''' Run the command :return: ''' # verify if the environment variables are correctly set check_environment() # create the argument parser parser = create_parser(handlers) # if no argument is provided, print help and exit if len(sys.argv[1:]) == 0: parser....
def execute(handlers, local_commands): ''' Run the command :return: ''' # verify if the environment variables are correctly set check_environment() # create the argument parser parser = create_parser(handlers) # if no argument is provided, print help and exit if len(sys.argv[1:]) == 0: parser....
[ "Run", "the", "command", ":", "return", ":" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/main.py#L309-L380
[ "def", "execute", "(", "handlers", ",", "local_commands", ")", ":", "# verify if the environment variables are correctly set", "check_environment", "(", ")", "# create the argument parser", "parser", "=", "create_parser", "(", "handlers", ")", "# if no argument is provided, pri...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
MetricsHandler.get
get method
heron/tools/tracker/src/python/handlers/metricshandler.py
def get(self): """ get method """ try: cluster = self.get_argument_cluster() role = self.get_argument_role() environ = self.get_argument_environ() topology_name = self.get_argument_topology() component = self.get_argument_component() metric_names = self.get_required_arguments...
def get(self): """ get method """ try: cluster = self.get_argument_cluster() role = self.get_argument_role() environ = self.get_argument_environ() topology_name = self.get_argument_topology() component = self.get_argument_component() metric_names = self.get_required_arguments...
[ "get", "method" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/metricshandler.py#L57-L80
[ "def", "get", "(", "self", ")", ":", "try", ":", "cluster", "=", "self", ".", "get_argument_cluster", "(", ")", "role", "=", "self", ".", "get_argument_role", "(", ")", "environ", "=", "self", ".", "get_argument_environ", "(", ")", "topology_name", "=", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
MetricsHandler.getComponentMetrics
Get the specified metrics for the given component name of this topology. Returns the following dict on success: { "metrics": { <metricname>: { <instance>: <numeric value>, <instance>: <numeric value>, ... }, ... }, "interval": <numeric value>, ...
heron/tools/tracker/src/python/handlers/metricshandler.py
def getComponentMetrics(self, tmaster, componentName, metricNames, instances, interval, callback=None): """ Get the specified metrics for the given componen...
def getComponentMetrics(self, tmaster, componentName, metricNames, instances, interval, callback=None): """ Get the specified metrics for the given componen...
[ "Get", "the", "specified", "metrics", "for", "the", "given", "component", "name", "of", "this", "topology", ".", "Returns", "the", "following", "dict", "on", "success", ":", "{", "metrics", ":", "{", "<metricname", ">", ":", "{", "<instance", ">", ":", "...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/metricshandler.py#L84-L171
[ "def", "getComponentMetrics", "(", "self", ",", "tmaster", ",", "componentName", ",", "metricNames", ",", "instances", ",", "interval", ",", "callback", "=", "None", ")", ":", "if", "not", "tmaster", "or", "not", "tmaster", ".", "host", "or", "not", "tmast...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
Metrics.floorTimestamps
floor timestamp
heron/tools/tracker/src/python/query_operators.py
def floorTimestamps(self, start, end, timeline): """ floor timestamp """ ret = {} for timestamp, value in timeline.items(): ts = timestamp / 60 * 60 if start <= ts <= end: ret[ts] = value return ret
def floorTimestamps(self, start, end, timeline): """ floor timestamp """ ret = {} for timestamp, value in timeline.items(): ts = timestamp / 60 * 60 if start <= ts <= end: ret[ts] = value return ret
[ "floor", "timestamp" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/query_operators.py#L54-L61
[ "def", "floorTimestamps", "(", "self", ",", "start", ",", "end", ",", "timeline", ")", ":", "ret", "=", "{", "}", "for", "timestamp", ",", "value", "in", "timeline", ".", "items", "(", ")", ":", "ts", "=", "timestamp", "/", "60", "*", "60", "if", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
Metrics.setDefault
set default time
heron/tools/tracker/src/python/query_operators.py
def setDefault(self, constant, start, end): """ set default time """ starttime = start / 60 * 60 if starttime < start: starttime += 60 endtime = end / 60 * 60 while starttime <= endtime: # STREAMCOMP-1559 # Second check is a work around, because the response from tmaster # co...
def setDefault(self, constant, start, end): """ set default time """ starttime = start / 60 * 60 if starttime < start: starttime += 60 endtime = end / 60 * 60 while starttime <= endtime: # STREAMCOMP-1559 # Second check is a work around, because the response from tmaster # co...
[ "set", "default", "time" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/query_operators.py#L63-L77
[ "def", "setDefault", "(", "self", ",", "constant", ",", "start", ",", "end", ")", ":", "starttime", "=", "start", "/", "60", "*", "60", "if", "starttime", "<", "start", ":", "starttime", "+=", "60", "endtime", "=", "end", "/", "60", "*", "60", "whi...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
SlidingWindowBolt.initialize
We initialize the window duration and slide interval
heronpy/api/bolt/window_bolt.py
def initialize(self, config, context): """We initialize the window duration and slide interval """ if SlidingWindowBolt.WINDOW_DURATION_SECS in config: self.window_duration = int(config[SlidingWindowBolt.WINDOW_DURATION_SECS]) else: self.logger.fatal("Window Duration has to be specified in t...
def initialize(self, config, context): """We initialize the window duration and slide interval """ if SlidingWindowBolt.WINDOW_DURATION_SECS in config: self.window_duration = int(config[SlidingWindowBolt.WINDOW_DURATION_SECS]) else: self.logger.fatal("Window Duration has to be specified in t...
[ "We", "initialize", "the", "window", "duration", "and", "slide", "interval" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/bolt/window_bolt.py#L65-L84
[ "def", "initialize", "(", "self", ",", "config", ",", "context", ")", ":", "if", "SlidingWindowBolt", ".", "WINDOW_DURATION_SECS", "in", "config", ":", "self", ".", "window_duration", "=", "int", "(", "config", "[", "SlidingWindowBolt", ".", "WINDOW_DURATION_SEC...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
SlidingWindowBolt.process
Process a single tuple of input We add the (time, tuple) pair into our current_tuples. And then look for expiring elemnents
heronpy/api/bolt/window_bolt.py
def process(self, tup): """Process a single tuple of input We add the (time, tuple) pair into our current_tuples. And then look for expiring elemnents """ curtime = int(time.time()) self.current_tuples.append((tup, curtime)) self._expire(curtime)
def process(self, tup): """Process a single tuple of input We add the (time, tuple) pair into our current_tuples. And then look for expiring elemnents """ curtime = int(time.time()) self.current_tuples.append((tup, curtime)) self._expire(curtime)
[ "Process", "a", "single", "tuple", "of", "input" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/bolt/window_bolt.py#L86-L94
[ "def", "process", "(", "self", ",", "tup", ")", ":", "curtime", "=", "int", "(", "time", ".", "time", "(", ")", ")", "self", ".", "current_tuples", ".", "append", "(", "(", "tup", ",", "curtime", ")", ")", "self", ".", "_expire", "(", "curtime", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
SlidingWindowBolt.process_tick
Called every slide_interval
heronpy/api/bolt/window_bolt.py
def process_tick(self, tup): """Called every slide_interval """ curtime = int(time.time()) window_info = WindowContext(curtime - self.window_duration, curtime) tuple_batch = [] for (tup, tm) in self.current_tuples: tuple_batch.append(tup) self.processWindow(window_info, tuple_batch) ...
def process_tick(self, tup): """Called every slide_interval """ curtime = int(time.time()) window_info = WindowContext(curtime - self.window_duration, curtime) tuple_batch = [] for (tup, tm) in self.current_tuples: tuple_batch.append(tup) self.processWindow(window_info, tuple_batch) ...
[ "Called", "every", "slide_interval" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/bolt/window_bolt.py#L106-L115
[ "def", "process_tick", "(", "self", ",", "tup", ")", ":", "curtime", "=", "int", "(", "time", ".", "time", "(", ")", ")", "window_info", "=", "WindowContext", "(", "curtime", "-", "self", ".", "window_duration", ",", "curtime", ")", "tuple_batch", "=", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
TumblingWindowBolt.initialize
We initialize the window duration and slide interval
heronpy/api/bolt/window_bolt.py
def initialize(self, config, context): """We initialize the window duration and slide interval """ if TumblingWindowBolt.WINDOW_DURATION_SECS in config: self.window_duration = int(config[TumblingWindowBolt.WINDOW_DURATION_SECS]) else: self.logger.fatal("Window Duration has to be specified in...
def initialize(self, config, context): """We initialize the window duration and slide interval """ if TumblingWindowBolt.WINDOW_DURATION_SECS in config: self.window_duration = int(config[TumblingWindowBolt.WINDOW_DURATION_SECS]) else: self.logger.fatal("Window Duration has to be specified in...
[ "We", "initialize", "the", "window", "duration", "and", "slide", "interval" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/bolt/window_bolt.py#L151-L164
[ "def", "initialize", "(", "self", ",", "config", ",", "context", ")", ":", "if", "TumblingWindowBolt", ".", "WINDOW_DURATION_SECS", "in", "config", ":", "self", ".", "window_duration", "=", "int", "(", "config", "[", "TumblingWindowBolt", ".", "WINDOW_DURATION_S...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
TumblingWindowBolt.process_tick
Called every window_duration
heronpy/api/bolt/window_bolt.py
def process_tick(self, tup): """Called every window_duration """ curtime = int(time.time()) window_info = WindowContext(curtime - self.window_duration, curtime) self.processWindow(window_info, list(self.current_tuples)) for tup in self.current_tuples: self.ack(tup) self.current_tuples....
def process_tick(self, tup): """Called every window_duration """ curtime = int(time.time()) window_info = WindowContext(curtime - self.window_duration, curtime) self.processWindow(window_info, list(self.current_tuples)) for tup in self.current_tuples: self.ack(tup) self.current_tuples....
[ "Called", "every", "window_duration" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/bolt/window_bolt.py#L175-L183
[ "def", "process_tick", "(", "self", ",", "tup", ")", ":", "curtime", "=", "int", "(", "time", ".", "time", "(", ")", ")", "window_info", "=", "WindowContext", "(", "curtime", "-", "self", ".", "window_duration", ",", "curtime", ")", "self", ".", "proce...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
DownloadHandler.get
get method
heron/shell/src/python/handlers/downloadhandler.py
def get(self, path): """ get method """ logging.debug("request to download: %s", path) # If the file is large, we want to abandon downloading # if user cancels the requests. # pylint: disable=attribute-defined-outside-init self.connection_closed = False self.set_header("Content-Disposition...
def get(self, path): """ get method """ logging.debug("request to download: %s", path) # If the file is large, we want to abandon downloading # if user cancels the requests. # pylint: disable=attribute-defined-outside-init self.connection_closed = False self.set_header("Content-Disposition...
[ "get", "method" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/shell/src/python/handlers/downloadhandler.py#L34-L68
[ "def", "get", "(", "self", ",", "path", ")", ":", "logging", ".", "debug", "(", "\"request to download: %s\"", ",", "path", ")", "# If the file is large, we want to abandon downloading", "# if user cancels the requests.", "# pylint: disable=attribute-defined-outside-init", "sel...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
RuntimeStateHandler.getStmgrsRegSummary
Get summary of stream managers registration summary
heron/tools/tracker/src/python/handlers/runtimestatehandler.py
def getStmgrsRegSummary(self, tmaster, callback=None): """ Get summary of stream managers registration summary """ if not tmaster or not tmaster.host or not tmaster.stats_port: return reg_request = tmaster_pb2.StmgrsRegistrationSummaryRequest() request_str = reg_request.SerializeToString()...
def getStmgrsRegSummary(self, tmaster, callback=None): """ Get summary of stream managers registration summary """ if not tmaster or not tmaster.host or not tmaster.stats_port: return reg_request = tmaster_pb2.StmgrsRegistrationSummaryRequest() request_str = reg_request.SerializeToString()...
[ "Get", "summary", "of", "stream", "managers", "registration", "summary" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/runtimestatehandler.py#L64-L103
[ "def", "getStmgrsRegSummary", "(", "self", ",", "tmaster", ",", "callback", "=", "None", ")", ":", "if", "not", "tmaster", "or", "not", "tmaster", ".", "host", "or", "not", "tmaster", ".", "stats_port", ":", "return", "reg_request", "=", "tmaster_pb2", "."...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
RuntimeStateHandler.get
get method
heron/tools/tracker/src/python/handlers/runtimestatehandler.py
def get(self): """ get method """ try: cluster = self.get_argument_cluster() role = self.get_argument_role() environ = self.get_argument_environ() topology_name = self.get_argument_topology() topology_info = self.tracker.getTopologyInfo(topology_name, cluster, role, environ) ...
def get(self): """ get method """ try: cluster = self.get_argument_cluster() role = self.get_argument_role() environ = self.get_argument_environ() topology_name = self.get_argument_topology() topology_info = self.tracker.getTopologyInfo(topology_name, cluster, role, environ) ...
[ "get", "method" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/runtimestatehandler.py#L106-L124
[ "def", "get", "(", "self", ")", ":", "try", ":", "cluster", "=", "self", ".", "get_argument_cluster", "(", ")", "role", "=", "self", ".", "get_argument_role", "(", ")", "environ", "=", "self", ".", "get_argument_environ", "(", ")", "topology_name", "=", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
atomic_write_file
file.write(...) is not atomic. We write to a tmp file and then rename to target path since rename is atomic. We do this to avoid the content of file is dirty read/partially read by others.
heron/executor/src/python/heron_executor.py
def atomic_write_file(path, content): """ file.write(...) is not atomic. We write to a tmp file and then rename to target path since rename is atomic. We do this to avoid the content of file is dirty read/partially read by others. """ # Write to a randomly tmp file tmp_file = get_tmp_filename() with ope...
def atomic_write_file(path, content): """ file.write(...) is not atomic. We write to a tmp file and then rename to target path since rename is atomic. We do this to avoid the content of file is dirty read/partially read by others. """ # Write to a randomly tmp file tmp_file = get_tmp_filename() with ope...
[ "file", ".", "write", "(", "...", ")", "is", "not", "atomic", ".", "We", "write", "to", "a", "tmp", "file", "and", "then", "rename", "to", "target", "path", "since", "rename", "is", "atomic", ".", "We", "do", "this", "to", "avoid", "the", "content", ...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L116-L131
[ "def", "atomic_write_file", "(", "path", ",", "content", ")", ":", "# Write to a randomly tmp file", "tmp_file", "=", "get_tmp_filename", "(", ")", "with", "open", "(", "tmp_file", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "content", ")", "#...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
setup
Set up log, process and signal handlers
heron/executor/src/python/heron_executor.py
def setup(executor): """Set up log, process and signal handlers""" # pylint: disable=unused-argument def signal_handler(signal_to_handle, frame): # We would do nothing here but just exit # Just catch the SIGTERM and then cleanup(), registered with atexit, would invoke Log.info('signal_handler invoked ...
def setup(executor): """Set up log, process and signal handlers""" # pylint: disable=unused-argument def signal_handler(signal_to_handle, frame): # We would do nothing here but just exit # Just catch the SIGTERM and then cleanup(), registered with atexit, would invoke Log.info('signal_handler invoked ...
[ "Set", "up", "log", "process", "and", "signal", "handlers" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L1154-L1196
[ "def", "setup", "(", "executor", ")", ":", "# pylint: disable=unused-argument", "def", "signal_handler", "(", "signal_to_handle", ",", "frame", ")", ":", "# We would do nothing here but just exit", "# Just catch the SIGTERM and then cleanup(), registered with atexit, would invoke", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
main
Register exit handlers, initialize the executor and run it.
heron/executor/src/python/heron_executor.py
def main(): """Register exit handlers, initialize the executor and run it.""" # Since Heron on YARN runs as headless users, pex compiled # binaries should be exploded into the container working # directory. In order to do this, we need to set the # PEX_ROOT shell environment before forking the processes she...
def main(): """Register exit handlers, initialize the executor and run it.""" # Since Heron on YARN runs as headless users, pex compiled # binaries should be exploded into the container working # directory. In order to do this, we need to set the # PEX_ROOT shell environment before forking the processes she...
[ "Register", "exit", "handlers", "initialize", "the", "executor", "and", "run", "it", "." ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L1210-L1223
[ "def", "main", "(", ")", ":", "# Since Heron on YARN runs as headless users, pex compiled", "# binaries should be exploded into the container working", "# directory. In order to do this, we need to set the", "# PEX_ROOT shell environment before forking the processes", "shell_env", "=", "os", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor.init_from_parsed_args
initialize from parsed arguments
heron/executor/src/python/heron_executor.py
def init_from_parsed_args(self, parsed_args): """ initialize from parsed arguments """ self.shard = parsed_args.shard self.topology_name = parsed_args.topology_name self.topology_id = parsed_args.topology_id self.topology_defn_file = parsed_args.topology_defn_file self.state_manager_connection =...
def init_from_parsed_args(self, parsed_args): """ initialize from parsed arguments """ self.shard = parsed_args.shard self.topology_name = parsed_args.topology_name self.topology_id = parsed_args.topology_id self.topology_defn_file = parsed_args.topology_defn_file self.state_manager_connection =...
[ "initialize", "from", "parsed", "arguments" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L205-L293
[ "def", "init_from_parsed_args", "(", "self", ",", "parsed_args", ")", ":", "self", ".", "shard", "=", "parsed_args", ".", "shard", "self", ".", "topology_name", "=", "parsed_args", ".", "topology_name", "self", ".", "topology_id", "=", "parsed_args", ".", "top...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor.parse_args
Uses python argparse to collect positional args
heron/executor/src/python/heron_executor.py
def parse_args(args): """Uses python argparse to collect positional args""" Log.info("Input args: %r" % args) parser = argparse.ArgumentParser() parser.add_argument("--shard", type=int, required=True) parser.add_argument("--topology-name", required=True) parser.add_argument("--topology-id", re...
def parse_args(args): """Uses python argparse to collect positional args""" Log.info("Input args: %r" % args) parser = argparse.ArgumentParser() parser.add_argument("--shard", type=int, required=True) parser.add_argument("--topology-name", required=True) parser.add_argument("--topology-id", re...
[ "Uses", "python", "argparse", "to", "collect", "positional", "args" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L322-L383
[ "def", "parse_args", "(", "args", ")", ":", "Log", ".", "info", "(", "\"Input args: %r\"", "%", "args", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"--shard\"", ",", "type", "=", "int", ",", "req...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor.initialize
Initialize the environment. Done with a method call outside of the constructor for 2 reasons: 1. Unit tests probably won't want/need to do this 2. We don't initialize the logger (also something unit tests don't want) until after the constructor
heron/executor/src/python/heron_executor.py
def initialize(self): """ Initialize the environment. Done with a method call outside of the constructor for 2 reasons: 1. Unit tests probably won't want/need to do this 2. We don't initialize the logger (also something unit tests don't want) until after the constructor """ create_folders = ...
def initialize(self): """ Initialize the environment. Done with a method call outside of the constructor for 2 reasons: 1. Unit tests probably won't want/need to do this 2. We don't initialize the logger (also something unit tests don't want) until after the constructor """ create_folders = ...
[ "Initialize", "the", "environment", ".", "Done", "with", "a", "method", "call", "outside", "of", "the", "constructor", "for", "2", "reasons", ":", "1", ".", "Unit", "tests", "probably", "won", "t", "want", "/", "need", "to", "do", "this", "2", ".", "We...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L390-L412
[ "def", "initialize", "(", "self", ")", ":", "create_folders", "=", "Command", "(", "'mkdir -p %s'", "%", "self", ".", "log_dir", ",", "self", ".", "shell_env", ")", "self", ".", "run_command_or_exit", "(", "create_folders", ")", "chmod_logs_dir", "=", "Command...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor._get_metricsmgr_cmd
get the command to start the metrics manager processes
heron/executor/src/python/heron_executor.py
def _get_metricsmgr_cmd(self, metricsManagerId, sink_config_file, port): ''' get the command to start the metrics manager processes ''' metricsmgr_main_class = 'org.apache.heron.metricsmgr.MetricsManager' metricsmgr_cmd = [os.path.join(self.heron_java_home, 'bin/java'), # We could not...
def _get_metricsmgr_cmd(self, metricsManagerId, sink_config_file, port): ''' get the command to start the metrics manager processes ''' metricsmgr_main_class = 'org.apache.heron.metricsmgr.MetricsManager' metricsmgr_cmd = [os.path.join(self.heron_java_home, 'bin/java'), # We could not...
[ "get", "the", "command", "to", "start", "the", "metrics", "manager", "processes" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L427-L466
[ "def", "_get_metricsmgr_cmd", "(", "self", ",", "metricsManagerId", ",", "sink_config_file", ",", "port", ")", ":", "metricsmgr_main_class", "=", "'org.apache.heron.metricsmgr.MetricsManager'", "metricsmgr_cmd", "=", "[", "os", ".", "path", ".", "join", "(", "self", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor._get_metrics_cache_cmd
get the command to start the metrics manager processes
heron/executor/src/python/heron_executor.py
def _get_metrics_cache_cmd(self): ''' get the command to start the metrics manager processes ''' metricscachemgr_main_class = 'org.apache.heron.metricscachemgr.MetricsCacheManager' metricscachemgr_cmd = [os.path.join(self.heron_java_home, 'bin/java'), # We could not rely on the d...
def _get_metrics_cache_cmd(self): ''' get the command to start the metrics manager processes ''' metricscachemgr_main_class = 'org.apache.heron.metricscachemgr.MetricsCacheManager' metricscachemgr_cmd = [os.path.join(self.heron_java_home, 'bin/java'), # We could not rely on the d...
[ "get", "the", "command", "to", "start", "the", "metrics", "manager", "processes" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L468-L508
[ "def", "_get_metrics_cache_cmd", "(", "self", ")", ":", "metricscachemgr_main_class", "=", "'org.apache.heron.metricscachemgr.MetricsCacheManager'", "metricscachemgr_cmd", "=", "[", "os", ".", "path", ".", "join", "(", "self", ".", "heron_java_home", ",", "'bin/java'", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor._get_healthmgr_cmd
get the command to start the topology health manager processes
heron/executor/src/python/heron_executor.py
def _get_healthmgr_cmd(self): ''' get the command to start the topology health manager processes ''' healthmgr_main_class = 'org.apache.heron.healthmgr.HealthManager' healthmgr_cmd = [os.path.join(self.heron_java_home, 'bin/java'), # We could not rely on the default -Xmx setting, which...
def _get_healthmgr_cmd(self): ''' get the command to start the topology health manager processes ''' healthmgr_main_class = 'org.apache.heron.healthmgr.HealthManager' healthmgr_cmd = [os.path.join(self.heron_java_home, 'bin/java'), # We could not rely on the default -Xmx setting, which...
[ "get", "the", "command", "to", "start", "the", "topology", "health", "manager", "processes" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L510-L543
[ "def", "_get_healthmgr_cmd", "(", "self", ")", ":", "healthmgr_main_class", "=", "'org.apache.heron.healthmgr.HealthManager'", "healthmgr_cmd", "=", "[", "os", ".", "path", ".", "join", "(", "self", ".", "heron_java_home", ",", "'bin/java'", ")", ",", "# We could no...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor._get_tmaster_processes
get the command to start the tmaster processes
heron/executor/src/python/heron_executor.py
def _get_tmaster_processes(self): ''' get the command to start the tmaster processes ''' retval = {} tmaster_cmd_lst = [ self.tmaster_binary, '--topology_name=%s' % self.topology_name, '--topology_id=%s' % self.topology_id, '--zkhostportlist=%s' % self.state_manager_connectio...
def _get_tmaster_processes(self): ''' get the command to start the tmaster processes ''' retval = {} tmaster_cmd_lst = [ self.tmaster_binary, '--topology_name=%s' % self.topology_name, '--topology_id=%s' % self.topology_id, '--zkhostportlist=%s' % self.state_manager_connectio...
[ "get", "the", "command", "to", "start", "the", "tmaster", "processes" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L545-L588
[ "def", "_get_tmaster_processes", "(", "self", ")", ":", "retval", "=", "{", "}", "tmaster_cmd_lst", "=", "[", "self", ".", "tmaster_binary", ",", "'--topology_name=%s'", "%", "self", ".", "topology_name", ",", "'--topology_id=%s'", "%", "self", ".", "topology_id...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor._get_streaming_processes
Returns the processes to handle streams, including the stream-mgr and the user code containing the stream logic of the topology
heron/executor/src/python/heron_executor.py
def _get_streaming_processes(self): ''' Returns the processes to handle streams, including the stream-mgr and the user code containing the stream logic of the topology ''' retval = {} instance_plans = self._get_instance_plans(self.packing_plan, self.shard) instance_info = [] for instance...
def _get_streaming_processes(self): ''' Returns the processes to handle streams, including the stream-mgr and the user code containing the stream logic of the topology ''' retval = {} instance_plans = self._get_instance_plans(self.packing_plan, self.shard) instance_info = [] for instance...
[ "Returns", "the", "processes", "to", "handle", "streams", "including", "the", "stream", "-", "mgr", "and", "the", "user", "code", "containing", "the", "stream", "logic", "of", "the", "topology" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L774-L841
[ "def", "_get_streaming_processes", "(", "self", ")", ":", "retval", "=", "{", "}", "instance_plans", "=", "self", ".", "_get_instance_plans", "(", "self", ".", "packing_plan", ",", "self", ".", "shard", ")", "instance_info", "=", "[", "]", "for", "instance_p...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor._get_ckptmgr_process
Get the command to start the checkpoint manager process
heron/executor/src/python/heron_executor.py
def _get_ckptmgr_process(self): ''' Get the command to start the checkpoint manager process''' ckptmgr_main_class = 'org.apache.heron.ckptmgr.CheckpointManager' ckptmgr_ram_mb = self.checkpoint_manager_ram / (1024 * 1024) ckptmgr_cmd = [os.path.join(self.heron_java_home, "bin/java"), ...
def _get_ckptmgr_process(self): ''' Get the command to start the checkpoint manager process''' ckptmgr_main_class = 'org.apache.heron.ckptmgr.CheckpointManager' ckptmgr_ram_mb = self.checkpoint_manager_ram / (1024 * 1024) ckptmgr_cmd = [os.path.join(self.heron_java_home, "bin/java"), ...
[ "Get", "the", "command", "to", "start", "the", "checkpoint", "manager", "process" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L843-L882
[ "def", "_get_ckptmgr_process", "(", "self", ")", ":", "ckptmgr_main_class", "=", "'org.apache.heron.ckptmgr.CheckpointManager'", "ckptmgr_ram_mb", "=", "self", ".", "checkpoint_manager_ram", "/", "(", "1024", "*", "1024", ")", "ckptmgr_cmd", "=", "[", "os", ".", "pa...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor._get_instance_plans
For the given packing_plan, return the container plan with the given container_id. If protobufs supported maps, we could just get the plan by id, but it doesn't so we have a collection of containers to iterate over.
heron/executor/src/python/heron_executor.py
def _get_instance_plans(self, packing_plan, container_id): """ For the given packing_plan, return the container plan with the given container_id. If protobufs supported maps, we could just get the plan by id, but it doesn't so we have a collection of containers to iterate over. """ this_containe...
def _get_instance_plans(self, packing_plan, container_id): """ For the given packing_plan, return the container plan with the given container_id. If protobufs supported maps, we could just get the plan by id, but it doesn't so we have a collection of containers to iterate over. """ this_containe...
[ "For", "the", "given", "packing_plan", "return", "the", "container", "plan", "with", "the", "given", "container_id", ".", "If", "protobufs", "supported", "maps", "we", "could", "just", "get", "the", "plan", "by", "id", "but", "it", "doesn", "t", "so", "we"...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L884-L900
[ "def", "_get_instance_plans", "(", "self", ",", "packing_plan", ",", "container_id", ")", ":", "this_container_plan", "=", "None", "for", "container_plan", "in", "packing_plan", ".", "container_plans", ":", "if", "container_plan", ".", "id", "==", "container_id", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor._get_heron_support_processes
Get a map from all daemon services' name to the command to start them
heron/executor/src/python/heron_executor.py
def _get_heron_support_processes(self): """ Get a map from all daemon services' name to the command to start them """ retval = {} retval[self.heron_shell_ids[self.shard]] = Command([ '%s' % self.heron_shell_binary, '--port=%s' % self.shell_port, '--log_file_prefix=%s/heron-shell-%s....
def _get_heron_support_processes(self): """ Get a map from all daemon services' name to the command to start them """ retval = {} retval[self.heron_shell_ids[self.shard]] = Command([ '%s' % self.heron_shell_binary, '--port=%s' % self.shell_port, '--log_file_prefix=%s/heron-shell-%s....
[ "Get", "a", "map", "from", "all", "daemon", "services", "name", "to", "the", "command", "to", "start", "them" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L903-L913
[ "def", "_get_heron_support_processes", "(", "self", ")", ":", "retval", "=", "{", "}", "retval", "[", "self", ".", "heron_shell_ids", "[", "self", ".", "shard", "]", "]", "=", "Command", "(", "[", "'%s'", "%", "self", ".", "heron_shell_binary", ",", "'--...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor._wait_process_std_out_err
Wait for the termination of a process and log its stdout & stderr
heron/executor/src/python/heron_executor.py
def _wait_process_std_out_err(self, name, process): ''' Wait for the termination of a process and log its stdout & stderr ''' proc.stream_process_stdout(process, stdout_log_fn(name)) process.wait()
def _wait_process_std_out_err(self, name, process): ''' Wait for the termination of a process and log its stdout & stderr ''' proc.stream_process_stdout(process, stdout_log_fn(name)) process.wait()
[ "Wait", "for", "the", "termination", "of", "a", "process", "and", "log", "its", "stdout", "&", "stderr" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L922-L925
[ "def", "_wait_process_std_out_err", "(", "self", ",", "name", ",", "process", ")", ":", "proc", ".", "stream_process_stdout", "(", "process", ",", "stdout_log_fn", "(", "name", ")", ")", "process", ".", "wait", "(", ")" ]
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor._start_processes
Start all commands and add them to the dict of processes to be monitored
heron/executor/src/python/heron_executor.py
def _start_processes(self, commands): """Start all commands and add them to the dict of processes to be monitored """ Log.info("Start processes") processes_to_monitor = {} # First start all the processes for (name, command) in commands.items(): p = self._run_process(name, command) proces...
def _start_processes(self, commands): """Start all commands and add them to the dict of processes to be monitored """ Log.info("Start processes") processes_to_monitor = {} # First start all the processes for (name, command) in commands.items(): p = self._run_process(name, command) proces...
[ "Start", "all", "commands", "and", "add", "them", "to", "the", "dict", "of", "processes", "to", "be", "monitored" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L976-L989
[ "def", "_start_processes", "(", "self", ",", "commands", ")", ":", "Log", ".", "info", "(", "\"Start processes\"", ")", "processes_to_monitor", "=", "{", "}", "# First start all the processes", "for", "(", "name", ",", "command", ")", "in", "commands", ".", "i...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor.start_process_monitor
Monitor all processes in processes_to_monitor dict, restarting any if they fail, up to max_runs times.
heron/executor/src/python/heron_executor.py
def start_process_monitor(self): """ Monitor all processes in processes_to_monitor dict, restarting any if they fail, up to max_runs times. """ # Now wait for any child to die Log.info("Start process monitor") while True: if len(self.processes_to_monitor) > 0: (pid, status) = os.wa...
def start_process_monitor(self): """ Monitor all processes in processes_to_monitor dict, restarting any if they fail, up to max_runs times. """ # Now wait for any child to die Log.info("Start process monitor") while True: if len(self.processes_to_monitor) > 0: (pid, status) = os.wa...
[ "Monitor", "all", "processes", "in", "processes_to_monitor", "dict", "restarting", "any", "if", "they", "fail", "up", "to", "max_runs", "times", "." ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L991-L1023
[ "def", "start_process_monitor", "(", "self", ")", ":", "# Now wait for any child to die", "Log", ".", "info", "(", "\"Start process monitor\"", ")", "while", "True", ":", "if", "len", "(", "self", ".", "processes_to_monitor", ")", ">", "0", ":", "(", "pid", ",...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor.get_commands_to_run
Prepare either TMaster or Streaming commands according to shard. The Shell command is attached to all containers. The empty container plan and non-exist container plan are bypassed.
heron/executor/src/python/heron_executor.py
def get_commands_to_run(self): """ Prepare either TMaster or Streaming commands according to shard. The Shell command is attached to all containers. The empty container plan and non-exist container plan are bypassed. """ # During shutdown the watch might get triggered with the empty packing plan...
def get_commands_to_run(self): """ Prepare either TMaster or Streaming commands according to shard. The Shell command is attached to all containers. The empty container plan and non-exist container plan are bypassed. """ # During shutdown the watch might get triggered with the empty packing plan...
[ "Prepare", "either", "TMaster", "or", "Streaming", "commands", "according", "to", "shard", ".", "The", "Shell", "command", "is", "attached", "to", "all", "containers", ".", "The", "empty", "container", "plan", "and", "non", "-", "exist", "container", "plan", ...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L1025-L1051
[ "def", "get_commands_to_run", "(", "self", ")", ":", "# During shutdown the watch might get triggered with the empty packing plan", "if", "len", "(", "self", ".", "packing_plan", ".", "container_plans", ")", "==", "0", ":", "return", "{", "}", "if", "self", ".", "_g...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor.get_command_changes
Compares the current command with updated command to return a 3-tuple of dicts, keyed by command name: commands_to_kill, commands_to_keep and commands_to_start.
heron/executor/src/python/heron_executor.py
def get_command_changes(self, current_commands, updated_commands): """ Compares the current command with updated command to return a 3-tuple of dicts, keyed by command name: commands_to_kill, commands_to_keep and commands_to_start. """ commands_to_kill = {} commands_to_keep = {} commands_to_...
def get_command_changes(self, current_commands, updated_commands): """ Compares the current command with updated command to return a 3-tuple of dicts, keyed by command name: commands_to_kill, commands_to_keep and commands_to_start. """ commands_to_kill = {} commands_to_keep = {} commands_to_...
[ "Compares", "the", "current", "command", "with", "updated", "command", "to", "return", "a", "3", "-", "tuple", "of", "dicts", "keyed", "by", "command", "name", ":", "commands_to_kill", "commands_to_keep", "and", "commands_to_start", "." ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L1053-L1079
[ "def", "get_command_changes", "(", "self", ",", "current_commands", ",", "updated_commands", ")", ":", "commands_to_kill", "=", "{", "}", "commands_to_keep", "=", "{", "}", "commands_to_start", "=", "{", "}", "# if the current command has a matching command in the updated...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor.launch
Determines the commands to be run and compares them with the existing running commands. Then starts new ones required and kills old ones no longer required.
heron/executor/src/python/heron_executor.py
def launch(self): ''' Determines the commands to be run and compares them with the existing running commands. Then starts new ones required and kills old ones no longer required. ''' with self.process_lock: current_commands = dict(map((lambda process: (process.name, process.command)), ...
def launch(self): ''' Determines the commands to be run and compares them with the existing running commands. Then starts new ones required and kills old ones no longer required. ''' with self.process_lock: current_commands = dict(map((lambda process: (process.name, process.command)), ...
[ "Determines", "the", "commands", "to", "be", "run", "and", "compares", "them", "with", "the", "existing", "running", "commands", ".", "Then", "starts", "new", "ones", "required", "and", "kills", "old", "ones", "no", "longer", "required", "." ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L1081-L1104
[ "def", "launch", "(", "self", ")", ":", "with", "self", ".", "process_lock", ":", "current_commands", "=", "dict", "(", "map", "(", "(", "lambda", "process", ":", "(", "process", ".", "name", ",", "process", ".", "command", ")", ")", ",", "self", "."...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
HeronExecutor.start_state_manager_watches
Receive updates to the packing plan from the statemgrs and update processes as needed.
heron/executor/src/python/heron_executor.py
def start_state_manager_watches(self): """ Receive updates to the packing plan from the statemgrs and update processes as needed. """ Log.info("Start state manager watches") statemgr_config = StateMgrConfig() statemgr_config.set_state_locations(configloader.load_state_manager_locations( ...
def start_state_manager_watches(self): """ Receive updates to the packing plan from the statemgrs and update processes as needed. """ Log.info("Start state manager watches") statemgr_config = StateMgrConfig() statemgr_config.set_state_locations(configloader.load_state_manager_locations( ...
[ "Receive", "updates", "to", "the", "packing", "plan", "from", "the", "statemgrs", "and", "update", "processes", "as", "needed", "." ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L1107-L1147
[ "def", "start_state_manager_watches", "(", "self", ")", ":", "Log", ".", "info", "(", "\"Start state manager watches\"", ")", "statemgr_config", "=", "StateMgrConfig", "(", ")", "statemgr_config", ".", "set_state_locations", "(", "configloader", ".", "load_state_manager...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
Runner.run
Builds the topology and submits it
heronpy/streamlet/runner.py
def run(self, name, config, builder): """Builds the topology and submits it""" if not isinstance(name, str): raise RuntimeError("Name has to be a string type") if not isinstance(config, Config): raise RuntimeError("config has to be a Config type") if not isinstance(builder, Builder): r...
def run(self, name, config, builder): """Builds the topology and submits it""" if not isinstance(name, str): raise RuntimeError("Name has to be a string type") if not isinstance(config, Config): raise RuntimeError("config has to be a Config type") if not isinstance(builder, Builder): r...
[ "Builds", "the", "topology", "and", "submits", "it" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/streamlet/runner.py#L36-L47
[ "def", "run", "(", "self", ",", "name", ",", "config", ",", "builder", ")", ":", "if", "not", "isinstance", "(", "name", ",", "str", ")", ":", "raise", "RuntimeError", "(", "\"Name has to be a string type\"", ")", "if", "not", "isinstance", "(", "config", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
_modules_to_main
Force every module in modList to be placed into main
heronpy/api/cloudpickle.py
def _modules_to_main(modList): """Force every module in modList to be placed into main""" if not modList: return main = sys.modules['__main__'] for modname in modList: if isinstance(modname, str): try: mod = __import__(modname) except Exception: sys.stderr.write( ...
def _modules_to_main(modList): """Force every module in modList to be placed into main""" if not modList: return main = sys.modules['__main__'] for modname in modList: if isinstance(modname, str): try: mod = __import__(modname) except Exception: sys.stderr.write( ...
[ "Force", "every", "module", "in", "modList", "to", "be", "placed", "into", "main" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/cloudpickle.py#L725-L742
[ "def", "_modules_to_main", "(", "modList", ")", ":", "if", "not", "modList", ":", "return", "main", "=", "sys", ".", "modules", "[", "'__main__'", "]", "for", "modname", "in", "modList", ":", "if", "isinstance", "(", "modname", ",", "str", ")", ":", "t...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
_fill_function
Fills in the rest of function data into the skeleton function object that were created via _make_skel_func().
heronpy/api/cloudpickle.py
def _fill_function(func, globalsn, defaults, dictn, module): """ Fills in the rest of function data into the skeleton function object that were created via _make_skel_func(). """ func.__globals__.update(globalsn) func.__defaults__ = defaults func.__dict__ = dictn func.__module__ = module return fu...
def _fill_function(func, globalsn, defaults, dictn, module): """ Fills in the rest of function data into the skeleton function object that were created via _make_skel_func(). """ func.__globals__.update(globalsn) func.__defaults__ = defaults func.__dict__ = dictn func.__module__ = module return fu...
[ "Fills", "in", "the", "rest", "of", "function", "data", "into", "the", "skeleton", "function", "object", "that", "were", "created", "via", "_make_skel_func", "()", "." ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/cloudpickle.py#L754-L763
[ "def", "_fill_function", "(", "func", ",", "globalsn", ",", "defaults", ",", "dictn", ",", "module", ")", ":", "func", ".", "__globals__", ".", "update", "(", "globalsn", ")", "func", ".", "__defaults__", "=", "defaults", "func", ".", "__dict__", "=", "d...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
_make_skel_func
Creates a skeleton function object that contains just the provided code and the correct number of cells in func_closure. All other func attributes (e.g. func_globals) are empty.
heronpy/api/cloudpickle.py
def _make_skel_func(code, closures, base_globals=None): """ Creates a skeleton function object that contains just the provided code and the correct number of cells in func_closure. All other func attributes (e.g. func_globals) are empty. """ closure = _reconstruct_closure(closures) if closures else None ...
def _make_skel_func(code, closures, base_globals=None): """ Creates a skeleton function object that contains just the provided code and the correct number of cells in func_closure. All other func attributes (e.g. func_globals) are empty. """ closure = _reconstruct_closure(closures) if closures else None ...
[ "Creates", "a", "skeleton", "function", "object", "that", "contains", "just", "the", "provided", "code", "and", "the", "correct", "number", "of", "cells", "in", "func_closure", ".", "All", "other", "func", "attributes", "(", "e", ".", "g", ".", "func_globals...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/cloudpickle.py#L774-L785
[ "def", "_make_skel_func", "(", "code", ",", "closures", ",", "base_globals", "=", "None", ")", ":", "closure", "=", "_reconstruct_closure", "(", "closures", ")", "if", "closures", "else", "None", "if", "base_globals", "is", "None", ":", "base_globals", "=", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
_load_class
Loads additional properties into class `cls`.
heronpy/api/cloudpickle.py
def _load_class(cls, d): """ Loads additional properties into class `cls`. """ for k, v in d.items(): if isinstance(k, tuple): typ, k = k if typ == 'property': v = property(*v) elif typ == 'staticmethod': v = staticmethod(v) # pylint: disable=redefined-variable-type e...
def _load_class(cls, d): """ Loads additional properties into class `cls`. """ for k, v in d.items(): if isinstance(k, tuple): typ, k = k if typ == 'property': v = property(*v) elif typ == 'staticmethod': v = staticmethod(v) # pylint: disable=redefined-variable-type e...
[ "Loads", "additional", "properties", "into", "class", "cls", "." ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/cloudpickle.py#L788-L802
[ "def", "_load_class", "(", "cls", ",", "d", ")", ":", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "isinstance", "(", "k", ",", "tuple", ")", ":", "typ", ",", "k", "=", "k", "if", "typ", "==", "'property'", ":", "v", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
CloudPickler.save_module
Save a module as an import
heronpy/api/cloudpickle.py
def save_module(self, obj): """ Save a module as an import """ self.modules.add(obj) self.save_reduce(subimport, (obj.__name__,), obj=obj)
def save_module(self, obj): """ Save a module as an import """ self.modules.add(obj) self.save_reduce(subimport, (obj.__name__,), obj=obj)
[ "Save", "a", "module", "as", "an", "import" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/cloudpickle.py#L176-L181
[ "def", "save_module", "(", "self", ",", "obj", ")", ":", "self", ".", "modules", ".", "add", "(", "obj", ")", "self", ".", "save_reduce", "(", "subimport", ",", "(", "obj", ".", "__name__", ",", ")", ",", "obj", "=", "obj", ")" ]
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
CloudPickler.save_function
Registered with the dispatch to handle all function types. Determines what kind of function obj is (e.g. lambda, defined at interactive prompt, etc) and handles the pickling appropriately.
heronpy/api/cloudpickle.py
def save_function(self, obj, name=None): """ Registered with the dispatch to handle all function types. Determines what kind of function obj is (e.g. lambda, defined at interactive prompt, etc) and handles the pickling appropriately. """ write = self.write if name is None: name = obj.__na...
def save_function(self, obj, name=None): """ Registered with the dispatch to handle all function types. Determines what kind of function obj is (e.g. lambda, defined at interactive prompt, etc) and handles the pickling appropriately. """ write = self.write if name is None: name = obj.__na...
[ "Registered", "with", "the", "dispatch", "to", "handle", "all", "function", "types", ".", "Determines", "what", "kind", "of", "function", "obj", "is", "(", "e", ".", "g", ".", "lambda", "defined", "at", "interactive", "prompt", "etc", ")", "and", "handles"...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/cloudpickle.py#L204-L257
[ "def", "save_function", "(", "self", ",", "obj", ",", "name", "=", "None", ")", ":", "write", "=", "self", ".", "write", "if", "name", "is", "None", ":", "name", "=", "obj", ".", "__name__", "try", ":", "# whichmodule() could fail, see", "# https://bitbuck...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
CloudPickler.save_function_tuple
Pickles an actual func object. A func comprises: code, globals, defaults, closure, and dict. We extract and save these, injecting reducing functions at certain points to recreate the func object. Keep in mind that some of these pieces can contain a ref to the func itself. Thus, a naive save on these ...
heronpy/api/cloudpickle.py
def save_function_tuple(self, func): """ Pickles an actual func object. A func comprises: code, globals, defaults, closure, and dict. We extract and save these, injecting reducing functions at certain points to recreate the func object. Keep in mind that some of these pieces can contain a ref to ...
def save_function_tuple(self, func): """ Pickles an actual func object. A func comprises: code, globals, defaults, closure, and dict. We extract and save these, injecting reducing functions at certain points to recreate the func object. Keep in mind that some of these pieces can contain a ref to ...
[ "Pickles", "an", "actual", "func", "object", ".", "A", "func", "comprises", ":", "code", "globals", "defaults", "closure", "and", "dict", ".", "We", "extract", "and", "save", "these", "injecting", "reducing", "functions", "at", "certain", "points", "to", "re...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/cloudpickle.py#L260-L291
[ "def", "save_function_tuple", "(", "self", ",", "func", ")", ":", "save", "=", "self", ".", "save", "write", "=", "self", ".", "write", "code", ",", "f_globals", ",", "defaults", ",", "closure", ",", "dct", ",", "base_globals", "=", "self", ".", "extra...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
CloudPickler.save_file
Save a file
heronpy/api/cloudpickle.py
def save_file(self, obj): # pylint: disable=too-many-branches """Save a file""" try: import StringIO as pystringIO #we can't use cStringIO as it lacks the name attribute except ImportError: import io as pystringIO # pylint: disable=reimported if not hasattr(obj, 'name') or not hasattr(obj,...
def save_file(self, obj): # pylint: disable=too-many-branches """Save a file""" try: import StringIO as pystringIO #we can't use cStringIO as it lacks the name attribute except ImportError: import io as pystringIO # pylint: disable=reimported if not hasattr(obj, 'name') or not hasattr(obj,...
[ "Save", "a", "file" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heronpy/api/cloudpickle.py#L604-L657
[ "def", "save_file", "(", "self", ",", "obj", ")", ":", "# pylint: disable=too-many-branches", "try", ":", "import", "StringIO", "as", "pystringIO", "#we can't use cStringIO as it lacks the name attribute", "except", "ImportError", ":", "import", "io", "as", "pystringIO", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
tail
Returns last n lines from the filename. No exception handling
scripts/shutils/save-logs.py
def tail(filename, n): """Returns last n lines from the filename. No exception handling""" size = os.path.getsize(filename) with open(filename, "rb") as f: fm = mmap.mmap(f.fileno(), 0, mmap.MAP_SHARED, mmap.PROT_READ) try: for i in xrange(size - 1, -1, -1): if fm[i] == '\n': n ...
def tail(filename, n): """Returns last n lines from the filename. No exception handling""" size = os.path.getsize(filename) with open(filename, "rb") as f: fm = mmap.mmap(f.fileno(), 0, mmap.MAP_SHARED, mmap.PROT_READ) try: for i in xrange(size - 1, -1, -1): if fm[i] == '\n': n ...
[ "Returns", "last", "n", "lines", "from", "the", "filename", ".", "No", "exception", "handling" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/scripts/shutils/save-logs.py#L27-L40
[ "def", "tail", "(", "filename", ",", "n", ")", ":", "size", "=", "os", ".", "path", ".", "getsize", "(", "filename", ")", "with", "open", "(", "filename", ",", "\"rb\"", ")", "as", "f", ":", "fm", "=", "mmap", ".", "mmap", "(", "f", ".", "filen...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
SerializerHelper.get_serializer
Returns a serializer for a given context
heron/instance/src/python/utils/misc/serializer_helper.py
def get_serializer(context): """Returns a serializer for a given context""" cluster_config = context.get_cluster_config() serializer_clsname = cluster_config.get(constants.TOPOLOGY_SERIALIZER_CLASSNAME, None) if serializer_clsname is None: return PythonSerializer() else: try: top...
def get_serializer(context): """Returns a serializer for a given context""" cluster_config = context.get_cluster_config() serializer_clsname = cluster_config.get(constants.TOPOLOGY_SERIALIZER_CLASSNAME, None) if serializer_clsname is None: return PythonSerializer() else: try: top...
[ "Returns", "a", "serializer", "for", "a", "given", "context" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/utils/misc/serializer_helper.py#L32-L47
[ "def", "get_serializer", "(", "context", ")", ":", "cluster_config", "=", "context", ".", "get_cluster_config", "(", ")", "serializer_clsname", "=", "cluster_config", ".", "get", "(", "constants", ".", "TOPOLOGY_SERIALIZER_CLASSNAME", ",", "None", ")", "if", "seri...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
EventLooper._run_once
Run once, should be called only from loop()
heron/instance/src/python/network/event_looper.py
def _run_once(self): """Run once, should be called only from loop()""" try: self.do_wait() self._execute_wakeup_tasks() self._trigger_timers() except Exception as e: Log.error("Error occured during _run_once(): " + str(e)) Log.error(traceback.format_exc()) self.should_exi...
def _run_once(self): """Run once, should be called only from loop()""" try: self.do_wait() self._execute_wakeup_tasks() self._trigger_timers() except Exception as e: Log.error("Error occured during _run_once(): " + str(e)) Log.error(traceback.format_exc()) self.should_exi...
[ "Run", "once", "should", "be", "called", "only", "from", "loop", "()" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/event_looper.py#L67-L76
[ "def", "_run_once", "(", "self", ")", ":", "try", ":", "self", ".", "do_wait", "(", ")", "self", ".", "_execute_wakeup_tasks", "(", ")", "self", ".", "_trigger_timers", "(", ")", "except", "Exception", "as", "e", ":", "Log", ".", "error", "(", "\"Error...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
EventLooper.register_timer_task_in_sec
Registers a new timer task :param task: function to be run at a specified second from now :param second: how many seconds to wait before the timer is triggered
heron/instance/src/python/network/event_looper.py
def register_timer_task_in_sec(self, task, second): """Registers a new timer task :param task: function to be run at a specified second from now :param second: how many seconds to wait before the timer is triggered """ # Python time is in float second_in_float = float(second) expiration = t...
def register_timer_task_in_sec(self, task, second): """Registers a new timer task :param task: function to be run at a specified second from now :param second: how many seconds to wait before the timer is triggered """ # Python time is in float second_in_float = float(second) expiration = t...
[ "Registers", "a", "new", "timer", "task" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/event_looper.py#L113-L122
[ "def", "register_timer_task_in_sec", "(", "self", ",", "task", ",", "second", ")", ":", "# Python time is in float", "second_in_float", "=", "float", "(", "second", ")", "expiration", "=", "time", ".", "time", "(", ")", "+", "second_in_float", "heappush", "(", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
EventLooper._get_next_timeout_interval
Get the next timeout from now This should be used from do_wait(). :returns (float) next_timeout, or 10.0 if there are no timer events
heron/instance/src/python/network/event_looper.py
def _get_next_timeout_interval(self): """Get the next timeout from now This should be used from do_wait(). :returns (float) next_timeout, or 10.0 if there are no timer events """ if len(self.timer_tasks) == 0: return sys.maxsize else: next_timeout_interval = self.timer_tasks[0][0] -...
def _get_next_timeout_interval(self): """Get the next timeout from now This should be used from do_wait(). :returns (float) next_timeout, or 10.0 if there are no timer events """ if len(self.timer_tasks) == 0: return sys.maxsize else: next_timeout_interval = self.timer_tasks[0][0] -...
[ "Get", "the", "next", "timeout", "from", "now" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/event_looper.py#L129-L139
[ "def", "_get_next_timeout_interval", "(", "self", ")", ":", "if", "len", "(", "self", ".", "timer_tasks", ")", "==", "0", ":", "return", "sys", ".", "maxsize", "else", ":", "next_timeout_interval", "=", "self", ".", "timer_tasks", "[", "0", "]", "[", "0"...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
EventLooper._execute_wakeup_tasks
Executes wakeup tasks, should only be called from loop()
heron/instance/src/python/network/event_looper.py
def _execute_wakeup_tasks(self): """Executes wakeup tasks, should only be called from loop()""" # Check the length of wakeup tasks first to avoid concurrent issues size = len(self.wakeup_tasks) for i in range(size): self.wakeup_tasks[i]()
def _execute_wakeup_tasks(self): """Executes wakeup tasks, should only be called from loop()""" # Check the length of wakeup tasks first to avoid concurrent issues size = len(self.wakeup_tasks) for i in range(size): self.wakeup_tasks[i]()
[ "Executes", "wakeup", "tasks", "should", "only", "be", "called", "from", "loop", "()" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/event_looper.py#L141-L146
[ "def", "_execute_wakeup_tasks", "(", "self", ")", ":", "# Check the length of wakeup tasks first to avoid concurrent issues", "size", "=", "len", "(", "self", ".", "wakeup_tasks", ")", "for", "i", "in", "range", "(", "size", ")", ":", "self", ".", "wakeup_tasks", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
EventLooper._trigger_timers
Triggers expired timers
heron/instance/src/python/network/event_looper.py
def _trigger_timers(self): """Triggers expired timers""" current = time.time() while len(self.timer_tasks) > 0 and (self.timer_tasks[0][0] - current <= 0): task = heappop(self.timer_tasks)[1] task()
def _trigger_timers(self): """Triggers expired timers""" current = time.time() while len(self.timer_tasks) > 0 and (self.timer_tasks[0][0] - current <= 0): task = heappop(self.timer_tasks)[1] task()
[ "Triggers", "expired", "timers" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/network/event_looper.py#L148-L153
[ "def", "_trigger_timers", "(", "self", ")", ":", "current", "=", "time", ".", "time", "(", ")", "while", "len", "(", "self", ".", "timer_tasks", ")", ">", "0", "and", "(", "self", ".", "timer_tasks", "[", "0", "]", "[", "0", "]", "-", "current", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
KillExecutorHandler.post
post method
heron/shell/src/python/handlers/killexecutorhandler.py
def post(self): """ post method """ def status_finish(ret): self.set_status(ret) self.finish() def kill_parent(): status_finish(200) logger.info("Killing parent executor") os.killpg(os.getppid(), signal.SIGTERM) logger = logging.getLogger(__file__) logger.info("Receiv...
def post(self): """ post method """ def status_finish(ret): self.set_status(ret) self.finish() def kill_parent(): status_finish(200) logger.info("Killing parent executor") os.killpg(os.getppid(), signal.SIGTERM) logger = logging.getLogger(__file__) logger.info("Receiv...
[ "post", "method" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/shell/src/python/handlers/killexecutorhandler.py#L36-L74
[ "def", "post", "(", "self", ")", ":", "def", "status_finish", "(", "ret", ")", ":", "self", ".", "set_status", "(", "ret", ")", "self", ".", "finish", "(", ")", "def", "kill_parent", "(", ")", ":", "status_finish", "(", "200", ")", "logger", ".", "...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
Query.execute_query
execute query
heron/tools/tracker/src/python/query.py
def execute_query(self, tmaster, query_string, start, end): """ execute query """ if not tmaster: raise Exception("No tmaster found") self.tmaster = tmaster root = self.parse_query_string(query_string) metrics = yield root.execute(self.tracker, self.tmaster, start, end) raise tornado.gen.R...
def execute_query(self, tmaster, query_string, start, end): """ execute query """ if not tmaster: raise Exception("No tmaster found") self.tmaster = tmaster root = self.parse_query_string(query_string) metrics = yield root.execute(self.tracker, self.tmaster, start, end) raise tornado.gen.R...
[ "execute", "query" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/query.py#L57-L64
[ "def", "execute_query", "(", "self", ",", "tmaster", ",", "query_string", ",", "start", ",", "end", ")", ":", "if", "not", "tmaster", ":", "raise", "Exception", "(", "\"No tmaster found\"", ")", "self", ".", "tmaster", "=", "tmaster", "root", "=", "self", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
Query.find_closing_braces
Find the index of the closing braces for the opening braces at the start of the query string. Note that first character of input string must be an opening braces.
heron/tools/tracker/src/python/query.py
def find_closing_braces(self, query): """Find the index of the closing braces for the opening braces at the start of the query string. Note that first character of input string must be an opening braces.""" if query[0] != '(': raise Exception("Trying to find closing braces for no opening braces") ...
def find_closing_braces(self, query): """Find the index of the closing braces for the opening braces at the start of the query string. Note that first character of input string must be an opening braces.""" if query[0] != '(': raise Exception("Trying to find closing braces for no opening braces") ...
[ "Find", "the", "index", "of", "the", "closing", "braces", "for", "the", "opening", "braces", "at", "the", "start", "of", "the", "query", "string", ".", "Note", "that", "first", "character", "of", "input", "string", "must", "be", "an", "opening", "braces", ...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/query.py#L66-L81
[ "def", "find_closing_braces", "(", "self", ",", "query", ")", ":", "if", "query", "[", "0", "]", "!=", "'('", ":", "raise", "Exception", "(", "\"Trying to find closing braces for no opening braces\"", ")", "num_open_braces", "=", "0", "for", "i", "in", "range", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
Query.get_sub_parts
The subparts are seperated by a comma. Make sure that commas inside the part themselves are not considered.
heron/tools/tracker/src/python/query.py
def get_sub_parts(self, query): """The subparts are seperated by a comma. Make sure that commas inside the part themselves are not considered.""" parts = [] num_open_braces = 0 delimiter = ',' last_starting_index = 0 for i in range(len(query)): if query[i] == '(': num_open_brac...
def get_sub_parts(self, query): """The subparts are seperated by a comma. Make sure that commas inside the part themselves are not considered.""" parts = [] num_open_braces = 0 delimiter = ',' last_starting_index = 0 for i in range(len(query)): if query[i] == '(': num_open_brac...
[ "The", "subparts", "are", "seperated", "by", "a", "comma", ".", "Make", "sure", "that", "commas", "inside", "the", "part", "themselves", "are", "not", "considered", "." ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/query.py#L83-L99
[ "def", "get_sub_parts", "(", "self", ",", "query", ")", ":", "parts", "=", "[", "]", "num_open_braces", "=", "0", "delimiter", "=", "','", "last_starting_index", "=", "0", "for", "i", "in", "range", "(", "len", "(", "query", ")", ")", ":", "if", "que...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
Query.parse_query_string
Returns a parse tree for the query, each of the node is a subclass of Operator. This is both a lexical as well as syntax analyzer step.
heron/tools/tracker/src/python/query.py
def parse_query_string(self, query): """Returns a parse tree for the query, each of the node is a subclass of Operator. This is both a lexical as well as syntax analyzer step.""" if not query: return None # Just braces do not matter if query[0] == '(': index = self.find_closing_braces(qu...
def parse_query_string(self, query): """Returns a parse tree for the query, each of the node is a subclass of Operator. This is both a lexical as well as syntax analyzer step.""" if not query: return None # Just braces do not matter if query[0] == '(': index = self.find_closing_braces(qu...
[ "Returns", "a", "parse", "tree", "for", "the", "query", "each", "of", "the", "node", "is", "a", "subclass", "of", "Operator", ".", "This", "is", "both", "a", "lexical", "as", "well", "as", "syntax", "analyzer", "step", "." ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/query.py#L101-L145
[ "def", "parse_query_string", "(", "self", ",", "query", ")", ":", "if", "not", "query", ":", "return", "None", "# Just braces do not matter", "if", "query", "[", "0", "]", "==", "'('", ":", "index", "=", "self", ".", "find_closing_braces", "(", "query", ")...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
MetricsQueryHandler.get
get method
heron/tools/tracker/src/python/handlers/metricsqueryhandler.py
def get(self): """ get method """ try: cluster = self.get_argument_cluster() role = self.get_argument_role() environ = self.get_argument_environ() topology_name = self.get_argument_topology() topology = self.tracker.getTopologyByClusterRoleEnvironAndName( cluster, role, ...
def get(self): """ get method """ try: cluster = self.get_argument_cluster() role = self.get_argument_role() environ = self.get_argument_environ() topology_name = self.get_argument_topology() topology = self.tracker.getTopologyByClusterRoleEnvironAndName( cluster, role, ...
[ "get", "method" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/metricsqueryhandler.py#L53-L74
[ "def", "get", "(", "self", ")", ":", "try", ":", "cluster", "=", "self", ".", "get_argument_cluster", "(", ")", "role", "=", "self", ".", "get_argument_role", "(", ")", "environ", "=", "self", ".", "get_argument_environ", "(", ")", "topology_name", "=", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
MetricsQueryHandler.executeMetricsQuery
Get the specified metrics for the given query in this topology. Returns the following dict on success: { "timeline": [{ "instance": <instance>, "data": { <start_time> : <numeric value>, <start_time> : <numeric value>, ... } }, { ... ...
heron/tools/tracker/src/python/handlers/metricsqueryhandler.py
def executeMetricsQuery(self, tmaster, queryString, start_time, end_time, callback=None): """ Get the specified metrics for the given query in this topology. Returns the following dict on success: { "timeline": [{ "instance": <instance>, "data": { <start_time> : <numeric ...
def executeMetricsQuery(self, tmaster, queryString, start_time, end_time, callback=None): """ Get the specified metrics for the given query in this topology. Returns the following dict on success: { "timeline": [{ "instance": <instance>, "data": { <start_time> : <numeric ...
[ "Get", "the", "specified", "metrics", "for", "the", "given", "query", "in", "this", "topology", ".", "Returns", "the", "following", "dict", "on", "success", ":", "{", "timeline", ":", "[", "{", "instance", ":", "<instance", ">", "data", ":", "{", "<start...
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/tracker/src/python/handlers/metricsqueryhandler.py#L78-L120
[ "def", "executeMetricsQuery", "(", "self", ",", "tmaster", ",", "queryString", ",", "start_time", ",", "end_time", ",", "callback", "=", "None", ")", ":", "query", "=", "Query", "(", "self", ".", "tracker", ")", "metrics", "=", "yield", "query", ".", "ex...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
create_parser
:param subparsers: :return:
heron/tools/cli/src/python/help.py
def create_parser(subparsers): ''' :param subparsers: :return: ''' parser = subparsers.add_parser( 'help', help='Prints help for commands', add_help=True) # pylint: disable=protected-access parser._positionals.title = "Required arguments" parser._optionals.title = "Optional arguments"...
def create_parser(subparsers): ''' :param subparsers: :return: ''' parser = subparsers.add_parser( 'help', help='Prints help for commands', add_help=True) # pylint: disable=protected-access parser._positionals.title = "Required arguments" parser._optionals.title = "Optional arguments"...
[ ":", "param", "subparsers", ":", ":", "return", ":" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/help.py#L26-L47
[ "def", "create_parser", "(", "subparsers", ")", ":", "parser", "=", "subparsers", ".", "add_parser", "(", "'help'", ",", "help", "=", "'Prints help for commands'", ",", "add_help", "=", "True", ")", "# pylint: disable=protected-access", "parser", ".", "_positionals"...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
run
:param command: :param parser: :param args: :param unknown_args: :return:
heron/tools/cli/src/python/help.py
def run(command, parser, args, unknown_args): ''' :param command: :param parser: :param args: :param unknown_args: :return: ''' # 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_hel...
def run(command, parser, args, unknown_args): ''' :param command: :param parser: :param args: :param unknown_args: :return: ''' # 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_hel...
[ ":", "param", "command", ":", ":", "param", "parser", ":", ":", "param", "args", ":", ":", "param", "unknown_args", ":", ":", "return", ":" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/cli/src/python/help.py#L51-L74
[ "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
BoltInstance.emit
Emits a new tuple from this Bolt It is compatible with StreamParse API. :type tup: list or tuple :param tup: the new output Tuple to send from this bolt, should only contain only serializable data. :type stream: str :param stream: the ID of the stream to emit this Tuple to. ...
heron/instance/src/python/basics/bolt_instance.py
def emit(self, tup, stream=Stream.DEFAULT_STREAM_ID, anchors=None, direct_task=None, need_task_ids=False): """Emits a new tuple from this Bolt It is compatible with StreamParse API. :type tup: list or tuple :param tup: the new output Tuple to send from this bolt, should only...
def emit(self, tup, stream=Stream.DEFAULT_STREAM_ID, anchors=None, direct_task=None, need_task_ids=False): """Emits a new tuple from this Bolt It is compatible with StreamParse API. :type tup: list or tuple :param tup: the new output Tuple to send from this bolt, should only...
[ "Emits", "a", "new", "tuple", "from", "this", "Bolt" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/basics/bolt_instance.py#L90-L159
[ "def", "emit", "(", "self", ",", "tup", ",", "stream", "=", "Stream", ".", "DEFAULT_STREAM_ID", ",", "anchors", "=", "None", ",", "direct_task", "=", "None", ",", "need_task_ids", "=", "False", ")", ":", "# first check whether this tuple is sane", "self", ".",...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
BoltInstance.process_incoming_tuples
Should be called when tuple was buffered into in_stream This method is equivalent to ``addBoltTasks()`` but is designed for event-driven single-thread bolt.
heron/instance/src/python/basics/bolt_instance.py
def process_incoming_tuples(self): """Should be called when tuple was buffered into in_stream This method is equivalent to ``addBoltTasks()`` but is designed for event-driven single-thread bolt. """ # back-pressure if self.output_helper.is_out_queue_available(): self._read_tuples_and_exec...
def process_incoming_tuples(self): """Should be called when tuple was buffered into in_stream This method is equivalent to ``addBoltTasks()`` but is designed for event-driven single-thread bolt. """ # back-pressure if self.output_helper.is_out_queue_available(): self._read_tuples_and_exec...
[ "Should", "be", "called", "when", "tuple", "was", "buffered", "into", "in_stream" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/basics/bolt_instance.py#L161-L173
[ "def", "process_incoming_tuples", "(", "self", ")", ":", "# back-pressure", "if", "self", ".", "output_helper", ".", "is_out_queue_available", "(", ")", ":", "self", ".", "_read_tuples_and_execute", "(", ")", "self", ".", "output_helper", ".", "send_out_tuples", "...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
BoltInstance.ack
Indicate that processing of a Tuple has succeeded It is compatible with StreamParse API.
heron/instance/src/python/basics/bolt_instance.py
def ack(self, tup): """Indicate that processing of a Tuple has succeeded It is compatible with StreamParse API. """ if not isinstance(tup, HeronTuple): Log.error("Only HeronTuple type is supported in ack()") return if self.acking_enabled: ack_tuple = tuple_pb2.AckTuple() ac...
def ack(self, tup): """Indicate that processing of a Tuple has succeeded It is compatible with StreamParse API. """ if not isinstance(tup, HeronTuple): Log.error("Only HeronTuple type is supported in ack()") return if self.acking_enabled: ack_tuple = tuple_pb2.AckTuple() ac...
[ "Indicate", "that", "processing", "of", "a", "Tuple", "has", "succeeded" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/basics/bolt_instance.py#L247-L269
[ "def", "ack", "(", "self", ",", "tup", ")", ":", "if", "not", "isinstance", "(", "tup", ",", "HeronTuple", ")", ":", "Log", ".", "error", "(", "\"Only HeronTuple type is supported in ack()\"", ")", "return", "if", "self", ".", "acking_enabled", ":", "ack_tup...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
BoltInstance.fail
Indicate that processing of a Tuple has failed It is compatible with StreamParse API.
heron/instance/src/python/basics/bolt_instance.py
def fail(self, tup): """Indicate that processing of a Tuple has failed It is compatible with StreamParse API. """ if not isinstance(tup, HeronTuple): Log.error("Only HeronTuple type is supported in fail()") return if self.acking_enabled: fail_tuple = tuple_pb2.AckTuple() fa...
def fail(self, tup): """Indicate that processing of a Tuple has failed It is compatible with StreamParse API. """ if not isinstance(tup, HeronTuple): Log.error("Only HeronTuple type is supported in fail()") return if self.acking_enabled: fail_tuple = tuple_pb2.AckTuple() fa...
[ "Indicate", "that", "processing", "of", "a", "Tuple", "has", "failed" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/instance/src/python/basics/bolt_instance.py#L271-L293
[ "def", "fail", "(", "self", ",", "tup", ")", ":", "if", "not", "isinstance", "(", "tup", ",", "HeronTuple", ")", ":", "Log", ".", "error", "(", "\"Only HeronTuple type is supported in fail()\"", ")", "return", "if", "self", ".", "acking_enabled", ":", "fail_...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
execute
Run the command :return:
heron/tools/admin/src/python/main.py
def execute(handlers): ''' Run the command :return: ''' # verify if the environment variables are correctly set check_environment() # create the argument parser parser = create_parser(handlers) # if no argument is provided, print help and exit if len(sys.argv[1:]) == 0: parser.print_help() ...
def execute(handlers): ''' Run the command :return: ''' # verify if the environment variables are correctly set check_environment() # create the argument parser parser = create_parser(handlers) # if no argument is provided, print help and exit if len(sys.argv[1:]) == 0: parser.print_help() ...
[ "Run", "the", "command", ":", "return", ":" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/main.py#L131-L172
[ "def", "execute", "(", "handlers", ")", ":", "# verify if the environment variables are correctly set", "check_environment", "(", ")", "# create the argument parser", "parser", "=", "create_parser", "(", "handlers", ")", "# if no argument is provided, print help and exit", "if", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
create_parser
Create a subparser for the standalone command :param subparsers: :return:
heron/tools/admin/src/python/standalone.py
def create_parser(subparsers): ''' Create a subparser for the standalone command :param subparsers: :return: ''' parser = subparsers.add_parser( 'standalone', help='Start a standalone Heron cluster', add_help=True ) cli_args.add_titles(parser) parser_action = parser.add_subparsers(...
def create_parser(subparsers): ''' Create a subparser for the standalone command :param subparsers: :return: ''' parser = subparsers.add_parser( 'standalone', help='Start a standalone Heron cluster', add_help=True ) cli_args.add_titles(parser) parser_action = parser.add_subparsers(...
[ "Create", "a", "subparser", "for", "the", "standalone", "command", ":", "param", "subparsers", ":", ":", "return", ":" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L69-L158
[ "def", "create_parser", "(", "subparsers", ")", ":", "parser", "=", "subparsers", ".", "add_parser", "(", "'standalone'", ",", "help", "=", "'Start a standalone Heron cluster'", ",", "add_help", "=", "True", ")", "cli_args", ".", "add_titles", "(", "parser", ")"...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
run
runs parser
heron/tools/admin/src/python/standalone.py
def run(command, parser, cl_args, unknown_args): ''' runs parser ''' action = cl_args["action"] if action == Action.SET: call_editor(get_inventory_file(cl_args)) update_config_files(cl_args) elif action == Action.CLUSTER: action_type = cl_args["type"] if action_type == Cluster.START: s...
def run(command, parser, cl_args, unknown_args): ''' runs parser ''' action = cl_args["action"] if action == Action.SET: call_editor(get_inventory_file(cl_args)) update_config_files(cl_args) elif action == Action.CLUSTER: action_type = cl_args["type"] if action_type == Cluster.START: s...
[ "runs", "parser" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L163-L200
[ "def", "run", "(", "command", ",", "parser", ",", "cl_args", ",", "unknown_args", ")", ":", "action", "=", "cl_args", "[", "\"action\"", "]", "if", "action", "==", "Action", ".", "SET", ":", "call_editor", "(", "get_inventory_file", "(", "cl_args", ")", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
template_slave_hcl
Template slave config file
heron/tools/admin/src/python/standalone.py
def template_slave_hcl(cl_args, masters): ''' Template slave config file ''' slave_config_template = "%s/standalone/templates/slave.template.hcl" % cl_args["config_path"] slave_config_actual = "%s/standalone/resources/slave.hcl" % cl_args["config_path"] masters_in_quotes = ['"%s"' % master for master in mas...
def template_slave_hcl(cl_args, masters): ''' Template slave config file ''' slave_config_template = "%s/standalone/templates/slave.template.hcl" % cl_args["config_path"] slave_config_actual = "%s/standalone/resources/slave.hcl" % cl_args["config_path"] masters_in_quotes = ['"%s"' % master for master in mas...
[ "Template", "slave", "config", "file" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L220-L228
[ "def", "template_slave_hcl", "(", "cl_args", ",", "masters", ")", ":", "slave_config_template", "=", "\"%s/standalone/templates/slave.template.hcl\"", "%", "cl_args", "[", "\"config_path\"", "]", "slave_config_actual", "=", "\"%s/standalone/resources/slave.hcl\"", "%", "cl_ar...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
template_scheduler_yaml
Template scheduler.yaml
heron/tools/admin/src/python/standalone.py
def template_scheduler_yaml(cl_args, masters): ''' Template scheduler.yaml ''' single_master = masters[0] scheduler_config_actual = "%s/standalone/scheduler.yaml" % cl_args["config_path"] scheduler_config_template = "%s/standalone/templates/scheduler.template.yaml" \ % cl_args...
def template_scheduler_yaml(cl_args, masters): ''' Template scheduler.yaml ''' single_master = masters[0] scheduler_config_actual = "%s/standalone/scheduler.yaml" % cl_args["config_path"] scheduler_config_template = "%s/standalone/templates/scheduler.template.yaml" \ % cl_args...
[ "Template", "scheduler", ".", "yaml" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L230-L240
[ "def", "template_scheduler_yaml", "(", "cl_args", ",", "masters", ")", ":", "single_master", "=", "masters", "[", "0", "]", "scheduler_config_actual", "=", "\"%s/standalone/scheduler.yaml\"", "%", "cl_args", "[", "\"config_path\"", "]", "scheduler_config_template", "=",...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
template_uploader_yaml
Tempate uploader.yaml
heron/tools/admin/src/python/standalone.py
def template_uploader_yaml(cl_args, masters): ''' Tempate uploader.yaml ''' single_master = masters[0] uploader_config_template = "%s/standalone/templates/uploader.template.yaml" \ % cl_args["config_path"] uploader_config_actual = "%s/standalone/uploader.yaml" % cl_args["config_...
def template_uploader_yaml(cl_args, masters): ''' Tempate uploader.yaml ''' single_master = masters[0] uploader_config_template = "%s/standalone/templates/uploader.template.yaml" \ % cl_args["config_path"] uploader_config_actual = "%s/standalone/uploader.yaml" % cl_args["config_...
[ "Tempate", "uploader", ".", "yaml" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L242-L252
[ "def", "template_uploader_yaml", "(", "cl_args", ",", "masters", ")", ":", "single_master", "=", "masters", "[", "0", "]", "uploader_config_template", "=", "\"%s/standalone/templates/uploader.template.yaml\"", "%", "cl_args", "[", "\"config_path\"", "]", "uploader_config_...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
template_apiserver_hcl
template apiserver.hcl
heron/tools/admin/src/python/standalone.py
def template_apiserver_hcl(cl_args, masters, zookeepers): """ template apiserver.hcl """ single_master = masters[0] apiserver_config_template = "%s/standalone/templates/apiserver.template.hcl" \ % cl_args["config_path"] apiserver_config_actual = "%s/standalone/resources/apiserv...
def template_apiserver_hcl(cl_args, masters, zookeepers): """ template apiserver.hcl """ single_master = masters[0] apiserver_config_template = "%s/standalone/templates/apiserver.template.hcl" \ % cl_args["config_path"] apiserver_config_actual = "%s/standalone/resources/apiserv...
[ "template", "apiserver", ".", "hcl" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L254-L275
[ "def", "template_apiserver_hcl", "(", "cl_args", ",", "masters", ",", "zookeepers", ")", ":", "single_master", "=", "masters", "[", "0", "]", "apiserver_config_template", "=", "\"%s/standalone/templates/apiserver.template.hcl\"", "%", "cl_args", "[", "\"config_path\"", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
template_statemgr_yaml
Template statemgr.yaml
heron/tools/admin/src/python/standalone.py
def template_statemgr_yaml(cl_args, zookeepers): ''' Template statemgr.yaml ''' statemgr_config_file_template = "%s/standalone/templates/statemgr.template.yaml" \ % cl_args["config_path"] statemgr_config_file_actual = "%s/standalone/statemgr.yaml" % cl_args["config_path"] ...
def template_statemgr_yaml(cl_args, zookeepers): ''' Template statemgr.yaml ''' statemgr_config_file_template = "%s/standalone/templates/statemgr.template.yaml" \ % cl_args["config_path"] statemgr_config_file_actual = "%s/standalone/statemgr.yaml" % cl_args["config_path"] ...
[ "Template", "statemgr", ".", "yaml" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L278-L288
[ "def", "template_statemgr_yaml", "(", "cl_args", ",", "zookeepers", ")", ":", "statemgr_config_file_template", "=", "\"%s/standalone/templates/statemgr.template.yaml\"", "%", "cl_args", "[", "\"config_path\"", "]", "statemgr_config_file_actual", "=", "\"%s/standalone/statemgr.yam...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
template_heron_tools_hcl
template heron tools
heron/tools/admin/src/python/standalone.py
def template_heron_tools_hcl(cl_args, masters, zookeepers): ''' template heron tools ''' heron_tools_hcl_template = "%s/standalone/templates/heron_tools.template.hcl" \ % cl_args["config_path"] heron_tools_hcl_actual = "%s/standalone/resources/heron_tools.hcl" \ ...
def template_heron_tools_hcl(cl_args, masters, zookeepers): ''' template heron tools ''' heron_tools_hcl_template = "%s/standalone/templates/heron_tools.template.hcl" \ % cl_args["config_path"] heron_tools_hcl_actual = "%s/standalone/resources/heron_tools.hcl" \ ...
[ "template", "heron", "tools" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L290-L307
[ "def", "template_heron_tools_hcl", "(", "cl_args", ",", "masters", ",", "zookeepers", ")", ":", "heron_tools_hcl_template", "=", "\"%s/standalone/templates/heron_tools.template.hcl\"", "%", "cl_args", "[", "\"config_path\"", "]", "heron_tools_hcl_actual", "=", "\"%s/standalon...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
print_cluster_info
get cluster info for standalone cluster
heron/tools/admin/src/python/standalone.py
def print_cluster_info(cl_args): ''' get cluster info for standalone cluster ''' parsed_roles = read_and_parse_roles(cl_args) masters = list(parsed_roles[Role.MASTERS]) slaves = list(parsed_roles[Role.SLAVES]) zookeepers = list(parsed_roles[Role.ZOOKEEPERS]) cluster = list(parsed_roles[Role.CLUSTER]) ...
def print_cluster_info(cl_args): ''' get cluster info for standalone cluster ''' parsed_roles = read_and_parse_roles(cl_args) masters = list(parsed_roles[Role.MASTERS]) slaves = list(parsed_roles[Role.SLAVES]) zookeepers = list(parsed_roles[Role.ZOOKEEPERS]) cluster = list(parsed_roles[Role.CLUSTER]) ...
[ "get", "cluster", "info", "for", "standalone", "cluster" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L349-L375
[ "def", "print_cluster_info", "(", "cl_args", ")", ":", "parsed_roles", "=", "read_and_parse_roles", "(", "cl_args", ")", "masters", "=", "list", "(", "parsed_roles", "[", "Role", ".", "MASTERS", "]", ")", "slaves", "=", "list", "(", "parsed_roles", "[", "Rol...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
add_additional_args
add additional parameters to parser
heron/tools/admin/src/python/standalone.py
def add_additional_args(parsers): ''' add additional parameters to parser ''' for parser in parsers: cli_args.add_verbose(parser) cli_args.add_config(parser) parser.add_argument( '--heron-dir', default=config.get_heron_dir(), help='Path to Heron home directory')
def add_additional_args(parsers): ''' add additional parameters to parser ''' for parser in parsers: cli_args.add_verbose(parser) cli_args.add_config(parser) parser.add_argument( '--heron-dir', default=config.get_heron_dir(), help='Path to Heron home directory')
[ "add", "additional", "parameters", "to", "parser" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L377-L387
[ "def", "add_additional_args", "(", "parsers", ")", ":", "for", "parser", "in", "parsers", ":", "cli_args", ".", "add_verbose", "(", "parser", ")", "cli_args", ".", "add_config", "(", "parser", ")", "parser", ".", "add_argument", "(", "'--heron-dir'", ",", "d...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
stop_cluster
teardown the cluster
heron/tools/admin/src/python/standalone.py
def stop_cluster(cl_args): ''' teardown the cluster ''' Log.info("Terminating cluster...") roles = read_and_parse_roles(cl_args) masters = roles[Role.MASTERS] slaves = roles[Role.SLAVES] dist_nodes = masters.union(slaves) # stop all jobs if masters: try: single_master = list(masters)[0] ...
def stop_cluster(cl_args): ''' teardown the cluster ''' Log.info("Terminating cluster...") roles = read_and_parse_roles(cl_args) masters = roles[Role.MASTERS] slaves = roles[Role.SLAVES] dist_nodes = masters.union(slaves) # stop all jobs if masters: try: single_master = list(masters)[0] ...
[ "teardown", "the", "cluster" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L389-L444
[ "def", "stop_cluster", "(", "cl_args", ")", ":", "Log", ".", "info", "(", "\"Terminating cluster...\"", ")", "roles", "=", "read_and_parse_roles", "(", "cl_args", ")", "masters", "=", "roles", "[", "Role", ".", "MASTERS", "]", "slaves", "=", "roles", "[", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
start_cluster
Start a Heron standalone cluster
heron/tools/admin/src/python/standalone.py
def start_cluster(cl_args): ''' Start a Heron standalone cluster ''' roles = read_and_parse_roles(cl_args) masters = roles[Role.MASTERS] slaves = roles[Role.SLAVES] zookeepers = roles[Role.ZOOKEEPERS] Log.info("Roles:") Log.info(" - Master Servers: %s" % list(masters)) Log.info(" - Slave Servers: %s...
def start_cluster(cl_args): ''' Start a Heron standalone cluster ''' roles = read_and_parse_roles(cl_args) masters = roles[Role.MASTERS] slaves = roles[Role.SLAVES] zookeepers = roles[Role.ZOOKEEPERS] Log.info("Roles:") Log.info(" - Master Servers: %s" % list(masters)) Log.info(" - Slave Servers: %s...
[ "Start", "a", "Heron", "standalone", "cluster" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L446-L478
[ "def", "start_cluster", "(", "cl_args", ")", ":", "roles", "=", "read_and_parse_roles", "(", "cl_args", ")", "masters", "=", "roles", "[", "Role", ".", "MASTERS", "]", "slaves", "=", "roles", "[", "Role", ".", "SLAVES", "]", "zookeepers", "=", "roles", "...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
start_heron_tools
Start Heron tracker and UI
heron/tools/admin/src/python/standalone.py
def start_heron_tools(masters, cl_args): ''' Start Heron tracker and UI ''' single_master = list(masters)[0] wait_for_master_to_start(single_master) cmd = "%s run %s >> /tmp/heron_tools_start.log 2>&1 &" \ % (get_nomad_path(cl_args), get_heron_tools_job_file(cl_args)) Log.info("Starting Heron Too...
def start_heron_tools(masters, cl_args): ''' Start Heron tracker and UI ''' single_master = list(masters)[0] wait_for_master_to_start(single_master) cmd = "%s run %s >> /tmp/heron_tools_start.log 2>&1 &" \ % (get_nomad_path(cl_args), get_heron_tools_job_file(cl_args)) Log.info("Starting Heron Too...
[ "Start", "Heron", "tracker", "and", "UI" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L510-L537
[ "def", "start_heron_tools", "(", "masters", ",", "cl_args", ")", ":", "single_master", "=", "list", "(", "masters", ")", "[", "0", "]", "wait_for_master_to_start", "(", "single_master", ")", "cmd", "=", "\"%s run %s >> /tmp/heron_tools_start.log 2>&1 &\"", "%", "(",...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
distribute_package
distribute Heron packages to all nodes
heron/tools/admin/src/python/standalone.py
def distribute_package(roles, cl_args): ''' distribute Heron packages to all nodes ''' Log.info("Distributing heron package to nodes (this might take a while)...") masters = roles[Role.MASTERS] slaves = roles[Role.SLAVES] tar_file = tempfile.NamedTemporaryFile(suffix=".tmp").name Log.debug("TAR file %s...
def distribute_package(roles, cl_args): ''' distribute Heron packages to all nodes ''' Log.info("Distributing heron package to nodes (this might take a while)...") masters = roles[Role.MASTERS] slaves = roles[Role.SLAVES] tar_file = tempfile.NamedTemporaryFile(suffix=".tmp").name Log.debug("TAR file %s...
[ "distribute", "Heron", "packages", "to", "all", "nodes" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L539-L552
[ "def", "distribute_package", "(", "roles", ",", "cl_args", ")", ":", "Log", ".", "info", "(", "\"Distributing heron package to nodes (this might take a while)...\"", ")", "masters", "=", "roles", "[", "Role", ".", "MASTERS", "]", "slaves", "=", "roles", "[", "Role...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
wait_for_master_to_start
Wait for a nomad master to start
heron/tools/admin/src/python/standalone.py
def wait_for_master_to_start(single_master): ''' Wait for a nomad master to start ''' i = 0 while True: try: r = requests.get("http://%s:4646/v1/status/leader" % single_master) if r.status_code == 200: break except: Log.debug(sys.exc_info()[0]) Log.info("Waiting for clu...
def wait_for_master_to_start(single_master): ''' Wait for a nomad master to start ''' i = 0 while True: try: r = requests.get("http://%s:4646/v1/status/leader" % single_master) if r.status_code == 200: break except: Log.debug(sys.exc_info()[0]) Log.info("Waiting for clu...
[ "Wait", "for", "a", "nomad", "master", "to", "start" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L554-L571
[ "def", "wait_for_master_to_start", "(", "single_master", ")", ":", "i", "=", "0", "while", "True", ":", "try", ":", "r", "=", "requests", ".", "get", "(", "\"http://%s:4646/v1/status/leader\"", "%", "single_master", ")", "if", "r", ".", "status_code", "==", ...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
wait_for_job_to_start
Wait for a Nomad job to start
heron/tools/admin/src/python/standalone.py
def wait_for_job_to_start(single_master, job): ''' Wait for a Nomad job to start ''' i = 0 while True: try: r = requests.get("http://%s:4646/v1/job/%s" % (single_master, job)) if r.status_code == 200 and r.json()["Status"] == "running": break else: raise RuntimeError() ...
def wait_for_job_to_start(single_master, job): ''' Wait for a Nomad job to start ''' i = 0 while True: try: r = requests.get("http://%s:4646/v1/job/%s" % (single_master, job)) if r.status_code == 200 and r.json()["Status"] == "running": break else: raise RuntimeError() ...
[ "Wait", "for", "a", "Nomad", "job", "to", "start" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L573-L592
[ "def", "wait_for_job_to_start", "(", "single_master", ",", "job", ")", ":", "i", "=", "0", "while", "True", ":", "try", ":", "r", "=", "requests", ".", "get", "(", "\"http://%s:4646/v1/job/%s\"", "%", "(", "single_master", ",", "job", ")", ")", "if", "r"...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
scp_package
scp and extract package
heron/tools/admin/src/python/standalone.py
def scp_package(package_file, destinations, cl_args): ''' scp and extract package ''' pids = [] for dest in destinations: if is_self(dest): continue Log.info("Server: %s" % dest) file_path = "/tmp/heron.tar.gz" dest_file_path = "%s:%s" % (dest, file_path) remote_cmd = "rm -rf ~/.her...
def scp_package(package_file, destinations, cl_args): ''' scp and extract package ''' pids = [] for dest in destinations: if is_self(dest): continue Log.info("Server: %s" % dest) file_path = "/tmp/heron.tar.gz" dest_file_path = "%s:%s" % (dest, file_path) remote_cmd = "rm -rf ~/.her...
[ "scp", "and", "extract", "package" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L594-L632
[ "def", "scp_package", "(", "package_file", ",", "destinations", ",", "cl_args", ")", ":", "pids", "=", "[", "]", "for", "dest", "in", "destinations", ":", "if", "is_self", "(", "dest", ")", ":", "continue", "Log", ".", "info", "(", "\"Server: %s\"", "%",...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
make_tarfile
Tar a directory
heron/tools/admin/src/python/standalone.py
def make_tarfile(output_filename, source_dir): ''' Tar a directory ''' with tarfile.open(output_filename, "w:gz") as tar: tar.add(source_dir, arcname=os.path.basename(source_dir))
def make_tarfile(output_filename, source_dir): ''' Tar a directory ''' with tarfile.open(output_filename, "w:gz") as tar: tar.add(source_dir, arcname=os.path.basename(source_dir))
[ "Tar", "a", "directory" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L634-L639
[ "def", "make_tarfile", "(", "output_filename", ",", "source_dir", ")", ":", "with", "tarfile", ".", "open", "(", "output_filename", ",", "\"w:gz\"", ")", "as", "tar", ":", "tar", ".", "add", "(", "source_dir", ",", "arcname", "=", "os", ".", "path", ".",...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
start_master_nodes
Start master nodes
heron/tools/admin/src/python/standalone.py
def start_master_nodes(masters, cl_args): ''' Start master nodes ''' pids = [] for master in masters: Log.info("Starting master on %s" % master) cmd = "%s agent -config %s >> /tmp/nomad_server_log 2>&1 &" \ % (get_nomad_path(cl_args), get_nomad_master_config_file(cl_args)) if not is_self...
def start_master_nodes(masters, cl_args): ''' Start master nodes ''' pids = [] for master in masters: Log.info("Starting master on %s" % master) cmd = "%s agent -config %s >> /tmp/nomad_server_log 2>&1 &" \ % (get_nomad_path(cl_args), get_nomad_master_config_file(cl_args)) if not is_self...
[ "Start", "master", "nodes" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L641-L673
[ "def", "start_master_nodes", "(", "masters", ",", "cl_args", ")", ":", "pids", "=", "[", "]", "for", "master", "in", "masters", ":", "Log", ".", "info", "(", "\"Starting master on %s\"", "%", "master", ")", "cmd", "=", "\"%s agent -config %s >> /tmp/nomad_server...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
start_slave_nodes
Star slave nodes
heron/tools/admin/src/python/standalone.py
def start_slave_nodes(slaves, cl_args): ''' Star slave nodes ''' pids = [] for slave in slaves: Log.info("Starting slave on %s" % slave) cmd = "%s agent -config %s >> /tmp/nomad_client.log 2>&1 &" \ % (get_nomad_path(cl_args), get_nomad_slave_config_file(cl_args)) if not is_self(slave): ...
def start_slave_nodes(slaves, cl_args): ''' Star slave nodes ''' pids = [] for slave in slaves: Log.info("Starting slave on %s" % slave) cmd = "%s agent -config %s >> /tmp/nomad_client.log 2>&1 &" \ % (get_nomad_path(cl_args), get_nomad_slave_config_file(cl_args)) if not is_self(slave): ...
[ "Star", "slave", "nodes" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L675-L707
[ "def", "start_slave_nodes", "(", "slaves", ",", "cl_args", ")", ":", "pids", "=", "[", "]", "for", "slave", "in", "slaves", ":", "Log", ".", "info", "(", "\"Starting slave on %s\"", "%", "slave", ")", "cmd", "=", "\"%s agent -config %s >> /tmp/nomad_client.log 2...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac
valid
read_and_parse_roles
read config files to get roles
heron/tools/admin/src/python/standalone.py
def read_and_parse_roles(cl_args): ''' read config files to get roles ''' roles = dict() with open(get_inventory_file(cl_args), 'r') as stream: try: roles = yaml.load(stream) except yaml.YAMLError as exc: Log.error("Error parsing inventory file: %s" % exc) sys.exit(-1) if Role.ZO...
def read_and_parse_roles(cl_args): ''' read config files to get roles ''' roles = dict() with open(get_inventory_file(cl_args), 'r') as stream: try: roles = yaml.load(stream) except yaml.YAMLError as exc: Log.error("Error parsing inventory file: %s" % exc) sys.exit(-1) if Role.ZO...
[ "read", "config", "files", "to", "get", "roles" ]
apache/incubator-heron
python
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/admin/src/python/standalone.py#L710-L737
[ "def", "read_and_parse_roles", "(", "cl_args", ")", ":", "roles", "=", "dict", "(", ")", "with", "open", "(", "get_inventory_file", "(", "cl_args", ")", ",", "'r'", ")", "as", "stream", ":", "try", ":", "roles", "=", "yaml", ".", "load", "(", "stream",...
ad10325a0febe89ad337e561ebcbe37ec5d9a5ac