From 52a74912fe5977533bed44866e68f1786fbec4b2 Mon Sep 17 00:00:00 2001 From: "marius.baseten" Date: Mon, 16 Dec 2024 08:42:09 -0800 Subject: [PATCH] Fixes --- docs/chains/doc_gen/API-reference.mdx | 4 ++-- docs/chains/doc_gen/generated-reference.mdx | 4 ++-- truss-chains/truss_chains/definitions.py | 1 + truss-chains/truss_chains/deployment/code_gen.py | 2 +- truss-chains/truss_chains/framework.py | 4 +++- truss-chains/truss_chains/public_api.py | 2 +- truss/templates/server/model_wrapper.py | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/chains/doc_gen/API-reference.mdx b/docs/chains/doc_gen/API-reference.mdx index bf2ac0f8d..fb24e0534 100644 --- a/docs/chains/doc_gen/API-reference.mdx +++ b/docs/chains/doc_gen/API-reference.mdx @@ -152,10 +152,10 @@ Options to customize RPCs to dependency chainlets. Decorator to mark a chainlet as the entrypoint of a chain. This decorator can be applied to *one* chainlet in a source file and then the -CLI push command simplifies: only the file, not the class within must be specified. +CLI push command simplifies: only the file, not the class within, must be specified. Optionally a display name for the Chain (not the Chainlet) can be set (effectively -giving a custom default value for the –name arg of the CLI push command). +giving a custom default value for the `name` arg of the CLI push command). Example usage: diff --git a/docs/chains/doc_gen/generated-reference.mdx b/docs/chains/doc_gen/generated-reference.mdx index 2a6933f9b..786c3f995 100644 --- a/docs/chains/doc_gen/generated-reference.mdx +++ b/docs/chains/doc_gen/generated-reference.mdx @@ -169,10 +169,10 @@ Options to customize RPCs to dependency chainlets. Decorator to mark a chainlet as the entrypoint of a chain. This decorator can be applied to *one* chainlet in a source file and then the -CLI push command simplifies: only the file, not the class within must be specified. +CLI push command simplifies: only the file, not the class within, must be specified. Optionally a display name for the Chain (not the Chainlet) can be set (effectively -giving a custom default value for the –name arg of the CLI push command). +giving a custom default value for the `name` arg of the CLI push command). Example usage: diff --git a/truss-chains/truss_chains/definitions.py b/truss-chains/truss_chains/definitions.py index fa53e9345..63933cbd7 100644 --- a/truss-chains/truss_chains/definitions.py +++ b/truss-chains/truss_chains/definitions.py @@ -508,6 +508,7 @@ class TrussMetadata(SafeModel): class ABCChainlet(abc.ABC): remote_config: ClassVar[RemoteConfig] = RemoteConfig() + # `meta_data` is not shared between subclasses, each has an isolated copy. meta_data: ClassVar[ChainletMetadata] = ChainletMetadata() @classmethod diff --git a/truss-chains/truss_chains/deployment/code_gen.py b/truss-chains/truss_chains/deployment/code_gen.py index 72c17bd6c..eb6572128 100644 --- a/truss-chains/truss_chains/deployment/code_gen.py +++ b/truss-chains/truss_chains/deployment/code_gen.py @@ -126,7 +126,7 @@ def _gen_pydantic_import_and_ref(raw_type: Any) -> _Source: def _gen_nested_pydantic(raw_type: Any) -> _Source: - """Handles `list[str, PydanticModel]` and similar, correctly resolving imports + """Handles `list[PydanticModel]` and similar, correctly resolving imports of model args that might be defined in other files.""" origin = get_origin(raw_type) assert origin in framework._SIMPLE_CONTAINERS diff --git a/truss-chains/truss_chains/framework.py b/truss-chains/truss_chains/framework.py index 5e1cece9f..f269f0128 100644 --- a/truss-chains/truss_chains/framework.py +++ b/truss-chains/truss_chains/framework.py @@ -1130,7 +1130,9 @@ def run_local( def entrypoint( cls_or_chain_name: Optional[Union[Type[ChainletT], str]] = None, ) -> Union[Callable[[Type[ChainletT]], Type[ChainletT]], Type[ChainletT]]: - """Decorator to tag a Chainlet as an entrypoint.""" + """Decorator to tag a Chainlet as an entrypoint. + Can be used with or without chain name argument. + """ def decorator(cls: Type[ChainletT]) -> Type[ChainletT]: if not (utils.issubclass_safe(cls, definitions.ABCChainlet)): diff --git a/truss-chains/truss_chains/public_api.py b/truss-chains/truss_chains/public_api.py index d40aa2446..90e27f58e 100644 --- a/truss-chains/truss_chains/public_api.py +++ b/truss-chains/truss_chains/public_api.py @@ -143,7 +143,7 @@ def mark_entrypoint( """Decorator to mark a chainlet as the entrypoint of a chain. This decorator can be applied to *one* chainlet in a source file and then the - CLI push command simplifies: only the file, not the class within must be specified. + CLI push command simplifies: only the file, not the class within, must be specified. Optionally a display name for the Chain (not the Chainlet) can be set (effectively giving a custom default value for the `--name` arg of the CLI push command). diff --git a/truss/templates/server/model_wrapper.py b/truss/templates/server/model_wrapper.py index 978b217e3..cff58f2ca 100644 --- a/truss/templates/server/model_wrapper.py +++ b/truss/templates/server/model_wrapper.py @@ -47,7 +47,7 @@ MODEL_BASENAME = "model" -NUM_LOAD_RETRIES = int(os.environ.get("NUM_LOAD_RETRIES", "1")) +NUM_LOAD_RETRIES = int(os.environ.get("NUM_LOAD_RETRIES_TRUSS", "1")) STREAMING_RESPONSE_QUEUE_READ_TIMEOUT_SECS = 60 DEFAULT_PREDICT_CONCURRENCY = 1 EXTENSIONS_DIR_NAME = "extensions"