本文整理汇总了Python中logging.fatal方法的典型用法代码示例。如果您正苦于以下问题:Python logging.fatal方法的具体用法?Python logging.fatal怎么用?Python logging.fatal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logging
的用法示例。
在下文中一共展示了logging.fatal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: combine_setup
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def combine_setup(name, combine_type, embed_img, embed_goal, num_img_neuorons=None,
num_goal_neurons=None):
with tf.name_scope(name + '_' + combine_type):
if combine_type == 'add':
# Simple concat features from goal and image
out = embed_img + embed_goal
elif combine_type == 'multiply':
# Multiply things together
re_embed_img = tf.reshape(
embed_img, shape=[-1, num_img_neuorons / num_goal_neurons,
num_goal_neurons])
re_embed_goal = tf.reshape(embed_goal, shape=[-1, num_goal_neurons, 1])
x = tf.matmul(re_embed_img, re_embed_goal, transpose_a=False, transpose_b=False)
out = slim.flatten(x)
elif combine_type == 'none' or combine_type == 'imgonly':
out = embed_img
elif combine_type == 'goalonly':
out = embed_goal
else:
logging.fatal('Undefined combine_type: %s', combine_type)
return out
示例2: init_display
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def init_display(self, width, height, fov, z_near, z_far, rgb_shader,
d_shader):
self.init_renderer_egl(width, height)
dir_path = os.path.dirname(os.path.realpath(__file__))
if d_shader is not None and rgb_shader is not None:
logging.fatal('Does not support setting both rgb_shader and d_shader.')
if d_shader is not None:
assert rgb_shader is None
shader = d_shader
self.modality = 'depth'
if rgb_shader is not None:
assert d_shader is None
shader = rgb_shader
self.modality = 'rgb'
self.create_shaders(os.path.join(dir_path, shader+'.vp'),
os.path.join(dir_path, shader + '.fp'))
aspect = width*1./(height*1.)
self.set_camera(fov, z_near, z_far, aspect)
示例3: process_arch_str
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def process_arch_str(args, arch_str):
# This function modifies args.
args.arch, args.mapper_arch = get_default_cmp_args()
arch_vars = get_arch_vars(arch_str)
args.navtask.task_params.outputs.ego_maps = True
args.navtask.task_params.outputs.ego_goal_imgs = True
args.navtask.task_params.outputs.egomotion = True
args.navtask.task_params.toy_problem = False
if arch_vars.var1 == 'lmap':
args = process_arch_learned_map(args, arch_vars)
elif arch_vars.var1 == 'pmap':
args = process_arch_projected_map(args, arch_vars)
else:
logging.fatal('arch_vars.var1 should be lmap or pmap, but is %s', arch_vars.var1)
assert(False)
return args
示例4: __init__
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def __init__(self, robot, env, task_params, category_list=None,
building_name=None, flip=False, logdir=None,
building_loader=None, r_obj=None):
tt = utils.Timer()
tt.tic()
Building.__init__(self, building_name, robot, env, category_list,
small=task_params.toy_problem, flip=flip, logdir=logdir,
building_loader=building_loader)
self.set_r_obj(r_obj)
self.task_params = task_params
self.task = None
self.episode = None
self._preprocess_for_task(self.task_params.building_seed)
if hasattr(self.task_params, 'map_scales'):
self.task.scaled_maps = resize_maps(
self.traversible.astype(np.float32)*1, self.task_params.map_scales,
self.task_params.map_resize_method)
else:
logging.fatal('VisualNavigationEnv does not support scale_f anymore.')
self.task.readout_maps_scaled = resize_maps(
self.traversible.astype(np.float32)*1,
self.task_params.readout_maps_scales,
self.task_params.map_resize_method)
tt.toc(log_at=1, log_str='VisualNavigationEnv __init__: ')
示例5: get_args_for_config
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def get_args_for_config(config_name):
configs = config_name.split('.')
type = configs[0]
config_name = '.'.join(configs[1:])
if type == 'cmp':
args = config_cmp.get_args_for_config(config_name)
args.setup_to_run = cmp.setup_to_run
args.setup_train_step_kwargs = cmp.setup_train_step_kwargs
elif type == 'bl':
args = config_vision_baseline.get_args_for_config(config_name)
args.setup_to_run = vision_baseline_lstm.setup_to_run
args.setup_train_step_kwargs = vision_baseline_lstm.setup_train_step_kwargs
else:
logging.fatal('Unknown type: {:s}'.format(type))
return args
示例6: Send
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def Send(self, path, params, method='POST', json_response=True):
# Drop parameters with value=None. Otherwise, the string 'None' gets sent.
rpc_params = dict((str(k), v) for k, v in params.items() if v is not None)
logging.info(
'http://%s%s%s', self.host, path, rpc_params and '?%s' % '&'.join(
['%s=%s' % (k, v) for k, v in sorted(rpc_params.items())]) or '')
# "payload=None" would a GET instead a POST.
if method == 'GET':
response_data = self.rpc_server.Send(path, payload=None, **rpc_params)
else:
response_data = self.rpc_server.Send(
path, payload=urllib.urlencode(rpc_params))
if response_data.startswith('bailing'):
logging.fatal(response_data)
raise RuntimeError
elif json_response:
return simplejson.loads(response_data)
else:
return response_data
示例7: InsortBrowser
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def InsortBrowser(cls, browsers, browser):
"""Insert a browser, in-place, into a sorted list of browsers.
Args:
browsers: a list of strings (e.g. ['iPhone 3.1', 'Safari 4.1'])
browser: a list of strings
"""
browser_key = cls.BrowserKey(browser)
low, high = 0, len(browsers)
while low < high:
mid = (low + high) / 2
if browser_key < cls.BrowserKey(browsers[mid]):
high = mid
else:
low = mid + 1
if not hasattr(browsers, 'insert'):
logging.fatal('Unexpected browsers list: %s', browsers)
browsers.insert(low, browser)
示例8: __init__
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def __init__(self, config, timer, db):
self.config = config
self.timer = timer
self.db = db
self.balancer_wait_secs = self.config.sharding.balancer.wait_secs
self.balancer_sleep = self.config.sharding.balancer.ping_secs
self.timer_name = self.__class__.__name__
self.config_server = None
self.config_db = None
self.mongos_db = None
self._balancer_state_start = None
self.restored = False
# Get a DB connection
try:
if isinstance(self.db, DB):
self.connection = self.db.connection()
if not self.db.is_mongos() and not self.db.is_configsvr():
raise DBOperationError('MongoDB connection is not to a mongos or configsvr!')
else:
raise Error("'db' field is not an instance of class: 'DB'!")
except Exception, e:
logging.fatal("Could not get DB connection! Error: %s" % e)
raise DBOperationError(e)
示例9: stop_balancer
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def stop_balancer(self):
logging.info("Stopping the balancer and waiting a max of %i sec" % self.balancer_wait_secs)
wait_cnt = 0
self.timer.start(self.timer_name)
self.set_balancer(False)
while wait_cnt < self.balancer_wait_secs:
if self.check_balancer_running():
wait_cnt += self.balancer_sleep
logging.info("Balancer is still running, sleeping for %i sec(s)" % self.balancer_sleep)
sleep(self.balancer_sleep)
else:
self.timer.stop(self.timer_name)
logging.info("Balancer stopped after %.2f seconds" % self.timer.duration(self.timer_name))
return
logging.fatal("Could not stop balancer %s!" % self.db.uri)
raise DBOperationError("Could not stop balancer %s" % self.db.uri)
示例10: get_configdb_hosts
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def get_configdb_hosts(self):
try:
cmdlineopts = self.db.admin_command("getCmdLineOpts")
config_string = None
if cmdlineopts.get('parsed').get('configdb'):
config_string = cmdlineopts.get('parsed').get('configdb')
elif cmdlineopts.get('parsed').get('sharding').get('configDB'):
config_string = cmdlineopts.get('parsed').get('sharding').get('configDB')
if config_string:
return MongoUri(config_string, 27019)
elif self.db.is_configsvr():
return self.db.uri
else:
logging.fatal("Unable to locate config servers for %s!" % self.db.uri)
raise OperationError("Unable to locate config servers for %s!" % self.db.uri)
except Exception, e:
raise OperationError(e)
示例11: get_config_server
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def get_config_server(self, force=False):
if force or not self.config_server:
configdb_uri = self.get_configdb_hosts()
try:
logging.info("Found sharding config server: %s" % configdb_uri)
if self.db.uri.hosts() == configdb_uri.hosts():
self.config_db = self.db
logging.debug("Re-using seed connection to config server(s)")
else:
self.config_db = DB(configdb_uri, self.config, True)
if not self.config_db.is_replset():
raise OperationError("configsvrs must have replication enabled")
self.config_server = Replset(self.config, self.config_db)
except Exception, e:
logging.fatal("Unable to locate config servers using %s: %s!" % (self.db.uri, e))
raise OperationError(e)
示例12: __init__
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def __init__(self, manager, config, timer, base_dir, backup_dir, tailed_oplogs, backup_oplogs):
super(Resolver, self).__init__(self.__class__.__name__, manager, config, timer, base_dir, backup_dir)
self.tailed_oplogs = tailed_oplogs
self.backup_oplogs = backup_oplogs
self.compression_supported = ['none', 'gzip']
self.resolver_summary = {}
self.resolver_state = {}
self.running = False
self.stopped = False
self.completed = False
self._pool = None
self._pooled = []
self._results = {}
self.threads(self.config.oplog.resolver.threads)
try:
self._pool = Pool(processes=self.threads())
except Exception, e:
logging.fatal("Could not start oplog resolver pool! Error: %s" % e)
raise Error(e)
示例13: create_forward_rnn
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def create_forward_rnn(self):
"""
Create the forward-only RNN
Parameters
-------
:return: the logits
"""
if self.rnn_created:
logging.fatal("Trying to create the language RNN but it is already.")
# Set placeholders for input
self.inputs_ph = tf.placeholder(tf.float32, shape=[self.max_input_seq_length, None, self.input_dim],
name="inputs_ph")
self.input_seq_lengths_ph = tf.placeholder(tf.int32, shape=[None], name="input_seq_lengths_ph")
# Build the RNN
self.global_step, logits, self.prediction, self.rnn_keep_state_op, self.rnn_state_zero_op, \
_, _, self.rnn_tuple_state = self._build_base_rnn(self.inputs_ph, self.input_seq_lengths_ph, True)
# Add the saving and restore operation
self.saver_op = self._add_saving_op()
return logits
示例14: create_forward_rnn
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def create_forward_rnn(self):
"""
Create the forward-only RNN
Parameters
-------
:return: the logits
"""
if self.rnn_created:
logging.fatal("Trying to create the acoustic RNN but it is already.")
# Set placeholders for input
self.inputs_ph = tf.placeholder(tf.float32, shape=[self.max_input_seq_length, None, self.input_dim],
name="inputs_ph")
self.input_seq_lengths_ph = tf.placeholder(tf.int32, shape=[None], name="input_seq_lengths_ph")
# Build the RNN
self.global_step, logits, self.prediction, self.rnn_keep_state_op, self.rnn_state_zero_op,\
_, _, self.rnn_tuple_state = self._build_base_rnn(self.inputs_ph, self.input_seq_lengths_ph, True)
# Add the saving and restore operation
self.saver_op = self._add_saving_op()
return logits
示例15: redis
# 需要导入模块: import logging [as 别名]
# 或者: from logging import fatal [as 别名]
def redis(self):
"""
Lazy-loaded redis connection
"""
from redis import StrictRedis
import redis.exceptions
try:
url = os.environ.get('REDIS_CONNECTION_URL',
'redis://localhost:6379/0')
conn = StrictRedis.from_url(url)
conn.ping()
except redis.exceptions.ConnectionError:
logging.fatal("Redis server is not running")
raise
return conn