Skip to content

Commit ebdfbe5

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 ebdfbe5

Some content is hidden

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

63 files changed

+4354
-1457
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: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
# run: |
3434
# ruff check .
3535

36-
test:
36+
test-unit:
3737
# needs: lint
3838
runs-on: ubuntu-latest
3939
timeout-minutes: 10
@@ -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:

autosubmit/autosubmit.py

Lines changed: 204 additions & 131 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2015-2025 Earth Sciences Department, BSC-CNS
2+
#
3+
# This file is part of Autosubmit.
4+
#
5+
# Autosubmit is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# Autosubmit is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with Autosubmit. If not, see <http://www.gnu.org/licenses/>.
17+
18+
"""Database data files."""

0 commit comments

Comments
 (0)