コード例 #1
0
ファイル: hummingbird.py プロジェクト: lcls-spi/hummingbird
def main():
    """The entry point of the program"""
    args = parse_cmdline_args()
    level = logging.WARNING
    if args.verbose:
        level = logging.INFO
    if args.debug:
        level = logging.DEBUG
    logging.basicConfig(format='%(filename)s:%(lineno)d %(message)s', level=level)

    if(args.backend is not None):
        from backend import Worker
        if(args.backend != True):
            worker = Worker(args.backend)
        else:
            worker = Worker(None)
        if not args.profile:
            worker.start()
        else:
            from pycallgraph import PyCallGraph
            from pycallgraph.output import GraphvizOutput
            with PyCallGraph(output=GraphvizOutput()):
                worker.start()
    elif(args.interface is not False):
        import interface
        interface.start_interface(args.no_restore)
    elif(args.reload is not False):
        import os, signal
        with open('.pid', 'r') as file:
            pid = int(file.read())
        os.kill(pid, signal.SIGUSR1)
コード例 #2
0
def main():
    """The entry point of the program"""
    args = parse_cmdline_args()
    level = logging.WARNING
    if args.verbose:
        level = logging.INFO
    if args.debug:
        level = logging.DEBUG
    logging.basicConfig(format='%(filename)s:%(lineno)d %(message)s', level=level)

    if args.port < PORT_RANGE[0] or args.port > PORT_RANGE[1]:
        print "The port must be from {0} to {1}".format(PORT_RANGE[0], PORT_RANGE[1])
        exit(0)

    if(args.backend is not None):
        from backend import Worker
        if(args.backend != True):
            worker = Worker(args.backend, args.port)
        else:
            worker = Worker(None, args.port)
        if not args.profile:
            worker.start()
        else:
            from pycallgraph import PyCallGraph
            from pycallgraph.output import GraphvizOutput
            with PyCallGraph(output=GraphvizOutput()):
                worker.start()
    elif(args.interface is not False):
        import interface
        interface.start_interface(args.no_restore)
    elif(args.reload is not False):
        import os, signal
        with open('.pid', 'r') as file:
            pid = int(file.read())
        os.kill(pid, signal.SIGUSR1)
コード例 #3
0
ファイル: hummingbird.py プロジェクト: FXIhub/hummingbird
def main():
    """The entry point of the program"""

    if len(sys.argv) == 1:
        argparser.print_help()

    if "-b" in sys.argv and (sys.argv.index("-b") + 1 < len(sys.argv)):
        config_file = sys.argv[sys.argv.index("-b") + 1]
        imp.load_source("__config_file", config_file)

    args = argparser.parse_args()

    level = logging.WARNING
    if args.verbose:
        level = logging.INFO
    if args.debug:
        level = logging.DEBUG
    logging.basicConfig(format="%(filename)s:%(lineno)d %(message)s", level=level)

    if args.port < PORT_RANGE[0] or args.port > PORT_RANGE[1]:
        print "The port must be from {0} to {1}".format(PORT_RANGE[0], PORT_RANGE[1])
        exit(0)

    if args.backend is not None:
        if args.influxdb is not None:
            from ipc import influx

            influx.init(args.influxdb)
        from backend import Worker

        if args.backend != True:
            worker = Worker(args.backend, args.port)
        else:
            worker = Worker(None, args.port)
        if not args.profile:
            worker.start()
        else:
            from pycallgraph import PyCallGraph
            from pycallgraph.output import GraphvizOutput
            import ipc.mpi
            import os

            graphviz = GraphvizOutput()
            graphviz.output_file = "pycallgraph_%d.png" % (ipc.mpi.rank)
            with PyCallGraph(output=graphviz):
                worker.start()
    elif args.interface is not False:
        import interface

        interface.start_interface(args.no_restore)
    elif args.reload is not False:
        import os, signal

        with open(".pid", "r") as file:
            pid = int(file.read())
        os.kill(pid, signal.SIGUSR1)
コード例 #4
0
def main():
    """The entry point of the program"""

    if(len(sys.argv) == 1):
        argparser.print_help()

    if "-b" in sys.argv and (sys.argv.index("-b")+1 < len(sys.argv)):
        config_file = sys.argv[sys.argv.index("-b")+1]
        imp.load_source('__config_file', config_file)
        
    args = argparser.parse_args()
    
    level = logging.WARNING
    if args.verbose:
        level = logging.INFO
    if args.debug:
        level = logging.DEBUG
    logging.basicConfig(format='%(filename)s:%(lineno)d %(message)s', level=level)

    if args.port < PORT_RANGE[0] or args.port > PORT_RANGE[1]:
        print "The port must be from {0} to {1}".format(PORT_RANGE[0], PORT_RANGE[1])
        exit(0)

    if(args.backend is not None):
        if (args.influxdb is not None):
            from ipc import influx
            influx.init(args.influxdb)
        from backend import Worker
        if(args.backend != True):
            worker = Worker(args.backend, args.port)
        else:
            worker = Worker(None, args.port)
        if not args.profile:
            worker.start()
        else:
            from pycallgraph import PyCallGraph
            from pycallgraph.output import GraphvizOutput
            import ipc.mpi
            import os
            graphviz = GraphvizOutput()
            graphviz.output_file = 'pycallgraph_%d.png' % (ipc.mpi.rank)
            with PyCallGraph(output=graphviz):
                worker.start()
    elif(args.interface is not False):
        import interface
        interface.start_interface(args.no_restore)
    elif(args.reload is not False):
        import os, signal
        with open('.pid', 'r') as file:
            pid = int(file.read())
        os.kill(pid, signal.SIGUSR1)