Skip to content

Commit 29c6ca9

Browse files
Revert "silencing pylint errors"
This reverts commit fd29a60.
1 parent 884eba9 commit 29c6ca9

File tree

10 files changed

+36
-76
lines changed

10 files changed

+36
-76
lines changed

services/director-v2/src/simcore_service_director_v2/modules/clusters_keeper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ async def get_or_create_on_demand_cluster(
3434
)
3535
_logger.info("received cluster: %s", returned_cluster)
3636
if returned_cluster.state is not ClusterState.RUNNING:
37-
raise ComputationalBackendOnDemandNotReadyError( # pylint: disable=unexpected-keyword-arg
37+
raise ComputationalBackendOnDemandNotReadyError(
3838
eta=timedelta_as_minute_second(returned_cluster.eta)
3939
)
4040
if not returned_cluster.dask_scheduler_ready:
41-
raise ComputationalBackendOnDemandNotReadyError( # pylint: disable=unexpected-keyword-arg
41+
raise ComputationalBackendOnDemandNotReadyError(
4242
eta=timedelta_as_minute_second(returned_cluster.eta)
4343
)
4444

services/director-v2/src/simcore_service_director_v2/modules/dask_client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,9 +522,7 @@ async def get_task_result(self, job_id: str) -> TaskOutputData:
522522
await task_future.result(timeout=_DASK_DEFAULT_TIMEOUT_S),
523523
)
524524
except KeyError as exc:
525-
raise ComputationalBackendTaskNotFoundError( # pylint: disable=unexpected-keyword-arg
526-
job_id=job_id
527-
) from exc
525+
raise ComputationalBackendTaskNotFoundError(job_id=job_id) from exc
528526
except distributed.TimeoutError as exc:
529527
raise ComputationalBackendTaskResultsNotReadyError from exc
530528

services/director-v2/src/simcore_service_director_v2/modules/dask_clients_pool.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ async def _concurently_safe_acquire_client() -> DaskClient:
108108
try:
109109
dask_client = await _concurently_safe_acquire_client()
110110
except Exception as exc:
111-
raise DaskClientAcquisisitonError( # pylint: disable=unexpected-keyword-arg
112-
cluster=cluster, error=exc
113-
) from exc
111+
raise DaskClientAcquisisitonError(cluster=cluster, error=exc) from exc
114112

115113
try:
116114
yield dask_client

services/director-v2/src/simcore_service_director_v2/modules/db/repositories/clusters.py

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ async def _compute_user_access_rights(
110110

111111
solved_rights = CLUSTER_NO_RIGHTS.model_dump()
112112
for group_row in filter(lambda ugrp: ugrp[1] != GroupType.PRIMARY, user_groups):
113-
grp_access = cluster.access_rights.get(
114-
group_row.gid, CLUSTER_NO_RIGHTS
115-
).model_dump()
113+
grp_access = cluster.access_rights.get(group_row.gid, CLUSTER_NO_RIGHTS).model_dump()
116114
for operation in ["read", "write", "delete"]:
117115
solved_rights[operation] |= grp_access[operation]
118116
return ClusterAccessRights(**solved_rights)
@@ -161,9 +159,7 @@ async def get_cluster(self, user_id: UserID, cluster_id: ClusterID) -> Cluster:
161159
async with self.db_engine.acquire() as conn:
162160
clusters_list = await _clusters_from_cluster_ids(conn, {cluster_id})
163161
if not clusters_list:
164-
raise ClusterNotFoundError( # pylint: disable=unexpected-keyword-arg
165-
cluster_id=cluster_id
166-
)
162+
raise ClusterNotFoundError(cluster_id=cluster_id)
167163
the_cluster = clusters_list[0]
168164

169165
access_rights = await _compute_user_access_rights(
@@ -175,9 +171,7 @@ async def get_cluster(self, user_id: UserID, cluster_id: ClusterID) -> Cluster:
175171
f"{access_rights=}",
176172
)
177173
if not access_rights.read:
178-
raise ClusterAccessForbiddenError( # pylint: disable=unexpected-keyword-arg
179-
cluster_id=cluster_id
180-
)
174+
raise ClusterAccessForbiddenError(cluster_id=cluster_id)
181175

182176
return the_cluster
183177

@@ -189,9 +183,7 @@ async def update_cluster( # pylint: disable=too-many-branches
189183
conn, {cluster_id}
190184
)
191185
if len(clusters_list) != 1:
192-
raise ClusterNotFoundError( # pylint: disable=unexpected-keyword-arg
193-
cluster_id=cluster_id
194-
)
186+
raise ClusterNotFoundError(cluster_id=cluster_id)
195187
the_cluster = clusters_list[0]
196188

197189
this_user_access_rights = await _compute_user_access_rights(
@@ -204,16 +196,12 @@ async def update_cluster( # pylint: disable=too-many-branches
204196
)
205197

206198
if not this_user_access_rights.write:
207-
raise ClusterAccessForbiddenError( # pylint: disable=unexpected-keyword-arg
208-
cluster_id=cluster_id
209-
)
199+
raise ClusterAccessForbiddenError(cluster_id=cluster_id)
210200

211201
if updated_cluster.owner and updated_cluster.owner != the_cluster.owner:
212202
# if the user wants to change the owner, we need more rights here
213203
if this_user_access_rights != CLUSTER_ADMIN_RIGHTS:
214-
raise ClusterAccessForbiddenError( # pylint: disable=unexpected-keyword-arg
215-
cluster_id=cluster_id
216-
)
204+
raise ClusterAccessForbiddenError(cluster_id=cluster_id)
217205

218206
# ensure the new owner has admin rights, too
219207
if not updated_cluster.access_rights:
@@ -237,9 +225,7 @@ async def update_cluster( # pylint: disable=too-many-branches
237225
]:
238226
# a manager cannot change the owner abilities or create
239227
# managers/admins
240-
raise ClusterAccessForbiddenError( # pylint: disable=unexpected-keyword-arg
241-
cluster_id=cluster_id
242-
)
228+
raise ClusterAccessForbiddenError(cluster_id=cluster_id)
243229

244230
resolved_access_rights.update(updated_cluster.access_rights)
245231
# ensure the user is not trying to mess around owner admin rights
@@ -249,9 +235,7 @@ async def update_cluster( # pylint: disable=too-many-branches
249235
)
250236
!= CLUSTER_ADMIN_RIGHTS
251237
):
252-
raise ClusterAccessForbiddenError( # pylint: disable=unexpected-keyword-arg
253-
cluster_id=cluster_id
254-
)
238+
raise ClusterAccessForbiddenError(cluster_id=cluster_id)
255239

256240
# ok we can update now
257241
try:
@@ -261,16 +245,12 @@ async def update_cluster( # pylint: disable=too-many-branches
261245
.values(to_clusters_db(updated_cluster, only_update=True))
262246
)
263247
except psycopg2.DatabaseError as e:
264-
raise ClusterInvalidOperationError( # pylint: disable=unexpected-keyword-arg
265-
cluster_id=cluster_id
266-
) from e
248+
raise ClusterInvalidOperationError(cluster_id=cluster_id) from e
267249
# upsert the rights
268250
if updated_cluster.access_rights:
269251
for grp, rights in resolved_access_rights.items():
270252
insert_stmt = pg_insert(cluster_to_groups).values(
271-
**rights.model_dump(by_alias=True),
272-
gid=grp,
273-
cluster_id=the_cluster.id,
253+
**rights.model_dump(by_alias=True), gid=grp, cluster_id=the_cluster.id
274254
)
275255
on_update_stmt = insert_stmt.on_conflict_do_update(
276256
index_elements=[
@@ -283,18 +263,14 @@ async def update_cluster( # pylint: disable=too-many-branches
283263

284264
clusters_list = await _clusters_from_cluster_ids(conn, {cluster_id})
285265
if not clusters_list:
286-
raise ClusterNotFoundError( # pylint: disable=unexpected-keyword-arg
287-
cluster_id=cluster_id
288-
)
266+
raise ClusterNotFoundError(cluster_id=cluster_id)
289267
return clusters_list[0]
290268

291269
async def delete_cluster(self, user_id: UserID, cluster_id: ClusterID) -> None:
292270
async with self.db_engine.acquire() as conn:
293271
clusters_list = await _clusters_from_cluster_ids(conn, {cluster_id})
294272
if not clusters_list:
295-
raise ClusterNotFoundError( # pylint: disable=unexpected-keyword-arg
296-
cluster_id=cluster_id
297-
)
273+
raise ClusterNotFoundError(cluster_id=cluster_id)
298274
the_cluster = clusters_list[0]
299275

300276
access_rights = await _compute_user_access_rights(
@@ -306,7 +282,5 @@ async def delete_cluster(self, user_id: UserID, cluster_id: ClusterID) -> None:
306282
f"{access_rights=}",
307283
)
308284
if not access_rights.delete:
309-
raise ClusterAccessForbiddenError( # pylint: disable=unexpected-keyword-arg
310-
cluster_id=cluster_id
311-
)
285+
raise ClusterAccessForbiddenError(cluster_id=cluster_id)
312286
await conn.execute(sa.delete(clusters).where(clusters.c.id == cluster_id))

services/director-v2/src/simcore_service_director_v2/modules/db/repositories/comp_runs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ async def create(
117117
row = await result.first()
118118
return CompRunsAtDB.model_validate(row)
119119
except ForeignKeyViolation as exc:
120-
raise ClusterNotFoundError( # pylint: disable=unexpected-keyword-arg
121-
cluster_id=cluster_id
122-
) from exc
120+
raise ClusterNotFoundError(cluster_id=cluster_id) from exc
123121

124122
async def update(
125123
self, user_id: UserID, project_id: ProjectID, iteration: PositiveInt, **values

services/director-v2/src/simcore_service_director_v2/utils/dask.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,14 +478,14 @@ def check_scheduler_is_still_the_same(
478478
):
479479
_logger.debug("current %s", f"{client.scheduler_info()=}")
480480
if "id" not in client.scheduler_info():
481-
raise ComputationalSchedulerChangedError( # pylint: disable=unexpected-keyword-arg
481+
raise ComputationalSchedulerChangedError(
482482
original_scheduler_id=original_scheduler_id,
483483
current_scheduler_id="No scheduler identifier",
484484
)
485485
current_scheduler_id = client.scheduler_info()["id"]
486486
if current_scheduler_id != original_scheduler_id:
487487
_logger.error("The computational backend changed!")
488-
raise ComputationalSchedulerChangedError( # pylint: disable=unexpected-keyword-arg
488+
raise ComputationalSchedulerChangedError(
489489
original_scheduler_id=original_scheduler_id,
490490
current_scheduler_id=current_scheduler_id,
491491
)

services/director-v2/src/simcore_service_director_v2/utils/dask_client_utils.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,19 +158,13 @@ async def _connect_with_gateway_and_create_cluster(
158158
raise ConfigurationError(msg) from exc
159159
except ValueError as exc:
160160
# this is when a 404=NotFound,422=MalformedData comes up
161-
raise DaskClientRequestError( # pylint: disable=unexpected-keyword-arg
162-
endpoint=endpoint, error=exc
163-
) from exc
161+
raise DaskClientRequestError(endpoint=endpoint, error=exc) from exc
164162
except dask_gateway.GatewayClusterError as exc:
165163
# this is when a 409=Conflict/Cannot complete request comes up
166-
raise DaskClusterError( # pylint: disable=unexpected-keyword-arg
167-
endpoint=endpoint, error=exc
168-
) from exc
164+
raise DaskClusterError(endpoint=endpoint, error=exc) from exc
169165
except dask_gateway.GatewayServerError as exc:
170166
# this is when a 500 comes up
171-
raise DaskGatewayServerError( # pylint: disable=unexpected-keyword-arg
172-
endpoint=endpoint, error=exc
173-
) from exc
167+
raise DaskGatewayServerError(endpoint=endpoint, error=exc) from exc
174168

175169

176170
def _is_dask_scheduler(authentication: ClusterAuthentication) -> bool:

services/director-v2/tests/unit/with_dbs/test_modules_comp_scheduler_dask_scheduler.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ async def test_task_progress_triggers(
10941094
"backend_error",
10951095
[
10961096
ComputationalBackendNotConnectedError(msg="faked disconnected backend"),
1097-
ComputationalSchedulerChangedError( # pylint: disable=unexpected-keyword-arg
1097+
ComputationalSchedulerChangedError(
10981098
original_scheduler_id="some_old_scheduler_id",
10991099
current_scheduler_id="some_new_scheduler_id",
11001100
),
@@ -1181,9 +1181,7 @@ class RebootState:
11811181
pytest.param(
11821182
RebootState(
11831183
dask_task_status=DaskClientTaskState.LOST,
1184-
task_result=ComputationalBackendTaskNotFoundError( # pylint: disable=unexpected-keyword-arg
1185-
job_id="fake_job_id"
1186-
),
1184+
task_result=ComputationalBackendTaskNotFoundError(job_id="fake_job_id"),
11871185
expected_task_state_group1=RunningState.FAILED,
11881186
expected_task_progress_group1=1,
11891187
expected_task_state_group2=RunningState.ABORTED,
@@ -1219,7 +1217,7 @@ class RebootState:
12191217
pytest.param(
12201218
RebootState(
12211219
dask_task_status=DaskClientTaskState.PENDING_OR_STARTED,
1222-
task_result=ComputationalBackendTaskResultsNotReadyError( # pylint: disable=unexpected-keyword-arg
1220+
task_result=ComputationalBackendTaskResultsNotReadyError(
12231221
job_id="fake_job_id"
12241222
),
12251223
expected_task_state_group1=RunningState.STARTED,
@@ -1519,8 +1517,10 @@ async def test_pipeline_with_on_demand_cluster_with_not_ready_backend_waits(
15191517
mocked_get_or_create_cluster: mock.Mock,
15201518
faker: Faker,
15211519
):
1522-
mocked_get_or_create_cluster.side_effect = ComputationalBackendOnDemandNotReadyError( # pylint: disable=unexpected-keyword-arg
1523-
eta=faker.time_delta(datetime.timedelta(hours=1))
1520+
mocked_get_or_create_cluster.side_effect = (
1521+
ComputationalBackendOnDemandNotReadyError(
1522+
eta=faker.time_delta(datetime.timedelta(hours=1))
1523+
)
15241524
)
15251525
# running the pipeline will trigger a call to the clusters-keeper
15261526
assert published_project.project.prj_owner

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/errors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ class BaseDynamicSidecarError(Exception):
99
"""Used as base for all exceptions"""
1010

1111
def __init__(
12-
self, message: str, status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR
12+
self, nessage: str, status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR
1313
) -> None:
14-
self.message: str = message
14+
self.message: str = nessage
1515
self.status_code: int = status_code
16-
super().__init__(message)
16+
super().__init__(nessage)
1717

1818

1919
class VolumeNotFoundError(BaseDynamicSidecarError):

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/modules/container_utils.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def _execute_command(container_name: str, command: str | Sequence[str]) ->
3838
inspect_result: dict[str, Any] = await exec_instance.inspect()
3939
exit_code: int | None = inspect_result.get("ExitCode", None)
4040
if exit_code != 0:
41-
raise ContainerExecCommandFailedError( # pylint: disable=unexpected-keyword-arg,no-value-for-parameter
41+
raise ContainerExecCommandFailedError(
4242
command=command, exit_code=exit_code, command_result=command_result
4343
)
4444

@@ -78,11 +78,9 @@ async def run_command_in_container(
7878
)
7979
except DockerError as e:
8080
if e.status == status.HTTP_404_NOT_FOUND:
81-
raise ContainerExecContainerNotFoundError( # pylint: disable=unexpected-keyword-arg,no-value-for-parameter
81+
raise ContainerExecContainerNotFoundError(
8282
container_name=container_name
8383
) from e
8484
raise
8585
except asyncio.TimeoutError as e:
86-
raise ContainerExecTimeoutError( # pylint: disable=unexpected-keyword-arg,no-value-for-parameter
87-
timeout=timeout, command=command
88-
) from e
86+
raise ContainerExecTimeoutError(timeout=timeout, command=command) from e

0 commit comments

Comments
 (0)