#NEWLINE# def main( ) : #NEWLINE# #INDENT# global args #NEWLINE# parser = argparse . ArgumentParser ( description = __doc__ ) #NEWLINE# parser . add_argument ( '-d' , '--dependency' , dest = 'dependency' , metavar = 'DEPENDENCY' , required = True , help = 'The root dependency name, which stores what config/serversets are needed to be watched by ZUM. The dependency can have either config/serverset name, or other dependencies.' ) #NEWLINE# parser . add_argument ( '-p' , '--port' , dest = 'port' , metavar = 'PORT' , required = True , help = 'The port Flask app will be running on.' ) #NEWLINE# parser . add_argument ( '-z' , '--zk-hosts-file-path' , dest = 'zk_hosts_file' , metavar = 'ZKHOSTS' , required = True , help = 'The path of file which have a list of Zookeeper endpoints (host:port) which keeps the metaconfig as well as the config/serversets' ) #NEWLINE# parser . add_argument ( '-a' , '--aws-key-file' , dest = 'aws_key_file' , metavar = 'AWSKEY' , required = True , help = 'The path of the file storing AWS access and secret keys' ) #NEWLINE# parser . add_argument ( '-b' , '--s3-bucket' , dest = 's3_bucket' , metavar = 'BUCKET' , required = True , help = 'The S3 bucket storing metaconfigs / configs' ) #NEWLINE# parser . add_argument ( '-e' , '--aws-s3-endpoint' , dest = 's3_endpoint' , metavar = 'ENDPOINT' , default = 's3.amazonaws.com' , help = 'The S3 endpoint storing metaconfig / configs' ) #NEWLINE# args = parser . parse_args ( ) #NEWLINE# initialize_zookeeper_aws_s3_configs ( args ) #NEWLINE# notification_processor = gevent . spawn ( _notification_processor ) #NEWLINE# dump_command_processing_info = gevent . spawn ( _dump_command_processing_info ) #NEWLINE# dependency = args . dependency #NEWLINE# gevent . spawn ( gevent_load_metaconfigs , dependency ) #NEWLINE# periodic_checking = gevent . spawn ( _periodic_checking ) #NEWLINE# holddown_queue_wiper = gevent . spawn ( _holddown_queue_wiper ) #NEWLINE# serverset_type_set_wiper = gevent . spawn ( _serverset_type_set_wiper ) #NEWLINE# _GREENLET_DICT [ 'notification_processor' ] = notification_processor #NEWLINE# _GREENLET_DICT [ 'dump_command_processing_info' ] = dump_command_processing_info #NEWLINE# _GREENLET_DICT [ 'periodic_checking' ] = periodic_checking #NEWLINE# _GREENLET_DICT [ 'holddown_queue_wiper' ] = holddown_queue_wiper #NEWLINE# _GREENLET_DICT [ 'serverset_type_set_wiper' ] = serverset_type_set_wiper #NEWLINE# log . info ( 'starting a Flask WSGI server for stats reporting' ) #NEWLINE# pywsgi . WSGIServer ( ( '0.0.0.0' , int ( args . port ) ) , app ) . serve_forever ( )