Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 FIX: Pin psycopg2-binary to 2.8.x #4989

Merged
merged 2 commits into from
Jun 17, 2021
Merged

🐛 FIX: Pin psycopg2-binary to 2.8.x #4989

merged 2 commits into from
Jun 17, 2021

Conversation

chrisjsewell
Copy link
Member

@chrisjsewell chrisjsewell commented Jun 17, 2021

I think psycopg2 2.9 (released yesterday: psycopg/psycopg2@5014501) has just broken all the testing 😬

See: https://github.com/aiidaplugins/aiida-lammps/pull/26/checks?check_run_id=2848451163

    @pytest.fixture(scope='session', autouse=True)
    def aiida_profile():
        """Set up AiiDA test profile for the duration of the tests.
    
        Note: scope='session' limits this fixture to run once per session. Thanks to ``autouse=True``, you don't actually
         need to depend on it explicitly - it will activate as soon as you import it in your ``conftest.py``.
        """
>       with test_manager(backend=get_test_backend_name(), profile_name=get_test_profile_name()) as manager:

...

command = 'CREATE DATABASE "aiida_db" OWNER "aiida" ENCODING \'UTF8\' LC_COLLATE=\'en_US.UTF-8\' LC_CTYPE=\'en_US.UTF-8\' TEMPLATE=template0'
dsn = {'database': 'postgres', 'host': 'localhost', 'password': None, 'port': 58049, ...}

    def _execute_psyco(command, dsn):
        """
        executes a postgres commandline through psycopg2
    
        :param command: A psql command line as a str
        :param dsn: will be forwarded to psycopg2.connect
        """
        import psycopg2  # pylint: disable=import-outside-toplevel
    
        output = None
        with psycopg2.connect(**dsn) as conn:
            conn.autocommit = True
            with conn.cursor() as cursor:
>               cursor.execute(command)
E               psycopg2.errors.ActiveSqlTransaction: CREATE DATABASE cannot run inside a transaction block

related:

cc @csadorf @giovannipizzi @sphuber @ltalirz

@chrisjsewell
Copy link
Member Author

Obviously this is a band-aid over what looks like might require a "deeper" fix

@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

Merging #4989 (c23996d) into develop (f4f543c) will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4989      +/-   ##
===========================================
+ Coverage    80.11%   80.11%   +0.01%     
===========================================
  Files          515      515              
  Lines        36676    36676              
===========================================
+ Hits         29380    29381       +1     
+ Misses        7296     7295       -1     
Flag Coverage Δ
django 74.58% <ø> (+0.03%) ⬆️
sqlalchemy 73.51% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiida/transports/util.py 65.63% <0.00%> (+3.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4f543c...c23996d. Read the comment docs.

@csadorf csadorf added topic/dependencies topic/dependencies/constraint Issues related to dependency constraints that should be resolved. type/bug labels Jun 17, 2021
Copy link
Contributor

@csadorf csadorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for fixing!

CasperWA added a commit to Materials-Consortia/optimade-python-tools that referenced this pull request Jun 17, 2021
For more information about the issue see PR at
aiidateam/aiida-core#4989. This fix should be removed as soon as
aiida-core>1.6.3 is released with the fix.
CasperWA added a commit to Materials-Consortia/optimade-python-tools that referenced this pull request Jun 17, 2021
For more information about the issue see PR at
aiidateam/aiida-core#4989. This fix should be removed as soon as
aiida-core>1.6.3 is released with the fix.
@csadorf csadorf merged commit ca91040 into develop Jun 17, 2021
@csadorf csadorf deleted the fix/psycopg2 branch June 17, 2021 17:32
zhubonan added a commit to zhubonan/aiida-vasp that referenced this pull request Jun 19, 2021
JPchico pushed a commit to JPchico/aiida-vasp that referenced this pull request Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/dependencies/constraint Issues related to dependency constraints that should be resolved. topic/dependencies type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants