本文整理汇总了Python中FileDict.FileDict.flush方法的典型用法代码示例。如果您正苦于以下问题:Python FileDict.flush方法的具体用法?Python FileDict.flush怎么用?Python FileDict.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileDict.FileDict
的用法示例。
在下文中一共展示了FileDict.flush方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fromDir
# 需要导入模块: from FileDict import FileDict [as 别名]
# 或者: from FileDict.FileDict import flush [as 别名]
#.........这里部分代码省略.........
self.prepared = True
def setSubmission(self, class_path, main_class, args, jar=None, xmx='2G', mem_free='3G', \
profile=False, asserts=True, actuallySubmit=False):
f = codecs.open(os.path.join(self.home, 'command_line_args.txt'), 'w', 'utf-8')
for a in args:
f.write(a + '\n')
f.close()
xmx = canonicalMemoryDescription(xmx)
mem_free = canonicalMemoryDescription(mem_free)
if jar is None: jar = 'None'
self.metaOpt.setValue('jar', jar)
self.metaOpt.setValue('main_class', main_class)
self.metaOpt.setValue('class_path', class_path)
self.metaOpt.setValue('xmx', xmx)
self.qsubOpt.setValue('mem_free', mem_free)
self.metaOpt.setValue('profile', bool2str(profile))
self.metaOpt.setValue('asserts', bool2str(asserts))
self.prepare()
if actuallySubmit:
self.submit()
def submit(self):
# don't submit the same job twice
assert self.submittedAt() is None
assert self.jid() is None
assert self.prepared
qsubScript = self.qsubScript()
self.metaOpt.setValue('submitted', timestamp())
self.metaOpt.flush()
self.javaOpt.flush()
self.qsubOpt.flush()
r = subprocess.check_output("qsub -N %s %s" % (self.name, qsubScript), shell=True)
jid = int(r.split()[2])
self.metaOpt.setValue('jid', jid, flush=True)
print "submitted job \"%s\" (%d)" % (self.name, jid)
def submittedAt(self):
s = self.metaOpt.getValue('submitted')
if s: return parsetime(s)
else: return None
def jid(self):
s = self.metaOpt.getValue('jid')
if s: return int(s)
else: return None
def failed(self):
if self.recentlySubmitted():
return False
f = self.newestLog()
if not f:
print 'there is no log file, assuming it failed!'
else:
return self.f_hasFailed(f)
def recentlySubmitted(self):
'''
give qsub some time to get its stuff together...
for the first 5 seconds after submitting, just assume the
job is running normally
'''