Custom Decorators

Extending the DBND SDK to create custom decorators for annotating tasks.

The goal of this example is to show you how you can extend DBND and create custom decorators for annotating tasks:

import logging

from functools import partial

from dbnd import output, parameter, task
from dbnd._core.task.decorated_callable_task import DecoratedPythonTask

class ExperiementTask(DecoratedPythonTask):
    custom_name = parameter.value("aa")

    previous_exp = parameter.value(1)
    score_card =
    my_ratio =

    def run(self):
        # wrapping code
        score = self._invoke_func()

        self.my_ratio.write_pickle(self.previous_exp + 1)

experiment = partial(task, _task_type=ExperiementTask)

def my_new_experiement(alpha: float = 0.2, previous_exp=1):
    logging.warning("My previous exp = %s", previous_exp)
    return 1, 2, alpha

What’s Next
Did this page help you?