opentf-toolkit-nightly 0.62.0.dev1370__py3-none-any.whl → 0.62.0.dev1377__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.
@@ -14,7 +14,7 @@
14
14
 
15
15
  """Helpers for the OpenTestFactory orchestrator services."""
16
16
 
17
- from typing import Any, Dict, List, NoReturn, Optional, Tuple, Union
17
+ from typing import Any, Dict, List, NoReturn, Optional, Union
18
18
 
19
19
  import logging
20
20
  import os
@@ -217,7 +217,7 @@ def _get_contextparameter_spec(app: Flask, name: str) -> Optional[Dict[str, Any]
217
217
  app.logger.info('Configuration:')
218
218
  parameters = app.config[PARAMETERS_KEY]
219
219
  try:
220
- spec = get_named(name, parameters)
220
+ spec = get_named(parameters, name)
221
221
  if spec.get('type') == 'int':
222
222
  spec['type'] = 'number'
223
223
  if spec.get('type') == 'bool':
opentf/commons/config.py CHANGED
@@ -226,7 +226,7 @@ def read_config(
226
226
 
227
227
  context_name = altcontext or config['current-context']
228
228
  try:
229
- context = get_named(context_name, config['contexts'])['context']
229
+ context = get_named(config['contexts'], context_name)['context']
230
230
  except ValueError as err:
231
231
  raise ConfigError(f'Could not find context "{context_name}": {err}.')
232
232
  return context, config
@@ -278,7 +278,7 @@ def read_descriptor(
278
278
  raise ConfigError(f'Could not get descriptor "{filename}", aborting: {err}.')
279
279
 
280
280
 
281
- def get_named(name: str, entries: List[Dict[str, Any]]) -> Dict[str, Any]:
281
+ def get_named(entries: List[Dict[str, Any]], name: str) -> Dict[str, Any]:
282
282
  """Get an entry from a list of dictionaries.
283
283
 
284
284
  Matching entries are those with a 'name' entry equal to the
@@ -286,8 +286,8 @@ def get_named(name: str, entries: List[Dict[str, Any]]) -> Dict[str, Any]:
286
286
 
287
287
  # Required parameters
288
288
 
289
- - name: a string, the entry 'name'
290
289
  - entries: a list of dictionaries
290
+ - name: a string, the entry 'name'
291
291
 
292
292
  # Returned value
293
293
 
@@ -221,6 +221,7 @@
221
221
  "IDLE",
222
222
  "PENDING",
223
223
  "UNREACHABLE",
224
+ "TERMINATING",
224
225
  null
225
226
  ]
226
227
  },
opentf/scripts/startup.py CHANGED
@@ -394,7 +394,7 @@ def start_plugins(conf: Dict[str, Any]) -> List[Any]:
394
394
  else:
395
395
  disabled = []
396
396
  if (v := _get_env('OPENTF_ALLURE_ENABLED')) is None or (
397
- v.lower() not in ('true', 'yes', 'on')
397
+ v.lower() not in ('true', 'yes', 'on', '1')
398
398
  ):
399
399
  disabled.append('allure.collector')
400
400
  disabled.append('result.aggregator')
@@ -14,11 +14,10 @@
14
14
 
15
15
  """A toolkit for creating OpenTestFactory plugins."""
16
16
 
17
- from typing import Any, Callable, Dict, List, Optional
17
+ from typing import Any, Callable, Dict, Optional
18
18
 
19
19
  import os
20
20
  import threading
21
- import sys
22
21
 
23
22
  from collections import defaultdict
24
23
  from time import sleep
@@ -553,7 +552,8 @@ def make_plugin(
553
552
 
554
553
  - name: a string
555
554
  - description: a string
556
- - `channel`, `generator` or `provider`: a function
555
+ - `channel`, `generator`, `provider`, `providers`, or `publisher`: a
556
+ function
557
557
  - providers: a dictionary
558
558
 
559
559
  # Optional parameters
@@ -15,8 +15,9 @@
15
15
  """Toolkit helpers for channels plugins."""
16
16
 
17
17
 
18
- from typing import Any, Callable, Dict, List, Optional, Tuple, Union
18
+ from typing import Any, Callable, Dict, List, NamedTuple, Optional, Set, Tuple, Union
19
19
 
20
+ from datetime import datetime
20
21
  from shlex import quote
21
22
 
22
23
  import fnmatch
@@ -137,6 +138,27 @@ OPENTF_VARIABLES_REGEX = re.compile(r'^(export|set)\s(\"?.+)$')
137
138
  OPENTF_VARIABLES_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_]+$')
138
139
 
139
140
 
141
+ ## Lease helpers
142
+
143
+
144
+ class Offer(NamedTuple):
145
+ """An offer for a job."""
146
+
147
+ job_id: str
148
+ metadata: Dict[str, Any]
149
+ candidates: List[str]
150
+ tags: Set[str]
151
+
152
+
153
+ class Lease(NamedTuple):
154
+ """A lease for a job."""
155
+
156
+ job_id: str
157
+ expire: datetime
158
+ offer: Dict[str, Any]
159
+ tags: Set[str]
160
+
161
+
140
162
  ## Variables helpers
141
163
 
142
164
 
opentf/toolkit/core.py CHANGED
@@ -283,10 +283,12 @@ def validate_params_inputs(inputs: Dict[str, Any]):
283
283
  format_ = inputs['format']
284
284
 
285
285
  if format_ != SQUASHTM_FORMAT:
286
- fail('Unknown format value for params.')
286
+ fail('Unknown "format" value for params.')
287
287
 
288
288
  if data.keys() - {'global', 'test'}:
289
- fail('Unexpected keys found in data, was only expecting global and/or test.')
289
+ fail(
290
+ 'Unexpected keys found in data, was only expecting "global" and/or "test".'
291
+ )
290
292
 
291
293
 
292
294
  def attach_file(path: str, **kwargs) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opentf-toolkit-nightly
3
- Version: 0.62.0.dev1370
3
+ Version: 0.62.0.dev1377
4
4
  Summary: OpenTestFactory Orchestrator Toolkit
5
5
  Home-page: https://gitlab.com/henixdevelopment/open-source/opentestfactory/python-toolkit
6
6
  Author: Martin Lafaix
@@ -1,6 +1,6 @@
1
- opentf/commons/__init__.py,sha256=N8GrBU1oL4sDUB4iVF5kPVB__uBlhe4FwD8E5ITV2pI,23011
1
+ opentf/commons/__init__.py,sha256=arFXmrY-ViO8htpI53s2kz4sGNawutTjFPn0jNsfx8Y,23004
2
2
  opentf/commons/auth.py,sha256=yUmAoZPk9Aru2UVT5xSjH96u9DOKPk17AeL1_12mjBM,16399
3
- opentf/commons/config.py,sha256=WiXoxuWQUebHrWAIY1fkxpwKb17uCnG29_8cZ2CaCcE,10454
3
+ opentf/commons/config.py,sha256=r84DKgZNr50Wgwv2iBmDY3nNIS-7Dq2JtliR9btTGts,10454
4
4
  opentf/commons/exceptions.py,sha256=7dhUXO8iyAbqVwlUKxZhgRzGqVcb7LkG39hFlm-VxIA,2407
5
5
  opentf/commons/expressions.py,sha256=jM_YKXVOFhvOE2aE2IuacuvxhIsOYTFs2oQkpcbWR6g,19645
6
6
  opentf/commons/meta.py,sha256=ygSO3mE2d-Ux62abzK1wYk86noT4R5Tumd90nyZo0MU,3322
@@ -30,7 +30,7 @@ opentf/schemas/opentestfactory.org/v1alpha1/ExecutionResult.json,sha256=UeWc4TfR
30
30
  opentf/schemas/opentestfactory.org/v1alpha1/GeneratorCommand.json,sha256=uxbqDhP4newgz-85TnGKbchx448QEQ8WB5PXpcJy2ME,1754
31
31
  opentf/schemas/opentestfactory.org/v1alpha1/GeneratorResult.json,sha256=LkHLGt2uam1Q5Ux0zP_O9oFgxBMCjD3Th3BsfsXxd1g,6633
32
32
  opentf/schemas/opentestfactory.org/v1alpha1/InsightCollector.json,sha256=mPYt6vuRlW2nq_hOHP1ssk1vXiaOKugzMwRiPm3FzTw,17940
33
- opentf/schemas/opentestfactory.org/v1alpha1/Notification.json,sha256=yx2_JJSTSAP9NVe_dxwc-0Y1StMcEqcqAJohztG5PsQ,8437
33
+ opentf/schemas/opentestfactory.org/v1alpha1/Notification.json,sha256=V-Yd7yQR6r8135cDrnh0W-ugQvtSvKpHQiNRoMP1N9g,8496
34
34
  opentf/schemas/opentestfactory.org/v1alpha1/PluginMetadata.json,sha256=BLklO7CObT4OpAEsQT60WJ1ttOcG71hIYzgN-e7Ch9k,2803
35
35
  opentf/schemas/opentestfactory.org/v1alpha1/ProviderCommand.json,sha256=soe0imdnnq1mfGEpcLJvF3JVUIrF-7FFECc7CzNzobI,2875
36
36
  opentf/schemas/opentestfactory.org/v1alpha1/ProviderConfig.json,sha256=HT0bgPJ5fNytQJr-wxU21oApp4RrjogurgRP-zj_eDs,3878
@@ -56,12 +56,12 @@ opentf/schemas/opentestfactory.org/v1beta1/ServiceConfig.json,sha256=m5ZgWAKbutu
56
56
  opentf/schemas/opentestfactory.org/v1beta1/Workflow.json,sha256=QZ8mM9PhzsI9gTmwmKTWYNoRn--rtcM3L0PzgnPBfMU,15424
57
57
  opentf/schemas/opentestfactory.org/v1beta2/ServiceConfig.json,sha256=rEvK2YWL5lG94_qYgR_GnLWNsaQhaQ-2kuZdWJr5NnY,3517
58
58
  opentf/scripts/launch_java_service.sh,sha256=S0jAaCuv2sZy0Gf2NGBuPX-eD531rcM-b0fNyhmzSjw,2423
59
- opentf/scripts/startup.py,sha256=AcVXU2auPvqMb_6OpGzkVqrpgYV6vz7x_Rnv8YbAEkk,23114
60
- opentf/toolkit/__init__.py,sha256=EBTZJ3srbzrLDd4fCmEN5C4NnoZ2kKhpE1aj6oMPtPs,22041
61
- opentf/toolkit/channels.py,sha256=6qKSsAgq_oJpuDRiKqVUz-EAjdfikcCG3SFAGmKZdhQ,25551
62
- opentf/toolkit/core.py,sha256=8REPRzLWrN50B2VMz8yO-AClgOOt8MsqYdafDw2my48,9608
63
- opentf_toolkit_nightly-0.62.0.dev1370.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
64
- opentf_toolkit_nightly-0.62.0.dev1370.dist-info/METADATA,sha256=PBI7Oca_P0qepFNUHfghv_WhMcudi860YzIxk93M9JQ,2214
65
- opentf_toolkit_nightly-0.62.0.dev1370.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
66
- opentf_toolkit_nightly-0.62.0.dev1370.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
67
- opentf_toolkit_nightly-0.62.0.dev1370.dist-info/RECORD,,
59
+ opentf/scripts/startup.py,sha256=K-uW-70EJb4Ou2dBFR_7utDU3oMWBczkomtikq_2qCc,23119
60
+ opentf/toolkit/__init__.py,sha256=YnH66dmePAIU7dq_xWFYTIEUrsL9qV9f82LRDiBzbzs,22057
61
+ opentf/toolkit/channels.py,sha256=oXZzW5bwcnGbJ7WAIkV42ekFnOQq7HxIvnyvURWaoNs,25904
62
+ opentf/toolkit/core.py,sha256=jMBDIYZ8Qn3BvsysfKoG0iTtjOnZsggetpH3eXygCsI,9636
63
+ opentf_toolkit_nightly-0.62.0.dev1377.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
64
+ opentf_toolkit_nightly-0.62.0.dev1377.dist-info/METADATA,sha256=5dQzMTM0rdKWHz-STjkmX5dkt0wq5x_t58JXy2ApaM0,2214
65
+ opentf_toolkit_nightly-0.62.0.dev1377.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
66
+ opentf_toolkit_nightly-0.62.0.dev1377.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
67
+ opentf_toolkit_nightly-0.62.0.dev1377.dist-info/RECORD,,