prestoadmin package¶
Subpackages¶
- prestoadmin.standalone package
- prestoadmin.util package
- Submodules
- prestoadmin.util.all_write_handler module
- prestoadmin.util.application module
- prestoadmin.util.base_config module
- prestoadmin.util.constants module
- prestoadmin.util.exception module
- prestoadmin.util.fabric_application module
- prestoadmin.util.fabricapi module
- prestoadmin.util.filesystem module
- prestoadmin.util.hiddenoptgroup module
- prestoadmin.util.httpscacertconnection module
- prestoadmin.util.local_config_util module
- prestoadmin.util.parser module
- prestoadmin.util.presto_config module
- prestoadmin.util.remote_config_util module
- prestoadmin.util.validators module
- prestoadmin.util.version_util module
- Module contents
- prestoadmin.yarn_slider package
Submodules¶
prestoadmin.catalog module¶
Module for presto catalog configurations
-
prestoadmin.catalog.
add
[source]¶ Deploy configuration for a catalog onto a cluster.
E.g.: ‘presto-admin catalog add tpch’ deploys a configuration file for the tpch connector. The configuration is defined by tpch.properties in the local catalog directory, which defaults to ~/.prestoadmin/catalog.
If no catalog name is specified, then configurations for all catalogs in the catalog directory will be deployed
Parameters: - Name of the catalog to be added (name) –
prestoadmin.collect module¶
Module for gathering various debug information for incident reporting using presto-admin
-
prestoadmin.collect.
logs
[source]¶ Gather all the server logs and presto-admin log and create a tar file.
prestoadmin.config module¶
Module for reading, writing, and processing configuration files
prestoadmin.configure_cmds module¶
Module for various configuration management tasks using presto-admin
-
prestoadmin.configure_cmds.
deploy
[source]¶ Deploy configuration on the remote hosts.
- Possible arguments are -
- coordinator - Deploy the coordinator configuration to the coordinator node workers - Deploy workers configuration to the worker nodes. This will not deploy configuration for a coordinator that is also a worker
If no rolename is specified, then configuration for all roles will be deployed. If there is no presto configuration file found in the configuration directory, default files will be deployed
Parameters: - [coordinator|workers] (rolename) –
-
prestoadmin.configure_cmds.
show
[source]¶ Print to the user the contents of the configuration files deployed
If no config_type is specified, then all four configurations will be printed. No warning will be printed for a missing log.properties since it is not a required configuration file.
Parameters: config_type – [node|jvm|config|log]
prestoadmin.coordinator module¶
Module for the presto coordinator’s configuration. Loads and validates the coordinator.json file and creates the files needed to deploy on the presto cluster
-
class
prestoadmin.coordinator.
Coordinator
[source]¶ Bases:
prestoadmin.node.Node
-
DEFAULT_PROPERTIES
= {'jvm.config': ['-server', '-Xmx16G', '-XX:-UseBiasedLocking', '-XX:+UseG1GC', '-XX:G1HeapRegionSize=32M', '-XX:+ExplicitGCInvokesConcurrent', '-XX:+HeapDumpOnOutOfMemoryError', '-XX:+UseGCOverheadLimit', '-XX:+ExitOnOutOfMemoryError', '-XX:ReservedCodeCacheSize=512M', '-DHADOOP_USER_NAME=hive'], 'config.properties': {'query.max-memory': '50GB', 'coordinator': 'true', 'discovery-server.enabled': 'true', 'http-server.http.port': '8080', 'node-scheduler.include-coordinator': 'false', 'query.max-memory-per-node': '8GB'}, 'node.properties': {'node.launcher-log-file': '/var/log/presto/launcher.log', 'node.server-log-file': '/var/log/presto/server.log', 'catalog.config-dir': '/etc/presto/catalog', 'node.data-dir': '/var/lib/presto/data', 'node.environment': 'presto', 'plugin.dir': '/usr/lib/presto/lib/plugin'}}¶
-
prestoadmin.deploy module¶
Common module for deploying the presto configuration
-
prestoadmin.deploy.
coordinator
()[source]¶ Deploy the coordinator configuration to the coordinator node
prestoadmin.fabric_patches module¶
Monkey patches needed to change logging and error handling in Fabric
prestoadmin.file module¶
Commands for running scripts on a cluster
prestoadmin.main module¶
This module contains Fab’s main method plus related subroutines.
main is executed as the command line fab
program and takes care of
parsing options and commands, loading the user settings file, loading a
fabfile, and executing the commands given.
The other callables defined in this module are internal only. Anything useful to individuals leveraging Fabric as a library, should be kept elsewhere.
-
prestoadmin.main.
display_command
(name, code=0)[source]¶ Print command function’s docstring, then exit. Invoked with -d/–display.
-
prestoadmin.main.
extract_tasks
(imported_vars)[source]¶ Handle extracting tasks from a given list of variables
-
prestoadmin.main.
get_default_options
(options, non_default_options)[source]¶ Given a dictionary of options containing the defaults optparse has filled in, and a dictionary of options containing only options parsed from the command line, returns a dictionary containing the default options that remain after removing the default options that were overridden by the options passed on the command line.
Mathematically, this returns a dictionary with default_options.keys = options.keys() non_default_options.keys() where is the set difference operator. The value of a key present in default_options is the value of the same key in options.
-
prestoadmin.main.
is_classic_task
(tup)[source]¶ Takes (name, object) tuple, returns True if it’s a non-Fab public callable.
-
prestoadmin.main.
is_task_object
(a)[source]¶ Determine if the provided value is a
Task
object.This returning True signals that all tasks within the fabfile module must be Task objects.
-
prestoadmin.main.
list_commands
(docstring, format_)[source]¶ Print all found commands/tasks, then exit. Invoked with
-l/--list.
If
docstring
is non-empty, it will be printed before the task list.format_
should conform to the options specified inLIST_FORMAT_OPTIONS
, e.g."short"
,"normal"
.
-
prestoadmin.main.
load_config
(load_config_callback)[source]¶ This provides a patch point for the unit tests so that individual test cases don’t need to know the internal details of what happens in _load_topology. See test_main.py for examples.
-
prestoadmin.main.
load_fabfile
(path, importer=None)[source]¶ Import given fabfile path and return (docstring, callables).
Specifically, the fabfile’s
__doc__
attribute (a string) and a dictionary of{'name': callable}
containing all callables which pass the “is a Fabric task” test.
-
prestoadmin.main.
load_tasks_from_module
(imported)[source]¶ Handles loading all of the tasks for a given imported module
-
prestoadmin.main.
parse_and_validate_commands
(args=['-b', 'html', '-W', '-d', '_build/doctrees', '.', '_build/html'])[source]¶
-
prestoadmin.main.
parse_arguments
(arguments, commands)[source]¶ Parse string list into list of tuples: command, args.
commands is formatted like {‘install’ : {‘server’ : WrappedCallable, ‘cli’ : WrappedCallable}, ‘topology’: {‘show’ : WrappedCallable}}
Thus, since our arguments are separated by spaces, and is of the form [‘install’, ‘server’], we iterate through the commands, progressively going deeper into the dict. If we run out of elements in the dict, the rest of the tokens are arguments to the function. If we don’t get down to the bottom-most level, the command is not valid. If at any point the next token is not in the possible_cmd map, the command is invalid.
-
prestoadmin.main.
parser_for_options
()[source]¶ Handle command-line options with LoggingOptionParser.
Return parser, largely for use in parse_arguments.
On this parser, you must call parser.parse_args()
-
prestoadmin.main.
update_output_levels
(show, hide)[source]¶ Update state.output values as per given comma-separated list of key names.
For example,
update_output_levels(show='debug,warnings')
is functionally equivalent tostate.output['debug'] = True ; state.output['warnings'] = True
. Conversely, anything given tohide
sets the values toFalse
.
prestoadmin.mode module¶
Module for handling presto-admin mode-related functionality.
prestoadmin.node module¶
Module for the presto coordinator’s configuration. Loads and validates the coordinator.json file and creates the files needed to deploy on the presto cluster
prestoadmin.package module¶
Module for rpm package deploy and install using presto-admin
-
prestoadmin.package.
install
[source]¶ Install the rpm package on the cluster
Parameters: - local_path – Absolute path to the rpm to be installed
- --nodeps (optional) – Flag to indicate if rpm install should ignore checking package dependencies. Equivalent to adding –nodeps flag to rpm -i.
-
prestoadmin.package.
uninstall
[source]¶ Uninstall the rpm package from the cluster
Parameters: - rpm_name – Name of the rpm to be uninstalled
- --nodeps (optional) – Flag to indicate if rpm uninstall) should ignore checking package dependencies. Equivalent to adding –nodeps flag to rpm -e.
- --force (optional) – Flag to indicate that rpm uninstall should not fail if package is not installed.
prestoadmin.plugin module¶
module for tasks relating to presto plugins
-
prestoadmin.plugin.
add_jar
[source]¶ Deploy jar for the specified plugin to the plugin directory.
Parameters: - - Local path to the jar to be deployed (local_path) –
- - Name of the plugin subdirectory to deploy jars to (plugin_name) –
- - (Optional) The plugin directory. If no directory is (plugin_dir) – given, ‘/usr/lib/presto/lib/plugin’ is used by default.
prestoadmin.presto_conf module¶
Module for processing presto configuration files
prestoadmin.prestoclient module¶
Simple client to communicate with a Presto server.
-
class
prestoadmin.prestoclient.
PrestoClient
(server, user, coordinator_config=None)[source]¶ -
-
run_sql
(sql, schema='default', catalog='hive')[source]¶ Execute a query connecting to Presto server using passed parameters.
Parameters: - sql – SQL query to be executed
- schema – Presto schema to be used while executing query (default=default)
- catalog – Catalog to be used by the server
Returns: list of rows or None if client was unable to connect to Presto
-
prestoadmin.server module¶
Module for installing, monitoring, and controlling presto server using presto-admin
-
prestoadmin.server.
install
[source]¶ Copy and install the presto-server rpm to all the nodes in the cluster and configure the nodes.
The topology information will be read from the config.json file. If this file is missing, then the coordinator and workers will be obtained interactively. Install will fail for invalid json configuration.
The catalog configurations will be read from the local catalog directory which defaults to ~/.prestoadmin/catalog. If this directory is missing or empty then no catalog configuration is deployed.
Install will fail for incorrectly formatted configuration files. Expected format is key=value for .properties files and one option per line for jvm.config
Parameters: - - String specifying location of presto rpm to copy and install (rpm_specifier) –
to nodes in the cluster. The string can specify a presto rpm in the following ways:
- ‘latest’ to download the latest release
- Url to download
- Version number to download
- Path to a local copy
If rpm_specifier matches multiple forms, it is interpreted as the form with highest precedence. The forms are listed from highest to lowest precedence (going top to bottom) For example, if the rpm_specifier matches the criteria to be a url to download, it will be interpreted as such and will never be interpreted as a version number or a local path.
Before downloading an rpm, install will attempt to find a local copy with a matching version number to the requested rpm. If such a match is found, it will use the local copy instead of downloading the rpm again.
- - (optional) Flag to indicate if server install (–nodeps) – should ignore checking Presto rpm package dependencies. Equivalent to adding –nodeps flag to rpm -i.
- - String specifying location of presto rpm to copy and install (rpm_specifier) –
-
prestoadmin.server.
uninstall
[source]¶ Uninstall Presto after stopping the services on all nodes
Parameters: - (optional) Flag to indicate if server uninstall (–nodeps) – should ignore checking Presto rpm package dependencies. Equivalent to adding –nodeps flag to rpm -e.
-
prestoadmin.server.
upgrade
[source]¶ Copy and upgrade a new presto-server rpm to all of the nodes in the cluster. Retains existing node configuration.
The existing topology information is read from the config.json file. Unlike install, there is no provision to supply topology information interactively.
The existing cluster configuration is collected from the nodes on the cluster and stored on the host running presto-admin. After the presto-server packages have been upgraded, presto-admin pushes the collected configuration back out to the hosts on the cluster.
Note that the configuration files in the presto-admin configuration directory are not updated during upgrade.
- :param new_rpm_path - The path to the new Presto RPM to
- install
- :param local_config_dir - (optional) Directory to store the cluster
- configuration in. If not specified, a temp directory is used.
- :param overwrite - (optional) if set to True then existing
- configuration will be orerwriten.
- :param –nodeps - (optional) Flag to indicate if server upgrade
- should ignore checking Presto rpm package dependencies. Equivalent to adding –nodeps flag to rpm -U.
-
prestoadmin.server.
start
[source]¶ Start the Presto server on all nodes
A status check is performed on the entire cluster and a list of servers that did not start, if any, are reported at the end.
prestoadmin.topology module¶
Module for setting and validating the presto-admin config
prestoadmin.workers module¶
Module for the presto worker`’s configuration. Loads and validates the workers.json file and creates the files needed to deploy on the presto cluster
-
class
prestoadmin.workers.
Worker
[source]¶ Bases:
prestoadmin.node.Node
-
DEFAULT_PROPERTIES
= {'jvm.config': ['-server', '-Xmx16G', '-XX:-UseBiasedLocking', '-XX:+UseG1GC', '-XX:G1HeapRegionSize=32M', '-XX:+ExplicitGCInvokesConcurrent', '-XX:+HeapDumpOnOutOfMemoryError', '-XX:+UseGCOverheadLimit', '-XX:+ExitOnOutOfMemoryError', '-XX:ReservedCodeCacheSize=512M', '-DHADOOP_USER_NAME=hive'], 'config.properties': {'query.max-memory': '50GB', 'coordinator': 'false', 'query.max-memory-per-node': '8GB', 'http-server.http.port': '8080'}, 'node.properties': {'node.launcher-log-file': '/var/log/presto/launcher.log', 'node.server-log-file': '/var/log/presto/server.log', 'catalog.config-dir': '/etc/presto/catalog', 'node.data-dir': '/var/lib/presto/data', 'node.environment': 'presto', 'plugin.dir': '/usr/lib/presto/lib/plugin'}}¶
-
Module contents¶
Presto-Admin tool for deploying and managing Presto clusters