Skip to content
Snippets Groups Projects
Commit cc20d186 authored by Daniel Nemergut's avatar Daniel Nemergut
Browse files

Removed the old casa cal table

parent ee3b5978
No related branches found
No related tags found
2 merge requests!1706merge 2.8.4 to main,!1670WS-1405 CASA matrix service
......@@ -106,7 +106,7 @@ def add_services(config: Configurator, session_factory: BeakerSessionFactoryConf
notification_rest_client,
)
archive_service = ArchiveService()
casa_matrix_service = CasaMatrixService()
casa_matrix_service = CasaMatrixService(get_tm_session(session_factory, transaction.manager))
# hook up the queue report collector for Prometheus
REGISTRY.register(QueueReportCollector(capability_info))
......
......@@ -27,7 +27,6 @@ from sqlalchemy.orm import Session
from workspaces.capability.schema import (
Capability,
CasaMatrixCapability,
CasaMatrixCasaVersion,
)
from workspaces.system.services.interfaces import CasaMatrixServiceIF
......@@ -323,24 +322,17 @@ class CasaMatrixService(CasaMatrixServiceIF):
return matrix_version
def delete_version(self, version: str) -> tuple[int, int]:
def delete_version(self, version: str) -> int:
"""
Deletes a CASA version from the matrix.
:return: Tuple containing the number of rows deleted in each table
"""
# Delete the capabilities associated with this version
child_rows_changed = 0
result = self.session.query(CasaMatrixCasaVersion).filter_by(casa_version=version).first()
if result:
child_rows_changed = self.session.query(CasaMatrixCapability).filter_by(matrix_id=result.matrix_id).delete()
self.session.flush()
# Delete the version from the matrix
rows_changed = self.session.query(CasaMatrixCasaVersion).filter_by(casa_version=version).delete()
self.session.flush()
return rows_changed, child_rows_changed
return rows_changed
def make_links(self, dry_run: bool = False) -> dict[str, list[str]]:
"""
......
......@@ -17,7 +17,7 @@
# along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
from abc import ABC, abstractmethod
from workspaces.capability.schema import CasaMatrixCapability, CasaMatrixCasaVersion
from workspaces.capability.schema import CasaMatrixCasaVersion
class EstimationServiceIF(ABC):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment