Skip to content

Commit 0625281

Browse files
committed
Contains all the job_list changes
Fixing issues fixing post rebase issues Remove an innecesary call Contains all the job_list changes small fix for update from file fix bug in check_running Fix for a large amount of inserts Fix for split Fixed postgres init Finished the integration tests wip ( only one case missing) WIP moved to db, Integration test for differences wip docs fix regression test fix docs not working Fix pipeline docs try update version Fixing remaining issues Main loop changes, db changes, test changes, check_alljobs changes wrapper checker reworked (wip) wrappers not quite working yet rebase fixing wrappers not all working yet trying un succesfully to fix tests Fixing and adding tests for horizontal wrapper trying to add tests fix tests rebase + fix for docker ( not sure why I needed to do it) Contains all as-postgres-joblist implementation Fixing tests, deleting unused code, main wrapped db is no longer deleted Fixed stats, set_status, recovery # maybe something is not working properly Recover last_log/ready_data moved to a db consult instead of files post rebase fix Sqlalchemy was not fully supporting sqlite Changes recovery #2577, #2563 fix comment backups/restore, fix monitor unused code fixing docker issue ( revert 5fcfc8f) fix tests fix rebase bug Fix platform issue for local platform and status for create Adding more tests, monitor is not working well in wrappers, fixed issue with job.parents not being filled Renamed db fields and other fixes adding tests remove unused code Contains all as-postgres-joblist implementation fix wrong ident postgres was failing due not getting the table from the schema more efficient rework clean_unused_nodes to cover all cases Adding some tests for wrappers section.. disabling tests for code that is not on this branch fixing ident after GUI conflict resolve Fixing tests some tests delete debug stuff Wrappers run, ( could be optimized tho) fixed some wrapper issues, but not all Revised the todo's Fixed issues with multi-wrappers ( run untested) added more fields Attempt to fix concurrent runs fixed -H, added expid protection, fixed create_required_folders marking xfail, testing option some XFAIL marked tests fixing tests ( some integration fails rng) Rebase + trying to fix tests after rebase. Integration fixed, regression failling the config one I think is due a change of TYPE: pkl -> type: sqlite 27 unit tests not working yet Super commit - Changed joblist, change Status filters, tests passing All current tests passing non-skipped Unit tests working fixing wrapper tests almost there fixing wrapper tests ( last kind of tests) unit job_list test remade more tests and trying to renable run_members ( -rom) another test fixing commit Modifying one test REmove tests that doesn't make sense now, added one more todo lint added TODO of missing scenarios for the checkpoints edges.. Added more tests added tests regression and integration working fixing tests... fixing regression tests Added calculate_auto_splits in the brother autosubmitconfigparser (sqlite_joblist branch) fix basic detect WIP trying to remove chunks > EXPERIMENT.numchunks Adding code to detect dynamic changes more fix fixes fixing stuff... all kinda works kinda not wrapper fix wrapper working and not at the same time (know why) wrappers fixes fix call monitor working wrapper methods very wip stuff fix display issues tests fixing bugs intregation tests updated test some cleanup Trying to save preview wrappers... added some wrapper methods fixing adding tests Revising integration tests.. Revising tests.. ( 36 pending) Revising tests.. ( 121 pending) Regression tests working unload working ( with issues in the last log) log and job_data working again Fix total jobs output, added count statments Full Run working Almost getting the load of the full list Run working! ( kinda, dynamic load missing) Fixing the different issues with special_conditions.. as I needed to adapt it anyway to the new format.. [wip] [wip] add if to setstate for log process Load working, but run fails ( logical it has old code still) Load almost working Re-arranged. Now we will only have self.graph. Added property self.graph_dict , self.job_list that are dynamic views of self.graph Renamed _job_list to job_list Added upsert, save loads etc save working wip added check_folders to make compatible older expids renamed pkl -> db Renamed tables
1 parent 64f4613 commit 0625281

File tree

112 files changed

+9439
-5278
lines changed

Some content is hidden

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

112 files changed

+9439
-5278
lines changed

