wallaroo.object


class DehydratedValue:

Represents a not-set sentinel value.

Attributes that are null in the database will be returned as None in Python, and we want them to be set as such, so None cannot be used as a sentinel value signaling that an optional attribute is not yet set. Objects of this class fill that role instead.

DehydratedValue()
def rehydrate(attr):

Decorator that rehydrates the named attribute if needed.

This should decorate getter calls for an attribute:

@rehydrate(_foo_attr)
def foo_attr(self):
    return self._foo_attr

This will cause the API object to "rehydrate" (perform a query to fetch and fill in all attributes from the database) if the named attribute is not set.

def value_if_present( data: Dict[str, Any], path: str) -> Union[Any, wallaroo.object.DehydratedValue]:

Returns a value in a nested dictionary, or DehydratedValue.

Parameters
  • str path: Dot-delimited path within a nested dictionary; e.g. foo.bar.baz
Returns

The requested value inside the dictionary, or DehydratedValue if it doesn't exist.

class RequiredAttributeMissing(builtins.Exception):

Raised when an API object is initialized without a required attribute.

RequiredAttributeMissing(class_name: str, attribute_name: str)
Inherited Members
builtins.BaseException
with_traceback
args
class ModelUploadError(builtins.Exception):

Raised when a model file fails to upload.

ModelUploadError(e)
Inherited Members
builtins.BaseException
with_traceback
args
class ModelConversionError(builtins.Exception):

Raised when a model file fails to convert.

ModelConversionError(e)
Inherited Members
builtins.BaseException
with_traceback
args
class ModelConversionTimeoutError(builtins.Exception):

Raised when a model conversion took longer than 10mins

ModelConversionTimeoutError(e)
Inherited Members
builtins.BaseException
with_traceback
args
class EntityNotFoundError(builtins.Exception):

Raised when a query for a specific API object returns no results.

This is specifically for queries by unique identifiers that are expected to return exactly one result; queries that can return 0 to many results should return empty list instead of raising this exception.

EntityNotFoundError(entity_type: str, params: Dict[str, str])
Inherited Members
builtins.BaseException
with_traceback
args
class LimitError(builtins.Exception):

Raised when deployment fails.

LimitError(e)
Inherited Members
builtins.BaseException
with_traceback
args
class UserLimitError(builtins.Exception):

Raised when a community instance has hit the user limit

UserLimitError()
Inherited Members
builtins.BaseException
with_traceback
args
class DeploymentError(builtins.Exception):

Raised when deployment fails.

DeploymentError(e)
Inherited Members
builtins.BaseException
with_traceback
args
class InferenceError(builtins.Exception):

Raised when inference fails.

InferenceError(error)
Inherited Members
builtins.BaseException
with_traceback
args
class InvalidNameError(builtins.Exception):

Raised when an entity's name does not meet the expected critieria.

Parameters
  • str name: the name string that is invalid
  • str req: a string description of the requirement
InvalidNameError(name: str, req: str)
Inherited Members
builtins.BaseException
with_traceback
args
class CommunicationError(builtins.Exception):

Raised when some component cannot be contacted. There is a networking, configuration or installation problem.

CommunicationError(e)
Inherited Members
builtins.BaseException
with_traceback
args
class Object(abc.ABC):

Base class for all backend GraphQL API objects.

This class serves as a framework for API objects to be constructed based on a partially-complete JSON response, and to fill in their remaining members dynamically if needed.

Object( gql_client: Union[gql.client.Client, NoneType], data: Dict[str, Any], standalone=False, fetch_first=False)

Base constructor.

Each object requires:

  • a GraphQL client - in order to fill its missing members dynamically
  • an initial data blob - typically from unserialized JSON, contains at
  • least the data for required members (typically the object's primary key) and optionally other data members.