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

Python log.error函数代码示例

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

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



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

示例1: orangefs_instalation

 def orangefs_instalation(self, node):    
     try:
         log.info('PabPlug: ' + node.alias + ' OrangeFS instalation')
         node.ssh.execute(self.__remote_module_path + '/bin/pvfs-instalation.sh 2>&1 > ' + self.__remote_module_path + '/log/pvfs-instalation.log') 
     except Exception as e:
         log.error('PabPlug: ' + node.alias + ' OrangeFS instalation error: '+str(e))
         sys.exit('PabPlug: ' + node.alias + ' OrangeFS instalation error: '+str(e))
开发者ID:Pablites,项目名称:PabPlug,代码行数:7,代码来源:pvfs_controller.py


示例2: list_bucket

 def list_bucket(self, bucketname):
     bucket = self.get_bucket_or_none(bucketname)
     if bucket:
         for file in bucket.list():
             if file.name: print file.name
     else:
         log.error('bucket %s does not exist' % bucketname)
开发者ID:mresnick,项目名称:StarCluster,代码行数:7,代码来源:awsutils.py


示例3: get_value

 def get_value(self, value, node):
     """
     Handle variables
     [[date]]
     [[alias]] - node name
     [[master]] - name of this nodes master
     [[localuser]] - user name of person that started cluster, 
         according to machine cluster started from
     """
     auto_pattern = r"\[\[(.+)\]\]"
     auto_v = re.match(auto_pattern, value)
     if auto_v:
         command = auto_v.group(1).strip()
         if command == "date":
             return datetime.utcnow().strftime("%c UTC")
         if command == "alias":
             return node.alias
         if command == "master":
             return master.alias
         if command == "localuser":
             return getpass.getuser()
         log.error(
             ("Tagging: <%s> appears to be a patterned tag, but " "no command found. Tagging as <%s>.")
             % (value, command)
         )
         return command
     else:
         return value
开发者ID:JohnCEarls,项目名称:starcluster-plugins,代码行数:28,代码来源:tagger.py


示例4: create

 def create(self, volume_size, volume_zone, name=None, tags=None):
     try:
         self.validate(volume_size, volume_zone, self._aws_block_device)
         instance = self._request_instance(volume_zone)
         self._validate_required_progs([self._mkfs_cmd.split()[0]])
         self._determine_device()
         vol = self._create_volume(volume_size, volume_zone)
         if tags:
             for tag in tags:
                 tagval = tags.get(tag)
                 tagmsg = "Adding volume tag: %s" % tag
                 if tagval:
                     tagmsg += "=%s" % tagval
                 log.info(tagmsg)
                 vol.add_tag(tag, tagval)
         if name:
             vol.add_tag("Name", name)
         self._attach_volume(self._volume, instance.id,
                             self._aws_block_device)
         self._get_volume_device(self._aws_block_device)
         self._format_volume()
         self.shutdown()
         log.info("Your new %sGB volume %s has been created successfully" %
                  (volume_size, vol.id))
         return vol
     except Exception:
         log.error("Failed to create new volume", exc_info=True)
         self._delete_new_volume()
         raise
     finally:
         self._warn_about_volume_hosts()
开发者ID:ricrogz,项目名称:StarCluster,代码行数:31,代码来源:volume.py


示例5: is_valid

 def is_valid(self, size, zone, device):
     try:
         self.validate(size, zone, device)
         return True
     except exception.BaseException, e:
         log.error(e.msg)
         return False
开发者ID:inteq,项目名称:StarCluster,代码行数:7,代码来源:volume.py


