Skip to content

Commit

Permalink
fix: attr error
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeAeich committed Jan 22, 2024
1 parent 8e1a4e6 commit c70f0f9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[mypy]
disable_error_code = attr-defined

[mypy-foca.*]
ignore_missing_imports = True
Expand Down
4 changes: 2 additions & 2 deletions pro_wes/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def _setup_first_start(app: App) -> None:
"""Set up application for first start."""
with app.app.app_context():
# create storage directory
work_dir = Path(current_app.config.foca.custom.post_runs.storage_path.resolve())
work_dir = Path(current_app.config.foca.custom.post_runs.storage_path.resolve()) # type: ignore
work_dir.mkdir(parents=True, exist_ok=True)
# set service info
try:
ServiceInfo().get_service_info()
except NotFound:
ServiceInfo().set_service_info(
data=current_app.config.foca.custom.service_info.dict()
data=current_app.config.foca.custom.service_info.dict() # type: ignore
)


Expand Down
2 changes: 1 addition & 1 deletion pro_wes/ga4gh/wes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def json_serialized_object_field_valid( # pylint: disable=no-self-argument
value does not represent an object/dictionary.
"""
if value == "" or value == "null" or value is None:
if field.name == "workflow_params":
if field == "workflow_params":
raise ValueError("field required")
return "{}"
try:
Expand Down
2 changes: 1 addition & 1 deletion pro_wes/ga4gh/wes/service_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ServiceInfo:
def __init__(self) -> None:
"""Class constructor."""
self.config: Dict = current_app.config
self.foca_config: Config = self.config.foca
self.foca_config: Config = self.config.foca # type: ignore
self.db_client_service_info: Collection = (
self.foca_config.db.dbs["runStore"].collections["service_info"].client
)
Expand Down
2 changes: 1 addition & 1 deletion pro_wes/ga4gh/wes/workflow_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class WorkflowRuns:
def __init__(self) -> None:
"""Class constructor."""
self.config: Dict = current_app.config
self.foca_config: Config = current_app.config.foca
self.foca_config: Config = current_app.config.foca # type: ignore
self.db_client: Collection = (
self.foca_config.db.dbs["runStore"].collections["runs"].client
)
Expand Down
12 changes: 6 additions & 6 deletions pro_wes/tasks/track_run_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def task__track_run_progress( # pylint: disable=too-many-statements
pro_wes.exceptions.EngineUnavailable: The remote service is unavailable
or is not a valid WES service.
"""
foca_config: Config = current_app.config.foca
foca_config: Config = current_app.config.foca # type: ignore
controller_config: Dict = foca_config.custom.post_runs

logger.info(f"[{self.request.id}] Start processing...")
Expand Down Expand Up @@ -95,7 +95,7 @@ def task__track_run_progress( # pylint: disable=too-many-statements
# if not isinstance(response, RunLog):
# db_client.update_run_state(state=State.SYSTEM_ERROR.value)
# raise EngineProblem("Did not receive expected response.")
response.pop("request", None)
response.pop("request", None) # type: ignore
document: DbDocument = db_client.upsert_fields_in_root_object(
root="run_log",
**response.dict(),
Expand All @@ -105,7 +105,7 @@ def task__track_run_progress( # pylint: disable=too-many-statements
run_state: State = State.UNKNOWN
attempt: int = 1
while not run_state.is_finished:
sleep(controller_config.polling_wait)
sleep(controller_config.polling_wait) # type: ignore

# ensure WES endpoint is available
assert document.wes_endpoint is not None, "No WES endpoint available."
Expand All @@ -117,14 +117,14 @@ def task__track_run_progress( # pylint: disable=too-many-statements
timeout=foca_config.custom.defaults.timeout,
)
except EngineUnavailable as exc:
if attempt <= controller_config.polling_attempts:
if attempt <= controller_config.polling_attempts: # type: ignore
attempt += 1
logger.warning(exc, exc_info=True)
continue
db_client.update_run_state(state=State.SYSTEM_ERROR.value)
raise
if not isinstance(response, RunStatus):
if attempt <= controller_config.polling_attempts:
if attempt <= controller_config.polling_attempts: # type: ignore
attempt += 1
logger.warning(f"Received error response: {response}")
continue
Expand All @@ -148,7 +148,7 @@ def task__track_run_progress( # pylint: disable=too-many-statements
# if not isinstance(response, RunLog):
# db_client.update_run_state(state=State.SYSTEM_ERROR.value)
# raise EngineProblem("Did not receive expected response.")
response.pop("request", None)
response.pop("request", None) # type: ignore
document = db_client.upsert_fields_in_root_object(
root="run_log",
**dict(response),
Expand Down
2 changes: 1 addition & 1 deletion tests/ga4gh/wes/endpoints/test_service_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from unittest.mock import MagicMock

from pro_wes.ga4gh.wes.service_info import RegisterServiceInfo
from pro_wes.ga4gh.wes.service_info import RegisterServiceInfo # type: ignore
from pro_wes.exceptions import (
NotFound,
ValidationError,
Expand Down

0 comments on commit c70f0f9

Please sign in to comment.