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

(Frontend): Check if snapshots are available #305

Open
wants to merge 1 commit into
base: feature-k8s-snapshots
Choose a base branch
from
Open
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions labextension/src/widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ async function activate(
// env we are in (like Local Laptop, MiniKF, GCP, UI without Kale, ...)
const backend = await getBackend(kernel);
let rokError: IRPCError = null;
let snapshotError: IRPCError = null;
if (backend) {
try {
await executeRpc(kernel, 'log.setup_logging');
Expand Down Expand Up @@ -111,6 +112,26 @@ async function activate(
throw error;
}
}

try {
await executeRpc(kernel, 'snapshot.check_snapshot_availability');
} catch (error) {
const unexpectedErrorCodes = [
RPC_CALL_STATUS.EncodingError,
RPC_CALL_STATUS.ImportError,
RPC_CALL_STATUS.UnhandledError,
];
if (
error instanceof RPCError &&
!unexpectedErrorCodes.includes(error.error.code)
) {
snapshotError = error.error;
console.warn('Snapshots are not available', snapshotError);
} else {
globalUnhandledRejection({ reason: error });
throw error;
}
}
} else {
rokError = {
rpc: 'rok.check_rok_availability',
Expand Down Expand Up @@ -175,6 +196,7 @@ async function activate(
backend={backend}
kernel={kernel}
rokError={rokError}
snapshotError={snapshotError}
/>,
);
widget.id = 'kubeflow-kale/kubeflowDeployment';
Expand Down