Skip to content

Commit 2839a08

Browse files
committed
Set flowcell_id based on central regex group
1 parent 58ce8be commit 2839a08

5 files changed

Lines changed: 9 additions & 21 deletions

File tree

dataflow_transfer/run_classes/element_runs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class AVITIRun(ElementRun):
2121

2222
def __init__(self, run_dir, configuration):
2323
super().__init__(run_dir, configuration)
24-
self.flowcell_id = self.run_id.split("_")[-1][1:] # 2507535225
2524

2625

2726
# TODO: Add Teton run class

dataflow_transfer/run_classes/generic_runs.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def __init__(self, run_dir, configuration):
3838
self.remote_destination = self.sequencer_config.get("remote_destination")
3939
self.db = StatusdbSession(self.configuration.get("statusdb"))
4040
self.run_id_format = self._resolve_run_id_format()
41+
self.flowcell_id = re.match(self.run_id_format, self.run_id).group("flowcell_id") if self.run_id_format else None
4142

4243
def _resolve_run_id_format(self):
4344
"""Resolve the run ID regex from central config."""
@@ -181,10 +182,15 @@ def has_status(self, status_name):
181182

182183
def update_statusdb(self, status, additional_info=None):
183184
"""Update the statusdb document for this run with the given status."""
184-
db_doc = (
185-
self.db.get_db_doc(ddoc="lookup", view="runfolder_id", run_id=self.run_id)
186-
or {}
185+
doc_id = self.db.get_doc_id(
186+
ddoc="lookup", view="runfolder_id", run_id=self.run_id
187187
)
188+
if doc_id:
189+
db_doc = self.db.get_document(
190+
db=self.db.db_name, doc_id=doc_id
191+
)
192+
else:
193+
db_doc = {}
188194

189195
statuses_to_only_update_once = [
190196
"sequencing_started",

dataflow_transfer/run_classes/illumina_runs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class IlluminaRun(Run):
1111
def __init__(self, run_dir, configuration):
1212
super().__init__(run_dir, configuration)
1313
self.final_file = "CopyComplete.txt"
14-
self.flowcell_id = self.run_id.split("_")[-1]
1514

1615

1716
@register_run_class
@@ -22,7 +21,6 @@ class NovaSeqXPlusRun(IlluminaRun):
2221

2322
def __init__(self, run_dir, configuration):
2423
super().__init__(run_dir, configuration)
25-
self.flowcell_id = self.run_id.split("_")[-1][1:] # 22CVHTLT1
2624

2725

2826
@register_run_class
@@ -53,4 +51,3 @@ class MiSeqi100Run(IlluminaRun):
5351

5452
def __init__(self, run_dir, configuration):
5553
super().__init__(run_dir, configuration)
56-
self.flowcell_id = self.run_id.split("_")[-1][1:] # SC2150561-SC3

dataflow_transfer/run_classes/ont_runs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class ONTRun(Run):
1111
def __init__(self, run_dir, configuration):
1212
super().__init__(run_dir, configuration)
1313
self.final_file = "final_summary.txt"
14-
self.flowcell_id = self.run_id.split("_")[-2]
1514

1615

1716
@register_run_class

dataflow_transfer/utils/statusdb.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,6 @@ def _retry_call(self, func):
5555
# re-raise last exception for caller to handle
5656
raise last_exception
5757

58-
def get_db_doc(self, ddoc, view, run_id):
59-
"""Retrieve a document from the database via retried call."""
60-
doc_id = self.get_doc_id(
61-
ddoc, view, run_id
62-
) # TODO: refactor to use get_document
63-
if doc_id:
64-
return self._retry_call(
65-
lambda: self.connection.get_document(
66-
db=self.db_name, doc_id=doc_id
67-
).get_result()
68-
)
69-
return None
70-
7158
def get_document(self, db, doc_id):
7259
"""Retrieve a document from any database via retried call."""
7360
return self._retry_call(

0 commit comments

Comments
 (0)