Skip to content

Commit f3a0625

Browse files
committed
Remove all Alembic from BIOMERO lib, eventsourcing also takes care of views via a rebuild on init_slurm
1 parent 33f094d commit f3a0625

8 files changed

Lines changed: 25 additions & 473 deletions

File tree

biomero/database.py

Lines changed: 9 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,9 @@ class JobView(Base):
4747
group (Integer): The group ID associated with the job.
4848
task_id (UUID): The unique identifier for the biomero task
4949
50-
Migration warning:
51-
Any schema change (columns, types, constraints, indexes)
52-
must be captured in a new Alembic revision and applied to
53-
the DB.
54-
55-
PowerShell (Windows):
56-
$env:SQLALCHEMY_URL = \
57-
'postgresql+psycopg2://USER:PASS@HOST:5432/DB'
58-
cd biomero/biomero
59-
alembic -c migrations/alembic.ini revision \
60-
--autogenerate -m "explain change"
61-
62-
Bash (Linux/macOS):
63-
export SQLALCHEMY_URL= \
64-
postgresql+psycopg2://USER:PASS@HOST:5432/DB
65-
cd biomero/biomero
66-
alembic -c migrations/alembic.ini revision \
67-
--autogenerate -m "explain change"
68-
69-
When packaged, migrations are included and run on startup.
70-
Alternatively run:
71-
alembic -c migrations/alembic.ini upgrade head
72-
73-
Notes:
74-
- Version table: alembic_version_biomero
75-
- Only BIOMERO tables are included via env.py
76-
include_object
50+
Note: Schema changes are handled via event sourcing system rebuild.
51+
Use SlurmClient.initialize_analytics_system(reset_tables=True) to
52+
apply changes.
7753
"""
7854
__tablename__ = 'biomero_job_view'
7955

@@ -92,32 +68,9 @@ class JobProgressView(Base):
9268
status (String): The current status of the Slurm job.
9369
progress (String, optional): The progress status of the Slurm job.
9470
95-
Migration warning:
96-
Any schema change (columns, types, constraints, indexes)
97-
must be captured in a new Alembic revision and applied to
98-
the DB.
99-
100-
PowerShell (Windows):
101-
$env:SQLALCHEMY_URL = \
102-
'postgresql+psycopg2://USER:PASS@HOST:5432/DB'
103-
cd biomero/biomero
104-
alembic -c migrations/alembic.ini revision \
105-
--autogenerate -m "explain change"
106-
107-
Bash (Linux/macOS):
108-
export SQLALCHEMY_URL= \
109-
postgresql+psycopg2://USER:PASS@HOST:5432/DB
110-
cd biomero/biomero
111-
alembic -c migrations/alembic.ini revision \
112-
--autogenerate -m "explain change"
113-
114-
Alternatively run upgrade:
115-
alembic -c migrations/alembic.ini upgrade head
116-
117-
Notes:
118-
- Version table: alembic_version_biomero
119-
- Only BIOMERO tables are included via env.py
120-
include_object
71+
Note: Schema changes are handled via event sourcing system rebuild.
72+
Use SlurmClient.initialize_analytics_system(reset_tables=True) to
73+
apply changes.
12174
"""
12275
__tablename__ = 'biomero_job_progress_view'
12376

@@ -142,32 +95,9 @@ class WorkflowProgressView(Base):
14295
main_task_name (String, optional): The main user-facing workflow task
14396
(e.g., "cellexpansion" instead of "SLURM_Get_Results.py")
14497
145-
Migration warning:
146-
Any schema change (columns, types, constraints, indexes)
147-
must be captured in a new Alembic revision and applied to
148-
the DB.
149-
150-
PowerShell (Windows):
151-
$env:SQLALCHEMY_URL = \
152-
'postgresql+psycopg2://USER:PASS@HOST:5432/DB'
153-
cd biomero/biomero
154-
alembic -c migrations/alembic.ini revision \
155-
--autogenerate -m "explain change"
156-
157-
Bash (Linux/macOS):
158-
export SQLALCHEMY_URL= \
159-
postgresql+psycopg2://USER:PASS@HOST:5432/DB
160-
cd biomero/biomero
161-
alembic -c migrations/alembic.ini revision \
162-
--autogenerate -m "explain change"
163-
164-
Alternatively run upgrade:
165-
alembic -c migrations/alembic.ini upgrade head
166-
167-
Notes:
168-
- Version table: alembic_version_biomero
169-
- Only BIOMERO tables are included via env.py
170-
include_object
98+
Note: Schema changes are handled via event sourcing system rebuild.
99+
Use SlurmClient.initialize_analytics_system(reset_tables=True) to
100+
apply changes.
171101
"""
172102
__tablename__ = 'biomero_workflow_progress_view'
173103

@@ -284,18 +214,6 @@ def create_scoped_session(cls, sqlalchemy_url: str = None):
284214
# Setup tables if they don't exist yet, and detect fresh installs
285215
Base.metadata.create_all(cls._engine)
286216

287-
# Run Alembic migrations for BIOMERO on startup if enabled.
288-
# If tables were created just now, signal migrator to auto-stamp.
289-
try:
290-
if CREATED_ANY_TABLES:
291-
os.environ["BIOMERO_CREATED_ANY_TABLES"] = "1"
292-
from .db_migrate import run_migrations_on_startup
293-
run_migrations_on_startup()
294-
except Exception:
295-
logger.error(
296-
"Failed to run BIOMERO migrations", exc_info=True
297-
)
298-
299217
# Create a scoped_session object.
300218
cls._session = scoped_session(
301219
sessionmaker(

biomero/db_migrate.py

Lines changed: 0 additions & 144 deletions
This file was deleted.

biomero/migrations/alembic.ini

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)