|
24 | 24 | # Number of threads to serve caputs |
25 | 25 | NUMBER_OF_CAPUT_THREADS = 20 |
26 | 26 |
|
27 | | -try: |
28 | | - from genie_python.channel_access_exceptions import ( |
29 | | - ReadAccessException, |
30 | | - UnableToConnectToPVException, |
31 | | - ) # noqa: F401 |
32 | | -except ImportError: |
33 | | - |
34 | | - class UnableToConnectToPVException(IOError): # noqa: N818 |
35 | | - """ |
36 | | - The system is unable to connect to a PV for some reason. |
37 | | - """ |
38 | | - |
39 | | - def __init__(self, pv_name: str, err: Exception) -> None: |
40 | | - super(UnableToConnectToPVException, self).__init__( |
41 | | - "Unable to connect to PV {0}: {1}".format(pv_name, err) |
42 | | - ) |
43 | | - |
44 | | - class ReadAccessException(IOError): # noqa: N818 |
45 | | - """ |
46 | | - PV exists but its value is unavailable to read. |
47 | | - """ |
48 | | - |
49 | | - def __init__(self, pv_name: str) -> None: |
50 | | - super(ReadAccessException, self).__init__( |
51 | | - "Read access denied for PV {}".format(pv_name) |
52 | | - ) |
53 | | - |
54 | | - |
55 | | -try: |
56 | | - # noinspection PyUnresolvedReferences |
57 | | - from genie_python.genie_cachannel_wrapper import EXIST_TIMEOUT, CaChannelWrapper |
58 | | -except ImportError: |
59 | | - print("ERROR: No genie_python on the system can not import CaChannelWrapper!") |
60 | | - |
61 | | -try: |
62 | | - from genie_python.genie_cachannel_wrapper import AlarmCondition as AlarmStatus |
63 | | - from genie_python.genie_cachannel_wrapper import AlarmSeverity |
64 | | -except ImportError: |
65 | | - from enum import IntEnum |
66 | | - |
67 | | - class AlarmSeverity(IntEnum): |
68 | | - """ |
69 | | - Enum for severity of alarm |
70 | | - """ |
71 | | - |
72 | | - No = 0 |
73 | | - Minor = 1 |
74 | | - Major = 2 |
75 | | - Invalid = 3 |
76 | | - |
77 | | - class AlarmStatus(IntEnum): |
78 | | - """ |
79 | | - Enum for status of alarm |
80 | | - """ |
81 | | - |
82 | | - BadSub = 16 |
83 | | - Calc = 12 |
84 | | - Comm = 9 |
85 | | - Cos = 8 |
86 | | - Disable = 18 |
87 | | - High = 4 |
88 | | - HiHi = 3 |
89 | | - HwLimit = 11 |
90 | | - Link = 14 |
91 | | - Lolo = 5 |
92 | | - Low = 6 |
93 | | - No = 0 |
94 | | - Read = 1 |
95 | | - ReadAccess = 20 |
96 | | - Scam = 13 |
97 | | - Simm = 19 |
98 | | - Soft = 15 |
99 | | - State = 7 |
100 | | - Timeout = 10 |
101 | | - UDF = 17 |
102 | | - Write = 2 |
103 | | - WriteAccess = 21 |
| 27 | +from genie_python.channel_access_exceptions import ( |
| 28 | + ReadAccessException, |
| 29 | + UnableToConnectToPVException, |
| 30 | +) |
| 31 | +from genie_python.genie_cachannel_wrapper import EXIST_TIMEOUT, CaChannelWrapper |
| 32 | +from genie_python.genie_cachannel_wrapper import AlarmCondition as AlarmStatus |
| 33 | +from genie_python.genie_cachannel_wrapper import AlarmSeverity |
104 | 34 |
|
105 | 35 |
|
106 | 36 | def _create_caput_pool() -> ThreadPoolExecutor: |
|
0 commit comments