Skip to content

Commit 2f26a91

Browse files
[pycue] Make monitoring imports unconditional
Remove conditional try/except around monitoring proto imports and MONITORING_AVAILABLE flag. Monitoring functions should always be available in pycue - if monitoring is disabled at cuebot level, it will return grpc.Status=UNIMPLEMENTED rather than failing at import. This allows toggling monitoring at the Cuebot end without requiring a new version of pycue.
1 parent b8792e1 commit 2f26a91

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

pycue/opencue/cuebot.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,8 @@
5858
from opencue_proto import subscription_pb2_grpc
5959
from opencue_proto import task_pb2
6060
from opencue_proto import task_pb2_grpc
61-
# Optional monitoring proto - may not be available in all deployments
62-
# pylint: disable=ungrouped-imports
63-
try:
64-
from opencue_proto import monitoring_pb2
65-
from opencue_proto import monitoring_pb2_grpc
66-
MONITORING_AVAILABLE = True
67-
except ImportError:
68-
MONITORING_AVAILABLE = False
69-
# pylint: enable=ungrouped-imports
61+
from opencue_proto import monitoring_pb2
62+
from opencue_proto import monitoring_pb2_grpc
7063
from opencue.exception import ConnectionException
7164
from opencue.exception import CueException
7265
import opencue.config
@@ -116,7 +109,7 @@ class Cuebot(object):
116109
'layer': job_pb2,
117110
'limit': limit_pb2,
118111
'matcher': filter_pb2,
119-
'monitoring': monitoring_pb2 if MONITORING_AVAILABLE else None,
112+
'monitoring': monitoring_pb2,
120113
'owner': host_pb2,
121114
'proc': host_pb2,
122115
'renderPartition': renderPartition_pb2,
@@ -142,7 +135,7 @@ class Cuebot(object):
142135
'layer': job_pb2_grpc.LayerInterfaceStub,
143136
'limit': limit_pb2_grpc.LimitInterfaceStub,
144137
'matcher': filter_pb2_grpc.MatcherInterfaceStub,
145-
'monitoring': monitoring_pb2_grpc.MonitoringInterfaceStub if MONITORING_AVAILABLE else None,
138+
'monitoring': monitoring_pb2_grpc.MonitoringInterfaceStub,
146139
'owner': host_pb2_grpc.OwnerInterfaceStub,
147140
'proc': host_pb2_grpc.ProcInterfaceStub,
148141
'renderPartition': renderPartition_pb2_grpc.RenderPartitionInterfaceStub,

0 commit comments

Comments
 (0)