class Connection(APIObject): SCHEMA = CONNECTION_CONTRACT def __init__(self, credentials, *args, **kwargs): # this is a bit clunky but we deserialize and then reserialize for now if isinstance(credentials, Credentials): credentials = credentials.serialize() # we can't serialize handles self._handle = kwargs.pop('handle') super(Connection, self).__init__(credentials=credentials, *args, **kwargs) # this will validate itself in its own __init__. self._credentials = create_credentials(self.type, self._contents['credentials']) @property def credentials(self): return self._credentials @property def handle(self): return self._handle @handle.setter def handle(self, value): self._handle = value name = named_property('name', 'The name of this connection') state = named_property('state', 'The state of the connection') transaction_open = named_property( 'transaction_open', 'True if there is an open transaction, False otherwise.')
class RunModelResult(APIObject): SCHEMA = RUN_MODEL_RESULT_CONTRACT def __init__(self, node, error=None, skip=False, status=None, failed=None, execution_time=0): super(RunModelResult, self).__init__(node=node, error=error, skip=skip, status=status, fail=failed, execution_time=execution_time) # these all get set after the fact, generally error = named_property('error', 'If there was an error, the text of that error') skip = named_property('skip', 'True if the model was skipped') fail = named_property('fail', 'True if this was a test and it failed') status = named_property('status', 'The status of the model execution') execution_time = named_property( 'execution_time', 'The time in seconds to execute the model') @property def errored(self): return self.error is not None @property def failed(self): return self.fail @property def skipped(self): return self.skip def serialize(self): result = super(RunModelResult, self).serialize() result['node'] = self.node.serialize() return result
class RunModelResult(NodeSerializable): SCHEMA = RUN_MODEL_RESULT_CONTRACT def __init__(self, node, error=None, skip=False, status=None, failed=None, warned=None, thread_id=None, timing=None, execution_time=0): if timing is None: timing = [] super(RunModelResult, self).__init__( node=node, error=error, skip=skip, status=status, fail=failed, warn=warned, execution_time=execution_time, thread_id=thread_id, timing=timing, ) # these all get set after the fact, generally error = named_property('error', 'If there was an error, the text of that error') skip = named_property('skip', 'True if the model was skipped') warn = named_property('warn', 'True if this was a test and it warned') fail = named_property('fail', 'True if this was a test and it failed') status = named_property('status', 'The status of the model execution') execution_time = named_property( 'execution_time', 'The time in seconds to execute the model') thread_id = named_property('thread_id', 'ID of the executing thread, e.g. Thread-3') timing = named_property('timing', 'List of TimingInfo objects') @property def failed(self): return self.fail @property def warned(self): return self.warn @property def skipped(self): return self.skip