How to use the batchflow.named_expr.eval_expr function in batchflow

To help you get started, we’ve selected a few batchflow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github analysiscenter / batchflow / batchflow / once_pipeline.py View on Github external
def _exec_action(self, action):
        args_value = eval_expr(action['args'], pipeline=self.pipeline)
        kwargs_value = eval_expr(action['kwargs'], pipeline=self.pipeline)

        if action['name'] in ACTIONS:
            method = getattr(self, ACTIONS[action['name']])
            method(action)
        else:
            method = self.pipeline.get_method(action['name'])
            if method is None:
                raise ValueError("Unknown method: %s" % action['name'])

            res = method(*args_value, **kwargs_value)

            if isinstance(action['save_to'], NamedExpression):
                action['save_to'].set(res, pipeline=self.pipeline)
            elif isinstance(action['save_to'], np.ndarray):
                action['save_to'][:] = res
github analysiscenter / batchflow / batchflow / research / executable.py View on Github external
def _call_function(self, job, iteration, experiment):
        function = eval_expr(self.function, job=job, iteration=iteration, experiment=experiment)
        if callable(function):
            args = eval_expr(self.args, job=job, iteration=iteration, experiment=experiment)
            kwargs = eval_expr(self.kwargs, job=job, iteration=iteration, experiment=experiment)
            result = function(*args, **kwargs)
        else:
            result = function
        self.put_result(iteration, result)
        return result
github analysiscenter / batchflow / batchflow / research / executable.py View on Github external
def _call_function(self, job, iteration, experiment):
        function = eval_expr(self.function, job=job, iteration=iteration, experiment=experiment)
        if callable(function):
            args = eval_expr(self.args, job=job, iteration=iteration, experiment=experiment)
            kwargs = eval_expr(self.kwargs, job=job, iteration=iteration, experiment=experiment)
            result = function(*args, **kwargs)
        else:
            result = function
        self.put_result(iteration, result)
        return result
github analysiscenter / batchflow / batchflow / research / domain.py View on Github external
def update_domain(self, path):
        """ Update domain by `update_func`. If returns None, domain will not be updated. """
        kwargs = eval_expr(self.update_kwargs, path=path)
        return self.update_func(**kwargs)
github analysiscenter / batchflow / batchflow / pipeline.py View on Github external
def _eval_expr(self, expr, batch=None):
        return eval_expr(expr, batch=batch, pipeline=self)
github analysiscenter / batchflow / batchflow / once_pipeline.py View on Github external
def _exec_action(self, action):
        args_value = eval_expr(action['args'], pipeline=self.pipeline)
        kwargs_value = eval_expr(action['kwargs'], pipeline=self.pipeline)

        if action['name'] in ACTIONS:
            method = getattr(self, ACTIONS[action['name']])
            method(action)
        else:
            method = self.pipeline.get_method(action['name'])
            if method is None:
                raise ValueError("Unknown method: %s" % action['name'])

            res = method(*args_value, **kwargs_value)

            if isinstance(action['save_to'], NamedExpression):
                action['save_to'].set(res, pipeline=self.pipeline)
            elif isinstance(action['save_to'], np.ndarray):
                action['save_to'][:] = res
github analysiscenter / batchflow / batchflow / research / executable.py View on Github external
def _call_function(self, job, iteration, experiment):
        function = eval_expr(self.function, job=job, iteration=iteration, experiment=experiment)
        if callable(function):
            args = eval_expr(self.args, job=job, iteration=iteration, experiment=experiment)
            kwargs = eval_expr(self.kwargs, job=job, iteration=iteration, experiment=experiment)
            result = function(*args, **kwargs)
        else:
            result = function
        self.put_result(iteration, result)
        return result
github analysiscenter / batchflow / batchflow / pipeline.py View on Github external
def _eval_expr(self, expr, batch=None):
        return eval_expr(expr, batch=batch, pipeline=self)
github analysiscenter / batchflow / batchflow / model_dir.py View on Github external
def eval_expr(self, expr, batch=None):
        """ Evaluate all named expressions in a given data structure """
        return eval_expr(expr, batch=batch)