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

Updating branch #223

Merged
merged 43 commits into from
Nov 15, 2023
Merged
Changes from 1 commit
Commits
Show all changes
43 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
69fe168
Merge pull request #220 from runpod/enhanced-deploy
justinmerrell Nov 13, 2023
f45825a
feat: create json logs
justinmerrell Nov 14, 2023
68c5695
fix: log format
justinmerrell Nov 14, 2023
52b0ace
fix: log formatting
justinmerrell Nov 14, 2023
fea875f
fix: format more logs
justinmerrell Nov 14, 2023
513c1c7
Update rp_job.py
justinmerrell Nov 14, 2023
b6039a5
Update rp_job.py
justinmerrell Nov 14, 2023
c22b4c8
Merge pull request #221 from runpod/json-logs
justinmerrell Nov 14, 2023
4b9170c
Update CHANGELOG.md
justinmerrell Nov 14, 2023
3d78e39
Merge pull request #222 from runpod/1.3.4-Update
justinmerrell Nov 14, 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
Update functions.py
  • Loading branch information
justinmerrell committed Nov 12, 2023
commit 7b5e714b8d73bf15d005b12fa7568eeea83f82e2
70 changes: 35 additions & 35 deletions runpod/cli/groups/project/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,41 @@
STARTER_TEMPLATES = os.path.join(os.path.dirname(__file__), 'starter_templates')


def _launch_dev_pod():
""" Launch a development pod. """
config = load_project_config() # Load runpod.toml

print("Deploying development pod on RunPod...")

# Prepare the environment variables
environment_variables = {"RUNPOD_PROJECT_ID": config["project"]["uuid"]}
for variable in config['project'].get('env_vars', {}):
environment_variables[variable] = config['project']['env_vars'][variable]

# Prepare the GPU types
selected_gpu_types = config['project'].get('gpu_types', [])
if config['project'].get('gpu', None):
selected_gpu_types.append(config['project']['gpu'])

# Attempt to launch a pod with the given configuration
new_pod = attempt_pod_launch(config, environment_variables)
if new_pod is None:
print("Selected GPU types unavailable, try again later or use a different type.")
return None

print("Waiting for pod to come online... ", end="")
sys.stdout.flush()

# Wait for the pod to come online
while new_pod.get('desiredStatus', None) != 'RUNNING' or new_pod.get('runtime') is None:
new_pod = get_pod(new_pod['id'])

project_pod_id = new_pod['id']

print(f"Project {config['project']['name']} pod ({project_pod_id}) created.", end="\n\n")
return project_pod_id


# -------------------------------- New Project ------------------------------- #
def create_new_project(project_name, runpod_volume_id, cuda_version, python_version, # pylint: disable=too-many-locals, too-many-arguments, too-many-statements
model_type=None, model_name=None, init_current_dir=False):
Expand Down Expand Up @@ -99,41 +134,6 @@ def create_new_project(project_name, runpod_volume_id, cuda_version, python_vers
tomlkit.dump(toml_config, config_file)


def _launch_dev_pod():
""" Launch a development pod. """
config = load_project_config() # Load runpod.toml

print("Deploying development pod on RunPod...")

# Prepare the environment variables
environment_variables = {"RUNPOD_PROJECT_ID": config["project"]["uuid"]}
for variable in config['project'].get('env_vars', {}):
environment_variables[variable] = config['project']['env_vars'][variable]

# Prepare the GPU types
selected_gpu_types = config['project'].get('gpu_types', [])
if config['project'].get('gpu', None):
selected_gpu_types.append(config['project']['gpu'])

# Attempt to launch a pod with the given configuration
new_pod = attempt_pod_launch(config, environment_variables)
if new_pod is None:
print("Selected GPU types unavailable, try again later or use a different type.")
return None

print("Waiting for pod to come online... ", end="")
sys.stdout.flush()

# Wait for the pod to come online
while new_pod.get('desiredStatus', None) != 'RUNNING' or new_pod.get('runtime') is None:
new_pod = get_pod(new_pod['id'])

project_pod_id = new_pod['id']

print(f"Project {config['project']['name']} pod ({project_pod_id}) created.", end="\n\n")
return project_pod_id


# ------------------------------- Start Project ------------------------------ #
def start_project(): # pylint: disable=too-many-locals, too-many-branches
'''
Expand Down