Skip to content

Commit 1e7101e

Browse files
committed
get_target_sequence also checks anomaly db for failed jobs
1 parent 080376d commit 1e7101e

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

hypernets_processor/main/sequence_processor_main.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,27 @@ def get_target_sequences(context, to_archive):
4848
# If adding to archive, remove previously processed paths from list by referencing
4949
# archive db
5050

51-
if to_archive:
51+
if to_archive is True:
5252
processed_products = [
5353
product["raw_product_name"]
5454
for product in context.archive_db["products"].find(
5555
site=context.get_config_value("site")
5656
)
5757
]
5858

59+
failed_products = [
60+
product["raw_product_name"]
61+
for product in context.anomaly_db["anomalies"].find(
62+
site=context.get_config_value("site")
63+
)
64+
]
65+
66+
complete_products = processed_products + failed_products
67+
5968
directory = os.path.dirname(raw_paths[0])
6069

6170
raw_products = [os.path.basename(raw_path) for raw_path in raw_paths]
62-
raw_products = list(set(raw_products) - set(processed_products))
71+
raw_products = list(set(raw_products) - set(complete_products))
6372
raw_paths = [
6473
os.path.join(directory, raw_product) for raw_product in raw_products
6574
]

hypernets_processor/main/tests/test_sequence_processor_main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def test_get_target_sequences_nottoarchive(self):
6868
)
6969

7070
expected_sequences = [
71+
os.path.join(tmpdir, "data", "SEQ20200311T112230"),
7172
os.path.join(tmpdir, "data", "SEQ20200311T112330"),
7273
os.path.join(tmpdir, "data", "SEQ20200311T112430"),
7374
os.path.join(tmpdir, "data", "SEQ20200311T112530")

hypernets_processor/test/test_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def setup_test_anomaly_db(url):
6262
db["anomalies"].insert(
6363
dict(
6464
anomaly="anomaly_name",
65-
raw_product_name="SEQ20200311T112430",
65+
raw_product_name="SEQ20200311T112330",
6666
site="site",
6767
)
6868
)

0 commit comments

Comments
 (0)