Ejemplo n.º 1
0
def main():
    """Start the Gunicorn WSGI.

    Args:
        None

    Returns:
        None

    """
    # Initialize key variables
    config = Config()
    

    # Make sure we have a database
    _ = connectivity()

    # Create agent object for web_proxy
    agent_gunicorn = Agent(PATTOO_API_WEB_PROXY, config=config)

    # Create agent for daemon
    agent_api = AgentAPI(
        PATTOO_API_WEB_NAME,
        PATTOO_API_WEB_PROXY,
        PATTOO_API_WEB,
        config=config)

    # Do control (API first, Gunicorn second)
    cli = AgentCLI()
    cli.control(agent_api)
    cli.control(agent_gunicorn)
Ejemplo n.º 2
0
def main():
    """Ingest data.

    Args:
        None

    Returns:
        None

    Method:
        1) Read the files in the cache directory older than a threshold
        2) Process the data in the files
        3) Repeat, if new files are found that are older than the threshold,
           or we have been running too long.

        Batches of files are read to reduce the risk of overloading available
        memory, and ensure we can exit if we are running too long.

    """
    # Make sure we have a database
    _ = connectivity()

    # Process cache
    args = arguments()
    success = files.process_cache(batch_size=args.batch_size,
                                  max_duration=args.max_duration,
                                  script=True)
    sys.exit(int(not success))
Ejemplo n.º 3
0
def main():
    """Main function to start the Gunicorn WSGI."""
    # Initialize key variables
    config = Config()

    # Make sure we have a database
    _ = connectivity()

    # Create agent object for web_proxy
    agent_gunicorn = Agent(PATTOO_API_AGENT_PROXY, config=config)

    # Create agent for daemon
    config = Config()
    agent_api = AgentAPI(
        PATTOO_API_AGENT_NAME,
        PATTOO_API_AGENT_PROXY,
        PATTOO_API_AGENT,
        config=config)

    # Add set API email address
    agent_api.set_api_email()

    # Set up encryption using Pgpier in Agent
    agent_api.set_gnupg() # Creation and retrieval of Pgpier object

    # Do control (API first, Gunicorn second)
    cli = AgentCLI()
    cli.control(agent_api)
    cli.control(agent_gunicorn)
Ejemplo n.º 4
0
def main():
    """Start the pattoo ingester daemon.

    Args:
        None

    Returns:
        None

    """
    # Initialize key variables
    config = Config()

    # Make sure we have a database
    _ = connectivity()

    # Poll
    agent_poller = PollingAgent(PATTOO_INGESTERD_NAME, config=config)

    # Do control
    cli = AgentCLI()
    cli.control(agent_poller, graceful=True)
Ejemplo n.º 5
0
def main():
    """Main function to start the Gunicorn WSGI."""
    # Initialize key variables
    config = Config()

    # Make sure we have a database
    _ = connectivity()

    # Create agent object for web_proxy
    agent_gunicorn = Agent(PATTOO_API_AGENT_PROXY, config=config)

    # Create agent for daemon
    config = Config()
    agent_api = AgentAPI(PATTOO_API_AGENT_NAME,
                         PATTOO_API_AGENT_PROXY,
                         PATTOO_API_AGENT,
                         config=config)

    # Do control (API first, Gunicorn second)
    cli = AgentCLI()
    cli.control(agent_api)
    cli.control(agent_gunicorn)
Ejemplo n.º 6
0
def main():
    """Pattoo CLI script.

    Args:
        None

    Returns:
        None

    """
    # Make sure we have a database
    _ = connectivity()

    # Initialize key variables
    _help = 'This program is the CLI interface to configuring pattoo'

    # Process the CLI
    _parser = Parser(additional_help=_help)
    (args, parser) = _parser.args()

    # Process CLI options
    if args.action == 'show':
        cli_show.process(args)

    elif args.action == 'create':
        cli_create.process(args)

    elif args.action == 'set':
        cli_set.process(args)

    elif args.action == 'import':
        cli_import.process(args)

    elif args.action == 'assign':
        cli_assign.process(args)

    # Print help if no argument options were triggered
    parser.print_help(sys.stderr)
    sys.exit(1)