def _execute_function_from_step_json(self, function_json_attr, exc_return_val=None, extra_kwargs=None): from orchestra.utils.task_lifecycle import (get_task_details) function_json = getattr(self.step, function_json_attr) path = function_json.get('path') kwargs = function_json.get('kwargs', {}) if extra_kwargs is not None: kwargs.update(extra_kwargs) try: function = locate(path) return function(get_task_details(self.id), **kwargs) except Exception: return exc_return_val
def get_detailed_description(self, extra_kwargs=None): """ This function uses a step's `description_function` field to generate dynamic text describing a step within a task. Args: extra_kwargs (dict): Additional (dynamic) kwargs that will be passed to the description function. Returns: detailed_description (str): Dynamic message describing the task. """ from orchestra.utils.task_lifecycle import (get_task_details) path = self.step.detailed_description_function.get('path') kwargs = self.step.detailed_description_function.get('kwargs', {}) if extra_kwargs is not None: kwargs.update(extra_kwargs) try: function = locate(path) return function(get_task_details(self.id), **kwargs) except: return ''
def get_detailed_description(self, extra_kwargs=None): """ This function uses a step's `description_function` field to generate dynamic text describing a step within a task. Args: extra_kwargs (dict): Additional (dynamic) kwargs that will be passed to the description function. Returns: detailed_description (str): Dynamic message describing the task. """ from orchestra.utils.task_lifecycle import ( get_task_details) path = self.step.detailed_description_function.get('path') kwargs = self.step.detailed_description_function.get('kwargs', {}) if extra_kwargs is not None: kwargs.update(extra_kwargs) try: function = locate(path) return function(get_task_details(self.id), **kwargs) except: return ''