result

this module contains the Result and Validation classes

class mosaic_orchestrator.result.ErrorDefinition(error_type: ErrorType, message: str, source: object)[source]

Represents an framework error with type, message and source

error_type: ErrorType
message: str
source: object
class mosaic_orchestrator.result.ErrorType(value)[source]

Defines the types of errors that can happen when building a task hierarchy.

GENERAL_ERROR = 7

an unspecified error has occurred

INPUT_ERROR = 2

a dependency could not be found or a supplied input-path could not be found.

MISSING_INPUT = 1

a input without default value is not set. source contains the path to the input.

MISSING_PDK_ITEM = 6

a view was not found in the pdk.

MISSING_TOOL = 3

a tool could not be found.

PDK_ERROR = 5

general error in connection with the pdk or a view.

TOOL_ERROR = 4

general error in connection with a tool.

VALIDATION_ERROR = 8

a validation failed.

class mosaic_orchestrator.result.Result(success: bool, value: Optional[T], error: Optional[str])[source]

a generic result that contains either an error or a value.

classmethod Fail(error: str)[source]

Create a Result object for a failed operation.

classmethod Ok(value=typing.Optional[~T])[source]

Create a Result object for a successful operation.

error: Optional[str]
property failure

True if operation failed, False if successful (read-only).

raise_on_fail() T[source]

Raise an error if the result is not successful

success: bool
value: Optional[T]
class mosaic_orchestrator.result.Validation[source]

represents the result of a validation.

This class is not intended to be subclassed by client code. Use the ValidationSuccess object and the ValidationError class instead.

classmethod of(success: bool, message: str) Validation[source]

convenience method to create a Validation object based on a flag and an error message.

Parameters:
  • success – when True this function returns ValidationSuccess, otherwise a ValidationError containing message is returned

  • message – the error message

class mosaic_orchestrator.result.ValidationError(message: Optional[str] = None)[source]

Validation result for error with optional message

message: Optional[str] = None
mosaic_orchestrator.result.ValidationSuccess = <mosaic_orchestrator.result._Success object>

Static validation result for success