Skip to content

Commit 91eae84

Browse files
Merge pull request #193 from DireLines/networkVolumeDropdown
Network volume dropdown
2 parents 0bc655f + 6503413 commit 91eae84

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

runpod/cli/groups/project/commands.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,26 @@ def new_project_wizard(project_name, model_type, model_name, init_current_dir):
3737
validate_project_name(project_name)
3838

3939
network_volumes = get_user()['networkVolumes']
40-
def print_net_vol(vol):
41-
return {'name':f"{vol['id']}: {vol['name']} ({vol['size']} GB, {vol['dataCenterId']})",
42-
'value':vol['id']}
43-
network_volumes = list(map(print_net_vol,network_volumes))
44-
questions = [
45-
{
46-
'type': 'rawlist',
47-
'name': 'volume-id',
48-
'qmark': '',
49-
'amark': '',
50-
'message': ' > Select a Network Volume:',
51-
'choices': network_volumes
52-
}
53-
]
54-
runpod_volume_id = prompt(questions)['volume-id']
40+
runpod_volume_id = ''
41+
if len(network_volumes) == 0:
42+
runpod_volume_id = click.prompt(
43+
" > Create a network volume (https://runpod.io/console/user/storage), then paste its id here", type=str)
44+
else:
45+
def print_net_vol(vol):
46+
return {'name':f"{vol['id']}: {vol['name']} ({vol['size']} GB, {vol['dataCenterId']})",
47+
'value':vol['id']}
48+
network_volumes = list(map(print_net_vol,network_volumes))
49+
questions = [
50+
{
51+
'type': 'rawlist',
52+
'name': 'volume-id',
53+
'qmark': '',
54+
'amark': '',
55+
'message': ' > Select a Network Volume:',
56+
'choices': network_volumes
57+
}
58+
]
59+
runpod_volume_id = prompt(questions)['volume-id']
5560

5661
python_version = click.prompt(
5762
" > Select a Python version, or press enter to use the default",

0 commit comments

Comments
 (0)