-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from weaviate/jose/backup_cancellation
Add support for backup cancellation and retreiving backup status
- Loading branch information
Showing
5 changed files
with
133 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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 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,42 @@ | ||
import click | ||
import sys | ||
from weaviate_cli.utils import get_client_from_context | ||
from weaviate_cli.managers.backup_manager import BackupManager | ||
|
||
|
||
# Create Group | ||
@click.group() | ||
def cancel(): | ||
"""Cancel operations in Weaviate.""" | ||
pass | ||
|
||
|
||
@cancel.command("backup") | ||
@click.option( | ||
"--backend", | ||
default="s3", | ||
type=click.Choice(["s3", "gcs", "filesystem"]), | ||
help="The backend used for storing the backups (default: s3).", | ||
) | ||
@click.option( | ||
"--backup_id", | ||
default="test-backup", | ||
help="Identifier used for the backup (default: test-backup).", | ||
) | ||
@click.pass_context | ||
def cancel_backup_cli(ctx: click.Context, backend: str, backup_id: str) -> None: | ||
"""Cancel a backup in Weaviate.""" | ||
|
||
client = None | ||
try: | ||
client = get_client_from_context(ctx) | ||
backup_manager = BackupManager(client) | ||
backup_manager.cancel_backup(backend=backend, backup_id=backup_id) | ||
except Exception as e: | ||
click.echo(f"Error: {e}") | ||
if client: | ||
client.close() | ||
sys.exit(1) | ||
finally: | ||
if client: | ||
client.close() |
This file contains 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 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