How to use the bigflow.error function in bigflow

To help you get started, we’ve selected a few bigflow 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 baidu / bigflow / bigflow_python / python / bigflow / serde.py View on Github external
def __init__(self, pipeline, proto_file):
        import os
        bigflow_python_home = os.getenv("BIGFLOW_PYTHON_HOME")
        module_name = proto_file.split('/')[-1].split('.')[0]
        proto_path = '/'.join(proto_file.split('/')[:-1])
        command = "%s/bigflow/bin/fast-pb-build %s %s %s" \
                %(bigflow_python_home, module_name, proto_path, proto_file)
        result = os.system(command)
        if result != 0:
            raise error.BigflowRuntimeException("Failed to fast-pb-build")

        egg_file = '%s/pb_modules/%s/dist/proto_wrapper-1.0-py2.7-linux-x86_64.egg' \
                %(bigflow_python_home, module_name)
        pipeline.add_egg_file(egg_file)
github baidu / bigflow / bigflow_python / python / bigflow / pipeline / pipeline_base.py View on Github external
""" 注册一个在 pipeline.run() 执行之前的 hook.
            hook 执行顺序: 注册的 name 进行 sorted 排序结果

        todo: deal with callback with parameters. Users can always use closure to convert a callback
              with parameters to a zero-parameter callback
        :param name:  钩子名称
        :param callback: 无参的 callback
        :return: None

        ..Note: This function is provided for advanced usage, please make sure you know what you are
                doing.
        """
        if callable(callback):
            self._before_run_hooks[name] = (callback, )
        else:
            raise error.BigflowPlanningException("Cannot register a non-callable object: %s" %
                                                 str(callback))
github baidu / bigflow / bigflow_python / python / bigflow / pipeline / pipeline_base.py View on Github external
def add_cache_id(self, cache_id):
        """
        save the ptype cache node id for use
        """
        if not isinstance(cache_id, str):
            raise error.BigflowPlanningException("be added cache id should be str")
        self._cache_node_ids.append(cache_id)