Skip to content

Commit 034fcd8

Browse files
LuiggiTenorioKkinow
authored andcommitted
Add Postgres support to Autosubmit.
Add Postgres support to Autosubmit Implemented with SQLAlchemy, abstract/OOP/protocols, a new configuration key DATABASE_BACKEND. Tested with Docker and TestContainers. More tests added (unit and integration).
1 parent 70cc5b3 commit 034fcd8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4381
-1459
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ omit =
1818
parallel = True
1919
source = ./autosubmit
2020
timid = False
21+
sigterm = True
2122

2223
[report]
2324
exclude_lines =

.github/workflows/ci.yaml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ jobs:
3333
# run: |
3434
# ruff check .
3535

36-
test:
36+
test-unit:
3737
# needs: lint
3838
runs-on: ubuntu-latest
39-
timeout-minutes: 10
39+
timeout-minutes: 15
4040

4141
strategy:
4242
matrix:
@@ -50,9 +50,11 @@ jobs:
5050
uses: actions/setup-python@v6
5151
with:
5252
python-version: ${{ matrix.python-version }}
53+
# See: https://github.com/actions/setup-python#caching-packages-dependencies
54+
cache: 'pip' # caching pip dependencies
5355

5456
- name: Install system dependencies
55-
run: sudo apt-get install -y graphviz rsync curl
57+
run: sudo apt-get install -y curl graphviz rsync
5658

5759
- name: Install dependencies
5860
run: |
@@ -64,7 +66,8 @@ jobs:
6466
pytest \
6567
--cov=autosubmit --cov-config=.coveragerc \
6668
--cov-report=xml:test/coverage.xml --cov-append \
67-
test/unit
69+
--dist load \
70+
test/unit -m "not postgres"
6871
6972
- name: Coverage report
7073
run: |
@@ -85,6 +88,16 @@ jobs:
8588
strategy:
8689
matrix:
8790
python-version: ["3.9", "3.10", "3.11", "3.12"]
91+
pytest-markers: ["not postgres"]
92+
# Here we include an extra build with the lowest version of Python and Postgres.
93+
# We do it this way to avoid wasting CICD resources since we already tested the
94+
# code with SQLite. So we run just one build with Postgres (normally newer versions
95+
# of Python may succeed while older fail -- e.g. using newer features in a code that
96+
# must support older versions).
97+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow#example-adding-configurations
98+
include:
99+
- python-version: '3.9'
100+
pytest-markers: 'postgres'
88101

89102
steps:
90103
- name: Checkout code
@@ -94,6 +107,8 @@ jobs:
94107
uses: actions/setup-python@v6
95108
with:
96109
python-version: ${{ matrix.python-version }}
110+
# See: https://github.com/actions/setup-python#caching-packages-dependencies
111+
cache: 'pip' # caching pip dependencies
97112

98113
- name: Install system dependencies
99114
run: sudo apt-get install -y curl git graphviz rsync
@@ -119,8 +134,9 @@ jobs:
119134
pytest \
120135
--cov=autosubmit --cov-config=.coveragerc \
121136
--cov-report=xml:test/coverage.xml --cov-append \
137+
--dist load \
122138
test/integration \
123-
-m 'not slurm'
139+
-m "${{ matrix.pytest-markers }}"
124140
125141
- name: Coverage report
126142
run: |
@@ -130,7 +146,7 @@ jobs:
130146
- name: Upload coverage artifact
131147
uses: actions/upload-artifact@v4
132148
with:
133-
name: coverage_integration_py-${{ matrix.python-version }}
149+
name: coverage_integration_py-${{ matrix.python-version }}-${{ matrix.pytest-markers }}
134150
path: coverage.xml
135151
retention-days: 7
136152

@@ -307,7 +323,7 @@ jobs:
307323
cffconvert --validate -i CITATION.cff
308324
309325
coverage:
310-
needs: [test, test-integration, test-regression, test-slurm, test-docs]
326+
needs: [test-unit, test-integration, test-regression, test-slurm, test-docs]
311327
runs-on: ubuntu-latest
312328
timeout-minutes: 2
313329
steps:

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
### 4.1.16: Unreleased
22

3+
This release adds support to Postgres using SQLAlchemy, without removing the
4+
SQLite support. By default, Autosubmit will use SQLite. Postgres support is
5+
experimental and not recommended for production yet.
6+
7+
Autosubmit Config Parser code has been merged back into this code base. LOCAL
8+
platform does not support wrappers anymore (it was used for testing).
9+
310
**Bug fixes:**
411

512
- Fixed issue with the verification of dirty Git local repositories in operational experiments #2446
@@ -20,6 +27,7 @@
2027
automatically answer yes to prompts #2569
2128
- Improvement of error message when `LOCAL` project location is a file, not a directory #1972 #1254
2229
- Removed the code for wrappers with local platform that were create only for tests #2522
30+
- Added SQLAlchemy as the main database entrypoint, enabling backends of Sqlite (default) and Postgres (new) #2187
2331

2432
### 4.1.15: Bug fixes, enhancements, and new features
2533

@@ -48,7 +56,7 @@ the filter the jobs. Not using any value for `-fp` still returns all jobs.
4856
- EDITO Autosubmit-Demo container updated to install API in different environment #2398
4957
- Update portalocker requirement from <=3.1.1 to <=3.2.0 #2423
5058
- Additional files are now generated upon using the `autosubmit inspect` command #2323
51-
- Operational runs now require no pending commits, ensuring a cleaner workflow. [#2220](https://github.com/BSC-ES/autosubmit/issues/2220), [PR](https://github.com/BSC-ES/autosubmit/pull/2293)
59+
- Operational runs now require no pending commits, ensuring a cleaner workflow. [#2220](https://github.com/BSC-ES/autosubmit/issues/2220), [PR](https://github.com/BSC-ES/autosubmit/pull/2293)
5260

5361
### 4.1.14: Bug fixes, enhancements, and new features
5462

0 commit comments

Comments
 (0)