qarnot 2.17.0__py3-none-any.whl → 2.18.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qarnot/_version.py +3 -3
- qarnot/computing_quotas.py +328 -0
- qarnot/connection.py +23 -6
- qarnot/helper.py +4 -3
- qarnot/pool.py +22 -0
- qarnot/task.py +24 -2
- {qarnot-2.17.0.dist-info → qarnot-2.18.0.dist-info}/METADATA +3 -2
- {qarnot-2.17.0.dist-info → qarnot-2.18.0.dist-info}/RECORD +11 -10
- {qarnot-2.17.0.dist-info → qarnot-2.18.0.dist-info}/WHEEL +1 -1
- {qarnot-2.17.0.dist-info → qarnot-2.18.0.dist-info/licenses}/LICENSE +0 -0
- {qarnot-2.17.0.dist-info → qarnot-2.18.0.dist-info}/top_level.txt +0 -0
qarnot/_version.py
CHANGED
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2025-
|
|
11
|
+
"date": "2025-05-22T14:41:22+0200",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "v2.
|
|
14
|
+
"full-revisionid": "9361585630d3dbcc8fa50ecbb9d20d592234a808",
|
|
15
|
+
"version": "v2.18.0"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Copyright 2025 Qarnot computing
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from typing import Optional, List, Dict, Any
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class UserSchedulingQuota(object):
|
|
19
|
+
"""Describes a scheduling quota for the user.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
def __init__(self, max_cores: int, running_cores_count: int, max_instances: int, running_instances_count: int):
|
|
23
|
+
"""Create a new UserSchedulingQuota object describing a scheduling quota for the user.
|
|
24
|
+
|
|
25
|
+
:param int max_cores: Maximum number of cores that can be simultaneously used with this scheduling plan.
|
|
26
|
+
:param int running_cores_count: Number of cores that are currently running with this scheduling plan.
|
|
27
|
+
:param int max_instances: Maximum number of instances that can be simultaneously used with this scheduling plan.
|
|
28
|
+
:param int running_instances_count: Number of instances that are currently running with this scheduling plan.
|
|
29
|
+
:returns: The created :class:`~qarnot.computing_quotas.UserSchedulingQuota`.
|
|
30
|
+
"""
|
|
31
|
+
self.max_cores = max_cores
|
|
32
|
+
""":type: :class:`int`
|
|
33
|
+
|
|
34
|
+
Maximum number of cores that can be simultaneously used with this scheduling plan.
|
|
35
|
+
"""
|
|
36
|
+
self.running_cores_count = running_cores_count
|
|
37
|
+
""":type: :class:`int`
|
|
38
|
+
|
|
39
|
+
Number of cores that are currently running with this scheduling plan.
|
|
40
|
+
"""
|
|
41
|
+
self.max_instances = max_instances
|
|
42
|
+
""":type: :class:`int`
|
|
43
|
+
|
|
44
|
+
Maximum number of instances that can be simultaneously used with this scheduling plan.
|
|
45
|
+
"""
|
|
46
|
+
self.running_instances_count = running_instances_count
|
|
47
|
+
""":type: :class:`int`
|
|
48
|
+
|
|
49
|
+
Number of instances that are currently running with this scheduling plan.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json: Dict[str, Any]):
|
|
54
|
+
"""Create a new UserSchedulingQuota object from json describing a scheduling quota for a user.
|
|
55
|
+
|
|
56
|
+
:param dict json: Dictionary representing the user scheduling plan
|
|
57
|
+
:returns: The created :class:`~qarnot.computing_quotas.UserSchedulingQuota`.
|
|
58
|
+
"""
|
|
59
|
+
if json is None:
|
|
60
|
+
return None
|
|
61
|
+
return cls(
|
|
62
|
+
json.get('maxCores'),
|
|
63
|
+
json.get('runningCoresCount'),
|
|
64
|
+
json.get('maxInstances'),
|
|
65
|
+
json.get('runningInstancesCount'),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class UserReservedSchedulingQuota(UserSchedulingQuota):
|
|
70
|
+
"""Describes a reserved scheduling quota for the user.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
def __init__(self, machine_key: str, max_cores: int, running_cores_count: int, max_instances: int, running_instances_count: int):
|
|
74
|
+
"""Create a new UserReservedSchedulingQuota object describing a reserved scheduling quota for the user.
|
|
75
|
+
|
|
76
|
+
:param str machine_key: Machine key of the reservation.
|
|
77
|
+
:param int max_cores: Maximum number of cores that can be simultaneously used with this reserved machine specification.
|
|
78
|
+
:param int running_cores_count: Number of cores that are currently running with this reserved machine specification.
|
|
79
|
+
:param int max_instances: Maximum number of instances that can be simultaneously used with this reserved machine specification.
|
|
80
|
+
:param int running_instances_count: Number of instances that are currently running with this reserved machine specification.
|
|
81
|
+
:returns: The created :class:`~qarnot.computing_quotas.UserReservedSchedulingQuota`.
|
|
82
|
+
"""
|
|
83
|
+
super().__init__(max_cores, running_cores_count, max_instances, running_instances_count)
|
|
84
|
+
self.machine_key = machine_key
|
|
85
|
+
""":type: :class:`str`
|
|
86
|
+
|
|
87
|
+
Machine key of the reservation.
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_json(cls, json: Dict[str, Any]):
|
|
92
|
+
"""Create a new UserReservedSchedulingQuota object from json describing a reserved scheduling quota for a user.
|
|
93
|
+
|
|
94
|
+
:param dict json: Dictionary representing the user reserved scheduling quota
|
|
95
|
+
:returns: The created :class:`~qarnot.computing_quotas.UserReservedSchedulingQuota`.
|
|
96
|
+
"""
|
|
97
|
+
if json is None:
|
|
98
|
+
return None
|
|
99
|
+
return cls(
|
|
100
|
+
json.get('machineKey'),
|
|
101
|
+
json.get('maxCores'),
|
|
102
|
+
json.get('runningCoresCount'),
|
|
103
|
+
json.get('maxInstances'),
|
|
104
|
+
json.get('runningInstancesCount'),
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class UserComputingQuotas(object):
|
|
109
|
+
"""Describes the user's computing quotas.
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
def __init__(self, flex: UserSchedulingQuota, on_demand: UserSchedulingQuota, reserved: List[UserReservedSchedulingQuota]):
|
|
113
|
+
"""Create a new UserComputingQuotas object describing the user's computing quotas.
|
|
114
|
+
|
|
115
|
+
:param `~qarnot.computing_quotas.UserSchedulingQuota` flex: Quotas for Flex scheduling plan.
|
|
116
|
+
:param `~qarnot.computing_quotas.UserSchedulingQuota` on_demand: Quotas for OnDemand scheduling plan.
|
|
117
|
+
:param List of `~qarnot.computing_quotas.UserReservedSchedulingQuota` reserved: Quotas for Reserved scheduling plan.
|
|
118
|
+
:returns: The created :class:`~qarnot.computing_quotas.UserComputingQuotas`.
|
|
119
|
+
"""
|
|
120
|
+
self.flex = flex
|
|
121
|
+
""":type: :class:`~qarnot.computing_quotas.UserSchedulingQuota`
|
|
122
|
+
|
|
123
|
+
Quotas for Flex scheduling plan."""
|
|
124
|
+
self.on_demand = on_demand
|
|
125
|
+
""":type: :class:`~qarnot.computing_quotas.UserSchedulingQuota`
|
|
126
|
+
|
|
127
|
+
Quotas for OnDemand scheduling plan."""
|
|
128
|
+
self.reserved = reserved
|
|
129
|
+
""":type: list(:class:`~qarnot.computing_quotas.UserReservedSchedulingQuota`)
|
|
130
|
+
|
|
131
|
+
Quotas for Reserved scheduling plan."""
|
|
132
|
+
|
|
133
|
+
@classmethod
|
|
134
|
+
def from_json(cls, json: Dict[str, Any]):
|
|
135
|
+
"""Create a new UserComputingQuotas object from json describing the user's computing quotas.
|
|
136
|
+
|
|
137
|
+
:param dict json: Dictionary representing the user computing quota
|
|
138
|
+
:returns: The created :class:`~qarnot.computing_quotas.UserComputingQuotas`.
|
|
139
|
+
"""
|
|
140
|
+
if json is None:
|
|
141
|
+
return None
|
|
142
|
+
return cls(
|
|
143
|
+
UserSchedulingQuota.from_json(json.get('flex')),
|
|
144
|
+
UserSchedulingQuota.from_json(json.get('onDemand')),
|
|
145
|
+
[UserReservedSchedulingQuota.from_json(v) for v in json.get('reserved', []) if v is not None]
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
class OrganizationSchedulingQuota(object):
|
|
150
|
+
"""Describes a scheduling quota for the organization.
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
def __init__(self, max_cores: int, running_cores_count: int, max_instances: int, running_instances_count: int):
|
|
154
|
+
"""Create a new OrganizationSchedulingQuota object describing a scheduling quota for the organization.
|
|
155
|
+
|
|
156
|
+
:param int max_cores: Maximum number of cores that can be simultaneously used with this scheduling plan.
|
|
157
|
+
:param int running_cores_count: Number of cores that are currently running with this scheduling plan.
|
|
158
|
+
:param int max_instances: Maximum number of instances that can be simultaneously used with this scheduling plan.
|
|
159
|
+
:param int running_instances_count: Number of instances that are currently running with this scheduling plan.
|
|
160
|
+
:returns: The created :class:`~qarnot.computing_quotas.OrganizationSchedulingQuota`.
|
|
161
|
+
"""
|
|
162
|
+
self.max_cores = max_cores
|
|
163
|
+
""":type: :class:`int`
|
|
164
|
+
|
|
165
|
+
Maximum number of cores that can be simultaneously used with this scheduling plan.
|
|
166
|
+
"""
|
|
167
|
+
self.running_cores_count = running_cores_count
|
|
168
|
+
""":type: :class:`int`
|
|
169
|
+
|
|
170
|
+
Number of cores that are currently running with this scheduling plan.
|
|
171
|
+
"""
|
|
172
|
+
self.max_instances = max_instances
|
|
173
|
+
""":type: :class:`int`
|
|
174
|
+
|
|
175
|
+
Maximum number of instances that can be simultaneously used with this scheduling plan.
|
|
176
|
+
"""
|
|
177
|
+
self.running_instances_count = running_instances_count
|
|
178
|
+
""":type: :class:`int`
|
|
179
|
+
|
|
180
|
+
Number of instances that are currently running with this scheduling plan.
|
|
181
|
+
"""
|
|
182
|
+
|
|
183
|
+
@classmethod
|
|
184
|
+
def from_json(cls, json: Dict[str, Any]):
|
|
185
|
+
"""Create a new OrganizationSchedulingQuota object from json describing a scheduling quota for the organization.
|
|
186
|
+
|
|
187
|
+
:param dict json: Dictionary representing the organization scheduling plan
|
|
188
|
+
:returns: The created :class:`~qarnot.computing_quotas.OrganizationSchedulingQuota`.
|
|
189
|
+
"""
|
|
190
|
+
if json is None:
|
|
191
|
+
return None
|
|
192
|
+
return cls(
|
|
193
|
+
json.get('maxCores'),
|
|
194
|
+
json.get('runningCoresCount'),
|
|
195
|
+
json.get('maxInstances'),
|
|
196
|
+
json.get('runningInstancesCount'),
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class OrganizationReservedSchedulingQuota(OrganizationSchedulingQuota):
|
|
201
|
+
"""Describes a reserved scheduling quota for the organization.
|
|
202
|
+
"""
|
|
203
|
+
|
|
204
|
+
def __init__(self, machine_key: str, max_cores: int, running_cores_count: int, max_instances: int, running_instances_count: int):
|
|
205
|
+
"""Create a new OrganizationReservedSchedulingQuota object describing a reserved scheduling quota for the organization.
|
|
206
|
+
|
|
207
|
+
:param str machine_key: Machine key of the reservation.
|
|
208
|
+
:param int max_cores: Maximum number of cores that can be simultaneously used with this reserved machine specification.
|
|
209
|
+
:param int running_cores_count: Number of cores that are currently running with this reserved machine specification.
|
|
210
|
+
:param int max_instances: Maximum number of instances that can be simultaneously used with this reserved machine specification.
|
|
211
|
+
:param int running_instances_count: Number of instances that are currently running with this reserved machine specification.
|
|
212
|
+
:returns: The created :class:`~qarnot.computing_quotas.OrganizationReservedSchedulingQuota`.
|
|
213
|
+
"""
|
|
214
|
+
super().__init__(max_cores, running_cores_count, max_instances, running_instances_count)
|
|
215
|
+
self.machine_key = machine_key
|
|
216
|
+
""":type: :class:`str`
|
|
217
|
+
|
|
218
|
+
Machine key of the reservation.
|
|
219
|
+
"""
|
|
220
|
+
|
|
221
|
+
@classmethod
|
|
222
|
+
def from_json(cls, json: Dict[str, Any]):
|
|
223
|
+
"""Create a new OrganizationReservedSchedulingQuota object from json describing a reserved scheduling quota for a organization.
|
|
224
|
+
|
|
225
|
+
:param dict json: Dictionary representing the organization reserved scheduling quota
|
|
226
|
+
:returns: The created :class:`~qarnot.computing_quotas.OrganizationReservedSchedulingQuota`.
|
|
227
|
+
"""
|
|
228
|
+
if json is None:
|
|
229
|
+
return None
|
|
230
|
+
return cls(
|
|
231
|
+
json.get('machineKey'),
|
|
232
|
+
json.get('maxCores'),
|
|
233
|
+
json.get('runningCoresCount'),
|
|
234
|
+
json.get('maxInstances'),
|
|
235
|
+
json.get('runningInstancesCount'),
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class OrganizationComputingQuotas(object):
|
|
240
|
+
"""Describes the organization's computing quotas.
|
|
241
|
+
"""
|
|
242
|
+
|
|
243
|
+
def __init__(self, name: str, flex: OrganizationSchedulingQuota, on_demand: OrganizationSchedulingQuota, reserved: List[OrganizationReservedSchedulingQuota]):
|
|
244
|
+
"""Create a new OrganizationComputingQuotas object describing the organization's computing quotas.
|
|
245
|
+
|
|
246
|
+
:param `str` name: Name of the organization.
|
|
247
|
+
:param `~qarnot.computing_quotas.OrganizationSchedulingQuota` flex: Quotas for Flex scheduling plan.
|
|
248
|
+
:param `~qarnot.computing_quotas.OrganizationSchedulingQuota` on_demand: Quotas for OnDemand scheduling plan.
|
|
249
|
+
:param List of `~qarnot.computing_quotas.OrganizationReservedSchedulingQuota` reserved: Quotas for Reserved scheduling plan.
|
|
250
|
+
:returns: The created :class:`~qarnot.computing_quotas.OrganizationComputingQuotas`.
|
|
251
|
+
"""
|
|
252
|
+
self.name = name
|
|
253
|
+
""":type: :class:`str`
|
|
254
|
+
|
|
255
|
+
Name of the organization."""
|
|
256
|
+
self.flex = flex
|
|
257
|
+
""":type: :class:`~qarnot.computing_quotas.OrganizationSchedulingQuota`
|
|
258
|
+
|
|
259
|
+
Quotas for Flex scheduling plan."""
|
|
260
|
+
self.on_demand = on_demand
|
|
261
|
+
""":type: :class:`~qarnot.computing_quotas.OrganizationSchedulingQuota`
|
|
262
|
+
|
|
263
|
+
Quotas for OnDemand scheduling plan."""
|
|
264
|
+
self.reserved = reserved
|
|
265
|
+
""":type: list(:class:`~qarnot.computing_quotas.OrganizationReservedSchedulingQuota`)
|
|
266
|
+
|
|
267
|
+
Quotas for Reserved scheduling plan."""
|
|
268
|
+
|
|
269
|
+
@classmethod
|
|
270
|
+
def from_json(cls, json: Dict[str, Any]):
|
|
271
|
+
"""Create a new OrganizationComputingQuotas object from json describing the organization's computing quotas.
|
|
272
|
+
|
|
273
|
+
:param dict json: Dictionary representing the organization computing quota
|
|
274
|
+
:returns: The created :class:`~qarnot.computing_quotas.OrganizationComputingQuotas`.
|
|
275
|
+
"""
|
|
276
|
+
if json is None:
|
|
277
|
+
return None
|
|
278
|
+
return cls(
|
|
279
|
+
json.get('name'),
|
|
280
|
+
OrganizationSchedulingQuota.from_json(json.get('flex')),
|
|
281
|
+
OrganizationSchedulingQuota.from_json(json.get('onDemand')),
|
|
282
|
+
[OrganizationReservedSchedulingQuota.from_json(v) for v in json.get('reserved', []) if v is not None]
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
class ComputingQuotas(object):
|
|
287
|
+
"""Describes user and organization computing quotas.
|
|
288
|
+
"""
|
|
289
|
+
|
|
290
|
+
def __init__(self, user_computing_quotas: Optional[UserComputingQuotas], organization_computing_quotas: Optional[OrganizationComputingQuotas] = None):
|
|
291
|
+
"""Create a new ComputingQuotas object describing user and organization computing quotas.
|
|
292
|
+
|
|
293
|
+
:param user_computing_quotas: the user related computing quotas
|
|
294
|
+
:type user_computing_quotas: `~qarnot.computing_quotas.UserComputingQuotas`, optional
|
|
295
|
+
:param organization_computing_quotas: the organization related computing quotas
|
|
296
|
+
:type organization_computing_quotas: `~qarnot.computing_quotas.OrganizationComputingQuotas`, optional
|
|
297
|
+
:returns: The created :class:`~qarnot.computing_quotas.ComputingQuotas`.
|
|
298
|
+
"""
|
|
299
|
+
self.user = user_computing_quotas
|
|
300
|
+
""":type: :class:`~qarnot.computing_quotas.UserComputingQuotas`
|
|
301
|
+
|
|
302
|
+
The user related computing quotas."""
|
|
303
|
+
self.organization = organization_computing_quotas
|
|
304
|
+
""":type: :class:`~qarnot.computing_quotas.OrganizationComputingQuotas`
|
|
305
|
+
|
|
306
|
+
The organization related computing quotas."""
|
|
307
|
+
|
|
308
|
+
@classmethod
|
|
309
|
+
def from_json(cls, json: Dict[str, Any]):
|
|
310
|
+
"""Create a new ComputingQuotas object from json describing user and organization computing quotas.
|
|
311
|
+
|
|
312
|
+
:param dict json: Dictionary representing the computing quotas
|
|
313
|
+
:returns: The created :class:`~qarnot.computing_quotas.ComputingQuotas`
|
|
314
|
+
"""
|
|
315
|
+
if json is None:
|
|
316
|
+
return None
|
|
317
|
+
user_computing_quotas = UserComputingQuotas.from_json(json.get('user'))
|
|
318
|
+
organization_computing_quotas = OrganizationComputingQuotas.from_json(json.get('organization'))
|
|
319
|
+
return cls(user_computing_quotas, organization_computing_quotas)
|
|
320
|
+
|
|
321
|
+
@classmethod
|
|
322
|
+
def from_json_legacy(cls, json: Dict[str, Any]):
|
|
323
|
+
if json is None:
|
|
324
|
+
return None
|
|
325
|
+
flex = UserSchedulingQuota(json.get('maxFlexCores'), json.get('runningFlexCoreCount'), json.get('maxFlexInstances'), json.get('runningFlexInstanceCount'))
|
|
326
|
+
onDemand = UserSchedulingQuota(json.get('maxOnDemandCores'), json.get('runningOnDemandCoreCount'), json.get('maxOnDemandInstances'), json.get('runningOnDemandInstanceCount'))
|
|
327
|
+
user = UserComputingQuotas(flex, onDemand, [])
|
|
328
|
+
return cls(user, None)
|
qarnot/connection.py
CHANGED
|
@@ -28,6 +28,7 @@ from .task import Task, BulkTaskResponse
|
|
|
28
28
|
from .pool import Pool
|
|
29
29
|
from .paginate import PaginateResponse, OffsetResponse
|
|
30
30
|
from .bucket import Bucket
|
|
31
|
+
from .computing_quotas import ComputingQuotas
|
|
31
32
|
from .job import Job
|
|
32
33
|
from ._filter import create_pool_filter, create_task_filter, create_job_filter
|
|
33
34
|
from ._retry import with_retry
|
|
@@ -95,8 +96,8 @@ class Connection(object):
|
|
|
95
96
|
unsafe=False
|
|
96
97
|
|
|
97
98
|
"""
|
|
98
|
-
self.logger = logger if logger is not None else Log.get_logger_for_stream(sys.stdout)
|
|
99
|
-
self.logger_stderr = logger if logger is not None else Log.get_logger_for_stream(sys.stderr) # to avoid breaking change of task stderr logs
|
|
99
|
+
self.logger = logger if logger is not None else Log.get_logger_for_stream(sys.stdout, "stdout")
|
|
100
|
+
self.logger_stderr = logger if logger is not None else Log.get_logger_for_stream(sys.stderr, "stderr") # to avoid breaking change of task stderr logs
|
|
100
101
|
self._version = "qarnot-sdk-python/" + __version__
|
|
101
102
|
self._http = requests.session()
|
|
102
103
|
self._retry_count = retry_count
|
|
@@ -997,21 +998,37 @@ class UserInfo(object):
|
|
|
997
998
|
""":type: :class:`int`
|
|
998
999
|
|
|
999
1000
|
Number of cores currently submitted or running."""
|
|
1000
|
-
self.
|
|
1001
|
+
self.computing_quotas = ComputingQuotas.from_json(info.get('computingQuotas')) or ComputingQuotas.from_json_legacy(info)
|
|
1002
|
+
""":type: :class:`~qarnot.computing_quotas.ComputingQuotas`
|
|
1003
|
+
|
|
1004
|
+
Computing quotas information of the user and his organization."""
|
|
1005
|
+
self.max_flex_instances = self.computing_quotas.user.flex.max_instances if self.computing_quotas is not None else info.get('maxFlexInstances')
|
|
1001
1006
|
""":type: :class:`int`
|
|
1002
1007
|
|
|
1008
|
+
.. deprecated:: v2.18.0
|
|
1009
|
+
Use `self.computing_quotas` instead.
|
|
1010
|
+
|
|
1003
1011
|
Maximum number of instances simultaneously used with Flex scheduling plan."""
|
|
1004
|
-
self.max_flex_cores = info.get('maxFlexCores')
|
|
1012
|
+
self.max_flex_cores = self.computing_quotas.user.flex.max_cores if self.computing_quotas is not None else info.get('maxFlexCores')
|
|
1005
1013
|
""":type: :class:`int`
|
|
1006
1014
|
|
|
1015
|
+
.. deprecated:: v2.18.0
|
|
1016
|
+
Use `self.computing_quotas` instead.
|
|
1017
|
+
|
|
1007
1018
|
Maximum number of cores simultaneously used with Flex scheduling plan."""
|
|
1008
|
-
self.max_on_demand_instances = info.get('maxOnDemandInstances')
|
|
1019
|
+
self.max_on_demand_instances = self.computing_quotas.user.on_demand.max_instances if self.computing_quotas is not None else info.get('maxOnDemandInstances')
|
|
1009
1020
|
""":type: :class:`int`
|
|
1010
1021
|
|
|
1022
|
+
.. deprecated:: v2.18.0
|
|
1023
|
+
Use `self.computing_quotas` instead.
|
|
1024
|
+
|
|
1011
1025
|
Maximum number of instances simultaneously used with OnDemand scheduling plan."""
|
|
1012
|
-
self.max_on_demand_cores = info.get('maxOnDemandCores')
|
|
1026
|
+
self.max_on_demand_cores = self.computing_quotas.user.on_demand.max_cores if self.computing_quotas is not None else info.get('maxOnDemandCores')
|
|
1013
1027
|
""":type: :class:`int`
|
|
1014
1028
|
|
|
1029
|
+
.. deprecated:: v2.18.0
|
|
1030
|
+
Use `self.computing_quotas` instead.
|
|
1031
|
+
|
|
1015
1032
|
Maximum number of cores simultaneously used with OnDemand scheduling plan."""
|
|
1016
1033
|
|
|
1017
1034
|
|
qarnot/helper.py
CHANGED
|
@@ -14,7 +14,7 @@ class Log():
|
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
16
|
@staticmethod
|
|
17
|
-
def get_logger_for_stream(stream: TextIO = None, log_format: str = DEFAULT_LOG_FORMAT):
|
|
17
|
+
def get_logger_for_stream(stream: TextIO = None, name: str = None, log_format: str = DEFAULT_LOG_FORMAT):
|
|
18
18
|
"""Create a logger whose output is a stream.
|
|
19
19
|
|
|
20
20
|
:param TextIO stream:
|
|
@@ -31,12 +31,13 @@ class Log():
|
|
|
31
31
|
:rtype: logging.Logger
|
|
32
32
|
:returns: The created logger.
|
|
33
33
|
"""
|
|
34
|
-
|
|
34
|
+
if name is None:
|
|
35
|
+
name = __name__
|
|
35
36
|
formatter = logging.Formatter(log_format)
|
|
36
37
|
handler = logging.StreamHandler(stream if stream is not None else sys.stdout)
|
|
37
38
|
handler.setFormatter(formatter)
|
|
38
39
|
|
|
39
|
-
logger = logging.getLogger(
|
|
40
|
+
logger = logging.getLogger(name)
|
|
40
41
|
logger.addHandler(handler)
|
|
41
42
|
logger.setLevel(logging.INFO)
|
|
42
43
|
return logger
|
qarnot/pool.py
CHANGED
|
@@ -114,6 +114,7 @@ class Pool(object):
|
|
|
114
114
|
self._queued_or_running_task_instances_count = 0.0
|
|
115
115
|
|
|
116
116
|
self._completion_time_to_live = "00:00:00"
|
|
117
|
+
self._max_time_queue_seconds: int = None
|
|
117
118
|
self._auto_delete = False
|
|
118
119
|
self._tasks_wait_for_synchronization = False
|
|
119
120
|
|
|
@@ -215,6 +216,8 @@ class Pool(object):
|
|
|
215
216
|
if 'completionTimeToLive' in json_pool:
|
|
216
217
|
self._completion_time_to_live = json_pool.get("completionTimeToLive")
|
|
217
218
|
|
|
219
|
+
self._max_time_queue_seconds = json_pool.get("maxTimeQueueSeconds", None)
|
|
220
|
+
|
|
218
221
|
if 'elasticProperty' in json_pool:
|
|
219
222
|
elasticProperty = json_pool.get("elasticProperty")
|
|
220
223
|
self._is_elastic = elasticProperty.get("isElastic")
|
|
@@ -297,6 +300,9 @@ class Pool(object):
|
|
|
297
300
|
json_pool['privileges'] = self._privileges.to_json()
|
|
298
301
|
json_pool['defaultRetrySettings'] = self._default_retry_settings.to_json()
|
|
299
302
|
|
|
303
|
+
if self._max_time_queue_seconds is not None:
|
|
304
|
+
json_pool['maxTimeQueueSeconds'] = self._max_time_queue_seconds
|
|
305
|
+
|
|
300
306
|
if self._scheduling_type is not None:
|
|
301
307
|
json_pool['schedulingType'] = self._scheduling_type.schedulingType
|
|
302
308
|
|
|
@@ -1431,6 +1437,22 @@ class Pool(object):
|
|
|
1431
1437
|
|
|
1432
1438
|
self._privileges._exportApiAndStorageCredentialsInEnvironment = True
|
|
1433
1439
|
|
|
1440
|
+
@property
|
|
1441
|
+
def max_time_queue_seconds(self):
|
|
1442
|
+
"""
|
|
1443
|
+
:type: :class:`uint`
|
|
1444
|
+
:getter: Max time to wait before time out when there is not any place to execute the pool.
|
|
1445
|
+
|
|
1446
|
+
pool's max time queue seconds
|
|
1447
|
+
"""
|
|
1448
|
+
self._update_if_summary()
|
|
1449
|
+
return self._max_time_queue_seconds
|
|
1450
|
+
|
|
1451
|
+
@max_time_queue_seconds.setter
|
|
1452
|
+
def max_time_queue_seconds(self, value: int):
|
|
1453
|
+
"""Setter for max_time_queue_seconds."""
|
|
1454
|
+
self._max_time_queue_seconds = value
|
|
1455
|
+
|
|
1434
1456
|
@property
|
|
1435
1457
|
def default_retry_settings(self) -> RetrySettings:
|
|
1436
1458
|
""":type: :class:`~qarnot.retry_settings.RetrySettings`
|
qarnot/task.py
CHANGED
|
@@ -19,7 +19,7 @@ from os import makedirs, path
|
|
|
19
19
|
import time
|
|
20
20
|
import warnings
|
|
21
21
|
import sys
|
|
22
|
-
from typing import Dict, Optional, Union, List, Any, Callable
|
|
22
|
+
from typing import Dict, Optional, Union, List, Any, Callable, Sequence
|
|
23
23
|
|
|
24
24
|
from qarnot.carbon_facts import CarbonClient, CarbonFacts
|
|
25
25
|
from qarnot.retry_settings import RetrySettings
|
|
@@ -40,6 +40,7 @@ from .exceptions import MissingTaskException, MaxTaskException, NotEnoughCredits
|
|
|
40
40
|
|
|
41
41
|
try:
|
|
42
42
|
from progressbar import AnimatedMarker, Bar, Percentage, AdaptiveETA, ProgressBar
|
|
43
|
+
from progressbar.widgets import WidgetBase
|
|
43
44
|
except ImportError:
|
|
44
45
|
pass
|
|
45
46
|
|
|
@@ -172,6 +173,7 @@ class Task(object):
|
|
|
172
173
|
self._progress = None
|
|
173
174
|
self._execution_time = None
|
|
174
175
|
self._wall_time = None
|
|
176
|
+
self._max_time_queue_seconds: int = None
|
|
175
177
|
self._end_date = None
|
|
176
178
|
self._upload_results_on_cancellation: Optional[bool] = None
|
|
177
179
|
self._hardware_constraints: List[HardwareConstraint] = []
|
|
@@ -513,6 +515,7 @@ class Task(object):
|
|
|
513
515
|
self._progress = json_task.get("progress", None)
|
|
514
516
|
self._execution_time = json_task.get("executionTime", None)
|
|
515
517
|
self._wall_time = json_task.get("wallTime", None)
|
|
518
|
+
self._max_time_queue_seconds = json_task.get("maxTimeQueueSeconds", None)
|
|
516
519
|
self._end_date = json_task.get("endDate", None)
|
|
517
520
|
self._labels = json_task.get("labels", {})
|
|
518
521
|
self._hardware_constraints = [HardwareConstraint.from_json(hw_constraint_dict) for hw_constraint_dict in json_task.get("hardwareConstraints", [])]
|
|
@@ -589,7 +592,7 @@ class Task(object):
|
|
|
589
592
|
|
|
590
593
|
if live_progress:
|
|
591
594
|
try:
|
|
592
|
-
widgets = [
|
|
595
|
+
widgets: Sequence[WidgetBase | str] = [
|
|
593
596
|
Percentage(),
|
|
594
597
|
' ', AnimatedMarker(),
|
|
595
598
|
' ', Bar(),
|
|
@@ -1778,6 +1781,22 @@ class Task(object):
|
|
|
1778
1781
|
self._update_if_summary()
|
|
1779
1782
|
return self._wall_time
|
|
1780
1783
|
|
|
1784
|
+
@property
|
|
1785
|
+
def max_time_queue_seconds(self):
|
|
1786
|
+
"""
|
|
1787
|
+
:type: :class:`uint`
|
|
1788
|
+
:getter: Max time to wait before time out when there is not any place to execute the task.
|
|
1789
|
+
|
|
1790
|
+
task's max time queue seconds
|
|
1791
|
+
"""
|
|
1792
|
+
self._update_if_summary()
|
|
1793
|
+
return self._max_time_queue_seconds
|
|
1794
|
+
|
|
1795
|
+
@max_time_queue_seconds.setter
|
|
1796
|
+
def max_time_queue_seconds(self, value: int):
|
|
1797
|
+
"""Setter for max_time_queue_seconds."""
|
|
1798
|
+
self._max_time_queue_seconds = value
|
|
1799
|
+
|
|
1781
1800
|
@property
|
|
1782
1801
|
def snapshot_interval(self):
|
|
1783
1802
|
"""
|
|
@@ -1836,6 +1855,9 @@ class Task(object):
|
|
|
1836
1855
|
self._resource_object_advanced = [x.to_json() for x in self._resource_objects]
|
|
1837
1856
|
json_task['advancedResourceBuckets'] = self._resource_object_advanced
|
|
1838
1857
|
|
|
1858
|
+
if self._max_time_queue_seconds is not None:
|
|
1859
|
+
json_task['maxTimeQueueSeconds'] = self._max_time_queue_seconds
|
|
1860
|
+
|
|
1839
1861
|
if self._result_object is not None:
|
|
1840
1862
|
json_task['resultBucket'] = self._result_object.uuid
|
|
1841
1863
|
if self._result_object._cache_ttl_sec is not None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: qarnot
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.18.0
|
|
4
4
|
Summary: Qarnot Computing SDK
|
|
5
5
|
Home-page: https://computing.qarnot.com
|
|
6
6
|
Author: Qarnot computing
|
|
@@ -27,6 +27,7 @@ Dynamic: classifier
|
|
|
27
27
|
Dynamic: description
|
|
28
28
|
Dynamic: home-page
|
|
29
29
|
Dynamic: license
|
|
30
|
+
Dynamic: license-file
|
|
30
31
|
Dynamic: requires-dist
|
|
31
32
|
Dynamic: requires-python
|
|
32
33
|
Dynamic: summary
|
|
@@ -2,29 +2,30 @@ qarnot/__init__.py,sha256=BCIFvWIe1EbzdZAMeKnyK9HYIqNHlSsbaaDMIL7VghA,5626
|
|
|
2
2
|
qarnot/_filter.py,sha256=J--0lOY2rverPEE3zrvuipYkOd9T_4HrW4eVNJqheac,10109
|
|
3
3
|
qarnot/_retry.py,sha256=4QdtI5Y_Jshja8zDxhx_g17dzABCIUGXQsjcPl65u7g,890
|
|
4
4
|
qarnot/_util.py,sha256=fmAq55CmfDTTB7yaOLspayC3Mvre7SCzp0YwWsnwpDA,5673
|
|
5
|
-
qarnot/_version.py,sha256=
|
|
5
|
+
qarnot/_version.py,sha256=7tz02m0CSFBqrG9O7MBXuCGhUSa4292fCRUFrZqcSI4,499
|
|
6
6
|
qarnot/advanced_bucket.py,sha256=dfhHOz0foJfEQoaCdGiS_-28w4Y6rq36ZloPgoEQiLE,7927
|
|
7
7
|
qarnot/bucket.py,sha256=aNuJqfYUm2YCQ0m8SBl384xspYkc9SJy6_G-FEKs8nk,24449
|
|
8
8
|
qarnot/carbon_facts.py,sha256=E_tBMsa2byEMgKAEilIFRsCE6_T978Zl7-ZXk4--PPI,10292
|
|
9
|
-
qarnot/
|
|
9
|
+
qarnot/computing_quotas.py,sha256=qK-aJFKKi8TGarQ_QX2rM4rjDsg3iMV__hgxikIgNy0,15418
|
|
10
|
+
qarnot/connection.py,sha256=x71AuXeO33iyxbdoWEQecjsyI_8VSvX7PXztzsNpzLE,46022
|
|
10
11
|
qarnot/error.py,sha256=WCkkILJzOi06Q5QRBfacU41D0MQeFCPsQc9Ub1Y6SXw,734
|
|
11
12
|
qarnot/exceptions.py,sha256=yt_iwCw_9pFdoKeOTxsr05kqW5Gu-th3gSfos5zI26g,2729
|
|
12
13
|
qarnot/forced_constant.py,sha256=-i4b_JO10YiWuJ7Q0bmWE_TEwtf8qSeLlkMTAbH55EM,1309
|
|
13
14
|
qarnot/forced_network_rule.py,sha256=g83LOCRy3c6e5WayQMlk-eYUXQFZICROLh6FDQ8G73k,4515
|
|
14
15
|
qarnot/hardware_constraint.py,sha256=YZi4FgaJQ84mxVDT4u2WxqJ-i_bikwssidTRHRc3JHA,13694
|
|
15
|
-
qarnot/helper.py,sha256=
|
|
16
|
+
qarnot/helper.py,sha256=HWy0ollEMoGvCXbAY_FfgkhJjpHRRmkNtavvrJba2PY,1564
|
|
16
17
|
qarnot/job.py,sha256=bag9NbugWCSf18J2c6nFKmWFFusXP58dfYYxd8CMsy8,19508
|
|
17
18
|
qarnot/paginate.py,sha256=DaUYDPAS0M8hf0hph8GuMSzTASymSUOpp-WqbfevX-s,1387
|
|
18
|
-
qarnot/pool.py,sha256=
|
|
19
|
+
qarnot/pool.py,sha256=dUSOOkuFhNyR3Yr07svLKNBlzITddyoJR1wOtmKgpxA,57033
|
|
19
20
|
qarnot/privileges.py,sha256=6j3n8q_RNdZ8bBPD9misHEpS0CbcQByqzxlOu8CS-rU,1896
|
|
20
21
|
qarnot/retry_settings.py,sha256=Illobh-1U8hPdzkffJu5TFKM_NdzCNYS2j1teBljX94,2512
|
|
21
22
|
qarnot/scheduling_type.py,sha256=j90APc1ji7xe2Z9OH9l81tjO12k0Wf9bSaG-_UCyeNI,2223
|
|
22
23
|
qarnot/secrets.py,sha256=v6-1UNhCnnW71eJYMeqhcUYLHnsnONGi4Qa3aoiG9qc,12354
|
|
23
24
|
qarnot/status.py,sha256=dCVsh9_ewIASZcreATbUd2qJ-cUMk0cRkyVLdrOot3Q,12348
|
|
24
25
|
qarnot/storage.py,sha256=jAist_J_6yzmRrkF5jqYNG3mhEP_y7KqCdNv4dJcHuM,6929
|
|
25
|
-
qarnot/task.py,sha256=
|
|
26
|
-
qarnot-2.
|
|
27
|
-
qarnot-2.
|
|
28
|
-
qarnot-2.
|
|
29
|
-
qarnot-2.
|
|
30
|
-
qarnot-2.
|
|
26
|
+
qarnot/task.py,sha256=Opg7QwZP2dZjPA4tCWkobqayoEHrmHCDc_-L_nSFQCo,76133
|
|
27
|
+
qarnot-2.18.0.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
|
28
|
+
qarnot-2.18.0.dist-info/METADATA,sha256=AnWFGHWQ2zUU8IruRuLng4hMokzfhsyn7bDE6aMbCnQ,2543
|
|
29
|
+
qarnot-2.18.0.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
30
|
+
qarnot-2.18.0.dist-info/top_level.txt,sha256=acRyoLZNyf_kuGTwHQgfZv2MfdTcZstyNjBhOxFtHzU,7
|
|
31
|
+
qarnot-2.18.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|