本文整理汇总了Python中cloudmesh_base.Shell.Shell.mkdir方法的典型用法代码示例。如果您正苦于以下问题:Python Shell.mkdir方法的具体用法?Python Shell.mkdir怎么用?Python Shell.mkdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cloudmesh_base.Shell.Shell
的用法示例。
在下文中一共展示了Shell.mkdir方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import mkdir [as 别名]
def open(self, filename=None):
if filename is not None:
self.filename = filename
else:
self.filename = path_expand(self.pbs.database_filename())
path = os.path.dirname(self.filename)
Shell.mkdir(path)
self.load()
示例2: create_cloudmesh_yaml
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import mkdir [as 别名]
def create_cloudmesh_yaml(filename):
if not os.path.exists(filename):
path = os.path.dirname(filename)
if not os.path.isdir(path):
Shell.mkdir(path)
etc_path = os.path.dirname(cloudmesh_client.__file__)
etc_file = os.path.join(etc_path, "etc", "cloudmesh.yaml")
to_dir = path_expand("~/.cloudmesh")
shutil.copy(etc_file, to_dir)
Console.ok("~/.cloudmesh/cloudmesh.yaml created")
示例3: create_config
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import mkdir [as 别名]
def create_config(cls, username):
dir_path = path_expand("~/.cloudmesh/{0}".format("accounts"))
if not os.path.exists(dir_path):
Shell.mkdir(dir_path)
filename = path_expand("~/.cloudmesh/{0}/{1}".format("accounts", ".config"))
data = dict(user=username)
with open(filename, 'w') as outfile:
outfile.write(yaml.dump(data, default_flow_style=True))
示例4: run
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import mkdir [as 别名]
def run(self):
banner("Setup the cmd3.yaml file")
cmd3_yaml = path_expand("~/.cloudmesh/cmd3.yaml")
if os.path.isfile(cmd3_yaml):
print ("ERROR: the file {0} already exists".format(cmd3_yaml))
print
print ("If you like to reinstall it, please remove the file")
else:
print ("Copy file: {0} -> {1} ".format(path_expand("etc/cmd3.yaml"), cmd3_yaml))
Shell.mkdir("~/.cloudmesh")
shutil.copy("etc/cmd3.yaml", path_expand("~/.cloudmesh/cmd3.yaml"))
示例5: start
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import mkdir [as 别名]
def start(self):
"""
Starts the cloudmesh_job process in the background.
"""
for key in ['dbpath', 'logpath']:
path = os.dirname(self.config[key])
Shell.mkdir(path)
r = Shell.sh("mongod", "--fork",
"--logpath", self.config['logpath'],
"--prot", self.config['port'],
'--dbpath', self.config['dbpath'])
print (r)
# TODO
# get the id from r
self.config['id'] = None # put here the real id
示例6: deploy
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import mkdir [as 别名]
def deploy(self):
"""
creates the directories if they do not exist
"""
try:
r = Shell.mkdir(self.db_path)
except Exception, e:
Console.error("Problem creating the database directory {:}".format(self.db_path))
print(e)
示例7: run
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import mkdir [as 别名]
def run(self):
banner("Setup the cloudmesh management yaml files ")
yamlfiles = ['cloudmesh_user.yaml', 'cloudmesh_project.yaml']
dir_path = path_expand("~/.cloudmesh/{0}".format("accounts"))
if not os.path.exists(dir_path):
Shell.mkdir(dir_path)
for yamlfile in yamlfiles:
filename = path_expand("~/.cloudmesh/{0}/{1}".format("accounts", yamlfile))
if os.path.isfile(filename):
Console.error("File {0} already exists. If you like to reinstall it, please remove the file".format(yamlfile))
else:
Console.info("Copying file: {0} -> {1} ".format(path_expand("etc/{0}/{1}".format("accounts", yamlfile)), filename))
shutil.copy("etc/{0}/{1}".format("accounts", yamlfile), path_expand("~/.cloudmesh/{0}/{1}".format("accounts", yamlfile)))
示例8: config_dir_setup
# 需要导入模块: from cloudmesh_base.Shell import Shell [as 别名]
# 或者: from cloudmesh_base.Shell.Shell import mkdir [as 别名]
def config_dir_setup(filename):
path = os.path.dirname(filename)
if not os.path.isdir(path):
Shell.mkdir(path)