Skip to content

Commit 931a5fc

Browse files
authored
feat(deposition): retry assembly creation failures due to FTP login e… (#6196)
…rror resolves # ### Screenshot ### PR Checklist - [ ] All necessary documentation has been adapted. - [ ] The implemented feature is covered by appropriate, automated tests. - [ ] Any manual testing that has been done is documented (i.e. what exactly was tested?) 🚀 Preview: Add `preview` label to enable
1 parent fcaee1c commit 931a5fc

4 files changed

Lines changed: 16 additions & 9 deletions

File tree

ena-submission/src/ena_deposition/create_assembly.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
get_authors,
2626
get_description,
2727
get_ena_analysis_process,
28+
retry_failed_submissions_for_matching_errors,
2829
set_accession_does_not_exist_error,
29-
trigger_retry_if_exists,
3030
)
3131
from .ena_types import (
3232
DEFAULT_EMBL_PROPERTY_FIELDS,
@@ -758,12 +758,18 @@ def assembly_table_handle_errors(
758758
)
759759
messages.append(msg)
760760

761-
last_retry_time = trigger_retry_if_exists(
761+
last_retry_time = retry_failed_submissions_for_matching_errors(
762762
entries_with_errors,
763763
db_config,
764764
table_name=TableName.ASSEMBLY_TABLE,
765765
retry_threshold_min=config.retry_threshold_min,
766766
last_retry=last_retry_time,
767+
error_substrings=(
768+
"Submit service authentication error. Invalid submission account user "
769+
"name or password. Please try enclosing your password in single quotes. "
770+
"The submission has failed because of a user error.",
771+
"does not exist in ENA",
772+
),
767773
)
768774
# TODO: Query ENA to check if assembly has in fact been created
769775
# If created update assembly_table

ena-submission/src/ena_deposition/create_project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
accession_exists,
1616
create_ena_project,
1717
get_alias,
18+
retry_failed_submissions_for_matching_errors,
1819
set_accession_does_not_exist_error,
19-
trigger_retry_if_exists,
2020
)
2121
from .ena_types import (
2222
OrganismType,
@@ -388,7 +388,7 @@ def project_table_handle_errors(
388388
time=datetime.now(tz=pytz.utc),
389389
slack_retry_threshold_min=config.slack_retry_threshold_min,
390390
)
391-
return trigger_retry_if_exists(
391+
return retry_failed_submissions_for_matching_errors(
392392
entries_with_errors,
393393
db_config,
394394
table_name=TableName.PROJECT_TABLE,

ena-submission/src/ena_deposition/create_sample.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
accession_exists,
1515
create_ena_sample,
1616
get_alias,
17+
retry_failed_submissions_for_matching_errors,
1718
set_accession_does_not_exist_error,
18-
trigger_retry_if_exists,
1919
)
2020
from .ena_types import (
2121
ProjectLink,
@@ -422,7 +422,7 @@ def sample_table_handle_errors(
422422
time=datetime.now(tz=pytz.utc),
423423
slack_retry_threshold_min=config.slack_retry_threshold_min,
424424
)
425-
last_retry_time = trigger_retry_if_exists(
425+
last_retry_time = retry_failed_submissions_for_matching_errors(
426426
entries_with_errors,
427427
db_config,
428428
table_name=TableName.SAMPLE_TABLE,

ena-submission/src/ena_deposition/ena_submission_helper.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,12 +878,12 @@ def set_accession_does_not_exist_error(
878878
logger.warning(f"{accession_type} creation failed and DB update failed.")
879879

880880

881-
def trigger_retry_if_exists(
881+
def retry_failed_submissions_for_matching_errors(
882882
entries_with_errors: Iterable[Mapping[str, Any]],
883883
db_config: SimpleConnectionPool,
884884
table_name: TableName,
885885
retry_threshold_min: int,
886-
error_substring: str = "does not exist in ENA",
886+
error_substrings: Sequence[str] = ("does not exist in ENA",),
887887
last_retry: datetime | None = None,
888888
) -> datetime | None:
889889
if (
@@ -892,7 +892,8 @@ def trigger_retry_if_exists(
892892
):
893893
return last_retry
894894
for entry in entries_with_errors:
895-
if error_substring not in str(entry.get("errors", "")):
895+
errors = str(entry.get("errors", ""))
896+
if not any(substring in errors for substring in error_substrings):
896897
continue
897898
match table_name:
898899
case TableName.PROJECT_TABLE:

0 commit comments

Comments
 (0)