4
4
from pathlib import Path
5
5
6
6
from pydantic import BaseModel # pylint: disable=no-name-in-module
7
-
7
+ from typing import List
8
8
from pro_wes .ga4gh .wes .models import ServiceInfoBase as ServiceInfo
9
9
10
10
# pragma pylint: disable=too-few-public-methods
11
11
12
+ class DB (BaseModel ):
13
+ """DB config for post_task.
14
+
15
+ Args:
16
+ insert_attempts: Number of attempts to insert a new task in DB.
17
+
18
+ Attributes:
19
+ insert_attempts: Number of attempts to insert a new task in DB.
20
+ """
21
+ insert_attempts : int = 10
22
+
23
+
24
+ class TaskID (BaseModel ):
25
+ """Task ID config.
26
+
27
+ Args:
28
+ charset: Characters to use when generating task IDs.
29
+ length: Length of the generated task ID.
30
+
31
+ Attributes:
32
+ charset: Characters to use when generating task IDs.
33
+ length: Length of the generated task ID.
34
+ """
35
+ charset : str = string .ascii_uppercase + string .digits
36
+ length : int = 6
37
+
38
+
39
+ class Timeout (BaseModel ):
40
+ """Timeout config.
41
+
42
+ Args:
43
+ post: Timeout for POST requests (None disables timeout).
44
+ poll: Timeout for polling.
45
+ job: Timeout for job execution (None disables timeout).
46
+
47
+ Attributes:
48
+ post: Timeout for POST requests (None disables timeout).
49
+ poll: Timeout for polling.
50
+ job: Timeout for job execution (None disables timeout).
51
+ """
52
+ post : Optional [int ] = None
53
+ poll : int = 2
54
+ job : Optional [int ] = None
55
+
56
+
57
+ class Polling (BaseModel ):
58
+ """Polling config.
59
+
60
+ Args:
61
+ wait: Wait time between polling attempts.
62
+ attempts: Max polling attempts before failure.
63
+
64
+ Attributes:
65
+ wait: Wait time between polling attempts.
66
+ attempts: Max polling attempts before failure.
67
+ """
68
+ wait : int = 3
69
+ attempts : int = 100
70
+
71
+
72
+ class PostTask (BaseModel ):
73
+ """Configuration for POST /task.
74
+
75
+ Args:
76
+ db: DB insert behavior.
77
+ task_id: Task ID generation settings.
78
+ timeout: Timeout settings.
79
+ polling: Polling behavior.
80
+
81
+ Attributes:
82
+ db: DB insert behavior.
83
+ task_id: Task ID generation settings.
84
+ timeout: Timeout settings.
85
+ polling: Polling behavior.
86
+ """
87
+ db : DB = DB ()
88
+ task_id : TaskID = TaskID ()
89
+ timeout : Timeout = Timeout ()
90
+ polling : Polling = Polling ()
91
+
92
+
93
+ class ListTasks (BaseModel ):
94
+ """Configuration for GET /tasks.
95
+
96
+ Args:
97
+ default_page_size: Default pagination size.
98
+
99
+ Attributes:
100
+ default_page_size: Default pagination size.
101
+ """
102
+ default_page_size : int = 5
103
+
104
+
105
+ class Monitor (BaseModel ):
106
+ """Celery monitor settings.
107
+
108
+ Args:
109
+ timeout: Timeout to wait for Celery monitoring.
110
+
111
+ Attributes:
112
+ timeout: Timeout to wait for Celery monitoring.
113
+ """
114
+ timeout : float = 0.1
115
+
116
+
117
+ class Celery (BaseModel ):
118
+ """Celery configuration.
119
+
120
+ Args:
121
+ monitor: Monitor settings.
122
+ message_maxsize: Maximum allowed message size.
123
+
124
+ Attributes:
125
+ monitor: Monitor settings.
126
+ message_maxsize: Maximum allowed message size.
127
+ """
128
+ monitor : Monitor = Monitor ()
129
+ message_maxsize : int = 16777216
130
+
12
131
13
132
class Controllers (BaseModel ):
14
- """Controller configurations.
133
+ """Controller configurations.
15
134
16
135
Args:
17
136
post_task: Settings for POST /task.
@@ -22,26 +141,10 @@ class Controllers(BaseModel):
22
141
post_task: Settings for POST /task.
23
142
list_tasks: Settings for GET /tasks.
24
143
celery: Celery background task settings.
25
- """
26
- post_task :
27
- db :
28
- insert_attempts : 10
29
- task_id :
30
- charset : string .ascii_uppercase + string .digits
31
- length : 6
32
- timeout :
33
- post : null
34
- poll : 2
35
- job : null
36
- polling :
37
- wait : 3
38
- attempts : 100
39
- list_tasks :
40
- default_page_size : 5
41
- celery :
42
- monitor :
43
- timeout : 0.1
44
- message_maxsize : 16777216
144
+ """
145
+ post_task : PostTask = PostTask ()
146
+ list_tasks : ListTasks = ListTasks ()
147
+ celery : Celery = Celery ()
45
148
46
149
class Tes (BaseModel ):
47
150
"""TES backend configuration.
@@ -53,14 +156,13 @@ class Tes(BaseModel):
53
156
service_list: List of available TES services.
54
157
"""
55
158
56
- service_list :
57
- - "https://csc-tesk-noauth.rahtiapp.fi"
58
- - "https://funnel.cloud.e-infra.cz/"
59
- - "https://tesk-eu.hypatia-comp.athenarc.gr"
60
- - "https://tesk-na.cloud.e-infra.cz"
61
- - "https://vm4816.kaj.pouta.csc.fi/"
62
-
63
-
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
+ ]
64
166
65
167
class StoreLogs (BaseModel ):
66
168
"""Logging configuration.
@@ -74,9 +176,12 @@ class StoreLogs(BaseModel):
74
176
execution_trace : True
75
177
76
178
class Middlewares (BaseModel ):
77
- - - "pro_tes.plugins.middlewares.task_distribution.distance.TaskDistributionDistance"
78
- - "pro_tes.plugins.middlewares.task_distribution.random.TaskDistributionRandom"
79
-
179
+ middlewares : List [List [str ]] = [
180
+ [
181
+ "pro_tes.plugins.middlewares.task_distribution.distance.TaskDistributionDistance" ,
182
+ "pro_tes.plugins.middlewares.task_distribution.random.TaskDistributionRandom" ,
183
+ ]
184
+ ]
80
185
81
186
class CustomConfig (BaseModel ):
82
187
"""Custom app configuration.
0 commit comments