Skip to content

Commit

Permalink
fix: dont suggest registering or deleting a checkpoint that is alread…
Browse files Browse the repository at this point in the history
…y deleted (determined-ai#8246)
  • Loading branch information
mapmeld authored Oct 25, 2023
1 parent c52ef71 commit 25adf7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions webui/react/src/components/CheckpointModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ ${checkpoint?.totalBatches}. This action may complete or fail without further no
<Modal
cancel
submit={{
disabled: checkpoint?.state === CheckpointState.Deleted,
handleError,
handler: handleOk,
text: 'Register Checkpoint',
Expand Down
5 changes: 1 addition & 4 deletions webui/react/src/utils/checkpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ import {

type CheckpointChecker = (checkpoint: CoreApiGenericCheckpoint) => boolean;

/* eslint-disable @typescript-eslint/no-unused-vars */
export const alwaysTrueCheckpointChecker = (checkpoint: CoreApiGenericCheckpoint): boolean => true;

const CheckpointCheckers: Record<CheckpointAction, CheckpointChecker> = {
/**
* for internal use: the typing ensures that checkers
* are defined for every CheckpointAction
* we expose the functions below as convenient wrappers
*/

[checkpointAction.Delete]: alwaysTrueCheckpointChecker,
[checkpointAction.Delete]: (checkpoint) => checkpoint.state !== CheckpointState.Deleted,

[checkpointAction.Register]: (checkpoint) => checkpoint.state === CheckpointState.Completed,
};
Expand Down

0 comments on commit 25adf7d

Please sign in to comment.