Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: juju/python-libjuju
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7e9bc99475ed881d3150037e5e4a2f82c0614600
Choose a base ref
..
head repository: juju/python-libjuju
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2aa46343c613a187e6df79af25bdcd250a71354c
Choose a head ref
Showing with 9 additions and 156 deletions.
  1. +2 −1 .github/workflows/test.yaml
  2. +0 −72 .github/workflows/test_candidate.yaml
  3. +0 −72 .github/workflows/test_edge.yaml
  4. +7 −8 juju/model.py
  5. +0 −3 tests/unit/test_wait_for_idle.py
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ jobs:
- "3.3/stable"
- "3.4/stable"
- "3.5/stable"
- "3.6/candidate"
- "3.6/stable"
new_wait_for_idle:
- "True"
- "False"
@@ -138,6 +138,7 @@ jobs:
- "3.3/stable"
- "3.4/stable"
- "3.5/stable"
- "3.6/stable"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
72 changes: 0 additions & 72 deletions .github/workflows/test_candidate.yaml

This file was deleted.

72 changes: 0 additions & 72 deletions .github/workflows/test_edge.yaml

This file was deleted.

15 changes: 7 additions & 8 deletions juju/model.py
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
import stat
import sys
import tempfile
import time
import warnings
import weakref
import zipfile
@@ -3281,25 +3282,26 @@ async def new_wait_for_idle(
apps = apps or list(self.applications)
idle_times: dict[str, datetime] = {}
units_ready: set[str] = set() # The units that are in the desired state
last_log_time: list[datetime | None] = [None]

start_time = datetime.now()
deadline = None if timeout is None else time.monotonic() + timeout

while True:
if deadline and time.monotonic() > deadline:
raise jasyncio.TimeoutError(
"Timed out waiting for model to become idle"
)

if await self._check_idle(
apps=apps,
raise_on_error=raise_on_error,
raise_on_blocked=raise_on_blocked,
status=status,
wait_for_at_least_units=wait_for_at_least_units,
wait_for_exact_units=wait_for_exact_units,
timeout=timeout,
idle_period=idle_period,
_wait_for_units=_wait_for_units,
idle_times=idle_times,
units_ready=units_ready,
last_log_time=last_log_time,
start_time=start_time,
):
break

@@ -3314,13 +3316,10 @@ async def _check_idle(
status: str | None,
wait_for_at_least_units: int | None,
wait_for_exact_units: int | None,
timeout: float | None,
idle_period: float,
_wait_for_units: int,
idle_times: dict[str, datetime],
units_ready: set[str],
last_log_time: list[datetime | None],
start_time: datetime,
) -> bool:
now = datetime.now()
expected_idle_since = now - timedelta(seconds=idle_period)
3 changes: 0 additions & 3 deletions tests/unit/test_wait_for_idle.py
Original file line number Diff line number Diff line change
@@ -327,13 +327,10 @@ def kwargs() -> dict[str, Any]:
status=None,
wait_for_at_least_units=None,
wait_for_exact_units=None,
timeout=100,
idle_period=0,
_wait_for_units=1,
idle_times={},
units_ready=set(),
last_log_time=[None],
start_time=datetime.now(),
)