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


Python whisper.validateArchiveList函数代码示例

本文整理汇总了Python中whisper.validateArchiveList函数的典型用法代码示例。如果您正苦于以下问题:Python validateArchiveList函数的具体用法?Python validateArchiveList怎么用?Python validateArchiveList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: loadStorageSchemas

def loadStorageSchemas():
  schemaList = []
  config = OrderedConfigParser()
  config.read(STORAGE_SCHEMAS_CONFIG)

  for section in config.sections():
    options = dict(config.items(section))
    matchAll = options.get('match-all')
    pattern = options.get('pattern')
    listName = options.get('list')

    retentions = options['retentions'].split(',')
    archives = [Archive.fromString(s) for s in retentions]

    if matchAll:
      mySchema = DefaultSchema(section, archives)

    elif pattern:
      mySchema = PatternSchema(section, pattern, archives)

    elif listName:
      mySchema = ListSchema(section, listName, archives)

    archiveList = [a.getTuple() for a in archives]

    try:
      whisper.validateArchiveList(archiveList)
      schemaList.append(mySchema)
    except whisper.InvalidConfiguration, e:
      log.msg("Invalid schemas found in %s: %s" % (section, e))
开发者ID:devsfr,项目名称:carbon,代码行数:30,代码来源:storage.py

示例2: loadStorageSchemas

def loadStorageSchemas():
  schemaList = []
  config = OrderedConfigParser()
  config.read(STORAGE_SCHEMAS_CONFIG)

  for section in config.sections():
    options = dict( config.items(section) )
    pattern = options.get('pattern')

    retentions = options['retentions'].split(',')
    archives = [ Archive.fromString(s) for s in retentions ]

    if pattern:
      mySchema = PatternSchema(section, pattern, archives)
    else:
      log.err("Section missing 'pattern': %s" % section)
      continue

    archiveList = [a.getTuple() for a in archives]

    try:
      whisper.validateArchiveList(archiveList)
      schemaList.append(mySchema)
    except whisper.InvalidConfiguration, e:
      log.msg("Invalid schemas found in %s: %s" % (section, e) )
开发者ID:celik0311,项目名称:carbon,代码行数:25,代码来源:storage.py

示例3: test_number_of_points

 def test_number_of_points(self):
     """
     number of points
     """
     whisper.validateArchiveList(self.retention)
     with AssertRaisesException(whisper.InvalidConfiguration("Each archive must have at least enough points to consolidate to the next archive (archive1 consolidates 60 of archive0's points but it has only 30 total points)")):
         whisper.validateArchiveList([(1, 30), (60, 60)])
开发者ID:alexandreboisvert,项目名称:whisper,代码行数:7,代码来源:test_whisper.py

示例4: test_timespan_coverage

 def test_timespan_coverage(self):
     """
     timespan coverage
     """
     whisper.validateArchiveList(self.retention)
     with AssertRaisesException(whisper.InvalidConfiguration('Lower precision archives must cover larger time intervals than higher precision archives (archive0: 60 seconds, archive1: 10 seconds)')):
         whisper.validateArchiveList([(1, 60), (10, 1)])
开发者ID:alexandreboisvert,项目名称:whisper,代码行数:7,代码来源:test_whisper.py

示例5: test_even_precision_division

 def test_even_precision_division(self):
     """
     even precision division
     """
     whisper.validateArchiveList([(60, 60), (6, 60)])
     with AssertRaisesException(whisper.InvalidConfiguration("Higher precision archives' precision must evenly divide all lower precision archives' precision (archive0: 7, archive1: 60)")):
         whisper.validateArchiveList([(60, 60), (7, 60)])
开发者ID:alexandreboisvert,项目名称:whisper,代码行数:7,代码来源:test_whisper.py

示例6: test_validate_archive_list

 def test_validate_archive_list(self):
     """
     blank archive config
     """
     with AssertRaisesException(
             whisper.InvalidConfiguration(
                 'You must specify at least one archive configuration!')):
         whisper.validateArchiveList([])
