コード例 #1
0
ファイル: show.py プロジェクト: clayton-colovore/infoset-ng
def ingester(args):
    """Process 'show ingester' commands.

    Args:
        args: Argparse arguments

    Returns:
        None

    """
    if args.subqualifier == 'logs':
        # Process logs
        config = configuration.Config()
        filename = config.log_file()
        tail = input_output.File(filename)
        tail.tail()

        # Done
        sys.exit(0)

    elif args.subqualifier == 'status':
        # Create agent objects
        agent_ingester = Agent(INGESTER_EXECUTABLE)

        # Get agent status
        daemon_ingester = AgentDaemon(agent_ingester)
        daemon_ingester.status()

        # Done
        sys.exit(0)

    # Show help if there are no matches
    general.cli_help()
コード例 #2
0
def ingester():
    """Process 'start ingester' commands.

    Args:
        None

    Returns:
        None

    """
    # Check existence of systemd file
    if general.systemd_exists(INGESTER_EXECUTABLE) is True:
        general.systemd_daemon(INGESTER_EXECUTABLE, action='start')
    else:
        # Check user
        general.check_user()

        # Create agent object
        agent_ingester = Agent(INGESTER_EXECUTABLE)

        # Start agent
        daemon_ingester = AgentDaemon(agent_ingester)
        daemon_ingester.start()

    # Done
    sys.exit(0)
コード例 #3
0
def api():
    """Process 'start api' commands.

    Args:
        None

    Returns:
        None

    """
    # Check existence of systemd file
    if general.systemd_exists(API_EXECUTABLE) is True:
        general.systemd_daemon(API_EXECUTABLE, action='start')
    else:
        # Check user
        general.check_user()

        # Create agent objects
        agent_gunicorn = Agent(API_GUNICORN_AGENT)
        agent_api = AgentAPI(API_EXECUTABLE, API_GUNICORN_AGENT)

        # Start daemons (API first, Gunicorn second)
        daemon_api = AgentDaemon(agent_api)
        daemon_api.start()
        daemon_gunicorn = AgentDaemon(agent_gunicorn)
        daemon_gunicorn.start()
        # Done
        sys.exit(0)
コード例 #4
0
ファイル: stop.py プロジェクト: clayton-colovore/infoset-ng
def ingester(args):
    """Process 'stop ingester' commands.

    Args:
        args: Argparse arguments

    Returns:
        None

    """
    # Check existence of systemd file
    if general.systemd_exists(INGESTER_EXECUTABLE) is True:
        general.systemd_daemon(INGESTER_EXECUTABLE, action='stop')
    else:
        # Check user
        general.check_user()

        # Create agent object
        agent_ingester = Agent(INGESTER_EXECUTABLE)

        # Stop daemon
        daemon_ingester = AgentDaemon(agent_ingester)
        if args.force is True:
            daemon_ingester.force()
        daemon_ingester.stop()

    # Done
    sys.exit(0)
コード例 #5
0
ファイル: show.py プロジェクト: clayton-colovore/infoset-ng
def api(args):
    """Process 'show api' commands.

    Args:
        args: Argparse arguments

    Returns:
        None

    """
    if args.subqualifier == 'logs':
        # Process logs
        config = configuration.Config()
        filename = config.web_log_file()
        tail = input_output.File(filename)
        tail.tail()

        # Done
        sys.exit(0)

    elif args.subqualifier == 'status':
        # Create agent objects
        agent_gunicorn = Agent(API_GUNICORN_AGENT)
        agent_api = AgentAPI(API_EXECUTABLE, API_GUNICORN_AGENT)

        # Get agent status
        daemon_gunicorn = AgentDaemon(agent_gunicorn)
        daemon_gunicorn.status()
        daemon_api = AgentDaemon(agent_api)
        daemon_api.status()

        # Done
        sys.exit(0)

    # Show help if there are no matches
    general.cli_help()
コード例 #6
0
ファイル: stop.py プロジェクト: clayton-colovore/infoset-ng
def api(args):
    """Process 'stop api' commands.

    Args:
        args: Argparse arguments

    Returns:
        None

    """
    # Check existence of systemd file
    if general.systemd_exists(API_EXECUTABLE) is True:
        general.systemd_daemon(API_EXECUTABLE, action='stop')
    else:
        # Check user
        general.check_user()

        # Create agent objects
        agent_gunicorn = Agent(API_GUNICORN_AGENT)
        agent_api = AgentAPI(API_EXECUTABLE, API_GUNICORN_AGENT)

        # Stop daemons
        daemon_gunicorn = AgentDaemon(agent_gunicorn)
        daemon_api = AgentDaemon(agent_api)
        if args.force is True:
            daemon_gunicorn.force()
            daemon_api.force()
        daemon_gunicorn.stop()
        daemon_api.stop()

    # Done
    sys.exit(0)