示例6: _eval_add_node

 def _eval_add_node(self):
     """
     This function inspects the current state of the SGE queue and decides
     whether or not to add nodes to the cluster. Returns the number of nodes
     to add.
     """
     num_nodes = len(self._cluster.nodes)
     if num_nodes >= self.max_nodes:
         log.info("Not adding nodes: already at or above maximum (%d)" %
                  self.max_nodes)
         return
     queued_jobs = self.stat.get_queued_jobs()
     if not queued_jobs and num_nodes >= self.min_nodes:
         log.info("Not adding nodes: at or above minimum nodes "
                  "and no queued jobs...")
         return
     total_slots = self.stat.count_total_slots()
     if not self.has_cluster_stabilized() and total_slots > 0:
         return
     running_jobs = self.stat.get_running_jobs()
     used_slots = sum([int(j['slots']) for j in running_jobs])
     qw_slots = sum([int(j['slots']) for j in queued_jobs])
     slots_per_host = self.stat.slots_per_host()
     avail_slots = total_slots - used_slots
     need_to_add = 0
     if num_nodes < self.min_nodes:
         log.info("Adding node: below minimum (%d)" % self.min_nodes)
         need_to_add = self.min_nodes - num_nodes
     elif total_slots == 0:
         # no slots, add one now
         need_to_add = 1
     elif qw_slots > avail_slots:
         log.info("Queued jobs need more slots (%d) than available (%d)" %
                  (qw_slots, avail_slots))
         oldest_job_dt = self.stat.oldest_queued_job_age()
         now = self.get_remote_time()
         age_delta = now - oldest_job_dt
         if age_delta.seconds > self.longest_allowed_queue_time:
             log.info("A job has been waiting for %d seconds "
                      "longer than max: %d" %
                      (age_delta.seconds, self.longest_allowed_queue_time))
             if slots_per_host != 0:
                 need_to_add = qw_slots / slots_per_host
             else:
                 need_to_add = 1
         else:
             log.info("No queued jobs older than %d seconds" %
                      self.longest_allowed_queue_time)
     max_add = self.max_nodes - len(self._cluster.running_nodes)
     need_to_add = min(self.add_nodes_per_iteration, need_to_add, max_add)
     if need_to_add > 0:
         log.warn("Adding %d nodes at %s" %
                  (need_to_add, str(utils.get_utc_now())))
         try:
             self._cluster.add_nodes(need_to_add)
             self.__last_cluster_mod_time = utils.get_utc_now()
             log.info("Done adding nodes at %s" %
                      str(self.__last_cluster_mod_time))
         except Exception:
             log.error("Failed to add new host", exc_info=True)
开发者ID:ricrogz,项目名称:StarCluster,代码行数:60,代码来源:__init__.py


示例7: is_valid

 def is_valid(self, size, zone, device, image):
     try:
         self.validate(size, zone, device, image)
         return True
     except exception.ValidationError,e:
         log.error(e.msg)
         return False
开发者ID:mresnick,项目名称:StarCluster,代码行数:7,代码来源:volume.py


示例8: __local_mpe_instalation

 def __local_mpe_instalation(self):    
     try:
         log.info('W2IO: local MPE instalation')
         call(self.__remote_module_path + '/bin/w2io-instalation.sh 2>&1 > ' + self.__remote_module_path + '/log/w2io-instalation.log') 
     except:
         log.error('W2IO: local MPE instalation error')
         sys.exit('W2IO: local MPE instalation error')
开发者ID:Pablites,项目名称:W2IO,代码行数:7,代码来源:main_w2io.py


示例9: recover

 def recover(self, nodes, master, user, user_shell, volumes):
     cmd = "ps -ef | grep sge_qmaster | grep -v grep | wc -l"
     rez = int(master.ssh.execute(cmd)[0])
     if rez == 0:
         log.error("sge_qmaster is down")
         cmd = "cd /opt/sge6/bin/linux-x64/ && ./sge_qmaster"
         master.ssh.execute(cmd)
开发者ID:cariaso,项目名称:StarCluster,代码行数:7,代码来源:sge.py


示例10: __local_fix_fetch

 def __local_fix_fetch(self):
     try:
         log.info('W2IO: local Fixing fetch problem')
         call(self.__remote_module_path + '/bin/fetch-problem.sh 2>&1 > ' + self.__remote_module_path + '/log/fetch-problem.log') 
     except:
         log.error('W2IO: local Fixing fetch problem error')
         sys.exit('W2IO: local Fixing fetch problem error')
开发者ID:Pablites,项目名称:W2IO,代码行数:7,代码来源:main_w2io.py


示例11: __local_dependency_instalation

 def __local_dependency_instalation(self):    
     try:
         log.info('W2IO: local Dependency instalation')
         call(self.__remote_module_path + '/bin/w2io-dependency.sh 2>&1 > ' + self.__remote_module_path + '/log/w2io-dependency.log') 
     except:
         log.error('W2IO: local Dependency instalation error')
         sys.exit('W2IO: local Dependency instalation error')
开发者ID:Pablites,项目名称:W2IO,代码行数:7,代码来源:main_w2io.py


示例12: __mpe_instalation

 def __mpe_instalation(self, node):    
     try:
         log.info('W2IO: ' + node.alias + ' MPE instalation')
         node.ssh.execute(self.__remote_module_path + '/bin/w2io-instalation.sh 2>&1 > ' + self.__remote_module_path + '/log/w2io-instalation.log') 
     except:
         log.error('W2IO: ' + node.alias + ' MPE instalation error')
         sys.exit('W2IO: ' + node.alias + ' MPE instalation error')
开发者ID:Pablites,项目名称:W2IO,代码行数:7,代码来源:main_w2io.py


示例13: __fix_fetch

 def __fix_fetch(self, node):
     try:
         log.info('W2IO: ' + node.alias + ' Fixing fetch problem')
         node.ssh.execute(self.__remote_module_path + '/bin/fetch-problem.sh 2>&1 > ' + self.__remote_module_path + '/log/fetch-problem.log') 
     except:
         log.error('W2IO: ' + node.alias + ' Fixing fetch problem error')
         sys.exit('W2IO: ' + node.alias + ' Fixing fetch problem error')
开发者ID:Pablites,项目名称:W2IO,代码行数:7,代码来源:main_w2io.py


示例14: _mount_volume

	def _mount_volume(self, node, volume, mount_path):
		if volume.attach_data.device == None:
			log.error("Volume %s has not been attached" % volume.id)
			return

		device = volume.attach_data.device.replace("sd","xvd")
		self._mount_device(node, device, mount_path)
开发者ID:rartzi,项目名称:raAWSLab,代码行数:7,代码来源:glusterfsencrypt.py


示例15: _validate

 def _validate(self, validate_running=False):
     """
     Checks that all cluster template settings are valid. Raises
     a ClusterValidationError exception if not. Passing
     validate_running=True will also check that the existing instances
     properties match the configuration of this cluster template.
     """
     log.info("Validating cluster template settings...")
     self._has_all_required_settings()
     self._validate_spot_bid()
     self._validate_cluster_size()
     self._validate_shell_setting()
     self._validate_permission_settings()
     self._validate_credentials()
     self._validate_keypair()
     self._validate_zone()
     self._validate_ebs_settings()
     self._validate_ebs_aws_settings()
     self._validate_image_settings()
     self._validate_instance_types()
     if validate_running:
         log.info("Validating existing instances...")
         try:
             self._validate_running_instances()
         except exception.ClusterValidationError, e:
             log.error("existing instances are not compatible with cluster" + " template settings:")
             raise
开发者ID:samof76,项目名称:StarCluster,代码行数:27,代码来源:cluster.py


示例16: create

 def create(self, volume_size, volume_zone, name=None, tags=None):
     try:
         self.validate(volume_size, volume_zone, self._device)
         instance = self._request_instance(volume_zone)
         self._validate_required_progs([self._mkfs_cmd.split()[0]])
         self._determine_device()
         vol = self._create_volume(volume_size, volume_zone)
         if tags:
             for tag in tags:
                 tagval = tags.get(tag)
                 tagmsg = "Adding volume tag: %s" % tag
                 if tagval:
                     tagmsg += "=%s" % tagval
                 log.info(tagmsg)
                 vol.add_tag(tag, tagval)
         if name:
             vol.add_tag("Name", name)
         self._attach_volume(self._volume, instance.id, self._device)
         self._format_volume()
         self.shutdown()
         self._warn_about_volume_hosts()
         self.log.info("Your new %sGB volume %s has been created "
                       "successfully" % (volume_size, vol.id))
         return vol
     except Exception:
         self.log.error("failed to create new volume")
         if self._volume:
             log.error(
                 "Error occured. Detaching, and deleting volume: %s" % \
                 self._volume.id)
             self._volume.detach(force=True)
             time.sleep(5)
             self._volume.delete()
         self._warn_about_volume_hosts()
         raise
