From 8754c40694f27eca688618e6a3cc8fc08d608735 Mon Sep 17 00:00:00 2001 From: Michael Franklin Date: Tue, 13 Dec 2022 14:46:03 +1100 Subject: [PATCH] Formatting pass # Conflicts: # models/models/analysis.py --- db/project.xml | 69 +++++++++++++++++++----------------- db/python/tables/analysis.py | 2 ++ db/python/tables/file.py | 2 +- models/models/analysis.py | 1 + models/models/file.py | 4 ++- scripts/migrate_files.py | 12 +++---- 6 files changed, 49 insertions(+), 41 deletions(-) diff --git a/db/project.xml b/db/project.xml index 0b56ba598..edfadc106 100644 --- a/db/project.xml +++ b/db/project.xml @@ -697,40 +697,45 @@ SET @@system_versioning_alter_history = 1; - + - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/db/python/tables/analysis.py b/db/python/tables/analysis.py index c2ca625a7..c83b4ad97 100644 --- a/db/python/tables/analysis.py +++ b/db/python/tables/analysis.py @@ -28,6 +28,7 @@ class AnalysisFilter(GenericFilterModel): status: GenericFilter[AnalysisStatus] = None meta: GenericMetaFilter = None output: GenericFilter[str] = None + outputs: GenericMetaFilter = None active: GenericFilter[bool] = None def __hash__(self): # pylint: disable=useless-parent-delegation @@ -58,6 +59,7 @@ async def create_analysis( sequencing_group_ids: List[int], meta: Optional[Dict[str, Any]] = None, output: str = None, + outputs: dict[str, Any] = None, active: bool = True, author: str = None, project: ProjectId = None, diff --git a/db/python/tables/file.py b/db/python/tables/file.py index 315024f12..8d494197c 100644 --- a/db/python/tables/file.py +++ b/db/python/tables/file.py @@ -35,4 +35,4 @@ async def create_files(self, files: list[File]): """ pass - # endregion CREATE \ No newline at end of file + # endregion CREATE diff --git a/models/models/analysis.py b/models/models/analysis.py index a88d6dd99..7fe900a5e 100644 --- a/models/models/analysis.py +++ b/models/models/analysis.py @@ -19,6 +19,7 @@ class AnalysisInternal(SMBase): type: str status: AnalysisStatus output: str = None + outputs: dict[str, Any] = None sequencing_group_ids: list[int] = [] timestamp_completed: str | None = None project: int | None = None diff --git a/models/models/file.py b/models/models/file.py index 1149af9f9..82d825e8f 100644 --- a/models/models/file.py +++ b/models/models/file.py @@ -1,9 +1,10 @@ from enum import Enum -from typing import Optional from pydantic import BaseModel + class FileType(Enum): + """Type of File that we record""" FILE = 'file' DIRECTORY = 'directory' @@ -17,3 +18,4 @@ class File(BaseModel): # in bytes size: int checksum: str | None + exists: bool diff --git a/scripts/migrate_files.py b/scripts/migrate_files.py index 4daeb025e..c8e0dcabc 100644 --- a/scripts/migrate_files.py +++ b/scripts/migrate_files.py @@ -26,11 +26,9 @@ async def migrate_analysis(): rows = await connection.fetch_all(get_query) mapped_files = defaultdict(list) for r in rows: - \mapped_files[r['output']].append(r['id']) - - inserted_files = insert_files(list(mapped_files.keys())) - - for f in inserted_files: - File(path=) - + mapped_files[r['output']].append(r['id']) + # inserted_files = insert_files(list(mapped_files.keys())) + # + # for f in inserted_files: + # File(path=)