Coverage for / home / jenkins / .local / lib / python3.10 / site-packages / hyper_multicore / _build / build_state.py: 0%
26 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-15 05:03 +0800
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-15 05:03 +0800
1# Copyright 2026 Huawei Technologies Co., Ltd
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"""Explicit per-build state and results, separate from the tool process runner."""
17import os
18import time
19from dataclasses import dataclass, field
20from pathlib import Path
21from .command_runner import Commands
24@dataclass
25class PreparedFramework:
26 """One selected interpreter and its collected build-only interface evidence."""
28 python: Path
29 identity: dict
30 packages: list = field(default_factory=list)
33@dataclass
34class BuildResult:
35 """Values needed after publication; no dynamic attributes on runner or transaction."""
37 payload: Path
38 pythons: list[Path]
39 frameworks: int
40 started: float
43class BuildContext:
44 """Own task state explicitly while sharing the runner's ordered stage records."""
46 def __init__(self, root: Path, native: Path) -> None:
47 """Collect task state without adding it to the command executor."""
48 self.root, self.native = root, native
49 self.directory = native / "logs"
50 self.run_id = time.strftime("%Y%m%d-%H%M%S") + f"-{os.getpid()}"
51 self.events = []
52 self.commands = Commands(self.directory, root=root, events=self.events,
53 scratch=native / "staging" / self.run_id / "tool-output")
54 self.frameworks = {}
55 self.vendor_requests = []
56 self.isolated = False