Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from twitter.common.log.options import LogOptions
except ImportError:
import logging as log
from twitter.common.metrics import AtomicGauge
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty
from .constants import Acl, Id
if WITH_APP:
app.add_option(
'--zookeeper',
default='zookeeper.local.twitter.com:2181',
metavar='HOST:PORT[,HOST:PORT,...]',
dest='twitter_common_zookeeper_ensemble',
help='A comma-separated list of host:port of ZooKeeper servers.')
app.add_option(
'--zookeeper_timeout',
type='float',
default=15.0,
dest='twitter_common_zookeeper_timeout',
help='The default timeout (in seconds) for ZK operations.')
app.add_option(
'--zookeeper_reconnects',
type='int',
default=0,
dest='twitter_common_zookeeper_reconnects',
VERSION = '0.0.2'
app.add_option('--nailgun-version',
dest='just_version',
default=False,
action='store_true',
help='print product version and exit')
app.add_option('--nailgun-showversion',
dest='show_version',
default=False,
action='store_true',
help='print product version and continue')
app.add_option('--nailgun-server',
dest='ng_host',
metavar='HOST',
default=NailgunClient.DEFAULT_NG_HOST,
help='to specify the address of the nailgun server (default is %default)')
app.add_option('--nailgun-port',
dest='ng_port',
metavar='PORT',
default=NailgunClient.DEFAULT_NG_PORT,
type='int',
help='to specify the port of the nailgun server (default is %default)')
app.add_option('--nailgun-help',
dest='show_help',
default=False,
action='store_true',
import zipfile
with contextlib.closing(zipfile.ZipFile('dist/thermos_executor.pex', 'a')) as zf:
zf.writestr('twitter/mesos/executor/resources/__init__.py', '')
zf.write('dist/thermos_runner.pex', 'twitter/mesos/executor/resources/thermos_runner.pex')
app.set_usage('%prog [options] tag')
cluster_list = Cluster.get_list()
app.add_option('--cluster', type = 'choice', choices = cluster_list, dest='cluster',
help='Cluster to deploy the scheduler in (one of: %s)' % ', '.join(cluster_list))
app.add_option('-v', dest='verbose', default=False, action='store_true',
help='Verbose logging.')
app.add_option('--really_push', dest='really_push', default=False, action='store_true',
help='Safeguard to prevent fat-fingering. When false, only show commands but do '
'not run them.')
app.add_option('--hotfix', dest='hotfix', default=False, action='store_true',
help='Indicates this is a hotfix deploy from the current tree.')
app.add_option('--release', dest='release', default=None, type=int,
help='Specify a release number to deploy. If none specified, it uses the latest '
'release assigned to the cluster environment. If specified, it must have '
'been assigned as a release for this environment.')
def main(_, options):
if not options.cluster:
cluster_list = Cluster.get_list()
print ('Please specify the cluster you would like to deploy to with\n\t--cluster %s'
def proxy_main():
app.add_option(
'--port',
dest='api_port',
type='int',
default=None,
help='Port for the HTTP API server')
app.add_option(
'--mesos_master',
dest='mesos_master',
default=None,
help='Mesos master address. It can be a ZooKeeper URL through which the master can be '
'detected')
app.add_option(
'--framework_user',
dest='framework_user',
help='The Unix user that Mysos executor runs as')
app.add_option(
'--framework_role',
dest='framework_role',
default='*',
help="The role that Mysos framework runs as. If set, Mysos only uses Mesos pool resources "
"with that role. The default value '*' is what Mesos considers as the default role.\n"
"NOTE: Mesos master needs to be configured to allow the specified role. See its --roles "
"flag")
app.add_option(
'--executor_uri',
dest='executor_uri',
LogOptions.set_stderr_log_level('DEBUG')
def main():
app.help()
if __name__ == '__main__':
app.interspersed_args(True)
app.add_option('-v',
dest='verbosity',
default='normal',
action='callback',
callback=set_verbose,
help='Verbose logging. (default: %default)')
app.add_option('-q',
dest='verbosity',
default='normal',
action='callback',
callback=set_quiet,
help='Quiet logging. (default: %default)')
LogOptions.set_stderr_log_level('INFO')
LogOptions.disable_disk_logging()
app.set_name('mesos-client')
app.set_usage(DEFAULT_USAGE_BANNER + generate_terse_usage())
app.main()
app.add_option("--http-address",
dest="http_addr",
metavar="HTTPADDR",
type=str,
default=socket.gethostname(),
help="listen address for http endpoints")
app.add_option("--zookeeper-port",
type=int,
default=2181,
help="ZK's client port (from which to sniff)")
app.add_option("--aggregation-depth",
dest="aggregation_depth",
type=int,
default=0,
help="aggregate paths up to a certain depth")
app.add_option("--max-results",
dest="max_results",
type=int,
default=10,
help="top number of results to be exported")
app.add_option("--refresh-time",
dest="refresh_time",
type=int,
default=0,
help="refresh time in the generated html")
app.add_option("--niceness",
dest="niceness",
type=int,
default=0,
help="set the niceness")
app.add_option("--set-cpu-affinity",
dest="cpu_affinity",
help='Host that should be excluded (you can use this multiple times)')
app.add_option('--include-host',
dest='included_hosts',
metavar='',
default=[],
action='append',
help='Host that should be included (you can use this multiple times)')
app.add_option('--count-requests', default=0, type=int, metavar='',
help='Count N requests and report a summary (default: group by path)')
app.add_option('--measure-latency', default=0, type=int, metavar='',
help='Measure latency of N pairs of requests and replies (default: group by path')
app.add_option('--group-by', default='path', type=str, metavar='',
help='Used with --count-requests or --measure-latency. Possible values: path, type or client')
app.add_option('--sort-by', default='avg', type=str, metavar='',
help='Used with --measure-latency. Possible values: avg, p95 and p99')
app.add_option("--aggregation-depth", default=0, type=int, metavar='',
help="Aggregate paths up to a certain depth. Used with --count-requests or --measure-latency")
app.add_option('--unpaired', default=False, action='store_true',
help='Don\'t pair reqs/reps')
app.add_option('-p', '--include-pings', default=False, action='store_true',
help='Whether to include ping requests and replies')
app.add_option('-c', '--colors', default=False, action='store_true',
help='Color each client/server stream differently')
app.add_option('--dump-bad-packet', default=False, action='store_true',
help='If unable to to deserialize a packet, print it out')
app.add_option('--version', default=False, action='store_true')
def setup():
LogOptions.set_stderr_log_level('NONE')
app.add_option('--iface', default='eth0', type=str,
help='The interface to sniff on')
app.add_option('--port', default=2889, type=int,
help='The ZAB port used by the leader')
app.add_option('-c', '--colors', default=False, action='store_true',
help='Color each learner/leader stream differently')
app.add_option('--dump-bad-packet', default=False, action='store_true',
help='Dump packets that cannot be deserialized')
app.add_option('--include-pings', default=False, action='store_true',
help='Whether to include pings send from learners to the leader')
app.add_option('--version', default=False, action='store_true')
default=[],
action='append',
help='Host that should be included (you can use this multiple times)')
app.add_option('--count-requests', default=0, type=int, metavar='',
help='Count N requests and report a summary (default: group by path)')
app.add_option('--measure-latency', default=0, type=int, metavar='',
help='Measure latency of N pairs of requests and replies (default: group by path')
app.add_option('--group-by', default='path', type=str, metavar='',
help='Used with --count-requests or --measure-latency. Possible values: path, type or client')
app.add_option('--sort-by', default='avg', type=str, metavar='',
help='Used with --measure-latency. Possible values: avg, p95 and p99')
app.add_option("--aggregation-depth", default=0, type=int, metavar='',
help="Aggregate paths up to a certain depth. Used with --count-requests or --measure-latency")
app.add_option('--unpaired', default=False, action='store_true',
help='Don\'t pair reqs/reps')
app.add_option('-p', '--include-pings', default=False, action='store_true',
help='Whether to include ping requests and replies')
app.add_option('-c', '--colors', default=False, action='store_true',
help='Color each client/server stream differently')
app.add_option('--dump-bad-packet', default=False, action='store_true',
help='If unable to to deserialize a packet, print it out')
app.add_option('--version', default=False, action='store_true')
app.add_option(
'--executor_cmd',
dest='executor_cmd',
default=None,
help='Command to execute the executor package')
app.add_option(
'--executor_environ',
dest='executor_environ',
default=None,
help="Environment variables for the executors (and the tasks) as a list of dicts keyed by "
"{name, value} in JSON. Note that these variables don't affect Mesos slave components "
"such as the fetcher")
app.add_option(
'--zk_url',
dest='zk_url',
default=None,
help='ZooKeeper URL for various Mysos operations, in the form of '
'"zk://username:password@servers/path". The sub-directory /discover is used for '
'communicating MySQL cluster information between Mysos scheduler and executors')
# TODO(jyx): This could also be made a per-cluster configuration.
app.add_option(
'--election_timeout',
dest='election_timeout',
default='60s',
help='The amount of time the scheduler waits for all slaves to respond during a MySQL master '
'election, e.g., 60s. After the timeout the master is elected from only the slaves that '
'have responded')