Exemplo n.º 1
0
ordering matters - and will continue unless the method call returns a value
that is not None.

At least one of the stages has to implement the calling method. If none of
them do, an AttributeError exception will be raised.
"""

import contextlib

import six

from zaqar.common import decorators
from zaqar.i18n import _
import zaqar.openstack.common.log as logging

LOG = logging.getLogger(__name__)


class Pipeline(object):

    def __init__(self, pipeline=None):
        self._pipeline = pipeline and list(pipeline) or []

    def append(self, stage):
        self._pipeline.append(stage)

    @decorators.memoized_getattr
    def __getattr__(self, name):
        with self.consumer_for(name) as consumer:
            return consumer
Exemplo n.º 2
0
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from oslo.config import cfg
from stevedore import driver

from zaqar.common import decorators
from zaqar.common import errors
from zaqar.openstack.common.cache import cache as oslo_cache
from zaqar.openstack.common import log
from zaqar.queues.storage import pipeline
from zaqar.queues.storage import pooling
from zaqar.queues.storage import utils as storage_utils

LOG = log.getLogger(__name__)

_CLI_OPTIONS = (
    cfg.BoolOpt('daemon', default=False,
                help='Run Zaqar server in background.'),
    cfg.BoolOpt('admin_mode', default=False,
                help='Activate endpoints to manage pool registry.'),
)

# NOTE (Obulpathi): Register daemon command line option for
# zaqar-server
CONF = cfg.CONF
CONF.register_cli_opts(_CLI_OPTIONS)

_GENERAL_OPTIONS = (
    cfg.BoolOpt('pooling', default=False,