pyobs-core 2.0.0.dev13__py3-none-any.whl → 2.0.0.dev14__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.
@@ -5,7 +5,8 @@ from typing import Any
5
5
  import astropy.units as u
6
6
 
7
7
  from pyobs.events import TaskFailedEvent, TaskFinishedEvent, TaskStartedEvent
8
- from pyobs.interfaces import FitsHeaderEntry, IAutonomous, IFitsHeaderBefore
8
+ from pyobs.interfaces import FitsHeaderEntry, IAutonomous, IFitsHeaderBefore, IRunning
9
+ from pyobs.interfaces.IRunning import RunningState
9
10
  from pyobs.modules import Module
10
11
  from pyobs.robotic import (
11
12
  Observation,
@@ -73,16 +74,19 @@ class Mastermind(Module, IAutonomous, IFitsHeaderBefore):
73
74
 
74
75
  # start
75
76
  self._running = True
77
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
76
78
 
77
79
  async def start(self, **kwargs: Any) -> None:
78
80
  """Starts a service."""
79
81
  log.info("Starting robotic system...")
80
82
  self._running = True
83
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
81
84
 
82
85
  async def stop(self, **kwargs: Any) -> None:
83
86
  """Stops a service."""
84
87
  log.info("Stopping robotic system...")
85
88
  self._running = False
89
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
86
90
 
87
91
  async def is_running(self, **kwargs: Any) -> bool:
88
92
  """Whether a service is running."""
@@ -3,7 +3,8 @@ from typing import Any
3
3
 
4
4
  from astropy.coordinates import SkyCoord
5
5
 
6
- from pyobs.interfaces import AcquisitionResult, IAcquisition, IAutonomous, IPointingRaDec, IPointingSeries
6
+ from pyobs.interfaces import AcquisitionResult, IAcquisition, IAutonomous, IPointingRaDec, IPointingSeries, IRunning
7
+ from pyobs.interfaces.IRunning import RunningState
7
8
  from pyobs.modules import Module
8
9
  from pyobs.utils import exceptions as exc
9
10
  from pyobs.utils.grids.filters import GridFilter
@@ -46,6 +47,11 @@ class PointingSeries(Module, IAutonomous):
46
47
  # add thread func
47
48
  self.add_background_task(self._run_thread, False)
48
49
 
50
+ async def open(self) -> None:
51
+ """Open module."""
52
+ await Module.open(self)
53
+ await self.comm.set_state(IRunning, RunningState(running=await self.is_running()))
54
+
49
55
  async def start(self, **kwargs: Any) -> None:
50
56
  """Starts a service."""
51
57
  pass
@@ -16,7 +16,8 @@ from pyobs.events import (
16
16
  TaskFinishedEvent,
17
17
  TaskStartedEvent,
18
18
  )
19
- from pyobs.interfaces import IRunnable, IStartStop
19
+ from pyobs.interfaces import IRunnable, IRunning, IStartStop
20
+ from pyobs.interfaces.IRunning import RunningState
20
21
  from pyobs.modules import Module
21
22
  from pyobs.robotic import (
22
23
  ObservationArchive,
@@ -106,13 +107,17 @@ class Scheduler(Module, IStartStop, IRunnable):
106
107
  await self.comm.register_event(TaskFailedEvent, self._on_task_finished)
107
108
  await self.comm.register_event(GoodWeatherEvent, self._on_good_weather)
108
109
 
110
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
111
+
109
112
  async def start(self, **kwargs: Any) -> None:
110
113
  """Start scheduler."""
111
114
  self._running = True
115
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
112
116
 
113
117
  async def stop(self, **kwargs: Any) -> None:
114
118
  """Stop scheduler."""
115
119
  self._running = False
120
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
116
121
 
117
122
  async def is_running(self, **kwargs: Any) -> bool:
118
123
  """Whether scheduler is running."""
@@ -8,7 +8,8 @@ from typing import Any
8
8
  import numpy as np
9
9
  from aiohttp import web
10
10
 
11
- from pyobs.interfaces import ICamera, IData, IExposureTime, IStartStop, IWindow
11
+ from pyobs.interfaces import ICamera, IData, IExposureTime, IRunning, IStartStop, IWindow
12
+ from pyobs.interfaces.IRunning import RunningState
12
13
  from pyobs.modules import Module
13
14
 
14
15
  log = logging.getLogger(__name__)
@@ -68,6 +69,8 @@ class Kiosk(Module, IStartStop):
68
69
  await self._site.start()
69
70
  self._is_listening = True
70
71
 
72
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
73
+
71
74
  async def close(self) -> None:
72
75
  """Close server"""
73
76
  await Module.close(self)
@@ -99,10 +102,12 @@ class Kiosk(Module, IStartStop):
99
102
  async def start(self, **kwargs: Any) -> None:
100
103
  """Start kiosk mode."""
101
104
  self._running = True
105
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
102
106
 
103
107
  async def stop(self, **kwargs: Any) -> None:
104
108
  """Stop kiosk mode."""
105
109
  self._running = False
110
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
106
111
 
107
112
  async def is_running(self, **kwargs: Any) -> bool:
108
113
  """Whether kiosk mode is running."""
@@ -4,7 +4,8 @@ import logging
4
4
  from typing import Any
5
5
 
6
6
  from pyobs.events import Event
7
- from pyobs.interfaces import IAutonomous
7
+ from pyobs.interfaces import IAutonomous, IRunning
8
+ from pyobs.interfaces.IRunning import RunningState
8
9
  from pyobs.modules import Module
9
10
  from pyobs.object import get_class_from_string
10
11
 
@@ -50,13 +51,17 @@ class Trigger(Module, IAutonomous):
50
51
  for event in events:
51
52
  await self.comm.register_event(event, self._handle_event)
52
53
 
54
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
55
+
53
56
  async def start(self, **kwargs: Any) -> None:
54
57
  """Starts a service."""
55
58
  self._running = True
59
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
56
60
 
57
61
  async def stop(self, **kwargs: Any) -> None:
58
62
  """Stops a service."""
59
63
  self._running = False
64
+ await self.comm.set_state(IRunning, RunningState(running=self._running))
60
65
 
61
66
  async def is_running(self, **kwargs: Any) -> bool:
62
67
  """Whether a service is running."""
@@ -3,7 +3,8 @@ from __future__ import annotations
3
3
  from typing import Any
4
4
 
5
5
  from pyobs.events import BadWeatherEvent, GoodWeatherEvent
6
- from pyobs.interfaces import FitsHeaderEntry, IFitsHeaderBefore, IWeather, WeatherSensorReading, WeatherState
6
+ from pyobs.interfaces import FitsHeaderEntry, IFitsHeaderBefore, IRunning, IWeather, WeatherSensorReading, WeatherState
7
+ from pyobs.interfaces.IRunning import RunningState
7
8
  from pyobs.modules import Module
8
9
  from pyobs.modules.weather.weather import FITS_HEADERS, SENSOR_UNITS
9
10
  from pyobs.utils.enums import WeatherSensors
@@ -101,6 +102,7 @@ class MockWeather(Module, IWeather, IFitsHeaderBefore):
101
102
  async def _publish_state(self) -> None:
102
103
  is_good = True if not self._active else self._good
103
104
  await self.comm.set_state(IWeather, WeatherState(good=is_good, readings=self._get_readings()))
105
+ await self.comm.set_state(IRunning, RunningState(running=self._active))
104
106
 
105
107
  def _get_readings(self) -> list[WeatherSensorReading]:
106
108
  return [
@@ -7,7 +7,8 @@ from typing import Any
7
7
  import astropy.units as u
8
8
 
9
9
  from pyobs.events import BadWeatherEvent, GoodWeatherEvent
10
- from pyobs.interfaces import FitsHeaderEntry, IFitsHeaderBefore, IWeather, WeatherSensorReading, WeatherState
10
+ from pyobs.interfaces import FitsHeaderEntry, IFitsHeaderBefore, IRunning, IWeather, WeatherSensorReading, WeatherState
11
+ from pyobs.interfaces.IRunning import RunningState
11
12
  from pyobs.modules import Module
12
13
  from pyobs.modules.weather.weather_api import WeatherApi
13
14
  from pyobs.modules.weather.weather_state import WeatherStatus
@@ -82,6 +83,8 @@ class Weather(Module, IWeather, IFitsHeaderBefore):
82
83
  await self.comm.register_event(BadWeatherEvent)
83
84
  await self.comm.register_event(GoodWeatherEvent)
84
85
 
86
+ await self.comm.set_state(IRunning, RunningState(running=self._active))
87
+
85
88
  async def start(self, **kwargs: Any) -> None:
86
89
  """Starts a service."""
87
90
 
@@ -92,10 +95,12 @@ class Weather(Module, IWeather, IFitsHeaderBefore):
92
95
 
93
96
  # activate
94
97
  self._active = True
98
+ await self.comm.set_state(IRunning, RunningState(running=self._active))
95
99
 
96
100
  async def stop(self, **kwargs: Any) -> None:
97
101
  """Stops a service."""
98
102
  self._active = False
103
+ await self.comm.set_state(IRunning, RunningState(running=self._active))
99
104
 
100
105
  async def is_running(self, **kwargs: Any) -> bool:
101
106
  """Whether a service is running."""
@@ -132,7 +132,8 @@ class LcoScheduleReader(Object):
132
132
  # any changes?
133
133
  if sorted(scheduled_tasks) != sorted(self._scheduled_tasks):
134
134
  log.info("Task list changed, found %d task(s) to run.", len(scheduled_tasks))
135
- for scheduled_task in sorted(scheduled_tasks, key=lambda x: x.start):
135
+ sorted_tasks = sorted(scheduled_tasks, key=lambda x: x.start)
136
+ for scheduled_task in sorted_tasks:
136
137
  log.info(
137
138
  " - %s to %s: %s (#%s)",
138
139
  scheduled_task.start,
@@ -140,6 +141,11 @@ class LcoScheduleReader(Object):
140
141
  scheduled_task.task.name,
141
142
  scheduled_task.task.id,
142
143
  )
144
+ if sorted_tasks:
145
+ obs = sorted_tasks[0]
146
+ log.info("Downloaded new schedule. Next observation is task %s at %s.", obs.task, obs.start)
147
+ else:
148
+ log.info("Downloaded new schedule.")
143
149
 
144
150
  # update
145
151
  self._scheduled_tasks = scheduled_tasks
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyobs-core
3
- Version: 2.0.0.dev13
3
+ Version: 2.0.0.dev14
4
4
  Summary: robotic telescope software
5
5
  Author-email: Tim-Oliver Husser <thusser@uni-goettingen.de>
6
6
  License-Expression: MIT
@@ -229,9 +229,9 @@ pyobs/modules/pointing/guidingstatistics/pixeloffset.py,sha256=wG7wN_1JxzGg46sGW
229
229
  pyobs/modules/pointing/guidingstatistics/skyoffsets.py,sha256=Rp9OFA969rZnRVbIHm1rasmPWI1SBtQ3nP6DzNg3Epk,1289
230
230
  pyobs/modules/pointing/guidingstatistics/uptime.py,sha256=JA5DsXbdAJYK0NRvFUeUd120BN_1FQqSBqVM39E05AM,2025
231
231
  pyobs/modules/robotic/__init__.py,sha256=awLUDoOQpmANpI_0Gnvgb-2w3L2yLIMSpCnUXkPvza0,296
232
- pyobs/modules/robotic/mastermind.py,sha256=5FJ8pM5DZiTyqd5Wt5m-3E_YHOglPaeeNLxt6Mex6Go,7438
233
- pyobs/modules/robotic/pointing.py,sha256=67QqvHs5CTTxsc0qyAwPEfcO4Jw9I_maVsXVFrupTA4,4132
234
- pyobs/modules/robotic/scheduler.py,sha256=o9CxKQom3BOd6J--yrmpjRAcuvs9hwtR4jh1fWwpzx0,13494
232
+ pyobs/modules/robotic/mastermind.py,sha256=7gq4I60fjkuo5wJjCZ49Bs3BGqNNvLNDzwENOqTOxmY,7742
233
+ pyobs/modules/robotic/pointing.py,sha256=d5MzGGaMtvnHDWeLIzknst9Wa-Y5D4n5anwj8DgpM4U,4378
234
+ pyobs/modules/robotic/scheduler.py,sha256=4L3UdIod33elkPnIA2BmkQoPJAN34pJeuYeszwiK14Q,13799
235
235
  pyobs/modules/robotic/scriptrunner.py,sha256=8vwu8xS8oqQfWGhsog_nr2Vo0DEs-87QaL7JnFfkeJI,1565
236
236
  pyobs/modules/roof/__init__.py,sha256=lARN3N3iqY_nb41Jaq6lE3UKhXuUvAnFeUqSq5HMQX4,209
237
237
  pyobs/modules/roof/basedome.py,sha256=Ew3M6ZREsTl_KflukZFFwdN6DqvkRICCIEjkSOGUNkI,1372
@@ -247,14 +247,14 @@ pyobs/modules/utils/autonomouswarning.py,sha256=tUtWAkODcZXSnNwWmSvbYkRafBIMQQBY
247
247
  pyobs/modules/utils/dummymode.py,sha256=IUfTRHHp02HOltqFRmvWkpoOZlHgXoAqkXC15pLIsJM,2998
248
248
  pyobs/modules/utils/fluentlogger.py,sha256=pS1Ej3NRMZQi7698zYkS0PN6s0k--b-10g_wyPdtRGQ,1686
249
249
  pyobs/modules/utils/httpfilecache.py,sha256=KHeMBjF204dv_0YFOfpRRhdOYbWMzE1Iw87chdHpUgA,3385
250
- pyobs/modules/utils/kiosk.py,sha256=bHaW0O_ppG0pXxD3iAcXVUvtaCvCReFXLOoKXXI30hA,5049
250
+ pyobs/modules/utils/kiosk.py,sha256=Wi0GLTcB-Bwj5dDPu6fOhMP-tdCgMmNHqyGra7XNxTI,5354
251
251
  pyobs/modules/utils/matrix.py,sha256=Byaz1FlcXFkgkshNGvite0PulLQGwRkHN0-WbnNh6fs,6079
252
252
  pyobs/modules/utils/stellarium.py,sha256=F3BVkslP9NpmFy0v3VsZo9wiGMTJtLWkpoO-OXAsdQw,4042
253
253
  pyobs/modules/utils/telegram.py,sha256=eAB2FUWq4GeyH6yPdgZrDQIb5CSkkxCzs-46dbwJPAc,23371
254
- pyobs/modules/utils/trigger.py,sha256=EZ30d4CnEuRLQRCmPlJnTyrv3mm_4q5k752ceFaSqbM,2984
254
+ pyobs/modules/utils/trigger.py,sha256=hk3z7PSgeaZsLiqxA7rIYz7URF5to8OUFo0n83JCzl8,3289
255
255
  pyobs/modules/weather/__init__.py,sha256=itI0SMrt2jQiK7uw5ZxoQ1UX5SOi-gVcPzGmMFHSku0,169
256
- pyobs/modules/weather/mockweather.py,sha256=EzyM_zNAoLmfCwG2TgRVPoCbAyCeLyxesuID0KdnlsE,4941
257
- pyobs/modules/weather/weather.py,sha256=QmIMOKLmuCaWQtbLqsgrDhNpIaEuR2vm6MsgnSqUGJU,7794
256
+ pyobs/modules/weather/mockweather.py,sha256=VDwIm4RlgOcl5Hby6uRuv0EL9RB22b3cm1jTqmBqxJI,5082
257
+ pyobs/modules/weather/weather.py,sha256=2a2i928yzZeCyLnNryZPaTqjfEO8a4WrbCV--aV1_TY,8096
258
258
  pyobs/modules/weather/weather_api.py,sha256=OfvboDXajCMydTLFz3_s4Sl7CNBWe3IluebWh_ARMXU,1217
259
259
  pyobs/modules/weather/weather_state.py,sha256=XzZiN-aM4yg-HEVeM3XmQXUshlG97Wr0Ka1vmL31vPw,736
260
260
  pyobs/robotic/__init__.py,sha256=A0jlO6KelDFObBo74_qM9lXX952kYeoj-Z47D0XiIOQ,441
@@ -325,7 +325,7 @@ pyobs/robotic/storage/filesystem/observationarchive.py,sha256=woy6n9ih4gI9Aw2zEx
325
325
  pyobs/robotic/storage/filesystem/taskarchive.py,sha256=vxhUJcbxKyaIj7G3XNCYwuTcrNJj0va8x0y7_WsyHIY,2214
326
326
  pyobs/robotic/storage/lco/__init__.py,sha256=VuniJ4vxDUFCWQrrGMDnnzNZlGbGYc6NPfMRQqkp2eA,241
327
327
  pyobs/robotic/storage/lco/_portal.py,sha256=9gV1WTMpadsi0crNa6kp1JpLZG6Dlv-hWrmRTUcKMu4,11300
328
- pyobs/robotic/storage/lco/_schedulereader.py,sha256=JxB5o8vGYRdRRpQR8_wGbaIfLgIuQ-Tw22Y7VXCq5ro,6797
328
+ pyobs/robotic/storage/lco/_schedulereader.py,sha256=GXVBkCBiTQvJDAv4IxTZAk1z4tWPd3p0nlllDASRIF0,7108
329
329
  pyobs/robotic/storage/lco/_schedulewriter.py,sha256=54ZX07uiXu03ous0VNV7IakVQKC4CbgVzXFryabeYeo,3928
330
330
  pyobs/robotic/storage/lco/configdb.py,sha256=uwdMR27IelX7TcTUhALDQoB4bMYiLrfrkB348ztr7ys,4098
331
331
  pyobs/robotic/storage/lco/mockobservationarchive.py,sha256=F6zxpcUJWEBOAR_OY2LvzZQv3QTS8CFn86QElPYZGg0,5249
@@ -428,8 +428,8 @@ pyobs/vfs/vfs.py,sha256=buHTmO6VUjSypkEMVxY8rDKrpMz65AY2OE2hGEsQsLI,10780
428
428
  pyobs/vfs/filelists/__init__.py,sha256=NaTGFjLGh043j_F7kWEx_cXaII7t3CbYguRk2g5hEqw,111
429
429
  pyobs/vfs/filelists/filelist.py,sha256=kCco_5G2gLH-nxWik-wcs6lGuc_-3LeeyR9L4_srf30,201
430
430
  pyobs/vfs/filelists/testing.py,sha256=M8f2BULdjRCc7JFOKhAH7Kwre_uVQC0xLcv9xGTfNFw,425
431
- pyobs_core-2.0.0.dev13.dist-info/METADATA,sha256=9g0HqWa2Dn5sXBkXKm5dMoyx0vQZAdHCWwAaH-0UrCA,1990
432
- pyobs_core-2.0.0.dev13.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
433
- pyobs_core-2.0.0.dev13.dist-info/entry_points.txt,sha256=0ceIn3dTDwWdGdJ5VdTvYim7vKkdTe6aqqpoaG065UY,109
434
- pyobs_core-2.0.0.dev13.dist-info/licenses/LICENSE,sha256=gC8djBliCENDmuRvzCoejpWbsn8eqKx61Hc8bmDZ2LI,1099
435
- pyobs_core-2.0.0.dev13.dist-info/RECORD,,
431
+ pyobs_core-2.0.0.dev14.dist-info/METADATA,sha256=I17f95bcD9MmNEea_FjdmNHerUEORK4I8cnjGQMbUnc,1990
432
+ pyobs_core-2.0.0.dev14.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
433
+ pyobs_core-2.0.0.dev14.dist-info/entry_points.txt,sha256=0ceIn3dTDwWdGdJ5VdTvYim7vKkdTe6aqqpoaG065UY,109
434
+ pyobs_core-2.0.0.dev14.dist-info/licenses/LICENSE,sha256=gC8djBliCENDmuRvzCoejpWbsn8eqKx61Hc8bmDZ2LI,1099
435
+ pyobs_core-2.0.0.dev14.dist-info/RECORD,,