.github/workflows/docker.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ permissions:
1111
jobs:
1212
build-docker-images:
1313
name: Build Docker images
14-
env:
15-
DOCKERHUB_SECRET: ${{ secrets.DOCKERHUB_TOKEN }}
16-
# NOTE: Secrets are not available for external contributors, so we skip the job.
17-
if: ${{ secrets.DOCKERHUB_TOKEN }}
14+
# NOTE: The Docker loging command apparently stopped working at some point
15+
# probably due to some security changes in either/both GitHub and
16+
# Dependabot. To solve this, we do not build docker images here.
17+
if: ${{ github.actor != 'dependabot[bot]' }}
1818
runs-on: ubuntu-latest
1919
timeout-minutes: 15
2020

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.1.15
1+
4.2

autosubmit/autosubmit.py

Lines changed: 691 additions & 705 deletions
Large diffs are not rendered by default.

autosubmit/config/basicconfig.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#
1515
# You should have received a copy of the GNU General Public License
1616
# along with Autosubmit. If not, see <http://www.gnu.org/licenses/>.
17-
1817
try:
1918
# noinspection PyCompatibility
2019
from configparser import SafeConfigParser

autosubmit/config/configcommon.py

Lines changed: 208 additions & 74 deletions
Large diffs are not rendered by default.

autosubmit/config/files/autosubmit-dummy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ MAIL:
1212
NOTIFICATIONS: False
1313
TO:
1414
STORAGE:
15-
TYPE: "pkl"
15+
TYPE: "db"
1616
COPY_REMOTE_LOGS: True

autosubmit/config/files/autosubmit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ MAIL:
1212
NOTIFICATIONS: False
1313
TO:
1414
STORAGE:
15-
TYPE: "pkl"
15+
TYPE: "db"
1616
COPY_REMOTE_LOGS: True

autosubmit/database/db_common.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,15 @@
2424
from pathlib import Path
2525
from typing import List, Optional, cast
2626

27-
from autosubmit.config.basicconfig import BasicConfig
2827
from sqlalchemy import delete, select, Connection, insert, text, update, func
2928
from sqlalchemy.schema import CreateTable
3029

30+
from autosubmit.config.basicconfig import BasicConfig
3131
from autosubmit.database import tables, session
3232
from autosubmit.log.log import Log, AutosubmitCritical
3333

3434
Log.get_logger("Autosubmit")
3535

36-
3736
CURRENT_DATABASE_VERSION = 1
3837
TIMEOUT = 15
3938

@@ -95,22 +94,16 @@ def open_conn(check_version=True):
9594
version = row[0]
9695
except sqlite3.OperationalError:
9796
# If this exception is thrown it's because db_version does not exist.
98-
# Database is from 2.x or 3.0 beta releases
99-
try:
100-
cursor.execute('SELECT type FROM experiment;')
101-
# If type field exists, it's from 2.x
102-
version = -1
103-
except sqlite3.Error:
104-
# If raises and error , it's from 3.0 beta releases
105-
version = 0
97+
version = 0
98+
Log.warning("Database version table does not exist. Assuming version 0.")
10699

107100
# If database version is not the expected, update database....
108-
if version < CURRENT_DATABASE_VERSION:
101+
if int(version) < int(CURRENT_DATABASE_VERSION):
109102
if not _update_database(version, cursor):
110103
raise AutosubmitCritical('Database version does not match', 7001)
111104

