opentf-toolkit-nightly 0.56.0.dev976__py3-none-any.whl → 0.56.0.dev988__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.
- opentf/commons/datasources.py +1 -1
- opentf/toolkit/__init__.py +44 -0
- opentf/toolkit/core.py +11 -0
- {opentf_toolkit_nightly-0.56.0.dev976.dist-info → opentf_toolkit_nightly-0.56.0.dev988.dist-info}/METADATA +1 -1
- {opentf_toolkit_nightly-0.56.0.dev976.dist-info → opentf_toolkit_nightly-0.56.0.dev988.dist-info}/RECORD +8 -8
- {opentf_toolkit_nightly-0.56.0.dev976.dist-info → opentf_toolkit_nightly-0.56.0.dev988.dist-info}/LICENSE +0 -0
- {opentf_toolkit_nightly-0.56.0.dev976.dist-info → opentf_toolkit_nightly-0.56.0.dev988.dist-info}/WHEEL +0 -0
- {opentf_toolkit_nightly-0.56.0.dev976.dist-info → opentf_toolkit_nightly-0.56.0.dev988.dist-info}/top_level.txt +0 -0
opentf/commons/datasources.py
CHANGED
|
@@ -174,7 +174,7 @@ def _uses_inception(events: List[Dict[str, Any]]) -> bool:
|
|
|
174
174
|
if not workflow_event:
|
|
175
175
|
raise ValueError('No Workflow event in workflow events...')
|
|
176
176
|
return any(
|
|
177
|
-
'inception' in _as_list(job
|
|
177
|
+
'inception' in _as_list(job.get('runs-on', []))
|
|
178
178
|
for job in workflow_event['jobs'].values()
|
|
179
179
|
)
|
|
180
180
|
|
opentf/toolkit/__init__.py
CHANGED
|
@@ -296,6 +296,17 @@ def _dispatch_executioncommand(_, handler: Handler, body: Dict[str, Any]):
|
|
|
296
296
|
return make_status_response('InternalError', msg)
|
|
297
297
|
|
|
298
298
|
|
|
299
|
+
def _dispatch_generatorcommand(_, handler: Handler, body: Dict[str, Any]):
|
|
300
|
+
"""Generator plugin dispatcher."""
|
|
301
|
+
try:
|
|
302
|
+
inputs: Dict[str, Any] = body.get('with', {})
|
|
303
|
+
core.publish_generatorresult(handler(inputs))
|
|
304
|
+
except Exception as err:
|
|
305
|
+
msg = f'Unexpected execution error: {err}.'
|
|
306
|
+
core.publish_error(msg)
|
|
307
|
+
return make_status_response('InternalError', msg)
|
|
308
|
+
|
|
309
|
+
|
|
299
310
|
########################################################################
|
|
300
311
|
# Watchdog
|
|
301
312
|
|
|
@@ -476,6 +487,37 @@ def run_plugin(plugin):
|
|
|
476
487
|
context[SUBSCRIPTION_KEY].append(
|
|
477
488
|
subscribe(kind=EXECUTIONCOMMAND, target='inbox', app=plugin)
|
|
478
489
|
)
|
|
490
|
+
elif context[KIND_KEY] == GENERATORCOMMAND:
|
|
491
|
+
for manifest in plugin.config['DESCRIPTOR']:
|
|
492
|
+
metadata = manifest.get('metadata', {})
|
|
493
|
+
if metadata.get('name', '').lower() != plugin.name.lower():
|
|
494
|
+
continue
|
|
495
|
+
if 'action' not in metadata:
|
|
496
|
+
continue
|
|
497
|
+
for event in manifest.get('events', []):
|
|
498
|
+
cat_prefix = event.get('categoryPrefix')
|
|
499
|
+
cat = event.get('category')
|
|
500
|
+
if cat or cat_prefix:
|
|
501
|
+
cat_version = event.get('categoryVersion')
|
|
502
|
+
labels = {}
|
|
503
|
+
if cat is not None:
|
|
504
|
+
labels['opentestfactory.org/category'] = cat
|
|
505
|
+
if cat_prefix is not None:
|
|
506
|
+
labels['opentestfactory.org/categoryPrefix'] = cat_prefix
|
|
507
|
+
if cat_version is not None:
|
|
508
|
+
labels['opentestfactory.org/categoryVersion'] = cat_version
|
|
509
|
+
context[SUBSCRIPTION_KEY].append(
|
|
510
|
+
subscribe(
|
|
511
|
+
kind=GENERATORCOMMAND,
|
|
512
|
+
target='inbox',
|
|
513
|
+
labels=labels,
|
|
514
|
+
app=plugin,
|
|
515
|
+
)
|
|
516
|
+
)
|
|
517
|
+
else:
|
|
518
|
+
plugin.logger.warning(
|
|
519
|
+
"At least one of 'category', 'categoryPrefix' required, ignoring."
|
|
520
|
+
)
|
|
479
521
|
run_app(plugin)
|
|
480
522
|
finally:
|
|
481
523
|
for subscription_id in plugin.config['CONTEXT'][SUBSCRIPTION_KEY]:
|
|
@@ -558,6 +600,8 @@ def make_plugin(
|
|
|
558
600
|
_dispatch_providercommand(plugin, provider, body)
|
|
559
601
|
elif channel:
|
|
560
602
|
return _dispatch_executioncommand(plugin, channel, body)
|
|
603
|
+
elif generator:
|
|
604
|
+
_dispatch_generatorcommand(plugin, generator, body)
|
|
561
605
|
else:
|
|
562
606
|
return make_status_response('BadRequest', 'Not implemented yet.')
|
|
563
607
|
|
opentf/toolkit/core.py
CHANGED
|
@@ -24,6 +24,7 @@ import posixpath
|
|
|
24
24
|
import sys
|
|
25
25
|
|
|
26
26
|
from opentf.commons import (
|
|
27
|
+
GENERATORRESULT,
|
|
27
28
|
PROVIDERRESULT,
|
|
28
29
|
EXECUTIONERROR,
|
|
29
30
|
publish,
|
|
@@ -140,6 +141,16 @@ def publish_providerresult(steps: Iterable) -> None:
|
|
|
140
141
|
publish_event(command)
|
|
141
142
|
|
|
142
143
|
|
|
144
|
+
def publish_generatorresult(jobs: Dict[str, Any]) -> None:
|
|
145
|
+
"""Publish GeneratorResult event."""
|
|
146
|
+
command = make_event(
|
|
147
|
+
GENERATORRESULT,
|
|
148
|
+
metadata=_getbody()['metadata'],
|
|
149
|
+
jobs={k: v.copy() for k, v in jobs.items()},
|
|
150
|
+
)
|
|
151
|
+
publish_event(command)
|
|
152
|
+
|
|
153
|
+
|
|
143
154
|
########################################################################
|
|
144
155
|
## Toolkit helpers
|
|
145
156
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
opentf/commons/__init__.py,sha256=KRY8ShQw_0ZZ0oEOiKi4-xnWofE_QsFjEe1T8wUxJ-w,21952
|
|
2
2
|
opentf/commons/auth.py,sha256=bM2Z3kxm2Wku1lKXaRAIg37LHvXWAXIZIqjplDfN2P8,15899
|
|
3
3
|
opentf/commons/config.py,sha256=GmvInVnUsXIwlNfgTQeQ_pPs97GeGTGn2S2QZEFwss8,7828
|
|
4
|
-
opentf/commons/datasources.py,sha256=
|
|
4
|
+
opentf/commons/datasources.py,sha256=4ye-TMtaE88O8GVcWx-FtKXOC8aIZLteR6wfIr7Do8U,25232
|
|
5
5
|
opentf/commons/expressions.py,sha256=A68F27Our8oVVphUrRvB5haSlqj2YCrH2OxHPNLBio4,19251
|
|
6
6
|
opentf/commons/pubsub.py,sha256=7khxAHVZiwJRcwIBJ6MPR-f3xY9144-2eNLROwq5F-4,5894
|
|
7
7
|
opentf/commons/schemas.py,sha256=lokZCU-wmsIkzVA-TVENtC7Io_GmYxrP-FQaOOowg4s,4044
|
|
@@ -45,11 +45,11 @@ opentf/schemas/opentestfactory.org/v1beta1/Workflow.json,sha256=QZ8mM9PhzsI9gTmw
|
|
|
45
45
|
opentf/schemas/opentestfactory.org/v1beta2/ServiceConfig.json,sha256=rEvK2YWL5lG94_qYgR_GnLWNsaQhaQ-2kuZdWJr5NnY,3517
|
|
46
46
|
opentf/scripts/launch_java_service.sh,sha256=S0jAaCuv2sZy0Gf2NGBuPX-eD531rcM-b0fNyhmzSjw,2423
|
|
47
47
|
opentf/scripts/startup.py,sha256=Da2zo93pBWbdRmj-wgekgLcF94rpNc3ZkbvR8R0w8XY,21279
|
|
48
|
-
opentf/toolkit/__init__.py,sha256=
|
|
48
|
+
opentf/toolkit/__init__.py,sha256=icNo_jz2IfhwddunQpfq6F-0xeKS70S-0Or5zJliEZs,21692
|
|
49
49
|
opentf/toolkit/channels.py,sha256=Cng3b4LUsxvCHUbp_skys9CFcKZMfcKhA_ODg_EAlIE,17156
|
|
50
|
-
opentf/toolkit/core.py,sha256=
|
|
51
|
-
opentf_toolkit_nightly-0.56.0.
|
|
52
|
-
opentf_toolkit_nightly-0.56.0.
|
|
53
|
-
opentf_toolkit_nightly-0.56.0.
|
|
54
|
-
opentf_toolkit_nightly-0.56.0.
|
|
55
|
-
opentf_toolkit_nightly-0.56.0.
|
|
50
|
+
opentf/toolkit/core.py,sha256=MvvWUrS4dvo3Qrd_Yl9uND3CllL0qtMi-y1S-Na1uQs,9621
|
|
51
|
+
opentf_toolkit_nightly-0.56.0.dev988.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
52
|
+
opentf_toolkit_nightly-0.56.0.dev988.dist-info/METADATA,sha256=ojgsewIQOmWuo06J0f6c113DhiU3VErtAhlQh2G8c5I,1945
|
|
53
|
+
opentf_toolkit_nightly-0.56.0.dev988.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
54
|
+
opentf_toolkit_nightly-0.56.0.dev988.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
|
|
55
|
+
opentf_toolkit_nightly-0.56.0.dev988.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|