• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SwissDataScienceCenter / renku-data-services / 5388199646

27 Jun 2023 09:35AM UTC coverage: 88.917% (+0.4%) from 88.567%
5388199646

push

gihub-action

web-flow
chore: changes for Postgres and Helm (#9)

Co-authored-by: Johann-Michael Thiebaut <johann.thiebaut@gmail.com>
Co-authored-by: Alessandro Degano <40891147+aledegano@users.noreply.github.com>
Co-authored-by: Ralf Grubenmann <ralf.grubenmann@protonmail.com>

654 of 654 new or added lines in 15 files covered. (100.0%)

1428 of 1606 relevant lines covered (88.92%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.14
/src/renku_crc/main.py
1
"""The entrypoint for the CRC application."""
1✔
2
import argparse
1✔
3
from os import environ
1✔
4

5
from sanic import Sanic
1✔
6
from sanic.worker.loader import AppLoader
1✔
7

8
from renku_crc.app import register_all_handlers
1✔
9
from renku_crc.config import Config
1✔
10

11

12
def create_app() -> Sanic:
1✔
13
    """Create a Sanic application."""
14
    config = Config.from_env()
1✔
15
    app = Sanic(config.app_name)
1✔
16
    if "COVERAGE_RUN" in environ:
1✔
17
        app.config.TOUCHUP = False
1✔
18
        # NOTE: in single process mode where we usually run schemathesis to get coverage the db migrations
19
        # specified below with the main_process_start decorator do not run.
20
        config.rp_repo.do_migrations()
1✔
21
        config.user_repo.do_migrations()
1✔
22
        config.rp_repo.initialize(config.default_resource_pool)
1✔
23
    app = register_all_handlers(app, config)
1✔
24

25
    @app.main_process_start
1✔
26
    async def do_migrations(*_):
1✔
27
        config.rp_repo.do_migrations()
×
28
        config.user_repo.do_migrations()
×
29
        config.rp_repo.initialize(config.default_resource_pool)
×
30

31
    return app
1✔
32

33

34
if __name__ == "__main__":
1✔
35
    parser = argparse.ArgumentParser(prog="Renku Compute Resource Access Control")
×
36
    # NOTE: K8s probes will fail if listening only on 127.0.0.1 - so we listen on 0.0.0.0
37
    parser.add_argument("-H", "--host", default="0.0.0.0", help="Host to listen on")  # nosec B104
×
38
    parser.add_argument("-p", "--port", default=8000, type=int, help="Port to listen on")
×
39
    parser.add_argument("--debug", action="store_true", help="Enable Sanic debug mode")
×
40
    parser.add_argument("--fast", action="store_true", help="Enable Sanic fast mode")
×
41
    parser.add_argument("-d", "--dev", action="store_true", help="Enable Sanic development mode")
×
42
    parser.add_argument("--single-process", action="store_true", help="Do not use multiprocessing.")
×
43
    args = vars(parser.parse_args())
×
44
    loader = AppLoader(factory=create_app)
×
45
    app = loader.load()
×
46
    app.prepare(**args)
×
47
    Sanic.serve(primary=app, app_loader=loader)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc