当前位置: 首页>>代码示例>>Python>>正文


Python RewriteRuleManager.read_from方法代码示例

本文整理汇总了Python中carbon.rewrite.RewriteRuleManager.read_from方法的典型用法代码示例。如果您正苦于以下问题:Python RewriteRuleManager.read_from方法的具体用法?Python RewriteRuleManager.read_from怎么用?Python RewriteRuleManager.read_from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在carbon.rewrite.RewriteRuleManager的用法示例。


在下文中一共展示了RewriteRuleManager.read_from方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: createAggregatorService

# 需要导入模块: from carbon.rewrite import RewriteRuleManager [as 别名]
# 或者: from carbon.rewrite.RewriteRuleManager import read_from [as 别名]
def createAggregatorService(config):
    from carbon.aggregator import receiver
    from carbon.aggregator.rules import RuleManager
    from carbon.routers import ConsistentHashingRouter
    from carbon.client import CarbonClientManager
    from carbon.rewrite import RewriteRuleManager
    from carbon.conf import settings
    from carbon import events

    root_service = createBaseService(config)

    # Configure application components
    router = ConsistentHashingRouter()
    client_manager = CarbonClientManager(router)
    client_manager.setServiceParent(root_service)

    events.metricReceived.addHandler(receiver.process)
    events.metricGenerated.addHandler(client_manager.sendDatapoint)

    RuleManager.read_from(settings["aggregation-rules"])
    if exists(settings["rewrite-rules"]):
        RewriteRuleManager.read_from(settings["rewrite-rules"])

    if not settings.DESTINATIONS:
      raise CarbonConfigException("Required setting DESTINATIONS is missing from carbon.conf")

    for destination in util.parseDestinations(settings.DESTINATIONS):
      client_manager.startClient(destination)

    return root_service
开发者ID:laiwei,项目名称:carbon,代码行数:32,代码来源:service.py

示例2: createAggregatorService

# 需要导入模块: from carbon.rewrite import RewriteRuleManager [as 别名]
# 或者: from carbon.rewrite.RewriteRuleManager import read_from [as 别名]
def createAggregatorService(config):
    from carbon.events import metricReceived
    from carbon.aggregator import receiver
    from carbon.aggregator.rules import RuleManager
    from carbon.aggregator import client
    from carbon.rewrite import RewriteRuleManager
    from carbon.conf import settings

    root_service = createBaseService(config)

    # Configure application components
    metricReceived.installHandler(receiver.process)
    RuleManager.read_from(settings["aggregation-rules"])
    if exists(settings["rewrite-rules"]):
        RewriteRuleManager.read_from(settings["rewrite-rules"])

    client.connect(settings["DESTINATION_HOST"],
                   int(settings["DESTINATION_PORT"]))

    return root_service
开发者ID:mtodd,项目名称:graphite,代码行数:22,代码来源:service.py

示例3: setupRewriterProcessor

# 需要导入模块: from carbon.rewrite import RewriteRuleManager [as 别名]
# 或者: from carbon.rewrite.RewriteRuleManager import read_from [as 别名]
def setupRewriterProcessor(root_service, settings):
  from carbon.rewrite import RewriteRuleManager

  rewrite_rules_path = settings["rewrite-rules"]
  RewriteRuleManager.read_from(rewrite_rules_path)
开发者ID:zhpn,项目名称:carbon,代码行数:7,代码来源:service.py

示例4: join

# 需要导入模块: from carbon.rewrite import RewriteRuleManager [as 别名]
# 或者: from carbon.rewrite.RewriteRuleManager import read_from [as 别名]
# Import application components
from carbon.log import logToStdout, logToDir
from carbon.instrumentation import startRecording
from carbon.listeners import MetricLineReceiver, MetricPickleReceiver, startListener
from carbon.aggregator.rules import RuleManager
from carbon.aggregator import receiver
from carbon.aggregator import client
from carbon.rewrite import RewriteRuleManager
from carbon.events import metricReceived
from carbon.util import daemonize

RuleManager.read_from(options.rules)

rewrite_rules_conf = join(CONF_DIR, 'rewrite-rules.conf')
if exists(rewrite_rules_conf):
  RewriteRuleManager.read_from(rewrite_rules_conf)

# --debug
if options.debug:
  logToStdout()

else:
  if not isdir(options.logdir):
    os.makedirs(options.logdir)

  daemonize()

  pidfile = open(options.pidfile, 'w')
  pidfile.write( str(os.getpid()) )
  pidfile.close()
开发者ID:katzj,项目名称:graphite,代码行数:32,代码来源:carbon-aggregator.py

示例5: test_read_from_starts_task

# 需要导入模块: from carbon.rewrite import RewriteRuleManager [as 别名]
# 或者: from carbon.rewrite.RewriteRuleManager import read_from [as 别名]
 def test_read_from_starts_task(self):
   with patch.object(RewriteRuleManager, 'read_rules'):
     with patch.object(RewriteRuleManager.read_task, 'start') as task_start_mock:
       RewriteRuleManager.read_from('foo.conf')
       task_start_mock.assert_called_once()
开发者ID:Akulatraxas,项目名称:carbon,代码行数:7,代码来源:test_rewrite.py

示例6: test_read_from_starts_task

# 需要导入模块: from carbon.rewrite import RewriteRuleManager [as 别名]
# 或者: from carbon.rewrite.RewriteRuleManager import read_from [as 别名]
 def test_read_from_starts_task(self):
   with patch.object(RewriteRuleManager, 'read_rules'):
     with patch.object(RewriteRuleManager.read_task, 'start') as task_start_mock:
       RewriteRuleManager.read_from('foo.conf')
       self.assertEqual(1, task_start_mock.call_count)
开发者ID:Hoodaly,项目名称:carbon,代码行数:7,代码来源:test_rewrite.py


注:本文中的carbon.rewrite.RewriteRuleManager.read_from方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。