Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced deploy #220

Merged
merged 33 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8c97085
improve deploy logic - separate dev and prod part 1
DireLines Nov 10, 2023
6ed7f06
reversed branches
DireLines Nov 10, 2023
2b2a7f5
helpers needed for redeploy
DireLines Nov 10, 2023
4146d1e
bug fixes for redeploy
DireLines Nov 10, 2023
47a7c1e
Merge pull request #219 from DireLines/main
justinmerrell Nov 12, 2023
d88a8f1
fix: linting
justinmerrell Nov 12, 2023
63494e0
Update functions.py
justinmerrell Nov 12, 2023
d417e53
Update functions.py
justinmerrell Nov 12, 2023
7b5e714
Update functions.py
justinmerrell Nov 12, 2023
b6fdb38
Update functions.py
justinmerrell Nov 12, 2023
27ede5d
Update test_project_functions.py
justinmerrell Nov 12, 2023
a6d2be5
fix: listing and tests
justinmerrell Nov 12, 2023
5ab5944
fix: tests and linting
justinmerrell Nov 12, 2023
6210655
Update functions.py
justinmerrell Nov 12, 2023
f0ed7b7
Update test_project_functions.py
justinmerrell Nov 12, 2023
1459127
Update test_project_functions.py
justinmerrell Nov 12, 2023
72450b8
Update test_project_functions.py
justinmerrell Nov 12, 2023
76c2f67
Update test_project_functions.py
justinmerrell Nov 13, 2023
0e1a029
Update test_project_functions.py
justinmerrell Nov 13, 2023
a1de81e
fix: add missing tests
justinmerrell Nov 13, 2023
04faade
fix: missing coverage
justinmerrell Nov 13, 2023
c99e408
Update test_project_functions.py
justinmerrell Nov 13, 2023
ee663e2
fix: tests
justinmerrell Nov 13, 2023
703e952
Update test_project_functions.py
justinmerrell Nov 13, 2023
1f062e2
Update test_project_functions.py
justinmerrell Nov 13, 2023
045fef5
Update test_project_functions.py
justinmerrell Nov 13, 2023
20b8136
Update functions.py
justinmerrell Nov 13, 2023
7a95891
Update test_project_functions.py
justinmerrell Nov 13, 2023
f923183
Update test_project_functions.py
justinmerrell Nov 13, 2023
195852c
fix: tests
justinmerrell Nov 13, 2023
a73c21e
fix: tests
justinmerrell Nov 13, 2023
fc2f7bd
Update test_project_functions.py
justinmerrell Nov 13, 2023
70bdf37
Update test_project_functions.py
justinmerrell Nov 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: tests
  • Loading branch information
justinmerrell committed Nov 13, 2023
commit ee663e2233d743828455c929541edc6161416f79
8 changes: 8 additions & 0 deletions examples/api/get_endpoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
""" Get all endpoints from the API """


import runpod

endpoints = runpod.get_endpoints()

print(endpoints)
8 changes: 7 additions & 1 deletion runpod/cli/groups/project/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from runpod import get_pods, create_pod, get_endpoints
from runpod import error as rp_error


def validate_project_name(name):
'''
Validate the project name.
Expand All @@ -19,6 +20,7 @@ def validate_project_name(name):
raise click.BadParameter(f"Project name contains an invalid character: '{match.group()}'.")
return name


def get_project_pod(project_id: str):
"""Check if a project pod exists.
Return the pod_id if it exists, else return None.
Expand All @@ -29,16 +31,18 @@ def get_project_pod(project_id: str):

return None


def get_project_endpoint(project_id: str):
"""Check if a project endpoint exists.
Return the endpoint_id if it exists, else return None.
Return the endpoint if it exists, else return None.
"""
for endpoint in get_endpoints():
if project_id in endpoint['name']:
return endpoint

return None


def copy_template_files(template_dir, destination):
"""Copy the template files to the destination directory."""
for item in os.listdir(template_dir):
Expand All @@ -49,6 +53,7 @@ def copy_template_files(template_dir, destination):
else:
shutil.copy2(source_item, destination_item)


def attempt_pod_launch(config, environment_variables):
"""Attempt to launch a pod with the given configuration."""
for gpu_type in config['project'].get('gpu_types', []):
Expand All @@ -72,6 +77,7 @@ def attempt_pod_launch(config, environment_variables):
print("Unavailable.")
return None


def load_project_config():
"""Load the project config file."""
project_config_file = os.path.join(os.getcwd(), 'runpod.toml')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli/test_cli_groups/test_project_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def test_create_project_endpoint(self, mock_get_project_endpoint, mock_get_proje

self.assertEqual(result, 'test_endpoint_id')
mock_create_template.assert_called_once_with(
name='test_project-endpoint | 123456| 123456',
name='test_project-endpoint | 123456 | 123456',
image_name='test_image',
container_disk_in_gb=10,
docker_start_cmd='bash -c ". /runpod-volume/123456/prod/venv/bin/activate && python -u /runpod-volume/123456/prod/test_project/handler.py"', # pylint: disable=line-too-long
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli/test_cli_groups/test_project_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_get_project_endpoint_exists(self, mock_get_endpoints):
"""Test the get_project_endpoint function when the project endpoint exists."""
mock_get_endpoints.return_value = [{"name": "test-1234", "id": "endpoint_id"}]
result = get_project_endpoint("1234")
self.assertEqual(result, "endpoint_id")
self.assertEqual(result, {"name": "test-1234", "id": "endpoint_id"})

@patch("os.listdir")
@patch("os.path.isdir", return_value=False)
Expand Down