opentf-toolkit-nightly 0.63.0.dev1406__py3-none-any.whl → 0.63.0.dev1410__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 +24 -23
- {opentf_toolkit_nightly-0.63.0.dev1406.dist-info → opentf_toolkit_nightly-0.63.0.dev1410.dist-info}/METADATA +1 -1
- {opentf_toolkit_nightly-0.63.0.dev1406.dist-info → opentf_toolkit_nightly-0.63.0.dev1410.dist-info}/RECORD +6 -6
- {opentf_toolkit_nightly-0.63.0.dev1406.dist-info → opentf_toolkit_nightly-0.63.0.dev1410.dist-info}/WHEEL +1 -1
- {opentf_toolkit_nightly-0.63.0.dev1406.dist-info → opentf_toolkit_nightly-0.63.0.dev1410.dist-info}/licenses/LICENSE +0 -0
- {opentf_toolkit_nightly-0.63.0.dev1406.dist-info → opentf_toolkit_nightly-0.63.0.dev1410.dist-info}/top_level.txt +0 -0
opentf/toolkit/channels.py
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
|
|
18
18
|
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Set, Tuple, Union
|
|
19
19
|
|
|
20
|
-
from collections import defaultdict
|
|
21
20
|
from copy import deepcopy
|
|
22
21
|
from datetime import datetime
|
|
23
22
|
from shlex import quote
|
|
@@ -48,15 +47,6 @@ STOPCOMMANDS_COMMAND = re.compile(r'^::stop-commands::(\w+)$')
|
|
|
48
47
|
ADDMASK_COMMAND = re.compile(r'^::add-mask::(.*)$')
|
|
49
48
|
PUT_FILE_COMMAND = re.compile(r'^::put\s+file=(.*?)\s*::(.*?)\s*$')
|
|
50
49
|
|
|
51
|
-
COMMAND_PATTERNS = (
|
|
52
|
-
ATTACH_COMMAND,
|
|
53
|
-
UPLOAD_COMMAND,
|
|
54
|
-
DOWNLOAD_COMMAND,
|
|
55
|
-
PUT_FILE_COMMAND,
|
|
56
|
-
SETOUTPUT_COMMAND,
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
50
|
## step sequence IDs
|
|
61
51
|
|
|
62
52
|
CHANNEL_REQUEST = -1
|
|
@@ -323,7 +313,10 @@ class JobState:
|
|
|
323
313
|
def __init__(self) -> None:
|
|
324
314
|
self.stop_command: Optional[str] = None
|
|
325
315
|
self.masks: List[str] = []
|
|
326
|
-
self.
|
|
316
|
+
self.output_commands: List[str] = []
|
|
317
|
+
self.attachments: List[str] = []
|
|
318
|
+
self.attachments_metadata: Dict[str, Any] = {}
|
|
319
|
+
self.artifacts_resp: bool = False
|
|
327
320
|
|
|
328
321
|
|
|
329
322
|
def mask(line: str, state: JobState) -> str:
|
|
@@ -552,17 +545,16 @@ def process_output(
|
|
|
552
545
|
outputs = {}
|
|
553
546
|
logs: List[str] = []
|
|
554
547
|
attachments: List[str] = []
|
|
555
|
-
attachments_metadata = {}
|
|
548
|
+
attachments_metadata: Dict[str, Any] = {}
|
|
556
549
|
|
|
557
550
|
is_channel_notify = False
|
|
558
551
|
step_sequence_id = metadata['step_sequence_id']
|
|
559
552
|
if resp is None:
|
|
560
553
|
resp, is_channel_notify = 0, True
|
|
561
|
-
if not is_channel_notify and jobstate.
|
|
562
|
-
stdout.extend(jobstate.
|
|
563
|
-
jobstate.
|
|
554
|
+
if not is_channel_notify and jobstate.output_commands:
|
|
555
|
+
stdout.extend(jobstate.output_commands)
|
|
556
|
+
jobstate.output_commands.clear()
|
|
564
557
|
|
|
565
|
-
has_artifacts = False
|
|
566
558
|
for line in stdout:
|
|
567
559
|
# Parsing stdout for workflow commands
|
|
568
560
|
if jobstate.stop_command:
|
|
@@ -570,14 +562,14 @@ def process_output(
|
|
|
570
562
|
jobstate.stop_command = None
|
|
571
563
|
continue
|
|
572
564
|
|
|
573
|
-
if is_channel_notify and
|
|
574
|
-
jobstate.
|
|
565
|
+
if is_channel_notify and SETOUTPUT_COMMAND.match(line):
|
|
566
|
+
jobstate.output_commands.append(line)
|
|
575
567
|
continue
|
|
576
568
|
|
|
577
569
|
if wcmd := ATTACH_COMMAND.match(line):
|
|
578
570
|
resp = _attach(wcmd.group(2), wcmd.group(1))
|
|
579
571
|
elif wcmd := UPLOAD_COMMAND.match(line):
|
|
580
|
-
|
|
572
|
+
jobstate.artifacts_resp = True
|
|
581
573
|
resp = _attach(wcmd.group(2), wcmd.group(1), is_artifact=True)
|
|
582
574
|
elif wcmd := DOWNLOAD_COMMAND.match(line):
|
|
583
575
|
resp = _download(wcmd.group(2), wcmd.group(1))
|
|
@@ -602,6 +594,9 @@ def process_output(
|
|
|
602
594
|
notify['logs'] = logs
|
|
603
595
|
if notify['metadata'].get('artifacts'):
|
|
604
596
|
del notify['metadata']['artifacts']
|
|
597
|
+
if attachments:
|
|
598
|
+
jobstate.attachments.extend(attachments)
|
|
599
|
+
jobstate.attachments_metadata.update(attachments_metadata)
|
|
605
600
|
return notify
|
|
606
601
|
|
|
607
602
|
if metadata.get('artifacts'):
|
|
@@ -621,11 +616,17 @@ def process_output(
|
|
|
621
616
|
result['outputs'] = outputs
|
|
622
617
|
if logs:
|
|
623
618
|
result['logs'] = logs
|
|
624
|
-
if attachments:
|
|
625
|
-
result['attachments'] = attachments
|
|
626
|
-
result['metadata']['attachments'] =
|
|
627
|
-
|
|
619
|
+
if attachments or jobstate.attachments:
|
|
620
|
+
result['attachments'] = jobstate.attachments + attachments
|
|
621
|
+
result['metadata']['attachments'] = {
|
|
622
|
+
**jobstate.attachments_metadata,
|
|
623
|
+
**attachments_metadata,
|
|
624
|
+
}
|
|
625
|
+
jobstate.attachments.clear()
|
|
626
|
+
jobstate.attachments_metadata = {}
|
|
627
|
+
if jobstate.artifacts_resp:
|
|
628
628
|
result['metadata']['upload'] = resp
|
|
629
|
+
jobstate.artifacts_resp = False
|
|
629
630
|
if opentf_variables:
|
|
630
631
|
result['variables'] = opentf_variables
|
|
631
632
|
return result
|
|
@@ -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.dev1410
|
|
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=BQh5ztQmIKpxns6ozDNto4YpegktydPZyhOO9F3g-2Q,27731
|
|
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.dev1410.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
65
|
+
opentf_toolkit_nightly-0.63.0.dev1410.dist-info/METADATA,sha256=JGYwdjQVyIzFakde1XO0lPfaQgH5qfY6RsHHSM6Bmfo,2215
|
|
66
|
+
opentf_toolkit_nightly-0.63.0.dev1410.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
|
67
|
+
opentf_toolkit_nightly-0.63.0.dev1410.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
|
|
68
|
+
opentf_toolkit_nightly-0.63.0.dev1410.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|