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

Refactor db_jobdata #135

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions autosubmit_api/autosubmit_legacy/job/job_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def get_tree_structured_from_previous_run(expid, BasicConfig, run_id, chunk_unit
chunk_size = experiment_run.chunk_size
else:
raise Exception("Autosubmit couldn't fin the experiment header information necessary to complete this request.")
job_list = job_data_structure.get_current_job_data(
run_id, all_states=True)
job_list = job_data_structure.get_current_job_data(run_id)
if not job_list:
return [], [], {}
else:
Expand Down
13 changes: 9 additions & 4 deletions autosubmit_api/database/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,19 @@ def create_main_db_conn() -> Connection:
return builder.product


def create_sqlite_db_engine(db_path: str) -> Engine:
"""
Create an engine for a SQLite DDBB.
"""
return create_engine(f"sqlite:///{ os.path.abspath(db_path)}", poolclass=NullPool)


def create_autosubmit_db_engine() -> Engine:
"""
Create an engine for the autosubmit DDBB. Usually named autosubmit.db
"""
APIBasicConfig.read()
return create_engine(
f"sqlite:///{ os.path.abspath(APIBasicConfig.DB_PATH)}", poolclass=NullPool
)
return create_sqlite_db_engine(APIBasicConfig.DB_PATH)


def create_as_times_db_engine() -> Engine:
Expand All @@ -71,7 +76,7 @@ def create_as_times_db_engine() -> Engine:
"""
APIBasicConfig.read()
db_path = os.path.join(APIBasicConfig.DB_DIR, APIBasicConfig.AS_TIMES_DB)
return create_engine(f"sqlite:///{ os.path.abspath(db_path)}", poolclass=NullPool)
return create_sqlite_db_engine(db_path)


def execute_with_limit_offset(
Expand Down
Loading