當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。