-
Notifications
You must be signed in to change notification settings - Fork 54
Cli submit delete raycluster #257
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
Merged
Fiona-Waters
merged 15 commits into
project-codeflare:cli-update
from
carsonmh:cli-submit-delete-raycluster
Aug 2, 2023
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
48d769e
add: create cluster from yaml function
carsonmh ec6efab
add: submit and delete functions
carsonmh d6bc888
change: cluster_name to name in submit raycluster
carsonmh 21ede61
add: load_auth in delete function
carsonmh 569b7aa
update: make get_cluster function use new config
carsonmh 67bfd8a
test: unit tests for submit and delete raycluster commands
carsonmh 3ff42d4
change: format slightly on submit/delete commands
carsonmh 8ce8edf
Add: context for current namespace and .codeflare path
carsonmh 7fe8461
fix: remove load_auth in functions so it doesn't run twice
carsonmh 1355455
Add: help messages for submit and delete functions
carsonmh c40601c
cleanup
carsonmh edfe0b9
remove: remove get_namespace every function call
carsonmh dca9bab
fix: fix tests
carsonmh 30ec230
change: make namespace default to 'default'
carsonmh 2943dce
refactor: remove unused imports
carsonmh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import click | ||
|
||
from codeflare_sdk.cluster.cluster import get_cluster | ||
from codeflare_sdk.cli.cli_utils import load_auth | ||
carsonmh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
@click.group() | ||
def cli(): | ||
""" | ||
Delete a specified resource from the Kubernetes cluster | ||
""" | ||
pass | ||
|
||
|
||
@cli.command() | ||
@click.argument("name", type=str) | ||
@click.option("--namespace", type=str, default="default") | ||
def raycluster(name, namespace): | ||
""" | ||
Delete a specified RayCluster from the Kubernetes cluster | ||
""" | ||
cluster = get_cluster(name, namespace) | ||
cluster.down() | ||
click.echo(f"Cluster deleted successfully") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import click | ||
import yaml | ||
import time | ||
|
||
from codeflare_sdk.cluster.cluster import Cluster | ||
from codeflare_sdk.cli.cli_utils import load_auth | ||
import codeflare_sdk.cluster.auth as sdk_auth | ||
carsonmh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
@click.group() | ||
def cli(): | ||
""" | ||
Submit a defined resource to the Kubernetes cluster | ||
""" | ||
pass | ||
|
||
|
||
@cli.command() | ||
@click.argument("name", type=str) | ||
@click.option("--wait", is_flag=True) | ||
def raycluster(name, wait): | ||
""" | ||
Submit a defined RayCluster to the Kubernetes cluster | ||
""" | ||
cluster = Cluster.from_definition_yaml(name + ".yaml") | ||
if not cluster: | ||
click.echo( | ||
"Error submitting RayCluster. Make sure the RayCluster is defined before submitting it" | ||
) | ||
return | ||
if not wait: | ||
cluster.up() | ||
click.echo("Cluster submitted successfully") | ||
return | ||
cluster.up() | ||
cluster.wait_ready() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.