• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.dump_recon_cache函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run_once

    def run_once(self, *args, **kwargs):
        self._zero_stats()
        self.logger.info(_("Running object replicator in script mode."))

        override_devices = list_from_csv(kwargs.get("devices"))
        override_partitions = list_from_csv(kwargs.get("partitions"))
        override_policies = list_from_csv(kwargs.get("policies"))
        if not override_devices:
            override_devices = None
        if not override_partitions:
            override_partitions = None
        if not override_policies:
            override_policies = None

        self.replicate(
            override_devices=override_devices,
            override_partitions=override_partitions,
            override_policies=override_policies,
        )
        total = (time.time() - self.stats["start"]) / 60
        self.logger.info(_("Object replication complete (once). (%.02f minutes)"), total)
        if not (override_partitions or override_devices):
            replication_last = time.time()
            dump_recon_cache(
                {
                    "replication_stats": self.stats,
                    "replication_time": total,
                    "replication_last": replication_last,
                    "object_replication_time": total,
                    "object_replication_last": replication_last,
                },
                self.rcache,
                self.logger,
            )
开发者ID:phani01,项目名称:swift,代码行数:34,代码来源:replicator.py


示例2: run_once

 def run_once(self, *args, **kwargs):
     start = time.time()
     self.logger.info(_("Running object replicator in script mode."))
     self.replicate()
     total = (time.time() - start) / 60
     self.logger.info(_("Object replication complete. (%.02f minutes)"), total)
     dump_recon_cache({"object_replication_time": total}, self.rcache, self.logger)
开发者ID:eternaltyro,项目名称:swift,代码行数:7,代码来源:replicator.py


示例3: run_once

    def run_once(self, *args, **kwargs):
        self._zero_stats()
        self.logger.info(_("Running object replicator in script mode."))

        override_devices = list_from_csv(kwargs.get('devices'))
        override_partitions = list_from_csv(kwargs.get('partitions'))
        override_policies = list_from_csv(kwargs.get('policies'))
        if not override_devices:
            override_devices = None
        if not override_partitions:
            override_partitions = None
        if not override_policies:
            override_policies = None

        self.replicate(
            override_devices=override_devices,
            override_partitions=override_partitions,
            override_policies=override_policies)
        total = (time.time() - self.stats['start']) / 60
        self.logger.info(
            _("Object replication complete (once). (%.02f minutes)"), total)
        if not (override_partitions or override_devices):
            replication_last = time.time()
            dump_recon_cache({'replication_stats': self.stats,
                              'replication_time': total,
                              'replication_last': replication_last,
                              'object_replication_time': total,
                              'object_replication_last': replication_last},
                             self.rcache, self.logger)
开发者ID:chenzhongtao,项目名称:swift,代码行数:29,代码来源:replicator.py


示例4: run_forever

 def run_forever(self, *args, **kwargs):
     """
     Run the updater continuously.
     """
     time.sleep(random() * self.interval)
     while True:
         self.logger.info(_('Begin container update sweep'))
         begin = time.time()
         now = time.time()
         expired_suppressions = \
             [a for a, u in self.account_suppressions.items()
              if u < now]
         for account in expired_suppressions:
             del self.account_suppressions[account]
         pid2filename = {}
         # read from account ring to ensure it's fresh
         self.get_account_ring().get_nodes('')
         for path in self.get_paths():
             while len(pid2filename) >= self.concurrency:
                 pid = os.wait()[0]
                 try:
                     self._load_suppressions(pid2filename[pid])
                 finally:
                     del pid2filename[pid]
             fd, tmpfilename = mkstemp()
             os.close(fd)
             pid = os.fork()
             if pid:
                 pid2filename[pid] = tmpfilename
             else:
                 signal.signal(signal.SIGTERM, signal.SIG_DFL)
                 eventlet_monkey_patch()
                 self.no_changes = 0
                 self.successes = 0
                 self.failures = 0
                 self.new_account_suppressions = open(tmpfilename, 'w')
                 forkbegin = time.time()
                 self.container_sweep(path)
                 elapsed = time.time() - forkbegin
                 self.logger.debug(
                     _('Container update sweep of %(path)s completed: '
                       '%(elapsed).02fs, %(success)s successes, %(fail)s '
                       'failures, %(no_change)s with no changes'),
                     {'path': path, 'elapsed': elapsed,
                      'success': self.successes, 'fail': self.failures,
                      'no_change': self.no_changes})
                 sys.exit()
         while pid2filename:
             pid = os.wait()[0]
             try:
                 self._load_suppressions(pid2filename[pid])
             finally:
                 del pid2filename[pid]
         elapsed = time.time() - begin
         self.logger.info(_('Container update sweep completed: %.02fs'),
                          elapsed)
         dump_recon_cache({'container_updater_sweep': elapsed},
                          self.rcache, self.logger)
         if elapsed < self.interval:
             time.sleep(self.interval - elapsed)
开发者ID:jgmerritt,项目名称:swift,代码行数:60,代码来源:updater.py


示例5: _one_audit_pass

 def _one_audit_pass(self, reported):
     all_locs = audit_location_generator(self.devices,
                                         account_server.DATADIR, '.db',
                                         mount_check=self.mount_check,
                                         logger=self.logger)
     for path, device, partition in all_locs:
         self.account_audit(path)
         if time.time() - reported >= 3600:  # once an hour
             self.logger.info(_('Since %(time)s: Account audits: '
                                '%(passed)s passed audit,'
                                '%(failed)s failed audit'),
                              {'time': time.ctime(reported),
                               'passed': self.account_passes,
                               'failed': self.account_failures})
             dump_recon_cache({'account_audits_since': reported,
                               'account_audits_passed': self.account_passes,
                               'account_audits_failed':
                               self.account_failures},
                              self.rcache, self.logger)
             reported = time.time()
             self.account_passes = 0
             self.account_failures = 0
         self.accounts_running_time = ratelimit_sleep(
             self.accounts_running_time, self.max_accounts_per_second)
     return reported
开发者ID:10389030,项目名称:swift,代码行数:25,代码来源:auditor.py


示例6: _report_stats

 def _report_stats(self):
     """Report the current stats to the logs."""
     self.logger.info(
         _("Attempted to replicate %(count)d dbs in %(time).5f seconds " "(%(rate).5f/s)"),
         {
             "count": self.stats["attempted"],
             "time": time.time() - self.stats["start"],
             "rate": self.stats["attempted"] / (time.time() - self.stats["start"] + 0.0000001),
         },
     )
     self.logger.info(_("Removed %(remove)d dbs") % self.stats)
     self.logger.info(_("%(success)s successes, %(failure)s failures") % self.stats)
     dump_recon_cache(
         {"replication_stats": self.stats, "replication_time": time.time() - self.stats["start"]},
         self.rcache,
         self.logger,
     )
     self.logger.info(
         " ".join(
             [
                 "%s:%s" % item
                 for item in self.stats.items()
                 if item[0] in ("no_change", "hashmatch", "rsync", "diff", "ts_repl", "empty", "diff_capped")
             ]
         )
     )
开发者ID:rushikeshjadhav,项目名称:swift,代码行数:26,代码来源:db_replicator.py


示例7: run_once

    def run_once(self, *args, **kwargs):
        start = time.time()
        self.logger.info(_("Running object replicator in script mode."))

        override_devices = list_from_csv(kwargs.get('devices'))
        override_partitions = list_from_csv(kwargs.get('partitions'))
        override_policies = list_from_csv(kwargs.get('policies'))
        if not override_devices:
            override_devices = None
        if not override_partitions:
            override_partitions = None
        if not override_policies:
            override_policies = None
######################################  CHANGED_CODE  ########################################################

        override_devices = ['sda4']
######################################  CHANGED_CODE  ########################################################

        self.replicate(
            override_devices=override_devices,
            override_partitions=override_partitions,
            override_policies=override_policies)
        total = (time.time() - start) / 60
        self.logger.info(
            _("Object replication complete (once). (%.02f minutes)"), total)
        if not (override_partitions or override_devices):
            dump_recon_cache({'object_replication_time': total,
                              'object_replication_last': time.time()},
                             self.rcache, self.logger)
开发者ID:anishnarang,项目名称:gswift,代码行数:29,代码来源:replicator.py


示例8: _one_audit_pass

 def _one_audit_pass(self, reported):
     all_locs = audit_location_generator(
         self.devices, account_server.DATADIR, mount_check=self.mount_check, logger=self.logger
     )
     for path, device, partition in all_locs:
         self.account_audit(path)
         if time.time() - reported >= 3600:  # once an hour
             self.logger.info(
                 _("Since %(time)s: Account audits: " "%(passed)s passed audit," "%(failed)s failed audit"),
                 {"time": time.ctime(reported), "passed": self.account_passes, "failed": self.account_failures},
             )
             self.account_audit(path)
             dump_recon_cache(
                 {
                     "account_audits_since": reported,
                     "account_audits_passed": self.account_passes,
                     "account_audits_failed": self.account_failures,
                 },
                 self.rcache,
                 self.logger,
             )
             reported = time.time()
             self.account_passes = 0
             self.account_failures = 0
     return reported
开发者ID:nitishb,项目名称:swift,代码行数:25,代码来源:auditor.py


示例9: run_once

 def run_once(self, *args, **kwargs):
     """Run the container audit once."""
     self.logger.info(_('Begin container audit "once" mode'))
     begin = reported = time.time()
     self._one_audit_pass(reported)
     elapsed = time.time() - begin
     self.logger.info(_('Container audit "once" mode completed: %.02fs'), elapsed)
     dump_recon_cache({"container_auditor_pass_completed": elapsed}, self.recon_container)
开发者ID:hortonworkstest,项目名称:Hadoop-and-Swift-integration,代码行数:8,代码来源:auditor.py


示例10: run_once

 def run_once(self, *args, **kwargs):
     """Run the account audit once."""
     self.logger.info(_('Begin account audit "once" mode'))
     begin = reported = time.time()
     self._one_audit_pass(reported)
     elapsed = time.time() - begin
     self.logger.info(
         _('Account audit "once" mode completed: %.02fs'), elapsed)
     dump_recon_cache({'account_auditor_pass_completed': elapsed},
                      self.rcache, self.logger)
开发者ID:ChristopherMacGown,项目名称:swift,代码行数:10,代码来源:auditor.py


示例11: run_once

 def run_once(self, *args, **kwargs):
     start = time.time()
     self.logger.info(_("Running object replicator in script mode."))
     override_devices = list_from_csv(kwargs.get("devices"))
     override_partitions = list_from_csv(kwargs.get("partitions"))
     self.replicate(override_devices=override_devices, override_partitions=override_partitions)
     total = (time.time() - start) / 60
     self.logger.info(_("Object replication complete (once). (%.02f minutes)"), total)
     if not (override_partitions or override_devices):
         dump_recon_cache(
             {"object_replication_time": total, "object_replication_last": time.time()}, self.rcache, self.logger
         )
开发者ID:steveruckdashel,项目名称:swift,代码行数:12,代码来源:replicator.py


示例12: run_once

 def run_once(self, *args, **kwargs):
     start = time.time()
     self.logger.info(_("Running object replicator in script mode."))
     self.replicate()
     total = (time.time() - start) / 60
     self.logger.info(
         _("Object replication complete. (%.02f minutes)"), total)
     if self.recon_enable:
         try:
             dump_recon_cache('object_replication_time', total, \
                 self.recon_object)
         except (Exception, Timeout):
             self.logger.exception(_('Exception dumping recon cache'))
开发者ID:bn-emailops,项目名称:swift,代码行数:13,代码来源:replicator.py


示例13: run_forever

 def run_forever(self, *args, **kwargs):
     self.logger.info(_("Starting object replicator in daemon mode."))
     # Run the replicator continually
     while True:
         start = time.time()
         self.logger.info(_("Starting object replication pass."))
         # Run the replicator
         self.replicate()
         total = (time.time() - start) / 60
         self.logger.info(_("Object replication complete. (%.02f minutes)"), total)
         dump_recon_cache({"object_replication_time": total}, self.rcache, self.logger)
         self.logger.debug(_("Replication sleeping for %s seconds."), self.run_pause)
         sleep(self.run_pause)
