本文整理汇总了Python中google3.enterprise.legacy.util.E.access方法的典型用法代码示例。如果您正苦于以下问题:Python E.access方法的具体用法?Python E.access怎么用?Python E.access使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类google3.enterprise.legacy.util.E
的用法示例。
在下文中一共展示了E.access方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import access [as 别名]
def main(unused_args):
if not E.access([E.LOCALHOST], FLAGS.enthome, 'rd'):
sys.exit("Invalid enthome %s" % FLAGS.enthome)
if ( not FLAGS.box_keys_dir or
not E.access([E.LOCALHOST], FLAGS.box_keys_dir, 'rwd') ):
sys.exit("Invalid box_keys_dir %s" % FLAGS.box_keys_dir)
if ( not FLAGS.license_keys_dir or
not E.access([E.LOCALHOST], FLAGS.license_keys_dir, 'rwd') ):
sys.exit("Invalid license_keys_dir %s" % FLAGS.license_keys_dir)
if FLAGS.installstate not in ["INSTALL", "ACTIVE", "SERVE", "TEST"]:
sys.exit("Invalid --installstate %s" % FLAGS.installstate)
reset_index.SetResetStatusCacheTimeout(FLAGS.reset_status_cache_timeout)
as = adminrunner_server.AdminRunnerServer(FLAGS.enthome,
FLAGS.installstate,
FLAGS.port,
FLAGS.box_keys_dir,
FLAGS.license_keys_dir)
# make sure we have been given a config file
if (not as.cfg.getGlobalParam(C.ENT_SYSTEM_HAS_VALID_CONFIG) and
as.cfg.getInstallState() != 'INSTALL'):
logging.fatal("adminrunner doesn't have a config file; you must "\
"install a conf rpm or run it with "\
"--installstate=INSTALL (for migration)")
return # just in case fatal doesn't exit
示例2: GetBorgmonVarValueCached
# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import access [as 别名]
if (value and scheduledCrawlOn):
value = GetBorgmonVarValueCached('scheduledCrawlRunning',
'scheduled_crawl_is_running')
return value
def main():
try:
argv = FLAGS(sys.argv) # parse flags
except flags.FlagsError, e:
sys.exit('%s\n%s' % (e, __doc__))
if (len(argv) < 2):
sys.exit(__doc__)
query_var = argv[1]
if FLAGS.logdir:
if E.access([E.LOCALHOST], FLAGS.logdir, 'rwd'):
# One log file per day, so as not to clutter the log directory
# if this process is run often.
# We can use localtime since this does not surface to the user.
logfile = '%s/snmphelper_%s' % (
FLAGS.logdir,
time.strftime('%Y%m%d', time.localtime(time.time())))
logging.info('Writing log to %s' % logfile)
logging.set_logfile(open(logfile, 'a'))
else:
logging.warn('Invalid log directory %s' % FLAGS.logdir)
try:
if query_var == 'crawlRunning':
# special case, not a system status or borgmon variable
print GetCrawlPauseStatus()
else:
示例3: createDataDirs
# 需要导入模块: from google3.enterprise.legacy.util import E [as 别名]
# 或者: from google3.enterprise.legacy.util.E import access [as 别名]
def createDataDirs(self, machines, onlyifneeded=false, node_replacement=0):
"""
Create the directories for an index.
Note that this function will get executed when a node is added back to the
cluster.
Input: onlyifneeded: If true, createDataDirs will only proceed if necessary;
if search.config is missing, we assume enterprise-data needs to be re-created
@return boolean Success status
"""
if onlyifneeded:
# The presence or absence of search.config indicates if we need to
# re-create the directories
config = '%s/search.config' % self.getGlobalParam(C.DATADIR)
if E.access(machines, config, 'f'):
logging.info('createDataDirs: search.config already exists')
return true
else:
logging.info("createDataDirs: search.config doesn't exist; re-creating")
logging.info("Create enterprise datadir...")
if not data_directory.create(
self.getGlobalParam(C.DATADISK),
self.getGlobalParam("ENT_BIGFILE_DATADISKS"),
self.getGlobalParam(C.DATACHUNK_PREFIX),
"enterprise",
self.getGlobalParam(C.BIN_DIRS),
machines):
logging.error("Error creating datadir")
return false
logging.info("Create querycache datadir...")
if not data_directory.create(
"%s/../querycache" % self.getGlobalParam(C.DATADISK),
self.getGlobalParam("ENT_BIGFILE_DATADISKS"),
"%s/../querycache" % self.getGlobalParam(C.DATACHUNK_PREFIX),
"cache",
self.getGlobalParam(C.BIN_DIRS),
machines):
logging.error("Error creating datadir")
return false
# Create FEEDS_DIR and FEED_STATUS_DIR for one-way
if not self.getGlobalParam(C.GFS_CELL):
cmnd = "mkdir -p %s; mkdir -p %s" % (self.getGlobalParam('FEEDS_DIR'),
self.getGlobalParam('FEED_STATUS_DIR'))
res = E.exe(cmnd)
logging.info("Result of command %s is %d" % (cmnd, res))
# Create ONEBOX_LOGS_DIR for one-way
if not self.getGlobalParam(C.GFS_CELL):
cmnd = "mkdir -p %s" % self.getGlobalParam('ONEBOX_LOGS_DIR')
res = E.exe(cmnd)
logging.info("Result of command %s is %d" % (cmnd, res))
# Create directory for rt-index cache
if self.getGlobalParam('RTSLAVE_LOCAL_CACHE_DIR'):
d = self.getGlobalParam('RTSLAVE_LOCAL_CACHE_DIR')
out = []
cmd = "mkdir -p %s; test -d %s" % (d,d)
if E.ERR_OK != E.execute(machines, cmd, out, false):
logging.error("Error creating cache directory for rtslave: %s" % out)
return false
# Ram cache directory is the mount point itself, so we don't need to create it.
#self.getGlobalParam('RTSLAVE_RAM_DIR_FOR_INDEX_CACHING')
return true