示例#1
0
 def test_manipulate_paths_like_upstream(self):
     sys_path = []
     bg_utils.manipulate_paths_like_upstream(
         "/a/b/c/bin/bg-carbon-aggregator-cache", sys_path
     )
     self.assertEqual(1, len(sys_path))
     self.assertEqual("/a/b/c/lib", sys_path[0])
示例#2
0
def main(_executable=sys.argv[0], _sys_path=sys.path):
    """The entry point of this module."""
    bg_utils.manipulate_paths_like_upstream(_executable, _sys_path)
    from carbon import util as carbon_util
    from carbon import exceptions as carbon_exceptions
    # Importing the plugin registers it.
    from biggraphite.plugins import carbon as unused_carbon  # noqa
    try:
        # The carbon code tries to guess GRAPHITE_ROOT from the filename
        # given to run_twistd_plugin() to set GRAPHITE_ROOT. This is then
        # used to setup default paths. Try to make it somewhat compatible
        # when carbon is installed in its default directory.
        bg_utils.setup_graphite_root_path(carbon_util.__file__)
        carbon_util.run_twistd_plugin("carbon-cache")
    except carbon_exceptions.CarbonConfigException as exc:
        # This is what carbon cache does, we preserve that behaviour.
        raise SystemExit(str(exc))
示例#3
0
def main(_executable=sys.argv[0], _sys_path=sys.path):
    """The entry point of this module."""
    bg_utils.manipulate_paths_like_upstream(_executable, _sys_path)
    from carbon import util as carbon_util
    from carbon import exceptions as carbon_exceptions

    # Importing the plugin registers it.
    from biggraphite.plugins import carbon as unused_carbon  # noqa

    try:
        # The carbon code tries to guess GRAPHITE_ROOT from the filename
        # given to run_twistd_plugin() to set GRAPHITE_ROOT. This is then
        # used to setup default paths. Try to make it somewhat compatible
        # when carbon is installed in its default directory.
        bg_utils.setup_graphite_root_path(carbon_util.__file__)
        carbon_util.run_twistd_plugin("carbon-cache")
    except carbon_exceptions.CarbonConfigException as exc:
        # This is what carbon cache does, we preserve that behaviour.
        raise SystemExit(str(exc))