uber-compose 2.3.3__tar.gz → 2.4.0__tar.gz
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.
- {uber_compose-2.3.3 → uber_compose-2.4.0}/PKG-INFO +2 -1
- {uber_compose-2.3.3 → uber_compose-2.4.0}/README.md +1 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/__init__.py +2 -1
- uber_compose-2.4.0/uber_compose/helpers/hooks.py +24 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/uber_compose.py +17 -0
- uber_compose-2.4.0/uber_compose/version +1 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose.egg-info/PKG-INFO +2 -1
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose.egg-info/SOURCES.txt +1 -0
- uber_compose-2.3.3/uber_compose/version +0 -1
- {uber_compose-2.3.3 → uber_compose-2.4.0}/LICENSE +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/setup.cfg +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/setup.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/constants.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/docker_compose.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/docker_compose_shell/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/docker_compose_shell/interface.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/docker_compose_shell/types.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/sequence_run_types.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/system_docker_compose.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/utils/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/utils/compose_files.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/utils/compose_instance_cfg.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/utils/env_files.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/utils/process_command_output.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/utils/shell_process.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/utils/state_waiting.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/env_description/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/env_description/env_tools.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/env_description/env_types.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/errors/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/errors/migrations.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/errors/up.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/broken_services.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/bytes_pickle.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/countdown_counter.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/exec_record.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/exec_result.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/health_policy.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/jobs_result.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/labels.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/singleton.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/helpers/state_keeper.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/output/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/output/console.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/output/styles.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/utils/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/utils/docker_compose_files_path.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/utils/docker_compose_service_deps.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/utils/search_docker_compose_files.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/utils/services_construction.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/base_structures/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/base_structures/common_json_cli.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/helpers/__init__.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/helpers/scenario_ordering.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/helpers/scenario_tag_processing.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/helpers/test_env_vars_setter.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/plugin.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/version.py +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose.egg-info/dependency_links.txt +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose.egg-info/requires.txt +0 -0
- {uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uber-compose
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: docker compose testing env orchestrator
|
|
5
5
|
Home-page: https://github.com/ko10ok/uber-compose
|
|
6
6
|
Author: Yuriy Sagitov
|
|
@@ -231,6 +231,7 @@ This is particularly useful when:
|
|
|
231
231
|
- **[E2E Test Setup](docs/E2E_CONTAINER_SETUP.md)** - Configure test container for E2E testing
|
|
232
232
|
- **[CLI Usage Guide](docs/CLI_USAGE.md)** - Guide for using CommonJsonCli with JSON log parsing
|
|
233
233
|
- **[X-Migration](docs/X_MIGRATION.md)** - Extended service initialization and migration commands
|
|
234
|
+
- **[Lifecycle Hooks](docs/HOOKS.md)** - Register callbacks that run after the environment is up
|
|
234
235
|
|
|
235
236
|
## 🛠️ Development Guide
|
|
236
237
|
|
|
@@ -198,6 +198,7 @@ This is particularly useful when:
|
|
|
198
198
|
- **[E2E Test Setup](docs/E2E_CONTAINER_SETUP.md)** - Configure test container for E2E testing
|
|
199
199
|
- **[CLI Usage Guide](docs/CLI_USAGE.md)** - Guide for using CommonJsonCli with JSON log parsing
|
|
200
200
|
- **[X-Migration](docs/X_MIGRATION.md)** - Extended service initialization and migration commands
|
|
201
|
+
- **[Lifecycle Hooks](docs/HOOKS.md)** - Register callbacks that run after the environment is up
|
|
201
202
|
|
|
202
203
|
## 🛠️ Development Guide
|
|
203
204
|
|
|
@@ -10,6 +10,7 @@ from uber_compose.env_description.env_types import OverridenService
|
|
|
10
10
|
from uber_compose.env_description.env_types import Service
|
|
11
11
|
from uber_compose.helpers.exec_result import ExecTimeout
|
|
12
12
|
from uber_compose.helpers.health_policy import UpHealthPolicy
|
|
13
|
+
from uber_compose.helpers.hooks import UberComposeEvent
|
|
13
14
|
from uber_compose.uber_compose import SystemUberCompose
|
|
14
15
|
from uber_compose.uber_compose import TheUberCompose
|
|
15
16
|
from uber_compose.vedro_plugin.base_structures.common_json_cli import CommandResult
|
|
@@ -27,5 +28,5 @@ __all__ = (
|
|
|
27
28
|
'CommonJsonCli', 'CommandResult', 'ProcessExit', 'JsonParser', 'json_parser', 'ExecTimeout', 'TimeOutCheck',
|
|
28
29
|
'ExecLifeCyclePolicy',
|
|
29
30
|
'VedroUberCompose', 'UpHealthPolicy', 'DEFAULT_COMPOSE', 'ComposeConfig', 'DEFAULT_ENV_DESCRIPTION',
|
|
30
|
-
'DEFAULT_ENV_ID',
|
|
31
|
+
'DEFAULT_ENV_ID', 'UberComposeEvent',
|
|
31
32
|
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from collections import defaultdict
|
|
2
|
+
from enum import Enum
|
|
3
|
+
import inspect
|
|
4
|
+
from typing import Any
|
|
5
|
+
from typing import Callable
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class UberComposeEvent(Enum):
|
|
9
|
+
AFTER_UP = 'after_up'
|
|
10
|
+
AFTER_UPDATED_ENV_UP = 'after_updated_env_up'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class HooksRegistry:
|
|
14
|
+
def __init__(self) -> None:
|
|
15
|
+
self._hooks: dict[UberComposeEvent, list[tuple[Callable[..., Any], tuple, dict]]] = defaultdict(list)
|
|
16
|
+
|
|
17
|
+
def on(self, event: UberComposeEvent, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None:
|
|
18
|
+
self._hooks[event].append((func, args, kwargs))
|
|
19
|
+
|
|
20
|
+
async def run(self, event: UberComposeEvent) -> None:
|
|
21
|
+
for func, args, kwargs in self._hooks[event]:
|
|
22
|
+
result = func(*args, **kwargs)
|
|
23
|
+
if inspect.isawaitable(result):
|
|
24
|
+
await result
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
import shlex
|
|
3
|
+
from typing import Any
|
|
3
4
|
from typing import Callable
|
|
4
5
|
from uuid import uuid4
|
|
5
6
|
|
|
@@ -23,6 +24,8 @@ from uber_compose.helpers.bytes_pickle import debase64_pickled
|
|
|
23
24
|
from uber_compose.helpers.exec_result import ExecResult
|
|
24
25
|
from uber_compose.helpers.exec_result import ExecTimeout
|
|
25
26
|
from uber_compose.helpers.health_policy import UpHealthPolicy
|
|
27
|
+
from uber_compose.helpers.hooks import HooksRegistry
|
|
28
|
+
from uber_compose.helpers.hooks import UberComposeEvent
|
|
26
29
|
from uber_compose.helpers.jobs_result import JobResult
|
|
27
30
|
from uber_compose.helpers.labels import Label
|
|
28
31
|
from uber_compose.helpers.singleton import SingletonMeta
|
|
@@ -59,6 +62,11 @@ class SystemUberCompose:
|
|
|
59
62
|
self.health_policy = health_policy
|
|
60
63
|
self.run_id = run_id
|
|
61
64
|
self.last_release_id = None
|
|
65
|
+
self._previous_release_id: str | None = None
|
|
66
|
+
self._hooks = HooksRegistry()
|
|
67
|
+
|
|
68
|
+
def on(self, event: UberComposeEvent, func: Callable, *args: Any, **kwargs: Any) -> None:
|
|
69
|
+
self._hooks.on(event, func, *args, **kwargs)
|
|
62
70
|
|
|
63
71
|
async def up(self,
|
|
64
72
|
config_template: Environment | None = None,
|
|
@@ -76,6 +84,7 @@ class SystemUberCompose:
|
|
|
76
84
|
|
|
77
85
|
reusable_env = self._find_reusable_env(services_state, config_template, force_restart)
|
|
78
86
|
if reusable_env is not None:
|
|
87
|
+
await self._hooks.run(UberComposeEvent.AFTER_UP)
|
|
79
88
|
return reusable_env
|
|
80
89
|
|
|
81
90
|
self._log_inflight_and_restart_info(services_state, force_restart)
|
|
@@ -145,6 +154,7 @@ class SystemUberCompose:
|
|
|
145
154
|
|
|
146
155
|
last_release_id = services_state.get_any().labels.get(Label.RELEASE_ID)
|
|
147
156
|
self.last_release_id = last_release_id
|
|
157
|
+
self._previous_release_id = last_release_id
|
|
148
158
|
return ReadyEnv(existing_env_id, env_config, last_release_id)
|
|
149
159
|
|
|
150
160
|
def _log_inflight_and_restart_info(self, services_state: ServicesComposeState, force_restart: bool) -> None:
|
|
@@ -183,6 +193,8 @@ class SystemUberCompose:
|
|
|
183
193
|
if self.last_release_id is None:
|
|
184
194
|
self.last_release_id = str(uuid4())
|
|
185
195
|
|
|
196
|
+
is_env_update = self._previous_release_id is not None
|
|
197
|
+
|
|
186
198
|
if parallelism_limit == 1:
|
|
187
199
|
self.logger.stage_debug(f'Using default service names with {parallelism_limit=}')
|
|
188
200
|
new_env_id = DEFAULT_ENV_ID
|
|
@@ -216,6 +228,11 @@ class SystemUberCompose:
|
|
|
216
228
|
|
|
217
229
|
self.logger.stage_info(Text('New environment started'))
|
|
218
230
|
|
|
231
|
+
await self._hooks.run(UberComposeEvent.AFTER_UP)
|
|
232
|
+
if is_env_update:
|
|
233
|
+
await self._hooks.run(UberComposeEvent.AFTER_UPDATED_ENV_UP)
|
|
234
|
+
self._previous_release_id = self.last_release_id
|
|
235
|
+
|
|
219
236
|
return ReadyEnv(
|
|
220
237
|
new_env_id,
|
|
221
238
|
compose_instance.compose_instance_files.env_config_instance.env,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.4.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: uber-compose
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: docker compose testing env orchestrator
|
|
5
5
|
Home-page: https://github.com/ko10ok/uber-compose
|
|
6
6
|
Author: Yuriy Sagitov
|
|
@@ -231,6 +231,7 @@ This is particularly useful when:
|
|
|
231
231
|
- **[E2E Test Setup](docs/E2E_CONTAINER_SETUP.md)** - Configure test container for E2E testing
|
|
232
232
|
- **[CLI Usage Guide](docs/CLI_USAGE.md)** - Guide for using CommonJsonCli with JSON log parsing
|
|
233
233
|
- **[X-Migration](docs/X_MIGRATION.md)** - Extended service initialization and migration commands
|
|
234
|
+
- **[Lifecycle Hooks](docs/HOOKS.md)** - Register callbacks that run after the environment is up
|
|
234
235
|
|
|
235
236
|
## 🛠️ Development Guide
|
|
236
237
|
|
|
@@ -39,6 +39,7 @@ uber_compose/helpers/countdown_counter.py
|
|
|
39
39
|
uber_compose/helpers/exec_record.py
|
|
40
40
|
uber_compose/helpers/exec_result.py
|
|
41
41
|
uber_compose/helpers/health_policy.py
|
|
42
|
+
uber_compose/helpers/hooks.py
|
|
42
43
|
uber_compose/helpers/jobs_result.py
|
|
43
44
|
uber_compose/helpers/labels.py
|
|
44
45
|
uber_compose/helpers/singleton.py
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.3.3
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/docker_compose_shell/__init__.py
RENAMED
|
File without changes
|
{uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/core/docker_compose_shell/interface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/base_structures/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/helpers/scenario_ordering.py
RENAMED
|
File without changes
|
|
File without changes
|
{uber_compose-2.3.3 → uber_compose-2.4.0}/uber_compose/vedro_plugin/helpers/test_env_vars_setter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|