-
Notifications
You must be signed in to change notification settings - Fork 54
View and delete jobs functionality in the CLI #293
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
openshift-merge-robot
merged 13 commits into
project-codeflare:cli-update
from
carsonmh:cli-view-delete-jobs
Aug 10, 2023
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
38c0ee8
create: list_jobs and get_job functions
carsonmh 3c2f1bb
create: list jobs CLI command
carsonmh 7afeb40
create: job status command
carsonmh 2e3c2d6
create: cancel job function
carsonmh f6c7bab
create: jobs logs command
carsonmh 8b4db2e
change: slightly change messages and namespace options for job status…
carsonmh a52588d
add: error handling and refactor to main CLI
carsonmh 7519dda
test: change tests for job functions, refactor tests and add tests fo…
carsonmh 0c704ac
cleanup
carsonmh 42b3f4b
make list command list all resources by default
carsonmh cafc6eb
fix unit tests
carsonmh 8b2de58
fix description of list jobs/rayclusters and change --no-ray flag
carsonmh 2ce8c4f
fix unit tests and list function
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,27 @@ | ||
import click | ||
from torchx.runner import get_runner | ||
|
||
|
||
from codeflare_sdk.cli.cli_utils import get_job_app_handle | ||
|
||
|
||
@click.group() | ||
def cli(): | ||
"""Cancel a resource""" | ||
pass | ||
|
||
|
||
@cli.command() | ||
@click.pass_context | ||
@click.argument("submission-id", type=str) | ||
def job(ctx, submission_id): | ||
"""Cancel a job""" | ||
runner = get_runner() | ||
try: | ||
app_handle = get_job_app_handle(submission_id) | ||
runner.cancel(app_handle=app_handle) | ||
click.echo(f"{submission_id} cancelled successfully") | ||
except FileNotFoundError: | ||
click.echo(f"Submission ID {submission_id} not found in Kubernetes Cluster") | ||
except Exception as e: | ||
click.echo("Error cancelling job: " + str(e)) |
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,25 @@ | ||
import click | ||
from torchx.runner import get_runner | ||
|
||
from codeflare_sdk.cli.cli_utils import get_job_app_handle | ||
|
||
|
||
@click.group() | ||
def cli(): | ||
"""Get the logs of a specified resource""" | ||
pass | ||
|
||
|
||
@cli.command() | ||
@click.pass_context | ||
@click.argument("submission-id", type=str) | ||
def job(ctx, submission_id): | ||
"""Get the logs of a specified job""" | ||
runner = get_runner() | ||
try: | ||
app_handle = get_job_app_handle(submission_id) | ||
click.echo("".join(runner.log_lines(app_handle, None))) | ||
except FileNotFoundError: | ||
click.echo(f"Submission ID {submission_id} not found in Kubernetes Cluster") | ||
except Exception as e: | ||
click.echo("Error getting job logs: " + str(e)) |
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
Oops, something went wrong.
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.