Skip to content

Commit ce58988

Browse files
committed
fix lint issues
1 parent f549c63 commit ce58988

File tree

1 file changed

+37
-16
lines changed

1 file changed

+37
-16
lines changed

pro_tes/config_models.py

+37-16
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
"""Custom app config models."""
22

33
from typing import Optional
4-
from pathlib import Path
5-
64
from pydantic import BaseModel # pylint: disable=no-name-in-module
75
from typing import List
86
from pro_wes.ga4gh.wes.models import ServiceInfoBase as ServiceInfo
7+
import string
8+
99

1010
# pragma pylint: disable=too-few-public-methods
1111

12+
1213
class DB(BaseModel):
1314
"""DB config for post_task.
1415
@@ -18,6 +19,7 @@ class DB(BaseModel):
1819
Attributes:
1920
insert_attempts: Number of attempts to insert a new task in DB.
2021
"""
22+
2123
insert_attempts: int = 10
2224

2325

@@ -32,6 +34,7 @@ class TaskID(BaseModel):
3234
charset: Characters to use when generating task IDs.
3335
length: Length of the generated task ID.
3436
"""
37+
3538
charset: str = string.ascii_uppercase + string.digits
3639
length: int = 6
3740

@@ -49,6 +52,7 @@ class Timeout(BaseModel):
4952
poll: Timeout for polling.
5053
job: Timeout for job execution (None disables timeout).
5154
"""
55+
5256
post: Optional[int] = None
5357
poll: int = 2
5458
job: Optional[int] = None
@@ -65,6 +69,7 @@ class Polling(BaseModel):
6569
wait: Wait time between polling attempts.
6670
attempts: Max polling attempts before failure.
6771
"""
72+
6873
wait: int = 3
6974
attempts: int = 100
7075

@@ -84,6 +89,7 @@ class PostTask(BaseModel):
8489
timeout: Timeout settings.
8590
polling: Polling behavior.
8691
"""
92+
8793
db: DB = DB()
8894
task_id: TaskID = TaskID()
8995
timeout: Timeout = Timeout()
@@ -99,6 +105,7 @@ class ListTasks(BaseModel):
99105
Attributes:
100106
default_page_size: Default pagination size.
101107
"""
108+
102109
default_page_size: int = 5
103110

104111

@@ -111,6 +118,7 @@ class Monitor(BaseModel):
111118
Attributes:
112119
timeout: Timeout to wait for Celery monitoring.
113120
"""
121+
114122
timeout: float = 0.1
115123

116124

@@ -125,6 +133,7 @@ class Celery(BaseModel):
125133
monitor: Monitor settings.
126134
message_maxsize: Maximum allowed message size.
127135
"""
136+
128137
monitor: Monitor = Monitor()
129138
message_maxsize: int = 16777216
130139

@@ -142,12 +151,14 @@ class Controllers(BaseModel):
142151
list_tasks: Settings for GET /tasks.
143152
celery: Celery background task settings.
144153
"""
154+
145155
post_task: PostTask = PostTask()
146156
list_tasks: ListTasks = ListTasks()
147157
celery: Celery = Celery()
148158

159+
149160
class Tes(BaseModel):
150-
"""TES backend configuration.
161+
"""TES backend configuration.
151162
152163
Args:
153164
service_list: List of available TES services.
@@ -156,35 +167,45 @@ class Tes(BaseModel):
156167
service_list: List of available TES services.
157168
"""
158169

159-
service_list: List[str] = [
160-
"https://csc-tesk-noauth.rahtiapp.fi",
161-
"https://funnel.cloud.e-infra.cz/",
162-
"https://tesk-eu.hypatia-comp.athenarc.gr",
163-
"https://tesk-na.cloud.e-infra.cz",
164-
"https://vm4816.kaj.pouta.csc.fi/",
165-
]
170+
service_list: List[str] = [
171+
"https://csc-tesk-noauth.rahtiapp.fi",
172+
"https://funnel.cloud.e-infra.cz/",
173+
"https://tesk-eu.hypatia-comp.athenarc.gr",
174+
"https://tesk-na.cloud.e-infra.cz",
175+
"https://vm4816.kaj.pouta.csc.fi/",
176+
]
177+
166178

167179
class StoreLogs(BaseModel):
168-
"""Logging configuration.
180+
"""Logging configuration.
169181
170182
Args:
171183
execution_trace: Whether to store execution trace logs.
172184
173185
Attributes:
174186
execution_trace: Whether to store execution trace logs.
175187
"""
176-
execution_trace: True
188+
189+
execution_trace: bool = True
190+
177191

178192
class Middlewares(BaseModel):
179193
middlewares: List[List[str]] = [
180194
[
181-
"pro_tes.plugins.middlewares.task_distribution.distance.TaskDistributionDistance",
182-
"pro_tes.plugins.middlewares.task_distribution.random.TaskDistributionRandom",
195+
(
196+
"pro_tes.plugins.middlewares.task_distribution.distance."
197+
"TaskDistributionDistance"
198+
),
199+
(
200+
"pro_tes.plugins.middlewares.task_distribution.random."
201+
"TaskDistributionRandom"
202+
),
183203
]
184204
]
185205

206+
186207
class CustomConfig(BaseModel):
187-
"""Custom app configuration.
208+
"""Custom app configuration.
188209
189210
Args:
190211
controllers: All controller-related config.
@@ -200,9 +221,9 @@ class CustomConfig(BaseModel):
200221
middlewares: Middleware class paths.
201222
service_info: Metadata about the service.
202223
"""
224+
203225
controllers: Controllers = Controllers()
204226
tes: Tes = Tes()
205227
storeLogs: StoreLogs = StoreLogs()
206228
middlewares: Middlewares = Middlewares()
207229
service_info: ServiceInfo
208-

0 commit comments

Comments
 (0)