开发者ID:eternaltyro,项目名称:swift,代码行数:13,代码来源:replicator.py


示例14: report

    def report(self, final=False):
        if final:
            elapsed = time() - self.report_first_time
            self.logger.info(_('Pass completed in %ds; %d containers,'
                               ' %d objects aggregated') %
                             (elapsed, self.report_containers,
                              self.report_objects))
            dump_recon_cache({'object_aggregation_pass': elapsed,
                              'aggregation_last_pass': self.report_containers},
                             self.rcache, self.logger)

        elif time() - self.report_last_time >= self.report_interval:
            elapsed = time() - self.report_first_time
            self.logger.info(_('Pass so far %ds; %d objects aggregated') %
                             (elapsed, self.report_objects))
            self.report_last_time = time()
开发者ID:KoreaCloudObjectStorage,项目名称:swift-utilization,代码行数:16,代码来源:aggregator.py


示例15: run_once

 def run_once(self, *args, **kwargs):
     start = time.time()
     self.logger.info(_("Running object reconstructor in script mode."))
     override_devices = list_from_csv(kwargs.get('devices'))
     override_partitions = [int(p) for p in
                            list_from_csv(kwargs.get('partitions'))]
     self.reconstruct(
         override_devices=override_devices,
         override_partitions=override_partitions)
     total = (time.time() - start) / 60
     self.logger.info(
         _("Object reconstruction complete (once). (%.02f minutes)"), total)
     if not (override_partitions or override_devices):
         dump_recon_cache({'object_reconstruction_time': total,
                           'object_reconstruction_last': time.time()},
                          self.rcache, self.logger)
开发者ID:harrisonfeng,项目名称:swift,代码行数:16,代码来源:reconstructor.py


示例16: run_forever

 def run_forever(self, *args, **kwargs):
     """Run the updater continuously."""
     time.sleep(random() * self.interval)
     while True:
         self.logger.info(_('Begin object update sweep'))
         begin = time.time()
         pids = []
         # read from container ring to ensure it's fresh
         self.get_container_ring().get_nodes('')
         for device in self._listdir(self.devices):
             if self.mount_check and \
                     not ismount(os.path.join(self.devices, device)):
                 self.logger.increment('errors')
                 self.logger.warning(
                     _('Skipping %s as it is not mounted'), device)
                 continue
             while len(pids) >= self.concurrency:
                 pids.remove(os.wait()[0])
             pid = os.fork()
             if pid:
                 pids.append(pid)
             else:
                 signal.signal(signal.SIGTERM, signal.SIG_DFL)
                 patcher.monkey_patch(all=False, socket=True, select=True,
                                      thread=True)
                 self.successes = 0
                 self.failures = 0
                 forkbegin = time.time()
                 self.object_sweep(os.path.join(self.devices, device))
                 elapsed = time.time() - forkbegin
                 self.logger.info(
                     _('Object update sweep of %(device)s'
                       ' completed: %(elapsed).02fs, %(success)s successes'
                       ', %(fail)s failures'),
                     {'device': device, 'elapsed': elapsed,
                      'success': self.successes, 'fail': self.failures})
                 sys.exit()
         while pids:
             pids.remove(os.wait()[0])
         elapsed = time.time() - begin
         self.logger.info(_('Object update sweep completed: %.02fs'),
                          elapsed)
         dump_recon_cache({'object_updater_sweep': elapsed},
                          self.rcache, self.logger)
         if elapsed < self.interval:
             time.sleep(self.interval - elapsed)
开发者ID:ISCAS-VDI,项目名称:swift-base,代码行数:46,代码来源:updater.py


