opentf-toolkit-nightly 0.63.0.dev1404__py3-none-any.whl → 0.63.0.dev1406__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/toolkit/channels.py +37 -2
- {opentf_toolkit_nightly-0.63.0.dev1404.dist-info → opentf_toolkit_nightly-0.63.0.dev1406.dist-info}/METADATA +1 -1
- {opentf_toolkit_nightly-0.63.0.dev1404.dist-info → opentf_toolkit_nightly-0.63.0.dev1406.dist-info}/RECORD +6 -6
- {opentf_toolkit_nightly-0.63.0.dev1404.dist-info → opentf_toolkit_nightly-0.63.0.dev1406.dist-info}/WHEEL +0 -0
- {opentf_toolkit_nightly-0.63.0.dev1404.dist-info → opentf_toolkit_nightly-0.63.0.dev1406.dist-info}/licenses/LICENSE +0 -0
- {opentf_toolkit_nightly-0.63.0.dev1404.dist-info → opentf_toolkit_nightly-0.63.0.dev1406.dist-info}/top_level.txt +0 -0
opentf/toolkit/channels.py
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Set, Tuple, Union
|
|
19
19
|
|
|
20
|
+
from collections import defaultdict
|
|
21
|
+
from copy import deepcopy
|
|
20
22
|
from datetime import datetime
|
|
21
23
|
from shlex import quote
|
|
22
24
|
|
|
@@ -46,6 +48,14 @@ STOPCOMMANDS_COMMAND = re.compile(r'^::stop-commands::(\w+)$')
|
|
|
46
48
|
ADDMASK_COMMAND = re.compile(r'^::add-mask::(.*)$')
|
|
47
49
|
PUT_FILE_COMMAND = re.compile(r'^::put\s+file=(.*?)\s*::(.*?)\s*$')
|
|
48
50
|
|
|
51
|
+
COMMAND_PATTERNS = (
|
|
52
|
+
ATTACH_COMMAND,
|
|
53
|
+
UPLOAD_COMMAND,
|
|
54
|
+
DOWNLOAD_COMMAND,
|
|
55
|
+
PUT_FILE_COMMAND,
|
|
56
|
+
SETOUTPUT_COMMAND,
|
|
57
|
+
)
|
|
58
|
+
|
|
49
59
|
|
|
50
60
|
## step sequence IDs
|
|
51
61
|
|
|
@@ -313,6 +323,7 @@ class JobState:
|
|
|
313
323
|
def __init__(self) -> None:
|
|
314
324
|
self.stop_command: Optional[str] = None
|
|
315
325
|
self.masks: List[str] = []
|
|
326
|
+
self.workflow_commands: List[str] = []
|
|
316
327
|
|
|
317
328
|
|
|
318
329
|
def mask(line: str, state: JobState) -> str:
|
|
@@ -332,6 +343,9 @@ def _as_log(line: str, jobstate: JobState):
|
|
|
332
343
|
return mask(line, jobstate).rstrip()
|
|
333
344
|
|
|
334
345
|
|
|
346
|
+
## artifacts
|
|
347
|
+
|
|
348
|
+
|
|
335
349
|
def process_upload(result: Dict[str, Any]) -> Dict[str, Any]:
|
|
336
350
|
"""Process ExecutionResult event containing .metadata.upload flag.
|
|
337
351
|
|
|
@@ -427,7 +441,7 @@ def _download_artifacts(
|
|
|
427
441
|
|
|
428
442
|
def process_output(
|
|
429
443
|
event: Dict[str, Any],
|
|
430
|
-
resp: int,
|
|
444
|
+
resp: Optional[int],
|
|
431
445
|
stdout: List[str],
|
|
432
446
|
stderr: List[str],
|
|
433
447
|
jobstate: JobState,
|
|
@@ -540,6 +554,14 @@ def process_output(
|
|
|
540
554
|
attachments: List[str] = []
|
|
541
555
|
attachments_metadata = {}
|
|
542
556
|
|
|
557
|
+
is_channel_notify = False
|
|
558
|
+
step_sequence_id = metadata['step_sequence_id']
|
|
559
|
+
if resp is None:
|
|
560
|
+
resp, is_channel_notify = 0, True
|
|
561
|
+
if not is_channel_notify and jobstate.workflow_commands:
|
|
562
|
+
stdout.extend(jobstate.workflow_commands)
|
|
563
|
+
jobstate.workflow_commands.clear()
|
|
564
|
+
|
|
543
565
|
has_artifacts = False
|
|
544
566
|
for line in stdout:
|
|
545
567
|
# Parsing stdout for workflow commands
|
|
@@ -548,6 +570,10 @@ def process_output(
|
|
|
548
570
|
jobstate.stop_command = None
|
|
549
571
|
continue
|
|
550
572
|
|
|
573
|
+
if is_channel_notify and any(p.match(line) for p in COMMAND_PATTERNS):
|
|
574
|
+
jobstate.workflow_commands.append(line)
|
|
575
|
+
continue
|
|
576
|
+
|
|
551
577
|
if wcmd := ATTACH_COMMAND.match(line):
|
|
552
578
|
resp = _attach(wcmd.group(2), wcmd.group(1))
|
|
553
579
|
elif wcmd := UPLOAD_COMMAND.match(line):
|
|
@@ -569,11 +595,20 @@ def process_output(
|
|
|
569
595
|
for line in stderr:
|
|
570
596
|
logs.append(mask(line, jobstate).rstrip())
|
|
571
597
|
|
|
598
|
+
if is_channel_notify:
|
|
599
|
+
notify = make_event(EXECUTIONRESULT, metadata=deepcopy(metadata), status=resp)
|
|
600
|
+
notify['metadata']['step_sequence_id_origin'] = metadata['step_sequence_id']
|
|
601
|
+
notify['metadata']['step_sequence_id'] = CHANNEL_NOTIFY
|
|
602
|
+
notify['logs'] = logs
|
|
603
|
+
if notify['metadata'].get('artifacts'):
|
|
604
|
+
del notify['metadata']['artifacts']
|
|
605
|
+
return notify
|
|
606
|
+
|
|
572
607
|
if metadata.get('artifacts'):
|
|
573
608
|
del metadata['artifacts']
|
|
574
609
|
|
|
575
610
|
opentf_variables = None
|
|
576
|
-
if
|
|
611
|
+
if step_sequence_id != CHANNEL_RELEASE:
|
|
577
612
|
if variables:
|
|
578
613
|
opentf_variables = _read_opentf_variables(variables)
|
|
579
614
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opentf-toolkit-nightly
|
|
3
|
-
Version: 0.63.0.
|
|
3
|
+
Version: 0.63.0.dev1406
|
|
4
4
|
Summary: OpenTestFactory Orchestrator Toolkit
|
|
5
5
|
Home-page: https://gitlab.com/henixdevelopment/open-source/opentestfactory/python-toolkit
|
|
6
6
|
Author: Martin Lafaix
|
|
@@ -58,11 +58,11 @@ opentf/schemas/opentestfactory.org/v1beta2/ServiceConfig.json,sha256=rEvK2YWL5lG
|
|
|
58
58
|
opentf/scripts/launch_java_service.sh,sha256=S0jAaCuv2sZy0Gf2NGBuPX-eD531rcM-b0fNyhmzSjw,2423
|
|
59
59
|
opentf/scripts/startup.py,sha256=DLanDaXutUTYcG2PwoJ34QH-5G0TwfLUY_xy1VkVOqA,23202
|
|
60
60
|
opentf/toolkit/__init__.py,sha256=YnH66dmePAIU7dq_xWFYTIEUrsL9qV9f82LRDiBzbzs,22057
|
|
61
|
-
opentf/toolkit/channels.py,sha256=
|
|
61
|
+
opentf/toolkit/channels.py,sha256=8WuybkK7HZpTvCqstnik6cz-OGd7p4AMBAfBJX3E3zA,27389
|
|
62
62
|
opentf/toolkit/core.py,sha256=jMBDIYZ8Qn3BvsysfKoG0iTtjOnZsggetpH3eXygCsI,9636
|
|
63
63
|
opentf/toolkit/models.py,sha256=PNfXVQbeyOwDfaNrLjcfhYm6duMSlNWBtZsWZcs53ag,6583
|
|
64
|
-
opentf_toolkit_nightly-0.63.0.
|
|
65
|
-
opentf_toolkit_nightly-0.63.0.
|
|
66
|
-
opentf_toolkit_nightly-0.63.0.
|
|
67
|
-
opentf_toolkit_nightly-0.63.0.
|
|
68
|
-
opentf_toolkit_nightly-0.63.0.
|
|
64
|
+
opentf_toolkit_nightly-0.63.0.dev1406.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
65
|
+
opentf_toolkit_nightly-0.63.0.dev1406.dist-info/METADATA,sha256=EXkrO2T8qRPNdSP83yiGluJDu-aq7zwXDY4mDbsrbUg,2215
|
|
66
|
+
opentf_toolkit_nightly-0.63.0.dev1406.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
|
67
|
+
opentf_toolkit_nightly-0.63.0.dev1406.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
|
|
68
|
+
opentf_toolkit_nightly-0.63.0.dev1406.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|