rhino_health.lib.endpoints.code_object.code_object_endpoints#

Module Contents#

Classes#

CodeObjectEndpoints

Endpoints for interacting with CodeObjects

class rhino_health.lib.endpoints.code_object.code_object_endpoints.CodeObjectEndpoints(session)#

Bases: LTSCodeObjectEndpoints

Endpoints for interacting with CodeObjects

run_code_object(code_object: rhino_health.lib.endpoints.code_object.code_object_dataclass.CodeObjectRunInput) rhino_health.lib.endpoints.code_object.code_object_dataclass.CodeObjectRunSyncResponse | rhino_health.lib.endpoints.code_object.code_object_dataclass.CodeObjectRunAsyncResponse#

Returns the result of starting a CodeRun

Warning

This feature is under development and the return response may change

Parameters:
code_object: CodeObjectRunInput

CodeObjectRunInput data class

Returns:
run_response: Union[CodeObjectRunSyncResponse, CodeObjectRunAsyncResponse]

Response dataclass depending on if the request was run synchronously

Examples

>>> run_response = session.code_object.code_object(run_code_object_input)
CodeObjectRunSyncResponse()
>>> run_response.code_run
CodeRun()
train_model(model: rhino_health.lib.endpoints.code_object.code_object_dataclass.ModelTrainInput)#

Starts training a NVFlare Model

Warning

This feature is under development and the return response may change

Parameters:
model: ModelTrainInput

ModelTrainInput data class

Returns:
run_response: ModelTrainAsyncResponse

Response dataclass

Examples

>>> session.code_object.train_model(model_train_input)
ModelTrainAsyncResponse()
create_code_object(code_object: rhino_health.lib.endpoints.code_object.code_object_dataclass.CodeObjectCreateInput, return_existing=True, add_version_if_exists=False)#

Starts the creation of a new CodeObject on the platform.

Warning

This feature is under development and the interface may change

Parameters:
code_object: CodeObjectCreateInput

CodeObjectCreateInput data class

return_existing: bool

If a CodeObject with the name already exists, return it instead of creating one. Takes precedence over add_version_if_exists

add_version_if_exists

If a CodeObject with the name already exists, create a new version.

Returns:
code_object: CodeObject

CodeObject dataclass

Examples

>>> session.code_object.create_code_object(create_code_object_input)
CodeObject()
get_code_object(code_object_uid: str)#

Returns a CodeObject dataclass

Parameters:
code_object_uid: str

UID for the CodeObject

Returns:
code_object: CodeObject

CodeObject dataclass

Examples

>>> session.code_object.get_code_object(my_code_object_uid)
CodeObject()
get_code_object_by_name(name, version=VersionMode.LATEST, project_uid=None) rhino_health.lib.endpoints.code_object.code_object_dataclass.CodeObject | None#

Returns the latest or a specific CodeObject dataclass

Warning

VersionMode.ALL will return the same as VersionMode.LATEST

Parameters:
name: str

Full name for the CodeObject

version: Optional[Union[int, VersionMode]]

Version of the CodeObject, latest by default, for an earlier version pass in an integer

project_uid: Optional[str]

Project UID to search under

Returns:
code_object: Optional[CodeObject]

CodeObject with the name or None if not found

Examples

>>> session.code_object.get_code_object_by_name("My CodeObject")
CodeObject(name="My CodeObject")
search_for_code_objects_by_name(name, version: int | rhino_health.lib.endpoints.endpoint.VersionMode | None = VersionMode.LATEST, project_uid: str | None = None, name_filter_mode: rhino_health.lib.endpoints.endpoint.NameFilterMode | None = NameFilterMode.CONTAINS)#

Returns CodeObject dataclasses

Parameters:
name: str

Full or partial name for the CodeObject

version: Optional[Union[int, VersionMode]]

Version of the CodeObject, latest by default

project_uid: Optional[str]

Project UID to search under

name_filter_mode: Optional[NameFilterMode]

Only return results with the specified filter mode. By default uses CONTAINS

Returns:
code_objects: List[CodeObject]

CodeObject dataclasses that match the name

See also

rhino_health.lib.endpoints.endpoint.FilterMode

Different modes to filter by

rhino_health.lib.endpoints.endpoint.VersionMode

Which version to return

Examples

>>> session.code_object.search_for_code_objects_by_name("My CodeObject")
[CodeObject(name="My CodeObject)]
get_build_logs(code_object_uid: str)#

Returns logs for building the CodeObject

Parameters:
code_object_uid: str

UID for the CodeObject

Returns:
build_logs: str

Examples

>>> session.code_object.get_build_logs(my_code_object_uid)
"Starting to build..."