コード例 #1
0
ファイル: test_labels.py プロジェクト: clchiou/garage
    def test_make_nested_labels(self):

        self.assertEqual(
            flatten(
                labels.make_nested_labels(
                    'foo.bar',
                    # Strings are iterables, too (this may be confusing
                    # sometimes).
                    ('a', ('b', 'x'), ('c', (('y', 'z'), ))),
                ), ),
            (
                ('a', 'foo.bar:a'),
                ('b.x', 'foo.bar:b.x'),
                ('c.y.z', 'foo.bar:c.y.z'),
            ),
        )

        self.assertEqual(
            flatten(
                labels.make_nested_labels(
                    'foo.bar',
                    (('a', ('x', 'y', 'z')), ),
                ), ),
            (
                ('a.x', 'foo.bar:a.x'),
                ('a.y', 'foo.bar:a.y'),
                ('a.z', 'foo.bar:a.z'),
            ),
        )
コード例 #2
0
ファイル: parts.py プロジェクト: clchiou/garage
def define_server(module_path=None, **kwargs):
    module_path = module_path or __package__
    module_labels = labels.make_nested_labels(module_path, SERVER_LABEL_NAMES)
    setup_server(
        module_labels,
        parameters.define(module_path, make_server_params(**kwargs)),
    )
    return module_labels
コード例 #3
0
def define_subscriber(module_path=None, **kwargs):
    module_path = module_path or subscribers.__name__
    module_labels = labels.make_nested_labels(
        module_path,
        SUBSCRIBER_LABEL_NAMES,
    )
    setup_subscriber(
        module_labels,
        parameters.define(module_path, make_subscriber_params(**kwargs)),
    )
    return module_labels
コード例 #4
0
import g1.asyncs.agents.parts
import g1.http.clients.parts.clusters
import g1.threads.parts
from g1.apps import asyncs
from g1.apps import parameters
from g1.apps import utils
from g1.asyncs import kernels
from g1.asyncs.bases import tasks
from g1.bases import labels
from g1.http import clients

LABELS = labels.make_nested_labels(
    __name__,
    (
        ('session', g1.http.clients.parts.clusters.SESSION_LABEL_NAMES),
        ('stub', g1.http.clients.parts.clusters.STUB_LABEL_NAMES),
    ),
)

g1.http.clients.parts.clusters.setup_session(
    LABELS.session,
    parameters.define(
        __name__ + '.session',
        g1.http.clients.parts.clusters.make_session_params(),
    ),
)

g1.http.clients.parts.clusters.setup_stub(
    LABELS.stub,
    parameters.define(