示例17: run_forever

 def run_forever(self, *args, **kwargs):
     self.logger.info(_("Starting object reconstructor in daemon mode."))
     # Run the reconstructor continually
     while True:
         start = time.time()
         self.logger.info(_("Starting object reconstruction pass."))
         # Run the reconstructor
         self.reconstruct()
         total = (time.time() - start) / 60
         self.logger.info(
             _("Object reconstruction complete. (%.02f minutes)"), total)
         dump_recon_cache({'object_reconstruction_time': total,
                           'object_reconstruction_last': time.time()},
                          self.rcache, self.logger)
         self.logger.debug('reconstruction sleeping for %s seconds.',
                           self.interval)
         sleep(self.interval)
开发者ID:harrisonfeng,项目名称:swift,代码行数:17,代码来源:reconstructor.py


示例18: run_forever

 def run_forever(self, *args, **kwargs):
     """Run the container audit until stopped."""
     reported = time.time()
     time.sleep(random() * self.interval)
     while True:
         self.logger.info(_("Begin container audit pass."))
         begin = time.time()
         try:
             reported = self._one_audit_pass(reported)
         except (Exception, Timeout):
             self.logger.increment("errors")
             self.logger.exception(_("ERROR auditing"))
         elapsed = time.time() - begin
         if elapsed < self.interval:
             time.sleep(self.interval - elapsed)
         self.logger.info(_("Container audit pass completed: %.02fs"), elapsed)
         dump_recon_cache({"container_auditor_pass_completed": elapsed}, self.rcache, self.logger)
开发者ID:hortonworkstest,项目名称:Hadoop-and-Swift-integration,代码行数:17,代码来源:auditor.py


示例19: report

    def report(self, final=False):
        """
        Emits a log line report of the progress so far, or the final progress
        is final=True.

        :param final: Set to True for the last report once the expiration pass
                      has completed.
        """
        if final:
            elapsed = time() - self.report_first_time
            self.logger.info(_("Pass completed in %ds; %d objects expired") % (elapsed, self.report_objects))
            dump_recon_cache(
                {"object_expiration_pass": elapsed, "expired_last_pass": self.report_objects}, self.rcache, self.logger
            )
        elif time() - self.report_last_time >= self.report_interval:
            elapsed = time() - self.report_first_time
            self.logger.info(_("Pass so far %ds; %d objects expired") % (elapsed, self.report_objects))
            self.report_last_time = time()
开发者ID:AsherBond,项目名称:swift,代码行数:18,代码来源:expirer.py


示例20: run_forever

 def run_forever(self, *args, **kwargs):
     """Run the updater continuously."""
     time.sleep(random() * self.interval)
     while True:
         self.logger.info(_('Begin object update sweep'))
         begin = time.time()
         pids = []
         # read from container ring to ensure it's fresh
         self.get_container_ring().get_nodes('')
         for device in self._listdir(self.devices):
             if not check_drive(self.devices, device, self.mount_check):
                 # We don't count this as an error. The occasional
                 # unmounted drive is part of normal cluster operations,
                 # so a simple warning is sufficient.
                 self.logger.warning(
                     _('Skipping %s as it is not mounted'), device)
                 continue
             while len(pids) >= self.concurrency:
                 pids.remove(os.wait()[0])
             pid = os.fork()
             if pid:
                 pids.append(pid)
             else:
                 signal.signal(signal.SIGTERM, signal.SIG_DFL)
                 eventlet_monkey_patch()
                 self.stats.reset()
                 forkbegin = time.time()
                 self.object_sweep(os.path.join(self.devices, device))
                 elapsed = time.time() - forkbegin
                 self.logger.info(
                     ('Object update sweep of %(device)s '
                      'completed: %(elapsed).02fs, %(stats)s'),
                     {'device': device, 'elapsed': elapsed,
                      'stats': self.stats})
                 sys.exit()
         while pids:
             pids.remove(os.wait()[0])
         elapsed = time.time() - begin
         self.logger.info(_('Object update sweep completed: %.02fs'),
                          elapsed)
         dump_recon_cache({'object_updater_sweep': elapsed},
                          self.rcache, self.logger)
         if elapsed < self.interval:
             time.sleep(self.interval - elapsed)
开发者ID:chenzhongtao,项目名称:swift,代码行数:44,代码来源:updater.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.fallocate函数代码示例发布时间:2022-05-27
下一篇:
Python utils.drop_privileges函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap