コード例 #1
0
def main(_):
    if not FLAGS.profile_context_path:
        sys.stderr.write(
            'Please provide a value for "profile_context_path".\n')
        return

    # Create profiler from profile context.
    ProfilerFromFile(FLAGS.profile_context_path)

    # Start server.
    start_server(FLAGS.server_port)
コード例 #2
0
def main(_):
    profile_path = os.path.expanduser(FLAGS.profile_context_path)
    profile_cnt = FLAGS.successive_profile_context_count

    # Require "profile_context_path" flag.
    if not profile_path:
        sys.stderr.write(
            'Please provide a value for "profile_context_path".\n')
        return

    # Verify profile context file exists.
    if not os.path.isdir(profile_path):
        sys.stderr.write(
            'No directory was found at "{}".\n'.format(profile_path))
        return

    # Start server.
    start_server(profile_path, profile_cnt, FLAGS.server_port, FLAGS.browser)
コード例 #3
0
ファイル: ui.py プロジェクト: owsd/profiler-ui
def main(_):
    profile_path = os.path.expanduser(FLAGS.profile_context_path)

    # Require "profile_context_path" flag.
    if not profile_path:
        sys.stderr.write(
            'Please provide a value for "profile_context_path".\n')
        return

    # Verify profile context file exists.
    if not os.path.isfile(profile_path):
        sys.stderr.write('No file was found at "{}".\n'.format(profile_path))
        return

    # Create profiler from profile context.
    ProfilerFromFile(profile_path.encode('utf-8'))

    # Start server.
    start_server(FLAGS.server_port)
コード例 #4
0
ファイル: main.py プロジェクト: jorsae/YiasaCrawler
def start(log, db, args):
    log.log(logger.LogLevel.INFO, 'Starting YiasaBot', force_print=True)
    settings = handler.HandlerSettings()
    settings.set_threads(args.threads)
    handler.HandlerSettings.max_urls = args.urls
    handler.HandlerSettings.refresh_rate = args.refresh

    defaultFill = fill_database(log, db)
    if defaultFill is False:
        log.log(logger.LogLevel.ERROR,
                'Was unable to fill database with default urls. Exiting..')
        sys.exit()

    spider_handler = handler.Handler(log, db, settings)

    handler_thread = threading.Thread(target=spider_handler.run)
    handler_thread.daemon = True
    handler_thread.start()

    # TODO: Need to start server on it's own thread
    if args.server:
        server.start_server(db, log)
コード例 #5
0
from server.server import start_server
start_server()
コード例 #6
0
ファイル: start.py プロジェクト: spitaels/imperialism-remake
                    desktop_session.startswith('ubuntu') or 'xfce' in desktop_session or desktop_session.startswith(
                'xubuntu') or 'gnome' in desktop_session):
            tools.set_option(constants.Opt.FULLSCREEN_SUPPORTED, False)
            tools.log_warning(
                'Desktop environment {} has problems with full screen mode. Will turn if off.'.format(desktop_session))
    if not tools.get_option(constants.Opt.FULLSCREEN_SUPPORTED):
        tools.set_option(constants.Opt.FULLSCREEN, False)

    # now we can safely assume that the environment is good to us

    # start server
    import multiprocessing
    # multiprocessing.freeze_support()
    multiprocessing.set_start_method('spawn')
    from server.server import start_server
    start_server()

    #from server.network import ServerProcess
    #from multiprocessing import Pipe
    #parent_conn, child_conn = Pipe()
    #server_process = ServerProcess(c.NETWORK_PORT, child_conn)
    #server_process.start()
    # start client, we will return when the programm finishes
    from client.client import start_client
    start_client()

    # client finished
    # stop server

    #parent_conn.send('quit')
    #server_process.join()
コード例 #7
0
            """)

        print(f"{'Handler':<10} {'Device name'}")

        for handler, device in zip(handlers_sorted, devices_list):
            print(f"{os.path.basename(handler):<10} {device.name}")
        sys.exit(0)

    if args.type:

        if args.type == 'server':

            # Get a list of all available events handlers in system
            handlers = misc.functions.get_all_devices_handlers(basename=True)

            # Filter devices to accept only valid devices.
            # This devices should exists in handlers
            filtered_devices = []
            for device in args.devices:
                if device not in handlers:
                    constants.globals.logger.info(
                        f"{device} is not a valid device handler")
                    continue

                filtered_devices.append(os.path.join('/dev/input', device))

            start_server(args.addr, args.port, filtered_devices)

        if args.type == 'client':
            connect_to(addr=args.addr, port=args.port)