Skip to content

Commit aab1378

Browse files
author
David Erb
committed
puts back datafaces context
1 parent 17d7466 commit aab1378

File tree

2 files changed

+31
-32
lines changed

2 files changed

+31
-32
lines changed

src/soakdb3_lib/context.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/soakdb3_lib/datafaces/context.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
# Base class for a Thing which has a name and traits.
3+
from dls_utilpack.callsign import callsign
44
from dls_utilpack.thing import Thing
55

66
# Things created in the context.
@@ -20,6 +20,8 @@ class Context(Thing):
2020
On exiting, it commands the server to shut down.
2121
2222
The enter and exit methods are exposed for use during testing.
23+
24+
TODO: Add unit test for soakdb3_lib.datafaces.context.
2325
"""
2426

2527
# ----------------------------------------------------------------------------------------
@@ -70,3 +72,31 @@ async def __aexit__(self, type, value, traceback):
7072
""" """
7173

7274
await self.aexit()
75+
76+
# ----------------------------------------------------------------------------------------
77+
async def is_process_started(self):
78+
""""""
79+
80+
if self.server is None:
81+
raise RuntimeError(f"{callsign(self)} a process has not been defined")
82+
83+
try:
84+
return await self.server.is_process_started()
85+
except Exception:
86+
raise RuntimeError(
87+
f"unable to determing process started for server {callsign(self.server)}"
88+
)
89+
90+
# ----------------------------------------------------------------------------------------
91+
async def is_process_alive(self):
92+
""""""
93+
94+
if self.server is None:
95+
raise RuntimeError(f"{callsign(self)} a process has not been defined")
96+
97+
try:
98+
return await self.server.is_process_alive()
99+
except Exception:
100+
raise RuntimeError(
101+
f"unable to determing dead or alive for server {callsign(self.server)}"
102+
)

0 commit comments

Comments
 (0)