cg 83.15.2__py3-none-any.whl → 83.15.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cg/__init__.py +1 -1
- cg/cli/base.py +2 -28
- cg/exc.py +7 -0
- cg/services/analysis_starter/analysis_starter.py +11 -1
- {cg-83.15.2.dist-info → cg-83.15.4.dist-info}/METADATA +1 -1
- {cg-83.15.2.dist-info → cg-83.15.4.dist-info}/RECORD +8 -8
- {cg-83.15.2.dist-info → cg-83.15.4.dist-info}/WHEEL +0 -0
- {cg-83.15.2.dist-info → cg-83.15.4.dist-info}/entry_points.txt +0 -0
cg/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__title__ = "cg"
|
|
2
|
-
__version__ = "83.15.
|
|
2
|
+
__version__ = "83.15.4"
|
cg/cli/base.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""Start of CLI"""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
import sys
|
|
@@ -28,16 +28,10 @@ from cg.cli.transfer import transfer_group
|
|
|
28
28
|
from cg.cli.upload.base import upload
|
|
29
29
|
from cg.cli.utils import CLICK_CONTEXT_SETTINGS
|
|
30
30
|
from cg.cli.workflow.base import workflow as workflow_cmd
|
|
31
|
-
from cg.constants.cli_options import FORCE
|
|
32
31
|
from cg.constants.constants import FileFormat
|
|
33
32
|
from cg.io.controller import ReadFile
|
|
34
33
|
from cg.models.cg_config import CGConfig
|
|
35
|
-
from cg.store.database import
|
|
36
|
-
create_all_tables,
|
|
37
|
-
drop_all_tables,
|
|
38
|
-
get_scoped_session_registry,
|
|
39
|
-
get_tables,
|
|
40
|
-
)
|
|
34
|
+
from cg.store.database import get_scoped_session_registry
|
|
41
35
|
|
|
42
36
|
LOG = logging.getLogger(__name__)
|
|
43
37
|
LEVELS = ["DEBUG", "INFO", "WARNING", "ERROR"]
|
|
@@ -82,26 +76,6 @@ def base(
|
|
|
82
76
|
context.call_on_close(teardown_session)
|
|
83
77
|
|
|
84
78
|
|
|
85
|
-
@base.command()
|
|
86
|
-
@click.option("--reset", is_flag=True, help="Reset database before setting up tables")
|
|
87
|
-
@FORCE
|
|
88
|
-
@click.pass_obj
|
|
89
|
-
def init(context: CGConfig, reset: bool, force: bool):
|
|
90
|
-
"""Setup the database."""
|
|
91
|
-
existing_tables: list[str] = get_tables()
|
|
92
|
-
if force or reset:
|
|
93
|
-
if existing_tables and not force:
|
|
94
|
-
message = f"Delete existing tables? [{', '.join(existing_tables)}]"
|
|
95
|
-
click.confirm(click.style(message, fg="yellow"), abort=True)
|
|
96
|
-
drop_all_tables()
|
|
97
|
-
elif existing_tables:
|
|
98
|
-
LOG.error("Database already exists, use '--reset'")
|
|
99
|
-
raise click.Abort
|
|
100
|
-
|
|
101
|
-
create_all_tables()
|
|
102
|
-
LOG.info(f"Success! New tables: {', '.join(get_tables())}")
|
|
103
|
-
|
|
104
|
-
|
|
105
79
|
def find_commands(group, query: str) -> list[str]:
|
|
106
80
|
"""Recursively find commands in a group that match the query.
|
|
107
81
|
Args:
|
cg/exc.py
CHANGED
|
@@ -348,6 +348,13 @@ class CaseNotConfiguredError(CgError):
|
|
|
348
348
|
"""Exception raised when a case is being run without a configuration."""
|
|
349
349
|
|
|
350
350
|
|
|
351
|
+
class CaseWorkflowMismatchError(CgError):
|
|
352
|
+
"""
|
|
353
|
+
Exception raised when a case is being run with a workflow different from the one specified
|
|
354
|
+
for it in the database.
|
|
355
|
+
"""
|
|
356
|
+
|
|
357
|
+
|
|
351
358
|
class MissingConfigFilesError(CgError):
|
|
352
359
|
"""Exception raised when a case is being run with missing configuration files."""
|
|
353
360
|
|
|
@@ -4,7 +4,7 @@ from subprocess import CalledProcessError
|
|
|
4
4
|
from requests import HTTPError
|
|
5
5
|
|
|
6
6
|
from cg.constants import Workflow
|
|
7
|
-
from cg.exc import AnalysisNotReadyError, SeqeraError
|
|
7
|
+
from cg.exc import AnalysisNotReadyError, CaseWorkflowMismatchError, SeqeraError
|
|
8
8
|
from cg.services.analysis_starter.configurator.abstract_model import CaseConfig
|
|
9
9
|
from cg.services.analysis_starter.configurator.configurator import Configurator
|
|
10
10
|
from cg.services.analysis_starter.input_fetcher.input_fetcher import InputFetcher
|
|
@@ -51,6 +51,7 @@ class AnalysisStarter:
|
|
|
51
51
|
def start(self, case_id: str, **flags) -> None:
|
|
52
52
|
"""Fetches raw data, generates configuration files and runs the specified case."""
|
|
53
53
|
LOG.info(f"Starting case {case_id}")
|
|
54
|
+
self._ensure_case_matches_workflow(case_id)
|
|
54
55
|
self.tracker.ensure_analysis_not_ongoing(case_id)
|
|
55
56
|
self.input_fetcher.ensure_files_are_ready(case_id)
|
|
56
57
|
case_config: CaseConfig = self.configurator.configure(case_id=case_id, **flags)
|
|
@@ -58,6 +59,7 @@ class AnalysisStarter:
|
|
|
58
59
|
|
|
59
60
|
def run(self, case_id: str, **flags) -> None:
|
|
60
61
|
"""Run a case using an assumed existing configuration."""
|
|
62
|
+
self._ensure_case_matches_workflow(case_id)
|
|
61
63
|
self.tracker.ensure_analysis_not_ongoing(case_id)
|
|
62
64
|
case_config: CaseConfig = self.configurator.get_config(case_id=case_id, **flags)
|
|
63
65
|
self._run_and_track(case_id=case_id, case_config=case_config)
|
|
@@ -70,3 +72,11 @@ class AnalysisStarter:
|
|
|
70
72
|
except (CalledProcessError, HTTPError, SeqeraError) as exception:
|
|
71
73
|
self.tracker.set_case_as_not_running(case_id)
|
|
72
74
|
raise exception
|
|
75
|
+
|
|
76
|
+
def _ensure_case_matches_workflow(self, case_id: str) -> None:
|
|
77
|
+
case: Case = self.store.get_case_by_internal_id_strict(case_id)
|
|
78
|
+
if case.data_analysis != self.workflow:
|
|
79
|
+
raise CaseWorkflowMismatchError(
|
|
80
|
+
f"Case {case_id} is assigned to workflow {case.data_analysis}, "
|
|
81
|
+
f"not {self.workflow}."
|
|
82
|
+
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
cg/__init__.py,sha256=
|
|
1
|
+
cg/__init__.py,sha256=Zss8t8-mLeYBlfvs0D6w2a6NyOAEOAHXVKXFmuF5jVw,41
|
|
2
2
|
cg/apps/__init__.py,sha256=pYf0vxo4iYQqURzFRYzqpOCdV8Cm9MWx0GHvJOz0EMg,315
|
|
3
3
|
cg/apps/coverage/__init__.py,sha256=dJtsmNf8tODE2-VEomMIoYA7ugLYZAk_upsfOQCZeF8,27
|
|
4
4
|
cg/apps/coverage/api.py,sha256=e_ozC3QeNKoEfpjjMaL-XjeBLtz-JySWccrtw0E9mLM,2940
|
|
@@ -72,7 +72,7 @@ cg/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
72
72
|
cg/cli/add.py,sha256=hNW79Nrr7kbmv5DNDjZh_JsAGxZSQp_cLFh1gT8qAe0,11935
|
|
73
73
|
cg/cli/archive.py,sha256=0P1KCMDHSHQIm-z3ONkF7JkmHvx0cziUJodYG-Z-pN8,4411
|
|
74
74
|
cg/cli/backup.py,sha256=TBLF3yLstEI_bcrGoCo79CcClBqa2-Lk-54rofmo57I,11229
|
|
75
|
-
cg/cli/base.py,sha256=
|
|
75
|
+
cg/cli/base.py,sha256=x0dWVQrY5HnTjMEXMQIP4mmoo7wHCR1tfalAGFkEUdo,4287
|
|
76
76
|
cg/cli/clean.py,sha256=uKpRYl9__VIrFQ5sFJeV8QwxkBBMLUZ3nB0vnsArlFU,7854
|
|
77
77
|
cg/cli/compress/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
78
78
|
cg/cli/compress/base.py,sha256=GSBDojXXz4yn6LzXj3RvmosIg3z1bjcPsv3r2ubQpWU,2344
|
|
@@ -225,7 +225,7 @@ cg/constants/slurm.py,sha256=_Y_InISKpGKT-oVMnES7k7Csz2G1l52MNtJwBZm0prI,313
|
|
|
225
225
|
cg/constants/subject.py,sha256=EE26Emu6T3_HWvsWeuI5GRGGIvB0BwCjN53KHrsr18U,577
|
|
226
226
|
cg/constants/symbols.py,sha256=c06D1mYFWstZbVEgiby2lUNriswUPVRU5TnSSy889tY,71
|
|
227
227
|
cg/constants/tb.py,sha256=UJHdsu109oR_zxvQrko9SqFANiSUn_UJTw5BFebWcds,621
|
|
228
|
-
cg/exc.py,sha256=
|
|
228
|
+
cg/exc.py,sha256=Omvtdskjyby9ISEV5mM27Aku82XM77I_eIYbiQaKV1I,8736
|
|
229
229
|
cg/io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
230
230
|
cg/io/api.py,sha256=WaiompYmK4bkl94fZkGzP2CTsQPmHaTSvy0oD0SKw4s,1037
|
|
231
231
|
cg/io/controller.py,sha256=4TTHm9fNY7Ti3S0r-uhxB3oycJ-Ni5Y44lFj5Yvl3_I,2978
|
|
@@ -515,7 +515,7 @@ cg/server/utils.py,sha256=fL5ZFlr2V-F3bbjPUi3LDxRuFK7UdN8jCp3txDvs0dE,227
|
|
|
515
515
|
cg/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
516
516
|
cg/services/analysis_service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
517
517
|
cg/services/analysis_service/analysis_service.py,sha256=vqT_f83Bf1hZ69HvfXwbR5FNqjh67nYTndWE0Rlr030,2041
|
|
518
|
-
cg/services/analysis_starter/analysis_starter.py,sha256=
|
|
518
|
+
cg/services/analysis_starter/analysis_starter.py,sha256=B6ZPOSVorkKDZwm1JZxTUKxwrFf7gns_T_eeMBLwGss,3509
|
|
519
519
|
cg/services/analysis_starter/configurator/abstract_model.py,sha256=S1g5VZJ_cnM8QdDe3AeHlUqq8iO9Fykp8Q80X2_6PvM,374
|
|
520
520
|
cg/services/analysis_starter/configurator/configurator.py,sha256=ZgELQu9dQPt_42EwcEbLNPsvaLP58xOrfAVSXFiTZSA,943
|
|
521
521
|
cg/services/analysis_starter/configurator/extensions/nallo.py,sha256=lsqFyzbdUmOgAuB_OKM-Zeyzq1cNiaekjwD5icY1_Nk,1111
|
|
@@ -923,7 +923,7 @@ cg/utils/flask/enum.py,sha256=xwNVtFPkSzoloJctLHu7obRyxcng1GJrhkeYkqwf9tw,1052
|
|
|
923
923
|
cg/utils/mapping.py,sha256=oZpZW2kgsbtAP2FZ7RtRPELiEE1zZk_nAGisHGtCOUo,491
|
|
924
924
|
cg/utils/time.py,sha256=_VOglhrFEZ5cwHK1U1g36SdwzB7UvV-Nvlt4ymuZUho,1501
|
|
925
925
|
cg/utils/utils.py,sha256=RciI_UhWcnG_pMZrmQZ1ZYb-O1N0DweTYMmhE0SIRgQ,1410
|
|
926
|
-
cg-83.15.
|
|
927
|
-
cg-83.15.
|
|
928
|
-
cg-83.15.
|
|
929
|
-
cg-83.15.
|
|
926
|
+
cg-83.15.4.dist-info/METADATA,sha256=TSXpbbn65reG3IDTqXyiKcvaHwfMll66sS2oVmigzzY,4940
|
|
927
|
+
cg-83.15.4.dist-info/WHEEL,sha256=3ny-bZhpXrU6vSQ1UPG34FoxZBp3lVcvK0LkgUz6VLk,88
|
|
928
|
+
cg-83.15.4.dist-info/entry_points.txt,sha256=q5f47YQQGltzK_xnIq1mDopRXXEItr85Xe1BCtG-Wts,39
|
|
929
|
+
cg-83.15.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|