f24cd42 Make db_session singleton

Authored and Committed by cqi 4 years ago
50 files changed. 1030 lines added. 1083 lines removed.
module_build_service/builder/KojiContentGenerator.py
file modified
+3 -3
module_build_service/builder/KojiModuleBuilder.py
file modified
+65 -67
module_build_service/builder/MockModuleBuilder.py
file modified
+16 -16
module_build_service/db_session.py
file added
+75
module_build_service/manage.py
file modified
+47 -45
module_build_service/models.py
file modified
+1 -108
module_build_service/monitor.py
file modified
+0 -17
module_build_service/scheduler/__init__.py
file modified
+12 -1
module_build_service/scheduler/consumer.py
file modified
+9 -8
module_build_service/scheduler/default_modules.py
file modified
+2 -2
module_build_service/scheduler/handlers/components.py
file modified
+9 -8
module_build_service/scheduler/handlers/greenwave.py
file modified
+4 -5
module_build_service/scheduler/handlers/modules.py
file modified
+14 -13
module_build_service/scheduler/handlers/repos.py
file modified
+3 -2
module_build_service/scheduler/handlers/tags.py
file modified
+2 -1
module_build_service/scheduler/producer.py
file modified
+33 -30
module_build_service/utils/batches.py
file modified
+9 -9
module_build_service/utils/general.py
file modified
+5 -7
module_build_service/utils/reuse.py
file modified
+14 -12
module_build_service/utils/submit.py
file modified
+9 -14
module_build_service/utils/ursine.py
file modified
+8 -11
module_build_service/views.py
file modified
+14 -2
tests/__init__.py
file modified
+17 -13
tests/conftest.py
file modified
+5 -11
tests/test_build/test_build.py
file modified
+90 -74
tests/test_builder/test_base.py
file modified
+2 -1
tests/test_builder/test_koji.py
file modified
+44 -25
tests/test_builder/test_mock.py
file modified
+8 -7
tests/test_content_generator.py
file modified
+5 -7
tests/test_logger.py
file modified
+3 -2
tests/test_manage.py
file modified
+5 -4
tests/test_models/test_models.py
file modified
+24 -34
tests/test_monitor.py
file modified
+19 -12
tests/test_resolver/test_db.py
file modified
+16 -19
tests/test_resolver/test_koji.py
file modified
+22 -22
tests/test_resolver/test_local.py
file modified
+4 -3
tests/test_resolver/test_mbs.py
file modified
+20 -20
tests/test_scheduler/test_consumer.py
file modified
+1 -1
tests/test_scheduler/test_default_modules.py
file modified
+17 -20
tests/test_scheduler/test_greenwave.py
file modified
+23 -20
tests/test_scheduler/test_module_init.py
file modified
+13 -14
tests/test_scheduler/test_module_wait.py
file modified
+18 -39
tests/test_scheduler/test_poller.py
file modified
+37 -41
tests/test_scheduler/test_repo_done.py
file modified
+20 -26
tests/test_scheduler/test_tag_tagged.py
file modified
+32 -31
tests/test_utils/test_greenwave.py
file modified
+4 -4
tests/test_utils/test_ursine.py
file modified
+19 -19
tests/test_utils/test_utils.py
file modified
+113 -136
tests/test_utils/test_utils_mse.py
file modified
+55 -56
tests/test_views/test_views.py
file modified
+40 -41
    Make db_session singleton
    
    Please note that this patch does not change the use of database session
    in MBS. So, in the frontend, the database session is still managed by
    Flask-SQLAlchemy, that is the db.session. And the backend, running event
    handlers, has its own database session created from SQLAclehmy session
    API directly.
    
    This patch aims to reduce the number of scoped_session created when call
    original function make_db_session. For technical detailed information,
    please refer to SQLAlchemy documentation Contextual/Thread-local
    Sessions.
    
    As a result, a global scoped_session is accessible from the
    code running inside backend, both the event handlers and functions
    called from handlers. The library code shared by frontend and backend,
    like resolvers, has no change.
    
    Similarly, db.session is only used to recreate database for every test.
    
    Signed-off-by: Chenxiong Qi <cqi@redhat.com>
    
        
  • c3i-jenkins
    success (100%)
    Build #203 successful (commit: f24cd422)
    4 years ago
file modified
+47 -45
file modified
+1 -108
file modified
+14 -2
file modified
+17 -13
file modified
+5 -11
file modified
+90 -74
file modified
+44 -25
file modified
+3 -2
file modified
+5 -4
file modified
+19 -12
file modified
+16 -19
file modified
+20 -20
file modified
+19 -19
file modified
+113 -136
file modified
+40 -41