Exemplo n.º 1
0
def start_actor(actor_type, **kwargs):
    configure_logging(level=CONFIG.log_level)
    if CONFIG.sentry_enable:
        sentry_init(CONFIG.sentry_dsn)
    backdoor.setup()
    is_scheduler = actor_type == 'scheduler'
    actors = list(collect_actors(f'rssant_{actor_type}'))
    if not is_scheduler:
        actors.extend([
            do_update_registery,
            do_keepalive,
            do_dns_service_update,
        ])
        kwargs.update(
            on_startup=[on_startup],
            on_shutdown=[on_shutdown],
        )
    start_actor_cli(
        actor_type=actor_type,
        actors=actors,
        registery_node_spec=CONFIG.registery_node_spec,
        schema_compiler=schema_compiler,
        storage_dir_path=CONFIG.actor_storage_path,
        storage_compact_wal_delta=CONFIG.actor_storage_compact_wal_delta,
        queue_max_complete_size=CONFIG.actor_queue_max_complete_size,
        max_retry_time=CONFIG.actor_max_retry_time,
        max_retry_count=CONFIG.actor_max_retry_count,
        token=CONFIG.actor_token,
        **kwargs
    )
Exemplo n.º 2
0
def main():
    backdoor.setup()
    app = ActorNode(
        actors=ACTORS,
        port=8081,
        name='registery',
        storage_dir_path='data/actorlib_example_registery',
    )
    app.run()
Exemplo n.º 3
0
def create_app():
    configure_logging(level=CONFIG.log_level)
    backdoor.setup()
    if CONFIG.sentry_enable:
        sentry_sdk.init(
            dsn=CONFIG.sentry_dsn,
            integrations=[AioHttpIntegration()]
        )
    api = web.Application()
    api.router.add_routes(routes)
    app = web.Application()
    app.add_subapp('/api/v1', api)
    setup_aiojobs(app, limit=5000, pending_limit=5000)
    return app
Exemplo n.º 4
0
def main():
    backdoor.setup()
    app = ActorNode(
        actors=ACTORS,
        port=8085,
        name='worker',
        storage_dir_path='data/actorlib_example_worker',
        storage_compact_wal_delta=100,
        registery_node_spec={
            'name': 'registery',
            'modules': ['registery'],
            'networks': [{
                'name': 'localhost',
                'url': 'http://localhost:8081',
            }],
        },
    )
    app.run()
Exemplo n.º 5
0
"""
WSGI config for rssant project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import backdoor
from django.core.wsgi import get_wsgi_application
import rssant_common.django_setup  # noqa:F401
from rssant_config import CONFIG
from rssant_common.logger import configure_logging
from rssant_common.helper import is_main_or_wsgi

if is_main_or_wsgi(__name__):
    configure_logging(level=CONFIG.log_level)
    backdoor.setup()
    application = get_wsgi_application()
Exemplo n.º 6
0
def get_wsgi_application():
    configure_logging(level=CONFIG.log_level)
    backdoor.setup()
    return _get_app()