开发者ID:yadsirhc,项目名称:whisper,代码行数:8,代码来源:test_whisper.py

示例7: test_duplicate

    def test_duplicate(self):
        """
        Checking duplicates
        """
        # TODO: Fix the lies with whisper.validateArchiveList() saying it returns True/False
        self.assertIsNone(whisper.validateArchiveList(self.retention))

        with AssertRaisesException(whisper.InvalidConfiguration('A Whisper database may not be configured having two archives with the same precision (archive0: (1, 60), archive1: (1, 60))')):
            whisper.validateArchiveList([(1, 60), (60, 60), (1, 60)])
开发者ID:alexandreboisvert,项目名称:whisper,代码行数:9,代码来源:test_whisper.py

示例8: print

  archives = []
  section_failed = False
  for retention in retentions:
    try:
      archives.append(whisper.parseRetentionDef(retention))
    except ValueError as e:
      print(
        "  - Error: Section '%s' contains an invalid item in its retention definition ('%s')" %
        (section, retention)
      )
      print("    %s" % e)
      section_failed = True

  if not section_failed:
    try:
      whisper.validateArchiveList(archives)
    except whisper.InvalidConfiguration as e:
      print(
        "  - Error: Section '%s' contains an invalid retention definition ('%s')" %
        (section, ','.join(retentions))
      )
      print("    %s" % e)

  if section_failed:
    errors_found += 1
  else:
    print("  OK")

if errors_found:
  raise SystemExit("Storage-schemas configuration '%s' failed validation" % SCHEMAS_FILE)
开发者ID:NixM0nk3y,项目名称:carbon,代码行数:30,代码来源:validate-storage-schemas.py

示例9: test_number_of_points

 def test_number_of_points(self):
     """number of points"""
     whisper.validateArchiveList([(1, 60), (60, 60)])
     with self.assertRaises(whisper.InvalidConfiguration):
         whisper.validateArchiveList([(1, 30), (60, 60)])
开发者ID:TheNoButton,项目名称:whisper,代码行数:5,代码来源:test_whisper.py

示例10: test_timespan_coverage

 def test_timespan_coverage(self):
     """timespan coverage"""
     whisper.validateArchiveList([(1, 60), (60, 60)])
     with self.assertRaises(whisper.InvalidConfiguration):
         whisper.validateArchiveList([(1, 60), (10, 1)])
开发者ID:TheNoButton,项目名称:whisper,代码行数:5,代码来源:test_whisper.py

示例11: test_even_precision_division

 def test_even_precision_division(self):
     """even precision division"""
     whisper.validateArchiveList([(60, 60), (6, 60)])
     with self.assertRaises(whisper.InvalidConfiguration):
         whisper.validateArchiveList([(60, 60), (7, 60)])
开发者ID:TheNoButton,项目名称:whisper,代码行数:5,代码来源:test_whisper.py

示例12: test_duplicate

 def test_duplicate(self):
     """Checking duplicates"""
     whisper.validateArchiveList([(1, 60), (60, 60)])
     with self.assertRaises(whisper.InvalidConfiguration):
         whisper.validateArchiveList([(1, 60), (60, 60), (1, 60)])
开发者ID:TheNoButton,项目名称:whisper,代码行数:5,代码来源:test_whisper.py

示例13: test_validate_archive_list

 def test_validate_archive_list(self):
     """blank archive config"""
     with self.assertRaises(whisper.InvalidConfiguration):
         whisper.validateArchiveList([])
开发者ID:TheNoButton,项目名称:whisper,代码行数:4,代码来源:test_whisper.py

示例14: validateArchiveList

 def validateArchiveList(self, archiveList):
   try:
     whisper.validateArchiveList(archiveList)
   except whisper.InvalidConfiguration, e:
     raise ValueError("%s" % e)
开发者ID:bmhatfield,项目名称:carbon,代码行数:5,代码来源:database.py


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