File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
_tree_objects/_grpc_helpers Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 2222
2323import dataclasses
2424import os
25+ import pathlib
2526import subprocess
2627from typing import TextIO
2728
@@ -103,6 +104,10 @@ def start(self) -> None:
103104 stdout_file = self ._config .stdout_file
104105 stderr_file = self ._config .stderr_file
105106
107+ binary = pathlib .Path (self ._config .binary_path )
108+ if not binary .exists ():
109+ raise FileNotFoundError (f"Binary not found: '{ binary } '" )
110+
106111 port = find_free_ports ()[0 ]
107112 self ._url = f"localhost:{ port } "
108113 self ._stdout = open (stdout_file , mode = "w" , encoding = "utf-8" )
Original file line number Diff line number Diff line change 2626from typing import Any , Concatenate , Generic , TypeVar
2727
2828from grpc import Channel
29+ from packaging .version import parse as parse_version
2930from typing_extensions import ParamSpec , Self
3031
3132from ansys .api .acp .v0 .base_pb2 import CollectionPath , DeleteRequest , ListRequest
@@ -302,6 +303,14 @@ def define_mutable_mapping(
302303 """Define a mutable mapping of child tree objects."""
303304
304305 def collection_property (self : ParentT ) -> MutableMapping [CreatableValueT ]:
306+ if object_class ._SUPPORTED_SINCE is not None and self ._server_version is not None :
307+ if self ._server_version < parse_version (object_class ._SUPPORTED_SINCE ):
308+ raise RuntimeError (
309+ f"The '{ object_class .__name__ } ' object is only supported since version "
310+ f"{ object_class ._SUPPORTED_SINCE } of the ACP gRPC server. The current server version is "
311+ f"{ self ._server_version } ."
312+ )
313+
305314 return MutableMapping ._initialize_with_cache (
306315 server_wrapper = self ._server_wrapper ,
307316 collection_path = CollectionPath (
You can’t perform that action at this time.
0 commit comments