def create_managed_feeds_manager_for_periodic_lambda():
    aws_region = os.environ['AWS_REGION']
    incoming_queue_name = os.environ['SQS_IN_QUEUE_NAME']
    engine = create_engine(os.environ['POSTGRES_URI'])

    Session = sessionmaker(bind=engine)

    return ManagedFeedsManager.create_manager(aws_region, Session(),
                                              incoming_queue_name)
Exemple #2
0
def create_managed_feeds_manager_for_periodic_lambda():
    aws_region = os.environ['AWS_REGION']
    pi_points_table_name = os.environ['PI_POINTS_TABLENAME']
    events_status_table_name = os.environ['EVENTS_STATUS_TABLENAME']
    incoming_queue_name = os.environ['SQS_IN_QUEUE_NAME']

    return ManagedFeedsManager.create_manager(aws_region, pi_points_table_name,
                                              events_status_table_name,
                                              incoming_queue_name)
Exemple #3
0
def _create_managed_feeds_manager(config):
    return ManagedFeedsManager.create_manager(
        aws_region=config['region'],
        pi_points_table_name=config['pi_points_table_name'],
        events_status_table_name=config['events_status_table_name'],
        incoming_queue_name=config['incoming_queue_name'])
Exemple #4
0
import argparse
import logging

from workers.managed_feeds.managed_feeds_manager import ManagedFeedsManager


def parse_command_line_args():
    parser = argparse.ArgumentParser(description='PI Communication Worker')
    parser.add_argument('--pi_points_table_name', required=True)
    parser.add_argument('--outgoing_sqs_name', required=True)
    parser.add_argument('--events_status_table_name', required=True)
    parser.add_argument('--region', required=True)
    return parser.parse_args()


if __name__ == '__main__':
    logging.basicConfig(level=logging.ERROR,
                        format='[%(asctime)s][%(levelname)s] %(message)s',
                        datefmt='%H:%M:%S')
    args = parse_command_line_args()

    feeds_manager = ManagedFeedsManager.create_manager(
        args.region,
        args.pi_points_table_name,
        args.events_status_table_name,
        outgoing_queue_name=args.outgoing_sqs_name)

    feeds_manager.start_processing_requests()
def _create_managed_feeds_manager(config):
    return ManagedFeedsManager.create_manager(
        aws_region=config['region'],
        postgres_session=database.session,
        incoming_queue_name=config['incoming_queue_name'])
Exemple #6
0
def managed_feeds_manager(s3_resource, sqs_service, managed_feeds_dynamo_dao, iot_service):
    return ManagedFeedsManager(s3_resource, sqs_service, managed_feeds_dynamo_dao, iot_service)
Exemple #7
0
from sqlalchemy.orm import sessionmaker, scoped_session
from workers.managed_feeds.managed_feeds_manager import ManagedFeedsManager


def parse_command_line_args():
    parser = argparse.ArgumentParser(description='PI Communication Worker')
    parser.add_argument('--outgoing_sqs_name', required=True)
    parser.add_argument('--region', required=True)
    parser.add_argument('--postgres-uri', required=True)
    parser.add_argument('--dts', required=True)
    return parser.parse_args()


if __name__ == '__main__':
    logging.basicConfig(level=logging.ERROR,
                        format='[%(asctime)s][%(levelname)s] %(message)s',
                        datefmt='%H:%M:%S')
    args = parse_command_line_args()

    engine = create_engine(args.postgres_uri, use_batch_mode=True)
    session_factory = sessionmaker(bind=engine)
    Session = scoped_session(session_factory)

    feeds_manager = ManagedFeedsManager.create_manager(
        args.region,
        postgres_session=Session,
        outgoing_queue_name=args.outgoing_sqs_name,
        use_iot=True if args.dts == 'AWS IoT' else False)

    feeds_manager.start_processing_requests()