def notify(_context, message): """Notifies the recipient of the desired event given the model. Log notifications using openstack's default logging system""" priority = message.get('priority', CONF.default_notification_level) priority = priority.lower() logger = logging.getLogger( 'staccato.openstack.common.notification.%s' % message['event_type']) getattr(logger, priority)(jsonutils.dumps(message))
import eventlet import greenlet from oslo.config import cfg from staccato.openstack.common.gettextutils import _ from staccato.openstack.common import importutils from staccato.openstack.common import jsonutils from staccato.openstack.common import log as logging from staccato.openstack.common.rpc import amqp as rpc_amqp from staccato.openstack.common.rpc import common as rpc_common qpid_messaging = importutils.try_import("qpid.messaging") qpid_exceptions = importutils.try_import("qpid.messaging.exceptions") LOG = logging.getLogger(__name__) qpid_opts = [ cfg.StrOpt('qpid_hostname', default='localhost', help='Qpid broker hostname'), cfg.IntOpt('qpid_port', default=5672, help='Qpid broker port'), cfg.ListOpt('qpid_hosts', default=['$qpid_hostname:$qpid_port'], help='Qpid HA cluster host:port pairs'), cfg.StrOpt('qpid_username', default='', help='Username for qpid connection'), cfg.StrOpt('qpid_password',
def _run(self, application, socket): """Start a WSGI server in a new green thread.""" logger = logging.getLogger("eventlet.wsgi") eventlet.wsgi.server(socket, application, custom_pool=self.tg.pool, log=logging.WritableLogger(logger))
import time import sqlalchemy import sqlalchemy.orm as sa_orm import sqlalchemy.orm.exc as orm_exc import sqlalchemy.sql.expression as sql_expression from staccato.db import migration, models import staccato.openstack.common.log as os_logging from staccato.common import exceptions from staccato.db import models import staccato.xfer.constants as constants LOG = os_logging.getLogger(__name__) class StaccatoDB(object): def __init__(self, CONF, autocommit=True, expire_on_commit=False): self.CONF = CONF self.engine = _get_db_object(CONF) self.maker = sa_orm.sessionmaker(bind=self.engine, autocommit=autocommit, expire_on_commit=expire_on_commit) def get_sessions(self): return self.maker() def get_new_xfer(self, owner,