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

aiidateam / aiida_core / 5961
74%

Build:
DEFAULT BRANCH: develop
Ran 30 Apr 2019 05:02PM UTC
Jobs 4
Files 385
Run time 9min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
5961

push

travis-ci

szoupanos
Properly unload database environment when swapping profiles

The experimental functionality to switch profile within the same
interpreter that was recently introduced, suffered a fatal flaw. Even
though the `load_profile` function correctly reset the `Manager`, which
would hold references configured for the old profile, it did not
consider database specific resources. The `Backend` instance was
properly reset, but both the Django and SqlAlchemy implementations also
configure an engine or connection to the database, based on the database
connection details specified for the profile.

These resources were not properly being reset and recreated after
changing profiles, causing the wrong database to be used. This was
discovered in the unittests for `verdi quicksetup/setup`. These tests
would create a complete temporary AiiDA instance complete with postgres
cluster and create a new profile, to which it would then switch for the
duration of the test. After the test, the original test session
variables would be restored. However, the database environment was never
actually being swapped, causing the tests not to use the temporary
database, but that of the general test session.

This problem is addressed, by implementing an `unload_dbenv` function
that destroys the database resources that are initialized by the
`load_dbenv` counterpart. This function is called when the manager is
reset, which in turn is called in `load_profile` when the profile is
switched.

For SqlAlchemy, the unloading is accomplished by disposing the current
engine and resetting the scoped session class by calling`reset_session`
which will reset the global variables in `aiida.backends.sqlalchemy`.

The `unload_dbenv` for Django has not yet been implemented. The
mechanism for loading the database environment for Django is to import
the settings file, which will define global variables based on the
current profile, which will be used by Django to create a database
connection. It is currently... (continued)

23436 of 32695 relevant lines covered (71.68%)

2.62 hits per line

Jobs
ID Job ID Ran Files Coverage
5 5961.5 (TEST_AIIDA_BACKEND=django TEST_TYPE="tests") 30 Apr 2019 05:02PM UTC 0
65.44
Travis Job 5961.5
6 5961.6 (TEST_AIIDA_BACKEND=django TEST_TYPE="tests") 30 Apr 2019 05:08PM UTC 0
65.38
Travis Job 5961.6
7 5961.7 (TEST_AIIDA_BACKEND=sqlalchemy TEST_TYPE="tests") 30 Apr 2019 05:08PM UTC 0
65.44
Travis Job 5961.7
8 5961.8 (TEST_AIIDA_BACKEND=sqlalchemy TEST_TYPE="tests") 30 Apr 2019 05:11PM UTC 0
65.36
Travis Job 5961.8
Source Files on build 5961
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #5961
  • 0fc7ff27 on github
  • Prev Build on develop (#5957)
  • Next Build on develop (#5969)
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

© 2026 Coveralls, Inc