开发者ID:jahangir123,项目名称:StarCluster,代码行数:35,代码来源:volume.py


示例17: execute

 def execute(self, args):
     if len(args) != 1:
         self.parser.error("please specify a <tag_name> for this cluster")
     cfg = self.cfg
     use_experimental = cfg.globals.get('enable_experimental')
     if self.opts.spot_bid is not None and not use_experimental:
         raise exception.ExperimentalFeature('Using spot instances')
     tag = self.tag = args[0]
     template = self.opts.cluster_template
     if not template:
         template = cfg.get_default_cluster_template(tag)
         log.info("Using default cluster template: %s" % template)
     cluster_exists = cluster.cluster_exists(tag, cfg)
     create = not self.opts.no_create
     if not cluster_exists and not create:
         raise exception.ClusterDoesNotExist(tag)
     scluster = cfg.get_cluster_template(template, tag)
     scluster.update(self.specified_options_dict)
     validate_running = self.opts.no_create
     validate_only = self.opts.validate_only
     try:
         scluster._validate(validate_running=validate_running)
         if validate_only:
             return
     except exception.ClusterValidationError,e:
         log.error('settings for cluster template "%s" are not valid:' % template)
         raise
开发者ID:quantumsummers,项目名称:StarCluster,代码行数:27,代码来源:cli.py


示例18: get_value

    def get_value(self, value, node):
        """
        Handle special values
        [[date]]
        [[alias]] - node name
        [[localuser]] - user name of person that started cluster, 
            according to machine cluster started from
        """
        auto_pattern = r'\[\[(.+)\]\]'
        auto_v = re.match(auto_pattern, value)
        if auto_v:
            special_value = auto_v.group(1).strip()
            if special_value == 'date':
                return datetime.utcnow().strftime('%c UTC')
            if special_value == 'alias':
                return node.alias
#            if special_value == 'master':
#                return master.alias
            if special_value == 'localuser':
                return getpass.getuser()
            log.error(("Tagging: <%s> appears to be a patterned tag, but " 
                    "no special_value found. Tagging as <%s>.") % 
                    (value, special_value) )
            return special_value
        else:
            return value
开发者ID:rartzi,项目名称:raAWSLab,代码行数:26,代码来源:tagger.py


示例19: _eval_remove_node

 def _eval_remove_node(self):
     """
     This function uses the sge stats to decide whether or not to
     remove a node from the cluster.
     """
     qlen = len(self.stat.get_queued_jobs())
     if qlen != 0:
         return
     if not self.has_cluster_stabilized():
         return
     num_nodes = len(self._cluster.nodes)
     if num_nodes <= self.min_nodes:
         log.info("Not removing nodes: already at or below minimum (%d)"
                  % self.min_nodes)
         return
     max_remove = num_nodes - self.min_nodes
     log.info("Looking for nodes to remove...")
     remove_nodes = self._find_nodes_for_removal(max_remove=max_remove)
     if not remove_nodes:
         log.info("No nodes can be removed at this time")
     for node in remove_nodes:
         if node.update() != "running":
             log.error("Node %s is already dead - not removing" %
                       node.alias)
             continue
         log.warn("Removing %s: %s (%s)" %
                  (node.alias, node.id, node.dns_name))
         try:
             self._cluster.remove_node(node)
             self.__last_cluster_mod_time = utils.get_utc_now()
         except Exception:
             log.error("Failed to remove node %s" % node.alias,
                       exc_info=True)
开发者ID:ricrogz,项目名称:StarCluster,代码行数:33,代码来源:__init__.py


示例20: bug_found

 def bug_found(self):
     log.error("Oops! Looks like you've found a bug in StarCluster")
     log.error("Debug file written to: %s" % static.DEBUG_FILE)
     log.error("Look for lines starting with PID: %s" % static.PID)
     log.error("Please submit this file, minus any private information,")
     log.error("to [email protected]")
     sys.exit(1)
开发者ID:agua,项目名称:StarCluster,代码行数:7,代码来源:cli.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python log.info函数代码示例发布时间:2022-05-27
下一篇:
Python log.debug函数代码示例发布时间: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