本文整理汇总了Python中libs.System.MogamiLog.debug方法的典型用法代码示例。如果您正苦于以下问题:Python MogamiLog.debug方法的具体用法?Python MogamiLog.debug怎么用?Python MogamiLog.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libs.System.MogamiLog
的用法示例。
在下文中一共展示了MogamiLog.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def __init__(self, fsize, dest, data_path, flag, *mode):
MogamiFile.__init__(self, fsize)
self.remote = True
self.dest = dest
self.data_path = data_path
self.flag = flag
self.mode = mode
self.prenum = 1
# calculation of the number of blocks
self.blnum = self.fsize / conf.blsize
if self.fsize % conf.blsize != 0:
self.blnum += 1
# initialization of read buffer
self.r_data = tuple([MogamiBlock() for i in range(self.blnum + 1)])
self.r_buflock = threading.Lock()
MogamiLog.debug("create r_data 0-%d block" % (len(self.r_data)-1))
# initialization of write buffer
self.w_list = []
self.w_data = cStringIO.StringIO()
self.w_buflock = threading.Lock()
self.w_len = 0
# for buffer of dirty data
self.dirty_dict = {}
示例2: chmod
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def chmod(self, path, mode):
MogamiLog.debug("path = %s w/ mode %s" % (path, oct(mode)))
try:
os.chmod(path, mode)
ans = 0
except os.error, e:
ans = e.errno
示例3: read
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def read(self, length, offset):
"""read handler.
return strings read from file
@param length request size of read
@param offset offset of read request
"""
MogamiLog.debug("**read offset=%d, length=%d" % (offset, length))
# check access pattern
#self.access_pattern.check_mode(offset, length)
#self.access_pattern.change_info(offset, ret_str.tell(),
# last_readbl)
"""
if conf.prefetch == True:
if last_readbl != self.access_pattern.last_bl:
#MogamiLog.debug("read: prenum %d \n" % (self.prenum))
if conf.force_prenum == True:
self.prenum = conf.prenum
blnum_list = []
prereq_list = self.access_pattern.return_need_block(
(last_readbl + 1) * 1024 * 1024, self.prenum,
self.blnum)
for prereq in prereq_list:
if prereq > self.blnum:
break
if self.bldata[prereq].state == 0:
blnum_list.append(prereq)
if len(blnum_list) != 0:
self.request_prefetch(blnum_list)
self.calc_time += end_t - start_t"""
return self.mogami_file.read(length, offset)
示例4: mkdir
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def mkdir(self, path, mode):
MogamiLog.debug("path = %s mode = %o" % (path, mode))
try:
os.mkdir(path, mode)
ans = 0
except os.error, e:
ans = e.errno
示例5: utime
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def utime(self, path, times):
MogamiLog.debug("path = %s, times = %s" % (path, str(times)))
try:
os.utime(path, times)
ans = 0
except os.error, e:
ans = e.errno
示例6: rmdir
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def rmdir(self, path):
MogamiLog.debug("path=%s" % (path))
try:
os.rmdir(path)
ans = 0
except os.error, e:
ans = e.errno
示例7: rename
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def rename(self, oldpath, newpath):
MogamiLog.debug(oldpath + ' -> ' + newpath)
try:
os.rename(oldpath, newpath)
ans = 0
except os.error, e:
ans = e.errno
示例8: release
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def release(self, flags):
if conf.ap == True:
start_t = time.time()
MogamiLog.debug("** release **")
fsize = self.mogami_file.release(flags)
ans = m_channel.release_req(self.metafd, fsize)
# delete file size cache
if self.path in file_size_dict:
del file_size_dict[self.path]
if conf.ap == True:
# prepare data to tell access pattern
myname = m_channel.getmyname()
(read_data, write_data) = self.access_pattern.mk_form_data()
pid = self.access_pattern.pid
cmd_args = self.access_pattern.cmd_args
path = self.access_pattern.path
end_t = time.time()
self.took_time += end_t - start_t
if cmd_args != None:
# process access pattern history (may be inserted to queue)
file_access_queue.put((cmd_args, pid, path, myname,
self.took_time, self.created,
read_data, write_data))
return 0
示例9: chown
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def chown(self, path, uid, gid):
MogamiLog.debug("path=%s uid=%d gid=%d" % (path, uid, gid))
try:
os.chown(path, uid, gid)
ans = 0
except os.error, e:
ans = e.errno
示例10: symlink
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def symlink(self, frompath, topath):
MogamiLog.debug("frompath = %s, topath = %s" % (frompath, topath))
try:
os.symlink(frompath, topath)
ans = 0
except os.error, e:
ans = e.errno
示例11: __init__
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def __init__(self, path, flag, *mode):
"""Initializer called when opened.
@param path file path
@param flag flags with open(2)
@param *mode file open mode (may not be specified)
"""
MogamiLog.debug("** open ** path = %s, flag = %s, mode = %s" %
(path, str(flag), str(mode)))
if conf.ap == True:
start_t = time.time()
# parse argurments
self.path = path
self.flag = flag
self.mode = mode
(ans, dest, self.metafd, data_path, self.fsize,
self.created) = m_channel.open_req(path, flag, *mode)
if ans != 0: # error on metadata server
e = IOError()
e.errno = ans
raise e
if dest == 'self':
self.mogami_file = FileManager.MogamiLocalFile(
self.fsize, data_path, flag, *mode)
else:
self.mogami_file = FileManager.MogamiRemoteFile(
self.fsize, dest, data_path, flag, *mode)
ans = self.mogami_file.create_connections(channels)
if ans != 0:
MogamiLog.error("open error !!")
e = IOError()
e.errno = ans
raise e
# register file size to file size dictionary
file_size_dict[path] = self.fsize
if conf.ap == True:
"""Get Id list to know pid.
list = {gid: pid: uid}
And then get the command from pid.
"""
try:
id_list = self.GetContext()
pid = id_list['pid']
f = open(os.path.join("/proc", str(pid), "cmdline"), 'r')
cmd_args = f.read().rsplit('\x00')[:-1]
except Exception, e:
# with any error, pass this part of process
cmd_args = None
pid = -1
self.access_pattern = FileManager.MogamiAccessPattern(
path, cmd_args, pid)
end_t = time.time()
self.took_time = end_t - start_t
示例12: unlink
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def unlink(self, path):
"""unlink handler.
@param path path name to unlink
"""
MogamiLog.debug("** unlink ** path = %s" % (path, ))
ans = m_channel.unlink_req(path)
return -ans
示例13: unlink
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def unlink(self, path):
MogamiLog.debug("path = %s" % path)
if os.path.isfile(path):
try:
(dest, data_path, fsize) = meta_file_info(path)
self.sysinfo.add_delfile(dest, data_path)
except Exception, e:
MogamiLog.error("cannot remove file contents of %s", path)
示例14: readlink
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def readlink(self, path):
print "path = " + path
MogamiLog.debug("path = %s" % path)
try:
result = os.readlink(path)
ans = 0
except os.error, e:
ans = e.errno
result = None
示例15: access
# 需要导入模块: from libs.System import MogamiLog [as 别名]
# 或者: from libs.System.MogamiLog import debug [as 别名]
def access(self, path, mode):
MogamiLog.debug("path = %s" % (path))
try:
if os.access(path, mode) == True:
ans = 0
else:
ans = errno.EACCES
except os.error, e:
ans = e.errno