本文整理汇总了Python中subprocess.Popen.rsplit方法的典型用法代码示例。如果您正苦于以下问题:Python Popen.rsplit方法的具体用法?Python Popen.rsplit怎么用?Python Popen.rsplit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subprocess.Popen
的用法示例。
在下文中一共展示了Popen.rsplit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Popen
# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import rsplit [as 别名]
# get Hail hash and Spark version to use for Jupyter notebook, if set through cluster startup metadata
spark = Popen('/usr/share/google/get_metadata_value attributes/SPARK', shell=True, stdout=PIPE).communicate()[0].strip()
hash = Popen('/usr/share/google/get_metadata_value attributes/HASH', shell=True, stdout=PIPE).communicate()[0].strip()
# default to Spark 2.0.2 if not otherwise specified through metadata
if not spark:
spark = '2.0.2'
# default to latest Hail build if none specified through metadata
if not hash:
hash = Popen(['gsutil', 'cat', 'gs://hail-common/latest-hash-spark{}.txt'.format(spark)], stdout=PIPE, stderr=PIPE).communicate()[0].strip()
# Hail jar
jar = Popen('/usr/share/google/get_metadata_value attributes/JAR', shell=True, stdout=PIPE).communicate()[0].strip()
if jar:
hail_jar = jar.rsplit('/')[-1]
jar_path = jar
else:
hail_jar = 'hail-hail-is-master-all-spark{0}-{1}.jar'.format(spark, hash)
jar_path = 'gs://hail-common/' + hail_jar
# Hail zip
zip = Popen('/usr/share/google/get_metadata_value attributes/ZIP', shell=True, stdout=PIPE).communicate()[0].strip()
if zip:
hail_zip = zip.rsplit('/')[-1]
zip_path = zip
else:
hail_zip = 'pyhail-hail-is-master-{}.zip'.format(hash)
zip_path = 'gs://hail-common/' + hail_zip
# make directory for Hail and Jupyter notebook related files