本文整理汇总了Python中starcluster.logger.log.error函数的典型用法代码示例。如果您正苦于以下问题:Python error函数的具体用法?Python error怎么用?Python error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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))
示例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)
示例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
示例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()
示例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
示例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)
示例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
示例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')
示例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)
示例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')
示例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')
示例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')
示例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')
示例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)
示例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