"""Computational tasks with properties"""

from properties.base import HasProperties
from properties.basic import String, Bool


class Result(HasProperties):
    """The result of a computation"""

    success = Bool(
        'Did the task succeed',
        default=True,
    )
    log = String(
        'Output log messages from the task',
        default='',
    )


class Task(HasProperties):
    """Computational task"""

    _REGISTRY = dict()
    Result = Result

    def wrap_call(self):
        """Carry out common tasks before and after execution"""
        return self()

    def __call__(self):
        """Execute the compute task"""
        raise NotImplementedError('Override in client classes')


class TaskException(Exception):
    """An exception related to a computational task"""


class PermanentTaskFailure(TaskException):
    """An exception that should not be retried"""

@@ -128,16 +128,20 @@
 %0A%0Aclass 
+Base
 Result(H
@@ -458,16 +458,20 @@
 esult = 
+Base
 Result%0A%0A

Rename Result to BaseResult.