<s> from __future__ import ( absolute_import , division , generators , nested_scopes , print_function , <EOL> unicode_literals , with_statement ) <EOL> import logging <EOL> from pants . binaries import binary_util <EOL> from pants . reporting . reporting_server import ReportingServerManager <EOL> from pants . task . task import QuietTaskMixin , Task <EOL> logger = logging . getLogger ( __name__ ) <EOL> class ReportingServerRun ( QuietTaskMixin , Task ) : <EOL> """<STR_LIT>""" <EOL> @ classmethod <EOL> def register_options ( cls , register ) : <EOL> super ( ReportingServerRun , cls ) . register_options ( register ) <EOL> register ( '<STR_LIT>' , type = int , default = <NUM_LIT:0> , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> register ( '<STR_LIT>' , type = list , default = [ '<STR_LIT:127.0.0.1>' ] , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> register ( '<STR_LIT>' , type = bool , <EOL> help = '<STR_LIT>' ) <EOL> register ( '<STR_LIT>' , advanced = True , <EOL> help = '<STR_LIT>' ) <EOL> register ( '<STR_LIT>' , advanced = True , <EOL> help = '<STR_LIT>' ) <EOL> def _maybe_open ( self , port ) : <EOL> if self . get_options ( ) . open : <EOL> binary_util . ui_open ( '<STR_LIT>' . format ( port = port ) ) <EOL> def execute ( self ) : <EOL> manager = ReportingServerManager ( self . context , self . get_options ( ) ) <EOL> if manager . is_alive ( ) : <EOL> logger . info ( '<STR_LIT>' <EOL> . format ( pid = manager . pid , port = manager . socket ) ) <EOL> else : <EOL> manager . daemonize ( ) <EOL> manager . await_socket ( <NUM_LIT:10> ) <EOL> logger . info ( '<STR_LIT>' <EOL> . format ( pid = manager . pid , port = manager . socket ) ) <EOL> self . _maybe_open ( manager . socket ) </s>
