def init():
"""
Interactively initialize a Valohai project.
"""
project = get_project()
if project:
error(
'The directory {directory} is already linked to {name}. Please unlink the directory first.'.format(
directory=project.directory,
name=project.name,
)
)
sys.exit(1)
click.secho('Hello! This wizard will help you start a Valohai compatible project.', fg='green', bold=True)
directory = get_project_directory()
if not click.confirm(
'First, let\'s make sure {dir} is the root directory of your project. Is that correct?'.format(
dir=click.style(directory, bold=True),
)
): # pragma: no cover
click.echo('Alright! Please change to the root directory of your project and try again.')
return
valohai_yaml_path = os.path.join(directory, 'valohai.yaml')
if not os.path.isfile(valohai_yaml_path):
click.echo('Looks like you don\'t have a Valohai.yaml file. Let\'s create one!')
yaml_wizard(directory)
else:
click.echo('There is a Valohai.yaml file in this directory, so let\'s skip the creation wizard.')
try:
get_host_and_token()
except NotLoggedIn: # pragma: no cover
error('Please log in with `vh login` before continuing.')
sys.exit(3)
link_or_create_prompt(directory)
width = min(70, click.get_terminal_size()[0])
click.secho('*' * width, fg='green', bold=True)
click.echo(DONE_TEXT.strip().format(
command=click.style('vh exec run --adhoc --watch execute', bold=True),
))
click.secho('*' * width, fg='green', bold=True)
评论列表
文章目录