Skip to content

Commit 3383dfe

Browse files
Merge pull request #194 from runpod/1.3.1-prep
1.3.1 prep
2 parents 90ff90d + 5bc87c2 commit 3383dfe

File tree

9 files changed

+58
-12
lines changed

9 files changed

+58
-12
lines changed

.github/workflows/vhs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: vhs
22
on:
3-
push:
4-
branches-ignore:
5-
- main
3+
# push:
4+
# branches-ignore:
5+
# - main
66

77
workflow_dispatch:
88

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Change Log
22

3-
## Release 1.3.1 (10/29/23)
3+
## Release 1.3.1 (10/30/23)
44

55
### Added
66

docs/cli/demos/config.gif

240 Bytes
Loading

docs/cli/demos/help.gif

227 Bytes
Loading

docs/cli/demos/ssh.gif

116 Bytes
Loading

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pillow >= 9.5.0
1111
prettytable >= 3.8.0
1212
py-cpuinfo >= 9.0.0
1313
python-dotenv >= 1.0.0
14+
inquirerpy == 0.3.4
1415
requests >= 2.31.0
1516
tomli >= 2.0.1
1617
tomlkit >= 0.12.1

runpod/cli/groups/project/commands.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
'''
44

55
import os
6+
import sys
67
import click
8+
from InquirerPy import prompt as cli_select
79

10+
from runpod import get_user
811
from .functions import (
912
create_new_project, launch_project, start_project_api, create_project_endpoint
1013
)
@@ -24,6 +27,12 @@ def project_cli():
2427
@click.option('--init', '-i', 'init_current_dir', is_flag=True, default=False)
2528
def new_project_wizard(project_name, model_type, model_name, init_current_dir):
2629
""" Create a new project. """
30+
network_volumes = get_user()['networkVolumes']
31+
if len(network_volumes) == 0:
32+
click.echo("You do not have any network volumes.")
33+
click.echo("Please create a network volume (https://runpod.io/console/user/storage) and try again.") # pylint: disable=line-too-long
34+
sys.exit(1)
35+
2736
click.echo("Creating a new project...")
2837

2938
if init_current_dir:
@@ -34,8 +43,24 @@ def new_project_wizard(project_name, model_type, model_name, init_current_dir):
3443

3544
validate_project_name(project_name)
3645

37-
runpod_volume_id = click.prompt(
38-
" > Enter a network storage ID (https://runpod.io/console/user/storage)", type=str)
46+
def print_net_vol(vol):
47+
return {
48+
'name':f"{vol['id']}: {vol['name']} ({vol['size']} GB, {vol['dataCenterId']})",
49+
'value':vol['id']
50+
}
51+
52+
network_volumes = list(map(print_net_vol,network_volumes))
53+
questions = [
54+
{
55+
'type': 'rawlist',
56+
'name': 'volume-id',
57+
'qmark': '',
58+
'amark': '',
59+
'message': ' > Select a Network Volume:',
60+
'choices': network_volumes
61+
}
62+
]
63+
runpod_volume_id = cli_select(questions)['volume-id']
3964

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

runpod/cli/groups/project/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def create_new_project(project_name, runpod_volume_id, python_version, # pylint:
7070
project_table = table()
7171
project_table.add("uuid", project_uuid)
7272
project_table.add("name", project_name)
73-
project_table.add("base_image", "runpod/base:0.1.0")
73+
project_table.add("base_image", "runpod/base:0.2.1")
7474
project_table.add("gpu_types", [
7575
"NVIDIA RTX A4000", "NVIDIA RTX A4500", "NVIDIA RTX A5000",
7676
"NVIDIA GeForce RTX 3090", "NVIDIA RTX A6000"])

tests/test_cli/test_cli_groups/test_project_commands.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,30 @@ class TestProjectCLI(unittest.TestCase):
1616
def setUp(self):
1717
self.runner = CliRunner()
1818

19+
def test_new_project_wizard_no_network_volumes(self):
20+
'''
21+
Tests the new_project_wizard command with no network volumes.
22+
'''
23+
with patch('runpod.cli.groups.project.commands.get_user') as mock_get_user:
24+
mock_get_user.return_value = {'networkVolumes':[]}
25+
26+
result = self.runner.invoke(new_project_wizard)
27+
28+
self.assertEqual(result.exit_code, 1)
29+
self.assertIn("You do not have any network volumes.", result.output)
1930

2031
def test_new_project_wizard_success(self):
2132
'''
2233
Tests the new_project_wizard command.
2334
'''
2435
with patch('click.prompt') as mock_prompt, \
2536
patch('click.confirm', return_value=True) as mock_confirm, \
26-
patch('runpod.cli.groups.project.commands.create_new_project') as mock_create:
27-
28-
mock_prompt.side_effect = ['TestProject', 'XYZ_VOLUME', '3.10']
37+
patch('runpod.cli.groups.project.commands.create_new_project') as mock_create, \
38+
patch('runpod.cli.groups.project.commands.get_user') as mock_get_user, \
39+
patch('runpod.cli.groups.project.commands.cli_select') as mock_select:
40+
mock_get_user.return_value = {'networkVolumes':[{ 'id': 'XYZ_VOLUME', 'name': 'XYZ_VOLUME', 'size': 100, 'dataCenterId': 'XYZ' }]} # pylint: disable=line-too-long
41+
mock_prompt.side_effect = ['TestProject', '3.10']
42+
mock_select.return_value = {'volume-id': 'XYZ_VOLUME'}
2943

3044
result = self.runner.invoke(new_project_wizard, ['--type', 'llama2', '--model', 'meta-llama/Llama-2-7b']) # pylint: disable=line-too-long
3145

@@ -43,8 +57,11 @@ def test_new_project_wizard_success_init_current_dir(self):
4357
with patch('click.prompt') as mock_prompt, \
4458
patch('click.confirm', return_value=True) as mock_confirm, \
4559
patch('runpod.cli.groups.project.commands.create_new_project') as mock_create, \
60+
patch('runpod.cli.groups.project.commands.get_user') as mock_get_user, \
61+
patch('runpod.cli.groups.project.commands.cli_select') as mock_select, \
4662
patch('os.getcwd') as mock_getcwd:
47-
63+
mock_get_user.return_value = {'networkVolumes':[{ 'id': 'XYZ_VOLUME', 'name': 'XYZ_VOLUME', 'size': 100, 'dataCenterId': 'XYZ' }]} # pylint: disable=line-too-long
64+
mock_select.return_value = {'volume-id': 'XYZ_VOLUME'}
4865
mock_prompt.side_effect = ['XYZ_VOLUME', '3.10']
4966

5067
self.runner.invoke(new_project_wizard, ['--init'])
@@ -56,7 +73,10 @@ def test_new_project_wizard_invalid_name(self):
5673
'''
5774
Tests the new_project_wizard command with an invalid project name.
5875
'''
59-
result = self.runner.invoke(new_project_wizard, ['--name', 'Invalid/Name'])
76+
with patch('runpod.cli.groups.project.commands.get_user') as mock_get_user:
77+
mock_get_user.return_value = {'networkVolumes':["XYZ_VOLUME"]}
78+
79+
result = self.runner.invoke(new_project_wizard, ['--name', 'Invalid/Name'])
6080

6181
self.assertEqual(result.exit_code, 2)
6282
self.assertIn("Project name contains an invalid character", result.output)

0 commit comments

Comments
 (0)