112105
# ... or ask for autosubmit upgrade
113-
elif version > CURRENT_DATABASE_VERSION:
106+
elif int(version) > int(CURRENT_DATABASE_VERSION):
114107
raise AutosubmitCritical('Database version is not compatible with this autosubmit version. '
115108
'Please execute pip install autosubmit --upgrade', 7002)
116109
return conn, cursor
@@ -158,9 +151,9 @@ def save_experiment(name: str, description: Optional[str], version: Optional[str
158151

159152
try:
160153
result = queue.get(True, TIMEOUT)
161-
except Exception:
162-
raise AutosubmitCritical(f"The database process exceeded the timeout limit {TIMEOUT}s. "
163-
f"Your experiment {name} couldn't be stored in the database.")
154+
except BaseException:
155+
raise AutosubmitCritical(
156+
"The database process exceeded the timeout limit {0}s. Your experiment {1} couldn't be stored in the database.".format(TIMEOUT, name))
164157
finally:
165158
proc.terminate()
166159
return result
@@ -234,7 +227,7 @@ def get_autosubmit_version(expid):
234227
:type expid: str
235228
:return: If experiment exists returns the autosubmit version for it, if not returns None
236229
:rtype: str
237-
"""
230+
"""
238231
fn = _get_autosubmit_version
239232
if BasicConfig.DATABASE_BACKEND == 'postgres':
240233
fn = _get_autosubmit_version_sqlalchemy
@@ -245,9 +238,9 @@ def get_autosubmit_version(expid):
245238

246239
try:
247240
result = queue.get(True, TIMEOUT)
248-
except Exception:
241+
except Exception as e:
249242
raise AutosubmitCritical(f"The database process exceeded the timeout limit {TIMEOUT}s. "
250-
f"Get experiment {expid} version failed to complete.")
243+
f"Get experiment {expid} version failed to complete. {str(e)}")
251244
finally:
252245
proc.terminate()
253246
return result
@@ -296,7 +289,6 @@ def delete_experiment(experiment_id):
296289
fn = _delete_experiment
297290
if BasicConfig.DATABASE_BACKEND == 'postgres':
298291
fn = _delete_experiment_sqlalchemy
299-
300292
queue = multiprocessing.Queue(1)
301293
proc = multiprocessing.Process(target=fn_wrapper, args=(fn, queue, experiment_id))
302294
proc.start()
@@ -407,10 +399,8 @@ def _check_experiment_exists(name, error_on_inexistence=True):
407399
def get_experiment_description(expid: str):
408400
if BasicConfig.DATABASE_BACKEND == 'postgres':
409401
return _get_experiment_description_sqlalchemy(expid)
410-
411-
check_db()
412-
413402
try:
403+
check_db()
414404
(conn, cursor) = open_conn()
415405
except DbException as e:
416406
raise AutosubmitCritical(
@@ -487,7 +477,7 @@ def _get_autosubmit_version(expid):
487477
# behaviour with the next sentence
488478
conn.text_factory = str
489479
cursor.execute('SELECT autosubmit_version FROM experiment WHERE name=:expid', {
490-
'expid': expid})
480+
'expid': expid})
491481
row = cursor.fetchone()
492482
close_conn(conn, cursor)
493483
if row is None:
@@ -507,7 +497,7 @@ def _last_name_used(test=False, operational=False, evaluation=False):
507497
:type test: bool
508498
:return: last experiment identifier used, 'empty' if there is none
509499
:rtype: str
510-
"""
500+
"""
511501
check_db()
512502

513503
try:
@@ -741,7 +731,7 @@ def _get_experiment_description_sqlalchemy(expid) -> List[List[str]]:
741731

742732

743733
def _update_experiment_description_version_sqlalchemy(
744-
name: str, description: Optional[str] = None, version: Optional[str] = None
734+
name: str, description: Optional[str] = None, version: Optional[str] = None
745735
) -> bool:
746736
# Conditional update statement
747737
if description is None and version is None:
@@ -815,7 +805,7 @@ def _last_name_used_sqlalchemy(test=False, operational=False, evaluation=False)
815805

816806
def _delete_experiment_sqlalchemy(experiment_id: str) -> bool:
817807
if not _check_experiment_exists_sqlalchemy(
818-
experiment_id, False
808+
experiment_id, False
819809
): # Reference the no anti-lock version.
820810
return True
821811

@@ -869,3 +859,13 @@ def get_connection_url(db_path: Optional['Path'] = None) -> str:
869859
raise ValueError('For SQLite databases you MUST provide a database file.')
870860

871861
return f'sqlite:///{str(Path(db_path).resolve())}'
862+
863+
864+
def check_db_path(db_path: Optional[Path], must_exists: bool = True) -> bool:
865+
"""Check if the database path exists."""
866+
if db_path and not db_path.exists() and must_exists:
867+
raise ValueError(f'Database path not found {str(db_path)}!')
868+
elif db_path and not db_path.exists() and not must_exists:
869+
return False
870+
else:
871+
return True

0 commit comments

Comments
 (0)