#NEWLINE# @ gen . coroutine #NEWLINE# def _Init( init_db = True , server_logging = True ) : #NEWLINE# #INDENT# 'Completes Viewfinder initialization, such as secrets, DB client, AMI metadata, and the\n  object store.\n  ' #NEWLINE# httpclient . AsyncHTTPClient . configure ( 'tornado.curl_httpclient.CurlAsyncHTTPClient' , max_clients = 100 ) #NEWLINE# if options . options . devbox : #NEWLINE# #INDENT# metadata = ami_metadata . Metadata ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# metadata = ( yield gen . Task ( ami_metadata . Metadata ) ) #NEWLINE# #UNINDENT# if ( metadata is None ) : #NEWLINE# #INDENT# raise Exception ( 'failed to fetch AWS instance metadata; if running on dev box, use the --devbox option' ) #NEWLINE# #UNINDENT# ami_metadata . SetAMIMetadata ( metadata ) #NEWLINE# logging . info ( 'AMI metadata initialized' ) #NEWLINE# ServerEnvironment . InitServerEnvironment ( ) #NEWLINE# logging . info ( 'server environment initialized' ) #NEWLINE# ( yield gen . Task ( secrets . InitSecrets , can_prompt = sys . stderr . isatty ( ) ) ) #NEWLINE# logging . info ( 'secrets initialized' ) #NEWLINE# if init_db : #NEWLINE# #INDENT# ( yield gen . Task ( db_client . InitDB , vf_schema . SCHEMA ) ) #NEWLINE# logging . info ( 'DB client initialized' ) #NEWLINE# #UNINDENT# object_store . InitObjectStore ( temporary = False ) #NEWLINE# logging . info ( 'object store initialized' ) #NEWLINE# if server_logging : #NEWLINE# #INDENT# server_log . InitServerLog ( ) #NEWLINE# #UNINDENT# logging . info ( 'main.py initialization complete' )