pyobs-core 2.29.0.dev3__py3-none-any.whl → 2.29.0.dev4__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.
- pyobs/mixins/coolingramp.py +44 -3
- {pyobs_core-2.29.0.dev3.dist-info → pyobs_core-2.29.0.dev4.dist-info}/METADATA +1 -1
- {pyobs_core-2.29.0.dev3.dist-info → pyobs_core-2.29.0.dev4.dist-info}/RECORD +6 -6
- {pyobs_core-2.29.0.dev3.dist-info → pyobs_core-2.29.0.dev4.dist-info}/WHEEL +0 -0
- {pyobs_core-2.29.0.dev3.dist-info → pyobs_core-2.29.0.dev4.dist-info}/entry_points.txt +0 -0
- {pyobs_core-2.29.0.dev3.dist-info → pyobs_core-2.29.0.dev4.dist-info}/licenses/LICENSE +0 -0
pyobs/mixins/coolingramp.py
CHANGED
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import logging
|
|
5
|
+
import time
|
|
5
6
|
from typing import Any
|
|
6
7
|
|
|
7
8
|
from pyobs.interfaces import CoolingState
|
|
@@ -19,6 +20,8 @@ _CLOSE_MARGIN_SECONDS = 60.0
|
|
|
19
20
|
_CLOSE_FALLBACK_TIMEOUT = 300.0
|
|
20
21
|
# extra time asked from pyobsd/systemd on top of the warm-up, for the rest of close()
|
|
21
22
|
_STOP_TIMEOUT_EXTRA_SECONDS = 30.0
|
|
23
|
+
# how often the warm-up on close logs its progress, in seconds
|
|
24
|
+
_WARMUP_LOG_INTERVAL = 60.0
|
|
22
25
|
|
|
23
26
|
|
|
24
27
|
class CoolingRampMixin:
|
|
@@ -150,7 +153,7 @@ class CoolingRampMixin:
|
|
|
150
153
|
extend_stop_timeout(timeout + _STOP_TIMEOUT_EXTRA_SECONDS)
|
|
151
154
|
self._cooling_target = (False, None)
|
|
152
155
|
try:
|
|
153
|
-
await asyncio.wait_for(self.
|
|
156
|
+
await asyncio.wait_for(self._cooling_warm_up(timeout), timeout)
|
|
154
157
|
except TimeoutError:
|
|
155
158
|
log.warning(
|
|
156
159
|
"Warm-up on close did not finish within %.0fs (setpoint at %s). "
|
|
@@ -190,11 +193,41 @@ class CoolingRampMixin:
|
|
|
190
193
|
|
|
191
194
|
# ramp -------------------------------------------------------------------------------------------------------
|
|
192
195
|
|
|
193
|
-
async def
|
|
196
|
+
async def _cooling_warm_up(self, timeout: float) -> None:
|
|
197
|
+
"""Runs the warm-up ramp to its end. Logs when it starts, about every _WARMUP_LOG_INTERVAL seconds while it
|
|
198
|
+
runs, and when it is done, so the log shows why the module takes long to stop."""
|
|
199
|
+
start = time.monotonic()
|
|
200
|
+
delay = await self._cooling_tick()
|
|
201
|
+
if self._cooling_target is None:
|
|
202
|
+
return # cooler was off already, or switched off in the first step
|
|
203
|
+
log.info(
|
|
204
|
+
"Warming up from %s towards %.1f °C before closing, may take up to %s.",
|
|
205
|
+
_temperature(self._cooling_commanded),
|
|
206
|
+
self._cooling_ramp.off_temperature,
|
|
207
|
+
_duration(timeout),
|
|
208
|
+
)
|
|
209
|
+
next_log = start + _WARMUP_LOG_INTERVAL
|
|
194
210
|
while self._cooling_target is not None:
|
|
195
|
-
delay = await self._cooling_tick()
|
|
196
211
|
if delay:
|
|
197
212
|
await asyncio.sleep(delay)
|
|
213
|
+
delay = await self._cooling_tick()
|
|
214
|
+
now = time.monotonic()
|
|
215
|
+
if self._cooling_target is not None and now >= next_log:
|
|
216
|
+
await self._cooling_log_warm_up(start + timeout - now)
|
|
217
|
+
next_log = now + _WARMUP_LOG_INTERVAL
|
|
218
|
+
log.info("Warm-up done after %s, cooling is off.", _duration(time.monotonic() - start))
|
|
219
|
+
|
|
220
|
+
async def _cooling_log_warm_up(self, left: float) -> None:
|
|
221
|
+
try:
|
|
222
|
+
sensor = await self._get_sensor_temperature()
|
|
223
|
+
except Exception:
|
|
224
|
+
sensor = None # only for the log, the next tick reports a real problem
|
|
225
|
+
log.info(
|
|
226
|
+
"Warming up: setpoint %s, sensor %s, up to %s left.",
|
|
227
|
+
_temperature(self._cooling_commanded),
|
|
228
|
+
_temperature(sensor),
|
|
229
|
+
_duration(max(0.0, left)),
|
|
230
|
+
)
|
|
198
231
|
|
|
199
232
|
async def _cooling_ramp_loop(self) -> None:
|
|
200
233
|
while True:
|
|
@@ -278,4 +311,12 @@ class CoolingRampMixin:
|
|
|
278
311
|
self._cooling_target = None
|
|
279
312
|
|
|
280
313
|
|
|
314
|
+
def _temperature(value: float | None) -> str:
|
|
315
|
+
return "unknown" if value is None else f"{value:.1f} °C"
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def _duration(seconds: float) -> str:
|
|
319
|
+
return f"{seconds:.0f} s" if seconds < 90 else f"{seconds / 60:.0f} min"
|
|
320
|
+
|
|
321
|
+
|
|
281
322
|
__all__ = ["CoolingRampMixin"]
|
|
@@ -206,7 +206,7 @@ pyobs/interfaces/__init__.py,sha256=b2kRbTTOYy5EaIkpYxTk3xKDP8QK7ZyeDnD8iuUnyXk,
|
|
|
206
206
|
pyobs/interfaces/interface.py,sha256=Qhdar9Dz4_Tb5rsflc07rjOBgp5vqxBzxdCWm--rDCc,3369
|
|
207
207
|
pyobs/mixins/__init__.py,sha256=ub1Enr-jIpL9rplP9G2o-gEwm83QtHb_ATdsqSl9p8I,1041
|
|
208
208
|
pyobs/mixins/camerasettings.py,sha256=r-DeJEdRIMqaa0uL0dUsrMpbHLJQL4WL9n6EkudTgI8,2541
|
|
209
|
-
pyobs/mixins/coolingramp.py,sha256=
|
|
209
|
+
pyobs/mixins/coolingramp.py,sha256=zLrBocczzhCWi6RJXjBUk2QhL13iEr4DtE99mEzNuEU,14464
|
|
210
210
|
pyobs/mixins/datapipeline.py,sha256=oLVe91NozxShdU1zl9zDHfByAFhqhc_kHc84doP8rjo,5196
|
|
211
211
|
pyobs/mixins/datasequence.py,sha256=sEB3i9kInxCdD22tqzP83UWtJMFcx1eOuhbfurNxsjk,5874
|
|
212
212
|
pyobs/mixins/fitsheader.py,sha256=hpSoPcU8omgPgR44INMz1-eqxa3uVNmxC7e21U1cR70,23587
|
|
@@ -479,8 +479,8 @@ pyobs/vfs/vfs.py,sha256=PTZcapn4U3yr2Ksa0xfbP0ssSiJhA6_XzgmNMdNav3U,14077
|
|
|
479
479
|
pyobs/vfs/filelists/__init__.py,sha256=NaTGFjLGh043j_F7kWEx_cXaII7t3CbYguRk2g5hEqw,111
|
|
480
480
|
pyobs/vfs/filelists/filelist.py,sha256=kCco_5G2gLH-nxWik-wcs6lGuc_-3LeeyR9L4_srf30,201
|
|
481
481
|
pyobs/vfs/filelists/testing.py,sha256=M8f2BULdjRCc7JFOKhAH7Kwre_uVQC0xLcv9xGTfNFw,425
|
|
482
|
-
pyobs_core-2.29.0.
|
|
483
|
-
pyobs_core-2.29.0.
|
|
484
|
-
pyobs_core-2.29.0.
|
|
485
|
-
pyobs_core-2.29.0.
|
|
486
|
-
pyobs_core-2.29.0.
|
|
482
|
+
pyobs_core-2.29.0.dev4.dist-info/METADATA,sha256=97x4anZ5Ox4pKH1qlawkWKLbSBWmlSHcau5BUo8t3Cg,3928
|
|
483
|
+
pyobs_core-2.29.0.dev4.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
484
|
+
pyobs_core-2.29.0.dev4.dist-info/entry_points.txt,sha256=0ceIn3dTDwWdGdJ5VdTvYim7vKkdTe6aqqpoaG065UY,109
|
|
485
|
+
pyobs_core-2.29.0.dev4.dist-info/licenses/LICENSE,sha256=Za86Qj8Jl9nLP446ogz9uK_nKoD5qJLcNZj6Qu2UdFQ,1101
|
|
486
|
+
pyobs_core-2.29.0.dev4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|