Fixed exception syntax
All checks were successful
autoBIGS.engine/pipeline/head This commit looks good
All checks were successful
autoBIGS.engine/pipeline/head This commit looks good
This commit is contained in:
parent
96d715fdcb
commit
1776f5aa51
@ -100,7 +100,7 @@ class RemoteBIGSdbMLSTProfiler(BIGSdbMLSTProfiler):
|
||||
yield result_allele if isinstance(sequence_string, str) else (sequence_string.name, result_allele)
|
||||
else:
|
||||
raise NoBIGSdbMatchesException(self._database_name, self._scheme_id, sequence_string.name if isinstance(sequence_string, NamedString) else None)
|
||||
except ConnectionError|ServerDisconnectedError as e: # Errors we will retry
|
||||
except (ConnectionError, ServerDisconnectedError) as e: # Errors we will retry
|
||||
last_error = e
|
||||
success = False
|
||||
await asyncio.sleep(5) # In case the connection issue is due to rate issues
|
||||
@ -109,7 +109,7 @@ class RemoteBIGSdbMLSTProfiler(BIGSdbMLSTProfiler):
|
||||
if not success and last_error is not None:
|
||||
try:
|
||||
raise last_error
|
||||
except ConnectionError|ServerDisconnectedError as e: # Non-fatal errors
|
||||
except (ConnectionError, ServerDisconnectedError) as e: # Non-fatal errors
|
||||
yield Allele("error", "error", None)
|
||||
|
||||
async def determine_mlst_st(self, alleles: Union[AsyncIterable[Union[Allele, tuple[str, Allele]]], Iterable[Union[Allele, tuple[str, Allele]]]]) -> Union[MLSTProfile, NamedMLSTProfile]:
|
||||
@ -156,7 +156,7 @@ class RemoteBIGSdbMLSTProfiler(BIGSdbMLSTProfiler):
|
||||
if len(names_list) > 0:
|
||||
result_mlst_profile = NamedMLSTProfile(str(tuple(names_list)) if len(set(names_list)) > 1 else names_list[0], result_mlst_profile)
|
||||
return result_mlst_profile
|
||||
except ConnectionError|ServerDisconnectedError as e:
|
||||
except (ConnectionError, ServerDisconnectedError) as e:
|
||||
last_error = e
|
||||
success = False
|
||||
await asyncio.sleep(5)
|
||||
@ -165,7 +165,7 @@ class RemoteBIGSdbMLSTProfiler(BIGSdbMLSTProfiler):
|
||||
try:
|
||||
if last_error is not None:
|
||||
raise last_error
|
||||
except ServerDisconnectedError|ConnectionError as e:
|
||||
except (ConnectionError, ServerDisconnectedError) as e:
|
||||
result_mlst_profile = NamedMLSTProfile((str(tuple(names_list)) if len(set(names_list)) > 1 else names_list[0]) + ":Error", None)
|
||||
raise ValueError("Last error was not recorded.")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user