From df7f88532a61e0db3298e2b47bd702cba556fd34 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 14 May 2024 16:38:12 -0700 Subject: [PATCH 001/161] feat: initial implementation of flat run actions --- .../pages/FlatRuns/FlatRunActionButton.tsx | 258 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 25 +- webui/react/src/services/api.ts | 24 ++ webui/react/src/services/apiConfig.ts | 53 +++- webui/react/src/services/decoder.ts | 8 +- 5 files changed, 350 insertions(+), 18 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx new file mode 100644 index 00000000000..2f8ebbd42f4 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -0,0 +1,258 @@ +import Button from 'hew/Button'; +import Dropdown, { MenuItem } from 'hew/Dropdown'; +import Icon, { IconName } from 'hew/Icon'; +import { useModal } from 'hew/Modal'; +import { useToast } from 'hew/Toast'; +import { useCallback, useMemo, useState } from 'react'; + +import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; +import { BatchAction } from 'components/TableActionBar'; +// import usePermissions from 'hooks/usePermissions'; +import { + archiveRuns, + deleteRuns, + killRuns, + openOrCreateTensorBoard, + unarchiveRuns, +} from 'services/api'; +import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { capitalizeWord } from 'utils/string'; +import { openCommandResponse } from 'utils/wait'; + +// export const getActionsForRunsUnion = ( +// experiments: FlatRun[], +// targets: ExperimentAction[], +// permissions: ExperimentPermissionSet, +// ): ExperimentAction[] => { +// if (!experiments.length) return []; // redundant, for clarity +// const actionsForExperiments = experiments.map((e) => +// getActionsForExperiment(e, targets, permissions), +// ); +// return targets.filter((action) => +// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), +// ); +// }; + +const BATCH_ACTIONS = [ + ExperimentAction.OpenTensorBoard, + ExperimentAction.Move, + ExperimentAction.RetainLogs, + ExperimentAction.Archive, + ExperimentAction.Unarchive, + ExperimentAction.Delete, + ExperimentAction.Activate, + ExperimentAction.Pause, + ExperimentAction.Cancel, + ExperimentAction.Kill, +] as const; + +const ACTION_ICONS: Record = { + [ExperimentAction.Activate]: 'play', + [ExperimentAction.Pause]: 'pause', + [ExperimentAction.Cancel]: 'stop', + [ExperimentAction.Archive]: 'archive', + [ExperimentAction.Unarchive]: 'document', + [ExperimentAction.Move]: 'workspaces', + [ExperimentAction.RetainLogs]: 'logs', + [ExperimentAction.OpenTensorBoard]: 'tensor-board', + [ExperimentAction.Kill]: 'cancelled', + [ExperimentAction.Delete]: 'error', +} as const; + +const LABEL_PLURAL = 'runs'; + +interface Props { + isMobile: boolean; + selectedRuns: FlatRun[]; + project: Project; + onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; +} + +const FlatRunActionButton = ({ + isMobile, + selectedRuns, + project, + onActionSuccess, +}: Props): JSX.Element => { + const [batchAction, setBatchAction] = useState(undefined); + // const permissions = usePermissions(); + const { openToast } = useToast(); + const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); + + const sendBatchActions = useCallback( + // TODO: remove this + // eslint-disable-next-line require-await + async (action: BatchAction): Promise => { + const validRunIds = selectedRuns + // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .map((run) => run.id); + const params = { + projectId: project.id, + runIds: validRunIds, + }; + switch (action) { + case ExperimentAction.OpenTensorBoard: { + if (validRunIds.length !== selectedRuns.length) { + // if unmanaged experiments are selected, open experimentTensorBoardModal + // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs + } else { + openCommandResponse( + await openOrCreateTensorBoard({ + experimentIds: params.runIds, + workspaceId: project.workspaceId, + }), + ); + } + return; + } + case ExperimentAction.Move: + // return ExperimentMoveModal.open(); + case ExperimentAction.RetainLogs: + // return ExperimentRetainLogsModal.open(); + case ExperimentAction.Activate: + // return await archiveRuns(params); + case ExperimentAction.Archive: + return await archiveRuns(params); + case ExperimentAction.Cancel: + // return await cancelExperiments(params); + case ExperimentAction.Kill: + return await killRuns(params); + case ExperimentAction.Pause: + // return await pauseExperiments(params); + case ExperimentAction.Unarchive: + return await unarchiveRuns(params); + case ExperimentAction.Delete: + return await deleteRuns(params); + } + }, + [project.id, project.workspaceId, selectedRuns], + ); + + const submitBatchAction = useCallback( + async (action: BatchAction) => { + try { + const results = await sendBatchActions(action); + if (results === undefined) return; + + onActionSuccess?.(action, results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: `No selected ${LABEL_PLURAL.toLowerCase()} were eligible for ${action.toLowerCase()}`, + title: `No eligible ${LABEL_PLURAL.toLowerCase()}`, + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, + title: `${action} Success`, + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to ${action.toLowerCase()} ${numFailures} ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `${action} Failure`, + }); + } else { + openToast({ + closeable: true, + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible + ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `Partial ${action} Failure`, + }); + } + } catch (e) { + const publicSubject = + action === ExperimentAction.OpenTensorBoard + ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` + : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + handleError(e, { + isUserTriggered: true, + publicMessage: 'Please try again later.', + publicSubject, + silent: false, + }); + } finally { + // onActionComplete?.(); + } + }, + [sendBatchActions, onActionSuccess, openToast], + ); + + const handleBatchAction = useCallback( + (action: string) => { + switch (action) { + case ExperimentAction.OpenTensorBoard: + submitBatchAction(action); + break; + case ExperimentAction.Move: + case ExperimentAction.RetainLogs: + sendBatchActions(action); + break; + default: + setBatchAction(action as BatchAction); + BatchActionConfirmModal.open(); + break; + } + }, + [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + ); + + // const availableBatchActions = useMemo(() => { + // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. + // }, [selectedExperimentIds, experimentMap, permissions]); + + const editMenuItems = useMemo(() => { + const groupedBatchActions = [ + BATCH_ACTIONS.slice(0, 1), // View in TensorBoard + BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete + BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill + ]; + const groupSize = groupedBatchActions.length; + return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { + const isLastGroup = index === groupSize - 1; + group.forEach((action) => + acc.push({ + danger: action === ExperimentAction.Delete, + // disabled: !availableBatchActions.includes(action), // TODO uncomment later + icon: , + key: action, + label: action, + }), + ); + if (!isLastGroup) acc.push({ type: 'divider' }); + return acc; + }, []); + }, []); + + return ( + <> + {selectedRuns.length > 0 && ( + + + + )} + {batchAction && ( + exp.unmanaged)} // TODO: is it needed for Runs? + onConfirm={() => submitBatchAction(batchAction)} + /> + )} + + ); +}; + +export default FlatRunActionButton; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 8fec702f44c..c5a087d8c3a 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -63,6 +63,7 @@ import { DEFAULT_SELECTION, SelectionType as SelectionState, } from 'pages/F_ExpList/F_ExperimentList.settings'; +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { paths } from 'routes/utils'; import { getProjectColumns, getProjectNumericMetricsRange, searchRuns } from 'services/api'; import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; @@ -195,6 +196,10 @@ const FlatRuns: React.FC = ({ project }) => { } }, [project.id]); + const selectedRunIdSet = useMemo(() => { + return new Set(settings.selection.type === 'ONLY_IN' ? settings.selection.selections : []); + }, [settings.selection]); + const columnsIfLoaded = useMemo( () => (isLoadingSettings ? [] : settings.columns), [isLoadingSettings, settings.columns], @@ -213,18 +218,16 @@ const FlatRuns: React.FC = ({ project }) => { if (isLoadingSettings) { return selectedMap; } - const selectedIdSet = new Set( - settings.selection.type === 'ONLY_IN' ? settings.selection.selections : [], - ); + runs.forEach((r, index) => { Loadable.forEach(r, (run) => { - if (selectedIdSet.has(run.id)) { + if (selectedRunIdSet.has(run.id)) { selectedMap.set(run.id, { index, run }); } }); }); return selectedMap; - }, [isLoadingSettings, settings.selection, runs]); + }, [isLoadingSettings, runs, selectedRunIdSet]); const selection = useMemo(() => { let rows = CompactSelection.empty(); @@ -237,6 +240,13 @@ const FlatRuns: React.FC = ({ project }) => { }; }, [loadedSelectedRunIds]); + const selectedRuns: FlatRun[] = useMemo(() => { + const selected = runs.flatMap((run) => { + return run.isLoaded && selectedRunIdSet.has(run.data.id) ? [run.data] : []; + }); + return selected; + }, [runs, selectedRunIdSet]); + const handleIsOpenFilterChange = useCallback((newOpen: boolean) => { setIsOpenFilter(newOpen); if (!newOpen) { @@ -914,6 +924,11 @@ const FlatRuns: React.FC = ({ project }) => { rowHeight={globalSettings.rowHeight} onRowHeightChange={onRowHeightChange} /> + diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 0a6c975e646..39acbb16325 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -757,6 +757,30 @@ export const searchRuns = generateDetApi< Type.SearchFlatRunPagination >(Config.searchRuns); +export const archiveRuns = generateDetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +>(Config.archiveRuns); + +export const deleteRuns = generateDetApi( + Config.deleteRuns, +); + +export const killRuns = generateDetApi( + Config.killRuns, +); + +export const moveRuns = generateDetApi( + Config.moveRuns, +); + +export const unarchiveRuns = generateDetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + void +>(Config.unarchiveRuns); + /* Tasks */ export const getCommands = generateDetApi< diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index f9d34fd7a9b..7c8c01d55f3 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -717,7 +717,7 @@ export const archiveExperiments: DetApi< Type.BulkActionResult > = { name: 'archiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.archiveExperiments(params.projectId, params, options); }, @@ -741,7 +741,7 @@ export const deleteExperiments: DetApi< Type.BulkActionResult > = { name: 'deleteExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.deleteExperiments(params.projectId, params, options); }, @@ -765,7 +765,7 @@ export const unarchiveExperiments: DetApi< Type.BulkActionResult > = { name: 'unarchiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.unarchiveExperiments(params.projectId, params, options); }, @@ -789,7 +789,7 @@ export const activateExperiments: DetApi< Type.BulkActionResult > = { name: 'activateExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.activateExperiments(params.projectId, params, options); }, @@ -813,7 +813,7 @@ export const pauseExperiments: DetApi< Type.BulkActionResult > = { name: 'pauseExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.pauseExperiments(params.projectId, params, options); }, @@ -837,7 +837,7 @@ export const cancelExperiments: DetApi< Type.BulkActionResult > = { name: 'cancelExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.cancelExperiments(params.projectId, params, options); }, @@ -861,7 +861,7 @@ export const killExperiments: DetApi< Type.BulkActionResult > = { name: 'killExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.killExperiments(params.projectId, params, options); }, @@ -1014,7 +1014,7 @@ export const moveExperiments: DetApi< Type.BulkActionResult > = { name: 'moveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.moveExperiments(params.projectId, params, options), }; @@ -1025,7 +1025,7 @@ export const changeExperimentLogRetention: DetApi< Type.BulkActionResult > = { name: 'changeExperimentLogRetention', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.putExperimentsRetainLogs(params.projectId, params, options), }; @@ -1148,6 +1148,41 @@ export const searchRuns: DetApi< ), }; +export const archiveRuns: DetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'archiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.archiveRuns(params, options), +}; + +export const deleteRuns: DetApi = { + name: 'deleteRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.deleteRuns(params, options), +}; + +export const killRuns: DetApi = { + name: 'killRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.killRuns(params, options), +}; + +export const moveRuns: DetApi = { + name: 'moveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.moveRuns(params, options), +}; + +export const unarchiveRuns: DetApi = + { + name: 'unarchiveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), + }; + /* Tasks */ export const getTask: DetApi< diff --git a/webui/react/src/services/decoder.ts b/webui/react/src/services/decoder.ts index 6f15eb56447..23f4820e5b7 100644 --- a/webui/react/src/services/decoder.ts +++ b/webui/react/src/services/decoder.ts @@ -875,11 +875,11 @@ export const decodeJobStates = ( >; }; -export const mapV1ExperimentActionResults = ( - results: Sdk.V1ExperimentActionResult[], +export const mapV1ActionResults = ( + results: Sdk.V1ExperimentActionResult[] | Sdk.V1RunActionResult[], ): types.BulkActionResult => { return results.reduce( - (acc, cur) => { + (acc: types.BulkActionResult, cur) => { if (cur.error.length > 0) { acc.failed.push(cur); } else { @@ -887,7 +887,7 @@ export const mapV1ExperimentActionResults = ( } return acc; }, - { failed: [], successful: [] } as types.BulkActionResult, + { failed: [], successful: [] }, ); }; From 7d968960938c68127e11821f6608e4477ae387ab Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 22 May 2024 11:34:30 -0700 Subject: [PATCH 002/161] fix: minor changes --- .../react/src/pages/FlatRuns/FlatRunActionButton.tsx | 4 +--- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2f8ebbd42f4..2fbd2d13cd6 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -81,8 +81,6 @@ const FlatRunActionButton = ({ const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( - // TODO: remove this - // eslint-disable-next-line require-await async (action: BatchAction): Promise => { const validRunIds = selectedRuns // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission @@ -111,7 +109,7 @@ const FlatRunActionButton = ({ case ExperimentAction.RetainLogs: // return ExperimentRetainLogsModal.open(); case ExperimentAction.Activate: - // return await archiveRuns(params); + // return await activate(params); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Cancel: diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index c5a087d8c3a..53d691a6e39 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,6 +53,7 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; +import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -636,6 +637,15 @@ const FlatRuns: React.FC = ({ project }) => { [rowRangeToIds, settings.selection, updateSettings], ); + const onActionSuccess = useCallback( + // TODO: update this function + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (_action: BatchAction, _successfulIds: number[]) => { + handleSelectionChange('remove-all'); + }, + [handleSelectionChange], + ); + const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -928,6 +938,7 @@ const FlatRuns: React.FC = ({ project }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} + onActionSuccess={onActionSuccess} /> From a1db2c3e1664734b37fcedb887052124a2658748 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 16:31:46 -0700 Subject: [PATCH 003/161] feat: add RBAC permissions for flatRuns --- webui/react/src/hooks/usePermissions.ts | 36 +++++- .../pages/FlatRuns/FlatRunActionButton.tsx | 112 +++++------------- webui/react/src/types.ts | 15 +++ webui/react/src/utils/flatRun.ts | 72 +++++++++++ 4 files changed, 151 insertions(+), 84 deletions(-) create mode 100644 webui/react/src/utils/flatRun.ts diff --git a/webui/react/src/hooks/usePermissions.ts b/webui/react/src/hooks/usePermissions.ts index e25ac702b98..ae909e64756 100644 --- a/webui/react/src/hooks/usePermissions.ts +++ b/webui/react/src/hooks/usePermissions.ts @@ -9,6 +9,8 @@ import userStore from 'stores/users'; import { DetailedUser, ExperimentPermissionsArgs, + FlatRun, + FlatRunPermissionsArgs, ModelItem, ModelVersion, Permission, @@ -53,7 +55,7 @@ interface MovePermissionsArgs { destination?: PermissionWorkspace; } -interface PermissionsHook { +export interface PermissionsHook { canAdministrateUsers: boolean; canAssignRoles: (arg0: WorkspacePermissionsArgs) => boolean; canCreateExperiment: (arg0: WorkspacePermissionsArgs) => boolean; @@ -67,6 +69,7 @@ interface PermissionsHook { canCreateWorkspace: boolean; canCreateWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canDeleteExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canDeleteFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canDeleteModel: (arg0: ModelPermissionsArgs) => boolean; canDeleteModelVersion: (arg0: ModelVersionPermissionsArgs) => boolean; canDeleteProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -88,6 +91,7 @@ interface PermissionsHook { canModifyWorkspaceCheckpointStorage: (arg0: WorkspacePermissionsArgs) => boolean; canModifyWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canMoveExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canMoveFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canMoveExperimentsTo: (arg0: MovePermissionsArgs) => boolean; canMoveModel: (arg0: MovePermissionsArgs) => boolean; canMoveProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -144,6 +148,7 @@ const usePermissions = (): PermissionsHook => { canCreateWorkspaceNSC(rbacOpts, args.workspace), canDeleteExperiment: (args: ExperimentPermissionsArgs) => canDeleteExperiment(rbacOpts, args.experiment), + canDeleteFlatRun: (args: FlatRunPermissionsArgs) => canDeleteFlatRun(rbacOpts, args.flatRun), canDeleteModel: (args: ModelPermissionsArgs) => canDeleteModel(rbacOpts, args.model), canDeleteModelVersion: (args: ModelVersionPermissionsArgs) => canDeleteModelVersion(rbacOpts, args.modelVersion), @@ -181,6 +186,7 @@ const usePermissions = (): PermissionsHook => { canMoveExperiment(rbacOpts, args.experiment), canMoveExperimentsTo: (args: MovePermissionsArgs) => canMoveExperimentsTo(rbacOpts, args.destination), + canMoveFlatRun: (args: FlatRunPermissionsArgs) => canMoveFlatRun(rbacOpts, args.flatRun), canMoveModel: (args: MovePermissionsArgs) => canMoveModel(rbacOpts, args.destination), canMoveProjects: (args: ProjectPermissionsArgs) => canMoveWorkspaceProjects(rbacOpts, args.project), @@ -679,4 +685,32 @@ const canManageResourcePoolBindings = ({ : !!currentUser && currentUser.isAdmin; }; +// Flat Runs + +const canDeleteFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const permitted = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? permitted.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + +const canMoveFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const srcPermit = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? srcPermit.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + export default usePermissions; diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2fbd2d13cd6..ee7130b4ddb 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -6,57 +6,32 @@ import { useToast } from 'hew/Toast'; import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; -import { BatchAction } from 'components/TableActionBar'; -// import usePermissions from 'hooks/usePermissions'; -import { - archiveRuns, - deleteRuns, - killRuns, - openOrCreateTensorBoard, - unarchiveRuns, -} from 'services/api'; +import usePermissions from 'hooks/usePermissions'; +import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; import handleError from 'utils/error'; +import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; -import { openCommandResponse } from 'utils/wait'; - -// export const getActionsForRunsUnion = ( -// experiments: FlatRun[], -// targets: ExperimentAction[], -// permissions: ExperimentPermissionSet, -// ): ExperimentAction[] => { -// if (!experiments.length) return []; // redundant, for clarity -// const actionsForExperiments = experiments.map((e) => -// getActionsForExperiment(e, targets, permissions), -// ); -// return targets.filter((action) => -// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), -// ); -// }; const BATCH_ACTIONS = [ - ExperimentAction.OpenTensorBoard, + // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, - ExperimentAction.RetainLogs, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - ExperimentAction.Activate, - ExperimentAction.Pause, - ExperimentAction.Cancel, + // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; +type BatchAction = (typeof BATCH_ACTIONS)[number]; + const ACTION_ICONS: Record = { - [ExperimentAction.Activate]: 'play', - [ExperimentAction.Pause]: 'pause', - [ExperimentAction.Cancel]: 'stop', + // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', - [ExperimentAction.RetainLogs]: 'logs', - [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Kill]: 'cancelled', + // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -67,6 +42,7 @@ interface Props { selectedRuns: FlatRun[]; project: Project; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunActionButton = ({ @@ -74,57 +50,39 @@ const FlatRunActionButton = ({ selectedRuns, project, onActionSuccess, + onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); - // const permissions = usePermissions(); + const permissions = usePermissions(); const { openToast } = useToast(); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( async (action: BatchAction): Promise => { const validRunIds = selectedRuns - // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { projectId: project.id, runIds: validRunIds, }; switch (action) { - case ExperimentAction.OpenTensorBoard: { - if (validRunIds.length !== selectedRuns.length) { - // if unmanaged experiments are selected, open experimentTensorBoardModal - // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs - } else { - openCommandResponse( - await openOrCreateTensorBoard({ - experimentIds: params.runIds, - workspaceId: project.workspaceId, - }), - ); - } - return; - } case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - case ExperimentAction.RetainLogs: - // return ExperimentRetainLogsModal.open(); - case ExperimentAction.Activate: - // return await activate(params); + // return ExperimentMoveModal.open(); + break; case ExperimentAction.Archive: return await archiveRuns(params); - case ExperimentAction.Cancel: - // return await cancelExperiments(params); case ExperimentAction.Kill: return await killRuns(params); - case ExperimentAction.Pause: - // return await pauseExperiments(params); case ExperimentAction.Unarchive: return await unarchiveRuns(params); case ExperimentAction.Delete: return await deleteRuns(params); + default: + break; } }, - [project.id, project.workspaceId, selectedRuns], + [project.id, selectedRuns], ); const submitBatchAction = useCallback( @@ -169,10 +127,7 @@ const FlatRunActionButton = ({ }); } } catch (e) { - const publicSubject = - action === ExperimentAction.OpenTensorBoard - ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` - : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { isUserTriggered: true, publicMessage: 'Please try again later.', @@ -180,20 +135,16 @@ const FlatRunActionButton = ({ silent: false, }); } finally { - // onActionComplete?.(); + onActionComplete?.(); } }, - [sendBatchActions, onActionSuccess, openToast], + [sendBatchActions, onActionSuccess, openToast, onActionComplete], ); const handleBatchAction = useCallback( (action: string) => { switch (action) { - case ExperimentAction.OpenTensorBoard: - submitBatchAction(action); - break; case ExperimentAction.Move: - case ExperimentAction.RetainLogs: sendBatchActions(action); break; default: @@ -202,27 +153,22 @@ const FlatRunActionButton = ({ break; } }, - [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + [BatchActionConfirmModal, sendBatchActions], ); - // const availableBatchActions = useMemo(() => { - // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); - // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. - // }, [selectedExperimentIds, experimentMap, permissions]); + const availableBatchActions = useMemo(() => { + return getActionsForFlatRunsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + }, [selectedRuns, permissions]); const editMenuItems = useMemo(() => { - const groupedBatchActions = [ - BATCH_ACTIONS.slice(0, 1), // View in TensorBoard - BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete - BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill - ]; + const groupedBatchActions = [BATCH_ACTIONS]; const groupSize = groupedBatchActions.length; return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { const isLastGroup = index === groupSize - 1; group.forEach((action) => acc.push({ danger: action === ExperimentAction.Delete, - // disabled: !availableBatchActions.includes(action), // TODO uncomment later + disabled: !availableBatchActions.includes(action), icon: , key: action, label: action, @@ -231,7 +177,7 @@ const FlatRunActionButton = ({ if (!isLastGroup) acc.push({ type: 'divider' }); return acc; }, []); - }, []); + }, [availableBatchActions]); return ( <> @@ -245,7 +191,7 @@ const FlatRunActionButton = ({ {batchAction && ( exp.unmanaged)} // TODO: is it needed for Runs? + isUnmanagedIncluded={selectedRuns.some((run) => run.experiment?.unmanaged ?? false)} onConfirm={() => submitBatchAction(batchAction)} /> )} diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 84463695548..22ab2ab6380 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1146,6 +1146,10 @@ export interface ExperimentPermissionsArgs { experiment: ProjectExperiment; } +export interface FlatRunPermissionsArgs { + flatRun: FlatRun; +} + export interface PermissionWorkspace { id: number; userId?: number; @@ -1253,3 +1257,14 @@ export interface FlatRunExperiment { export interface SearchFlatRunPagination extends WithPagination { runs: FlatRun[]; } + +export const FlatRunAction = { + Archive: 'Archive', + Delete: 'Delete', + Kill: 'Kill', + Move: 'Move', + // Pause: 'Pause', + Unarchive: 'Unarchive', +} as const; + +export type FlatRunAction = ValueOf; diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts new file mode 100644 index 00000000000..6375851fd24 --- /dev/null +++ b/webui/react/src/utils/flatRun.ts @@ -0,0 +1,72 @@ +import { deletableRunStates, killableRunStates, terminalRunStates } from 'constants/states'; +import { PermissionsHook } from 'hooks/usePermissions'; +import { FlatRun, FlatRunAction } from 'types'; + +type FlatRunChecker = (flatRun: FlatRun) => boolean; + +type FlatRunPermissionSet = Pick< + PermissionsHook, + 'canCreateExperiment' | 'canDeleteFlatRun' | 'canModifyExperiment' | 'canMoveFlatRun' +>; + +const flatRunCheckers: Record = { + [FlatRunAction.Archive]: (flatRun) => + !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + + [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), + + [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), + + [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + + // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), + + [FlatRunAction.Unarchive]: (flatRun) => + terminalRunStates.has(flatRun.state) && flatRun.parentArchived, +}; + +export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { + return flatRunCheckers[action](flatRun); +}; + +const getActionsForFlatRun = ( + flatRun: FlatRun, + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun) return []; // redundant, for clarity + const workspace = { id: flatRun.workspaceId }; + return targets + .filter((action) => canActionFlatRun(action, flatRun)) + .filter((action) => { + switch (action) { + case FlatRunAction.Delete: + return permissions.canDeleteFlatRun({ flatRun }); + + case FlatRunAction.Move: + return permissions.canMoveFlatRun({ flatRun }); + + case FlatRunAction.Archive: + case FlatRunAction.Unarchive: + return permissions.canModifyExperiment({ workspace }); + + case FlatRunAction.Kill: + return permissions.canModifyExperiment({ workspace }) && !flatRun.experiment?.unmanaged; + + default: + return true; + } + }); +}; + +export const getActionsForFlatRunsUnion = ( + flatRun: FlatRun[], + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun.length) return []; + const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); + return targets.filter((action) => + actionsForRuns.some((runActions) => runActions.includes(action)), + ); +}; From a49676d748d89345cfb530c3592611f6015f1cd6 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 17:28:07 -0700 Subject: [PATCH 004/161] feat: return `archived` for FlatRun --- harness/determined/common/api/bindings.py | 4 ++ master/internal/api_runs.go | 1 + proto/pkg/runv1/run.pb.go | 60 +++++++++++++--------- proto/src/determined/run/v1/run.proto | 5 +- webui/react/src/services/api-ts-sdk/api.ts | 6 +++ webui/react/src/services/apiConfig.ts | 15 +++--- webui/react/src/types.ts | 1 + webui/react/src/utils/flatRun.ts | 7 ++- 8 files changed, 64 insertions(+), 35 deletions(-) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index 84748e1c4b2..5c688167e37 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -4275,6 +4275,7 @@ class v1FlatRun(Printable): def __init__( self, *, + archived: bool, checkpointCount: int, checkpointSize: str, id: int, @@ -4295,6 +4296,7 @@ def __init__( summaryMetrics: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, userId: "typing.Union[int, None, Unset]" = _unset, ): + self.archived = archived self.checkpointCount = checkpointCount self.checkpointSize = checkpointSize self.id = id @@ -4327,6 +4329,7 @@ def __init__( @classmethod def from_json(cls, obj: Json) -> "v1FlatRun": kwargs: "typing.Dict[str, typing.Any]" = { + "archived": obj["archived"], "checkpointCount": obj["checkpointCount"], "checkpointSize": obj["checkpointSize"], "id": obj["id"], @@ -4360,6 +4363,7 @@ def from_json(cls, obj: Json) -> "v1FlatRun": def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out: "typing.Dict[str, typing.Any]" = { + "archived": self.archived, "checkpointCount": self.checkpointCount, "checkpointSize": self.checkpointSize, "id": self.id, diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index abc0eec2745..15620121591 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,6 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). + ColumnExpr("r.archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 7406eca7199..9816a359c85 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,6 +216,8 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` + // The archived status of this run + Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` } func (x *FlatRun) Reset() { @@ -383,6 +385,13 @@ func (x *FlatRun) GetExperiment() *FlatRunExperiment { return nil } +func (x *FlatRun) GetArchived() bool { + if x != nil { + return x.Archived + } + return false +} + var File_determined_run_v1_run_proto protoreflect.FileDescriptor var file_determined_run_v1_run_proto_rawDesc = []byte{ @@ -440,7 +449,7 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x70, 0x61, 0x63, 0x68, 0x79, 0x64, 0x65, 0x72, 0x6d, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xf9, 0x08, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0xa0, 0x09, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, @@ -493,29 +502,32 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x6e, 0x74, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x06, - 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x3a, - 0x9b, 0x01, 0x92, 0x41, 0x97, 0x01, 0x0a, 0x94, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, - 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0xd2, 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, - 0x01, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, - 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, - 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, - 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, - 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, - 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, - 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, - 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1a, 0x0a, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x3a, 0xa6, 0x01, 0x92, 0x41, + 0xa2, 0x01, 0x0a, 0x9f, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, 0x0a, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0xd2, + 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0a, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0xd2, 0x01, 0x08, 0x61, 0x72, 0x63, 0x68, + 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, + 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, + 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, + 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, + 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, + 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/proto/src/determined/run/v1/run.proto b/proto/src/determined/run/v1/run.proto index 62f4a54502f..6ea1b43e226 100644 --- a/proto/src/determined/run/v1/run.proto +++ b/proto/src/determined/run/v1/run.proto @@ -66,7 +66,8 @@ message FlatRun { "project_name", "workspace_id", "workspace_name", - "parent_archived" + "parent_archived", + "archived" ] } }; @@ -110,4 +111,6 @@ message FlatRun { bool parent_archived = 18; // Data related the the experiment associated with this run. optional FlatRunExperiment experiment = 19; + // The archived status of this run + bool archived = 20; } diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index 240bbab8018..004baf96a9d 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3494,6 +3494,12 @@ export interface V1FlatRun { * @memberof V1FlatRun */ experiment?: V1FlatRunExperiment; + /** + * The archived status of this run + * @type {boolean} + * @memberof V1FlatRun + */ + archived: boolean; } /** * diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index 7c8c01d55f3..b782ac8f284 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1176,12 +1176,15 @@ export const moveRuns: DetApi detApi.Internal.moveRuns(params, options), }; -export const unarchiveRuns: DetApi = - { - name: 'unarchiveRuns', - postProcess: noOp, - request: (params, options) => detApi.Internal.unarchiveRuns(params, options), - }; +export const unarchiveRuns: DetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'unarchiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), +}; /* Tasks */ diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 22ab2ab6380..6f633247b19 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1237,6 +1237,7 @@ export interface FlatRun { projectName: string; workspaceId: number; workspaceName: string; + archived: boolean; parentArchived: boolean; experiment?: FlatRunExperiment; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6375851fd24..6c2aef34d5e 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,18 +11,17 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), - [FlatRunAction.Unarchive]: (flatRun) => - terminalRunStates.has(flatRun.state) && flatRun.parentArchived, + [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { From 738f7ce3e29262a27e7d74564219a72e717ca61e Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 11:09:46 -0700 Subject: [PATCH 005/161] chore: minor changes --- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 3 +-- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 15 +++++---------- webui/react/src/utils/flatRun.ts | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index ee7130b4ddb..0413a0a35b3 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -126,6 +126,7 @@ const FlatRunActionButton = ({ title: `Partial ${action} Failure`, }); } + await onActionComplete?.(); } catch (e) { const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { @@ -134,8 +135,6 @@ const FlatRunActionButton = ({ publicSubject, silent: false, }); - } finally { - onActionComplete?.(); } }, [sendBatchActions, onActionSuccess, openToast, onActionComplete], diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 53d691a6e39..7a8b92030d6 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,7 +53,6 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; -import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -637,14 +636,10 @@ const FlatRuns: React.FC = ({ project }) => { [rowRangeToIds, settings.selection, updateSettings], ); - const onActionSuccess = useCallback( - // TODO: update this function - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (_action: BatchAction, _successfulIds: number[]) => { - handleSelectionChange('remove-all'); - }, - [handleSelectionChange], - ); + const onActionComplete = useCallback(async () => { + handleSelectionChange('remove-all'); + await fetchRuns(); + }, [fetchRuns, handleSelectionChange]); const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -938,7 +933,7 @@ const FlatRuns: React.FC = ({ project }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} - onActionSuccess={onActionSuccess} + onActionComplete={onActionComplete} /> diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6c2aef34d5e..fb266d5c797 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,13 +11,13 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), + !flatRun.parentArchived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, + [FlatRunAction.Move]: (flatRun) => !flatRun.parentArchived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), From 0afcf85acad314ca9175b109d92ee8e12339109b Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 15:15:43 -0700 Subject: [PATCH 006/161] test: `canActionFlatRun` test cases --- webui/react/src/constants/states.ts | 2 +- webui/react/src/utils/flatRun.test.ts | 218 ++++++++++++++++++++++++++ 2 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 webui/react/src/utils/flatRun.test.ts diff --git a/webui/react/src/constants/states.ts b/webui/react/src/constants/states.ts index c0cb4ab57e1..677c4477e99 100644 --- a/webui/react/src/constants/states.ts +++ b/webui/react/src/constants/states.ts @@ -65,7 +65,7 @@ export const terminalCommandStates: Set = new Set([ CommandState.Terminating, ]); -const runStateList = [ +export const runStateList = [ RunState.Canceled, RunState.Completed, RunState.Error, diff --git a/webui/react/src/utils/flatRun.test.ts b/webui/react/src/utils/flatRun.test.ts new file mode 100644 index 00000000000..3b7d97c29f7 --- /dev/null +++ b/webui/react/src/utils/flatRun.test.ts @@ -0,0 +1,218 @@ +import dayjs from 'dayjs'; + +import { + deletableRunStates, + killableRunStates, + runStateList, + terminalRunStates, +} from 'constants/states'; +import { FlatRun, FlatRunAction, RunState } from 'types'; +import { canActionFlatRun } from 'utils/flatRun'; + +describe('Flat Run Utilities', () => { + const BASE_FLAT_RUN: Readonly = { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }; + + describe('canActionFlatRun function', () => { + const terminatedRunStates: Set = new Set( + Object.values(RunState).filter((v) => terminalRunStates.has(v)), + ); + + describe('Archive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be archivable (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, flatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be archivable (%s)', + (terminatedRunState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, archivedFlatRun)).toBeFalsy(); + + // parentArchived and archived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, bothArchivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Unarchive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be unarchivable (%s)', + (terminatedRunState) => { + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeTruthy(); + + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, bothArchivedFlatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be unarchivable with Terminated Run State (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, parentArchivedFlatRun)).toBeFalsy(); + }, + ); + + it.each(Array.from(Object.values(RunState).filter((v) => !terminatedRunStates.has(v))))( + 'should not be unarchivable with non Terminated Run States (%s)', + (nonTerminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Delete Action', () => { + it.each(runStateList)('should be deletable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((state) => !deletableRunStates.has(state)))( + 'should not be deletable', + (nonDeletableRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonDeletableRunState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Kill Action', () => { + const killRunStates: Set = new Set( + Object.values(RunState).filter((v) => killableRunStates.includes(v)), + ); + + it.each(Array.from(killRunStates))('should be killable (%s)', (killRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: killRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((v) => !killRunStates.has(v)))( + 'should not be killable (%s)', + (nonKillRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonKillRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Move Action', () => { + it.each(Object.values(RunState))('should be movable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState))('should not be movable (%s)', (runState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, archivedFlatRun)).toBeFalsy(); + + // both archived and parentArchived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, bothArchivedFlatRun)).toBeFalsy(); + }); + }); + }); +}); From 575a9593b67ab33c027e3c74bf4eebeacfd54f1f Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 11:49:57 -0700 Subject: [PATCH 007/161] chore: better type --- .../pages/FlatRuns/FlatRunActionButton.tsx | 4 ++-- webui/react/src/utils/flatRun.ts | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 0413a0a35b3..a1a650b836a 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -39,8 +39,8 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; - selectedRuns: FlatRun[]; - project: Project; + selectedRuns: ReadonlyArray>; + project: Readonly; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index fb266d5c797..8b52c9cb22c 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -2,7 +2,7 @@ import { deletableRunStates, killableRunStates, terminalRunStates } from 'consta import { PermissionsHook } from 'hooks/usePermissions'; import { FlatRun, FlatRunAction } from 'types'; -type FlatRunChecker = (flatRun: FlatRun) => boolean; +type FlatRunChecker = (flatRun: Readonly) => boolean; type FlatRunPermissionSet = Pick< PermissionsHook, @@ -24,15 +24,15 @@ const flatRunCheckers: Record = { [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; -export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { +export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly): boolean => { return flatRunCheckers[action](flatRun); }; const getActionsForFlatRun = ( - flatRun: FlatRun, - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: Readonly, + targets: ReadonlyArray, + permissions: Readonly, +): ReadonlyArray => { if (!flatRun) return []; // redundant, for clarity const workspace = { id: flatRun.workspaceId }; return targets @@ -59,10 +59,10 @@ const getActionsForFlatRun = ( }; export const getActionsForFlatRunsUnion = ( - flatRun: FlatRun[], - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: ReadonlyArray>, + targets: ReadonlyArray, + permissions: Readonly, +): Readonly => { if (!flatRun.length) return []; const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); return targets.filter((action) => From 1e59bf4e5dfc9d7451e875a63784d5e0d5b722e1 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 12:18:04 -0700 Subject: [PATCH 008/161] test: `FlatRunActionButton` test --- .../FlatRuns/FlatRunActionButton.test.tsx | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx new file mode 100644 index 00000000000..9a9b1ba7aeb --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -0,0 +1,60 @@ +import { render, screen } from '@testing-library/react'; +import dayjs from 'dayjs'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; + +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; +import { FlatRun, Project, RunState, WorkspaceState } from 'types'; + +const setup = (selectedFlatRuns: ReadonlyArray>) => { + const project: Readonly = { + archived: false, + id: 1, + immutable: false, + name: 'proj', + notes: [], + state: WorkspaceState.Unspecified, + userId: 1, + workspaceId: 1, + }; + + render( + + + , + ); +}; + +describe('canActionFlatRun function', () => { + describe('Flat Run Action Button Visibility', () => { + it('should not be appeard without selected flat runs', () => { + setup([]); + expect(screen.queryByText('Actions')).not.toBeInTheDocument(); + }); + + it('should be appeard with selected flat runs', async () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + + setup(flatRuns); + expect(await screen.findByText('Actions')).toBeInTheDocument(); + }); + }); +}); From 6919563268b6efa997cb3a16b2f4cc46889637b7 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 30 May 2024 09:59:52 -0700 Subject: [PATCH 009/161] fix: fix run `archived` logic in postgres --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 15620121591..d87923c3e4a 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,7 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived"). + ColumnExpr("r.archived OR e.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). From faf66e2954c8a45cee40d1e5316dd56b7a1aa6e0 Mon Sep 17 00:00:00 2001 From: Ashton G Date: Mon, 3 Jun 2024 10:16:09 -0400 Subject: [PATCH 010/161] chore: run bulk action interstitial component (#9390) Co-authored-by: Keita Fish --- .../components/InterstitialModalComponent.tsx | 2 +- ...nFilterInterstitialModalComponent.test.tsx | 216 ++++++++++++++++++ .../RunFilterInterstitialModalComponent.tsx | 168 ++++++++++++++ .../RunMoveWarningModalComponent.test.tsx | 93 ++++++++ .../RunMoveWarningModalComponent.tsx | 54 +++++ webui/react/src/hooks/useTypedParams.test.tsx | 4 +- .../pages/TrialDetails/TrialDetailsLogs.tsx | 15 +- webui/react/src/setupTests.ts | 19 +- .../src/utils/mergeAbortControllers.test.ts | 87 +++++++ .../react/src/utils/mergeAbortControllers.ts | 20 ++ 10 files changed, 653 insertions(+), 25 deletions(-) create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.test.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.tsx create mode 100644 webui/react/src/utils/mergeAbortControllers.test.ts create mode 100644 webui/react/src/utils/mergeAbortControllers.ts diff --git a/webui/react/src/components/InterstitialModalComponent.tsx b/webui/react/src/components/InterstitialModalComponent.tsx index 0789b4a6b38..7eaff4c822e 100644 --- a/webui/react/src/components/InterstitialModalComponent.tsx +++ b/webui/react/src/components/InterstitialModalComponent.tsx @@ -6,7 +6,7 @@ import { useCallback, useEffect } from 'react'; export type onInterstitialCloseActionType = (reason: 'ok' | 'close' | 'failed') => void; interface Props { - onCloseAction: (reason: 'ok' | 'close' | 'failed') => void; + onCloseAction: onInterstitialCloseActionType; loadableData: Loadable; } diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx new file mode 100644 index 00000000000..3284273cdaf --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx @@ -0,0 +1,216 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { FilterFormSetWithoutId, FormField } from 'components/FilterForm/components/type'; +import RunFilterInterstitialModalComponent, { + CloseReason, + ControlledModalRef, + Props, +} from 'components/RunFilterInterstitialModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +vi.mock('services/api', async () => ({ + ...(await vi.importActual('services/api')), + searchRuns: vi.fn(() => + Promise.resolve({ + pagination: { + total: 0, + }, + }), + ), +})); + +const { searchRuns } = await import('services/api'); +const searchRunsMock = vi.mocked(searchRuns); + +const emptyFilterFormSetWithoutId: FilterFormSetWithoutId = { + filterGroup: { + children: [], + conjunction: 'or', + kind: 'group', + }, + showArchived: false, +}; + +const setupTest = (props: Partial = {}) => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunFilterInterstitialModalComponent', () => { + beforeEach(() => { + searchRunsMock.mockRestore(); + }); + + it('does not call server until opened', () => { + const { ref } = setupTest(); + + expect(searchRunsMock).not.toBeCalled(); + act(() => { + ref.current?.open(); + }); + expect(searchRunsMock).toBeCalled(); + }); + + it('calls server with filter describing filter selection', () => { + const expectedFilterGroup: FilterFormSetWithoutId['filterGroup'] = { + children: [ + { + columnName: 'experimentName', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator: 'contains', + type: 'COLUMN_TYPE_TEXT', + value: 'foo', + }, + ], + conjunction: 'and', + kind: 'group', + }; + const expectedExclusions = [1, 2, 3]; + const { ref } = setupTest({ + filterFormSet: { + filterGroup: expectedFilterGroup, + showArchived: true, + }, + selection: { + exclusions: expectedExclusions, + type: 'ALL_EXCEPT', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + // TODO: is there a better way to test this expectation? + expect(filterFormSet.showArchived).toBeTruthy(); + const [filterGroup, idFilterGroup] = filterFormSet.filterGroup.children?.[0].children || []; + expect(filterGroup).toEqual(expectedFilterGroup); + + const idFilters = idFilterGroup.children; + expect(idFilters.every((f: FormField) => f.operator === '!=')).toBeTruthy(); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedExclusions); + }); + + it('calls server with filter describing visual selection', () => { + const expectedSelection = [1, 2, 3]; + const { ref } = setupTest({ + selection: { + selections: expectedSelection, + type: 'ONLY_IN', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + expect(filterFormSet.showArchived).toBe(false); + const idFilters = filterFormSet.filterGroup.children?.[0].children || []; + expect(idFilters.every((f: FormField) => f.operator === '=')).toBe(true); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedSelection); + }); + + it('cancels request when modal is closed via close button', async () => { + searchRunsMock.mockImplementation((_params, options) => { + return new Promise((_resolve, reject) => { + options?.signal?.addEventListener('abort', () => { + reject(); + }); + }); + }); + const { ref } = setupTest(); + // explicit type here because typescript can't infer that the act function + // runs imperatively. + let lifecycle: Promise | undefined; + // we don't await the act because we need the render pipeline to flush + // before we get the close reason back + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('close'); + }); + + it('closes modal with has_search_runs when it has runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 1, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('has_search_runs'); + }); + + it('closes modal with no_search_runs when it lacks runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 0, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('no_search_runs'); + }); + + it('closes modal with failed when request errors outside of aborts', async () => { + searchRunsMock.mockImplementation(() => Promise.reject(new Error('uh oh!'))); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('failed'); + }); +}); diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx new file mode 100644 index 00000000000..a117b74202e --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx @@ -0,0 +1,168 @@ +import { useModal } from 'hew/Modal'; +import { Failed, NotLoaded } from 'hew/utils/loadable'; +import { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react'; + +import { FilterFormSetWithoutId, Operator } from 'components/FilterForm/components/type'; +import InterstitialModalComponent, { + onInterstitialCloseActionType, +} from 'components/InterstitialModalComponent'; +import { SelectionType } from 'components/Searches/Searches.settings'; +import { useAsync } from 'hooks/useAsync'; +import { searchRuns } from 'services/api'; +import { DetError } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; +import { observable } from 'utils/observable'; + +export type CloseReason = 'has_search_runs' | 'no_search_runs' | 'failed' | 'close' | 'manual'; + +export interface Props { + projectId?: number; + selection: SelectionType; + filterFormSet: FilterFormSetWithoutId; +} + +export interface ControlledModalRef { + open: () => Promise; + close: (reason?: CloseReason) => void; +} + +/** + * Modal component for checking selections for runs that are part of a search. + * is essentially a single purpose interstitial modal component. Because it + * wraps a modal and the intended use is within a user flow, this component does + * not use the `useModal` hook. instead, it exposes control via ref. the `open` + * method of the ref returns a promise that resolves when the modal is closed + * with the reason why the modal closed. + * + */ +export const RunFilterInterstitialModalComponent = forwardRef( + ({ projectId, selection, filterFormSet }: Props, ref): JSX.Element => { + const InterstitialModal = useModal(InterstitialModalComponent); + const [isOpen, setIsOpen] = useState(false); + const closeController = useRef(new AbortController()); + const lifecycleObservable = useRef(observable(null)); + + const { close: internalClose, open: internalOpen } = InterstitialModal; + + const open = async () => { + internalOpen(); + setIsOpen(true); + const closeReason = await lifecycleObservable.current.toPromise(); + if (closeReason === null) { + // this promise should never reject -- toPromise only resolves when the + // value changes, and no code sets the observavble to null + return Promise.reject(); + } + return closeReason; + }; + + const close = useCallback( + (reason: CloseReason = 'manual') => { + setIsOpen(false); + // encourage render with isOpen to false before closing to prevent + // firing onCloseAction twice + setTimeout(() => internalClose('close'), 0); + closeController.current.abort(); + closeController.current = new AbortController(); + lifecycleObservable.current.set(reason); + lifecycleObservable.current = observable(null); + }, + [internalClose], + ); + + useImperativeHandle(ref, () => ({ close, open })); + + const selectionHasSearchRuns = useAsync( + async (canceler) => { + if (!isOpen) return NotLoaded; + const mergedCanceler = mergeAbortControllers(canceler, closeController.current); + const idToFilter = (operator: Operator, id: number) => + ({ + columnName: 'id', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator, + type: 'COLUMN_TYPE_NUMBER', + value: id, + }) as const; + const filterGroup: FilterFormSetWithoutId['filterGroup'] = + selection.type === 'ALL_EXCEPT' + ? { + children: [ + filterFormSet.filterGroup, + { + children: selection.exclusions.map(idToFilter.bind(this, '!=')), + conjunction: 'and', + kind: 'group', + }, + ], + conjunction: 'and', + kind: 'group', + } + : { + children: selection.selections.map(idToFilter.bind(this, '=')), + conjunction: 'or', + kind: 'group', + }; + const filter: FilterFormSetWithoutId = { + ...filterFormSet, + filterGroup: { + children: [ + filterGroup, + { + columnName: 'numTrials', + kind: 'field', + location: 'LOCATION_TYPE_EXPERIMENT', + operator: '>', + type: 'COLUMN_TYPE_NUMBER', + value: 1, + } as const, + ], + conjunction: 'and', + kind: 'group', + }, + }; + try { + const results = await searchRuns( + { + filter: JSON.stringify(filter), + limit: 0, + projectId, + }, + { signal: mergedCanceler.signal }, + ); + + return (results.pagination.total || 0) > 0; + } catch (e) { + if (!mergedCanceler.signal.aborted) { + return Failed(e instanceof Error ? e : new DetError(e)); + } + return NotLoaded; + } + }, + [selection, filterFormSet, projectId, isOpen], + ); + + const interstitialClose: onInterstitialCloseActionType = useCallback( + (reason) => { + if (reason === 'ok') { + return selectionHasSearchRuns.forEach((bool) => { + const fixedReason = bool ? 'has_search_runs' : 'no_search_runs'; + close(fixedReason); + }); + } + close(reason); + }, + [close, selectionHasSearchRuns], + ); + + return ( + + ); + }, +); + +export default RunFilterInterstitialModalComponent; diff --git a/webui/react/src/components/RunMoveWarningModalComponent.test.tsx b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx new file mode 100644 index 00000000000..8847538b527 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx @@ -0,0 +1,93 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { + CloseReason, + RunMoveWarningFlowRef, + RunMoveWarningModalComponent, +} from 'components/RunMoveWarningModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +const setupTest = () => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunMoveWarningModalComponent', () => { + it('is not shown until opened', () => { + const { ref } = setupTest(); + + expect(screen.queryByText('Move Run Dependency Alert')).toBeNull(); + act(() => { + ref.current?.open(); + }); + expect(screen.queryByText('Move Run Dependency Alert')).not.toBeNull(); + }); + + it('closes modal with cancel when closed with the x button', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with cancel when cancel button is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const cancelButton = await screen.findByText('Cancel'); + await userEvent.click(cancelButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with ok when submit is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const okayButton = await screen.findByText('Move independent runs'); + await userEvent.click(okayButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('ok'); + }); + + it('closes modal with manual when manually closed with no arg', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + act(() => { + ref.current?.close(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('manual'); + }); +}); diff --git a/webui/react/src/components/RunMoveWarningModalComponent.tsx b/webui/react/src/components/RunMoveWarningModalComponent.tsx new file mode 100644 index 00000000000..3a2d0086e20 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.tsx @@ -0,0 +1,54 @@ +import { Modal, useModal } from 'hew/Modal'; +import { observable, WritableObservable } from 'micro-observables'; +import { forwardRef, useImperativeHandle, useRef } from 'react'; + +export type CloseReason = 'ok' | 'cancel' | 'manual'; + +import handleError from 'utils/error'; + +type RunMoveWarningProps = { + onClose: (reason: 'ok' | 'cancel') => void; +}; +const RunMoveWarningCopy = ({ onClose }: RunMoveWarningProps) => ( + onClose('ok'), text: 'Move independent runs' }} + title="Move Run Dependency Alert" + onClose={() => onClose('cancel')}> + Some runs you are trying to move belong to a Hyperparameter Search and cannot be moved + independently to maintain their contextual relationships. These runs will be skipped. + +); + +export type RunMoveWarningFlowRef = { + open: () => Promise; + close: () => void; +}; + +export const RunMoveWarningModalComponent = forwardRef((_, ref) => { + const RunMoveWarning = useModal(RunMoveWarningCopy); + const closeReason = useRef>(observable(null)); + + const { close: internalClose, open: internalOpen } = RunMoveWarning; + + const open = async () => { + internalOpen(); + const reason = await closeReason.current.toPromise(); + if (reason === null) { + return Promise.reject(); + } + return reason; + }; + + const close = (reason: CloseReason = 'manual') => { + internalClose(reason); + closeReason.current.set(reason); + closeReason.current = observable(null); + }; + + useImperativeHandle(ref, () => ({ close, open })); + + return ; +}); + +export default RunMoveWarningModalComponent; diff --git a/webui/react/src/hooks/useTypedParams.test.tsx b/webui/react/src/hooks/useTypedParams.test.tsx index 054c5aecdb9..dadaf631d7e 100644 --- a/webui/react/src/hooks/useTypedParams.test.tsx +++ b/webui/react/src/hooks/useTypedParams.test.tsx @@ -174,8 +174,8 @@ describe('useTypedParams', () => { .afterEach(() => navSpy.mockClear()), ); }); - it('does not update if params are not changed', () => { - fc.assert( + it('does not update if params are not changed', async () => { + await fc.assert( fc .asyncProperty(sameArbPartial, async ([params, partial]) => { const { hookRef } = setupTest(params); diff --git a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx index e75b75c99c7..8f93518fb7c 100644 --- a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx +++ b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx @@ -16,6 +16,7 @@ import { readStream } from 'services/utils'; import { ExperimentBase, TrialDetails } from 'types'; import { downloadTrialLogs } from 'utils/browser'; import handleError, { ErrorType } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; import css from './TrialDetailsLogs.module.scss'; @@ -26,20 +27,6 @@ export interface Props { type OrderBy = 'ORDER_BY_UNSPECIFIED' | 'ORDER_BY_ASC' | 'ORDER_BY_DESC'; -const mergeAbortControllers = (...controllers: AbortController[]) => { - const mergedController = new AbortController(); - - controllers.forEach((c) => { - const abort = () => { - mergedController.abort(); - c.signal.removeEventListener('abort', abort); - }; - c.signal.addEventListener('abort', abort); - }); - - return mergedController; -}; - const TrialDetailsLogs: React.FC = ({ experiment, trial }: Props) => { const { ui } = useUI(); const [filterOptions, setFilterOptions] = useState({}); diff --git a/webui/react/src/setupTests.ts b/webui/react/src/setupTests.ts index fe8c871c9f7..b8b22e32f0b 100644 --- a/webui/react/src/setupTests.ts +++ b/webui/react/src/setupTests.ts @@ -6,20 +6,23 @@ */ import '@testing-library/jest-dom/extend-expect'; import 'micro-observables/batchingForReactDom'; -import 'utils/prototypes'; import 'whatwg-fetch'; import Schema from 'async-validator'; -import { noOp } from 'utils/service'; +// this code doesn't work in node environments +if (globalThis.window) { + await import('utils/prototypes'); + const { noOp } = await import('utils/service'); -/** - * To clean up the async-validator console warning that get generated during testing. - * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning - */ -Schema.warning = noOp; + /** + * To clean up the async-validator console warning that get generated during testing. + * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning + */ + Schema.warning = noOp; +} -Object.defineProperty(window, 'matchMedia', { +Object.defineProperty(globalThis, 'matchMedia', { value: () => ({ addEventListener: vi.fn(), addListener: vi.fn(), // deprecated diff --git a/webui/react/src/utils/mergeAbortControllers.test.ts b/webui/react/src/utils/mergeAbortControllers.test.ts new file mode 100644 index 00000000000..51308bac61f --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.test.ts @@ -0,0 +1,87 @@ +// @vitest-environment node +// we're using node because the jsdom version of the abortcontroller doesn't have reasons on abortsignals +import fc from 'fast-check'; +import { zip } from 'lodash'; + +import { mergeAbortControllers } from 'utils/mergeAbortControllers'; + +// arbitrary to generate a list of abort controllers to pass to mergeAbortControllers +const argArb = fc.uniqueArray( + fc.constant(() => new AbortController()).map((f) => f()), + { minLength: 1 }, +); + +// return a subset of the above to control +const argArbWithSelection = (n?: number) => + argArb.chain((arr) => + fc.tuple(fc.constant(arr), fc.shuffledSubarray(arr, { maxLength: n, minLength: 1 })), + ); + +// the above, but the subset from the above returns with unique reason values to +// verify which abortController was the first to abort +const argArbWithSelectionAndReasons = (n?: number) => + argArbWithSelection(n).chain(([args, selection]) => { + const reasonsArb = fc.uniqueArray(fc.anything(), { + maxLength: selection.length, + minLength: selection.length, + }); + const selectionAndReasonArb = reasonsArb + .map((reasons) => zip(selection, reasons)) + .filter((tups): tups is [AbortController, unknown][] => + tups.every((tup) => tup.every((c) => c !== undefined)), + ); + + return fc.tuple(fc.constant(args), selectionAndReasonArb); + }); + +describe('mergeAbortControllers', () => { + it('merged abort controller aborts if any constituent aborts', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(); + expect(result.signal.aborted).toBe(true); + }), + ); + }); + it('merged abort controller aborts with constituent reason', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(1), ([args, abortControllers]) => { + const [[abortController, reason]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(reason); + expect(abortController.signal.reason).toBe(reason); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); + it('merged abort controller only reflects the first abort', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(), ([args, abortControllers]) => { + const [[firstAbortController]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortControllers.forEach(([abortController, reason]) => { + abortController.abort(reason); + }); + expect(result.signal.reason).toBe(firstAbortController.signal.reason); + }), + ); + }); + + it('merging an aborted controller results in an aborted controller', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + abortController.abort(); + const result = mergeAbortControllers(...args); + + expect(result.signal.aborted).toBe(true); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); +}); diff --git a/webui/react/src/utils/mergeAbortControllers.ts b/webui/react/src/utils/mergeAbortControllers.ts new file mode 100644 index 00000000000..98004fe3100 --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.ts @@ -0,0 +1,20 @@ +export const mergeAbortControllers = (...controllers: AbortController[]): AbortController => { + const mergedController = new AbortController(); + + controllers.forEach((c) => { + // resulting controller is aborted, just ignore the rest + if (mergedController.signal.aborted) return; + // preemptively abort if the signal's already aborted + if (c.signal.aborted) return mergedController.abort(c.signal.reason); + + const abort = () => { + mergedController.abort(c.signal.reason); + c.signal.removeEventListener('abort', abort); + }; + c.signal.addEventListener('abort', abort); + }); + + return mergedController; +}; + +export default mergeAbortControllers; From e796b5c849dad40692ad75d2343625a8a9a5aa1f Mon Sep 17 00:00:00 2001 From: John Kim Date: Mon, 3 Jun 2024 10:49:55 -0400 Subject: [PATCH 011/161] RunActionDropdown --- .../src/components/RunActionDropdown.tsx | 394 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 119 ++++-- 2 files changed, 467 insertions(+), 46 deletions(-) create mode 100644 webui/react/src/components/RunActionDropdown.tsx diff --git a/webui/react/src/components/RunActionDropdown.tsx b/webui/react/src/components/RunActionDropdown.tsx new file mode 100644 index 00000000000..c38f3298d4b --- /dev/null +++ b/webui/react/src/components/RunActionDropdown.tsx @@ -0,0 +1,394 @@ +import { GridCell } from '@glideapps/glide-data-grid'; +import Button from 'hew/Button'; +import { ContextMenuCompleteHandlerProps } from 'hew/DataGrid/contextMenu'; +import Dropdown, { DropdownEvent, MenuItem } from 'hew/Dropdown'; +import Icon from 'hew/Icon'; +// import { useModal } from 'hew/Modal'; +import { useToast } from 'hew/Toast'; +// import useConfirm from 'hew/useConfirm'; +import { copyToClipboard } from 'hew/utils/functions'; +// import { Failed, Loadable, Loaded, NotLoaded } from 'hew/utils/loadable'; +import React, { + MouseEvent, useCallback, useMemo, + // useRef, useState +} from 'react'; + +import css from 'components/ActionDropdown/ActionDropdown.module.scss'; +// import ExperimentEditModalComponent from 'components/ExperimentEditModal'; +// import ExperimentMoveModalComponent from 'components/ExperimentMoveModal'; +// import ExperimentRetainLogsModalComponent from 'components/ExperimentRetainLogsModal'; +// import HyperparameterSearchModalComponent from 'components/HyperparameterSearchModal'; +// import InterstitialModalComponent, { +// type onInterstitialCloseActionType, +// } from 'components/InterstitialModalComponent'; +// import usePermissions from 'hooks/usePermissions'; +import { handlePath } from 'routes/utils'; +// import { +// activateExperiment, +// archiveExperiment, +// cancelExperiment, +// deleteExperiment, +// getExperiment, +// killExperiment, +// openOrCreateTensorBoard, +// pauseExperiment, +// unarchiveExperiment, +// } from 'services/api'; +import { + BulkExperimentItem, + ExperimentAction, + FlatRun, + // FullExperimentItem, + // ProjectExperiment, + ValueOf, +} from 'types'; +import handleError, { ErrorLevel, ErrorType } from 'utils/error'; +// import { getActionsForExperiment } from 'utils/experiment'; +import { capitalize } from 'utils/string'; +// import { openCommandResponse } from 'utils/wait'; + +interface Props { + children?: React.ReactNode; + cell?: GridCell; + // experiment: ProjectExperiment; + run: FlatRun; + isContextMenu?: boolean; + link?: string; + makeOpen?: boolean; + onComplete?: ContextMenuCompleteHandlerProps; + onLink?: () => void; + onVisibleChange?: (visible: boolean) => void; + workspaceId?: number; +} + +const Action = { + Copy: 'Copy Value', + NewTab: 'Open Link in New Tab', + NewWindow: 'Open Link in New Window', + ...ExperimentAction, +}; + +type Action = ValueOf; + +// const dropdownActions = [ +// Action.SwitchPin, +// Action.Activate, +// Action.Pause, +// Action.Archive, +// Action.Unarchive, +// Action.Cancel, +// Action.Kill, +// Action.Edit, +// Action.Move, +// Action.RetainLogs, +// Action.OpenTensorBoard, +// Action.HyperparameterSearch, +// Action.Delete, +// ]; + +const RunActionDropdown: React.FC = ({ + run, + cell, + isContextMenu, + link, + makeOpen, + // onComplete, + onLink, + onVisibleChange, + children, +}: Props) => { + // const id = experiment.id; + const id = run.id; + // const ExperimentEditModal = useModal(ExperimentEditModalComponent); + // const ExperimentMoveModal = useModal(ExperimentMoveModalComponent); + // const ExperimentRetainLogsModal = useModal(ExperimentRetainLogsModalComponent); + // const { + // Component: HyperparameterSearchModal, + // open: hyperparameterSearchModalOpen, + // close: hyperparameterSearchModalClose, + // } = useModal(HyperparameterSearchModalComponent); + // const { + // Component: InterstitialModal, + // open: interstitialModalOpen, + // close: interstitialModalClose, + // } = useModal(InterstitialModalComponent); + // const [experimentItem, setExperimentItem] = useState>(NotLoaded); + // const canceler = useRef(new AbortController()); + // const confirm = useConfirm(); + const { openToast } = useToast(); + + // this is required when experiment does not contain `config`. + // since we removed config. See #8765 on GitHub + // const fetchedExperimentItem = useCallback(async () => { + // try { + // setExperimentItem(NotLoaded); + // const response: FullExperimentItem = await getExperiment( + // { id: experiment.id }, + // { signal: canceler.current.signal }, + // ); + // setExperimentItem(Loaded(response)); + // } catch (e) { + // handleError(e, { publicSubject: 'Unable to fetch experiment data.' }); + // setExperimentItem(Failed(new Error('experiment data failure'))); + // } + // }, [experiment.id]); + + // const onInterstitalClose: onInterstitialCloseActionType = useCallback( + // (reason) => { + // switch (reason) { + // case 'ok': + // hyperparameterSearchModalOpen(); + // break; + // case 'failed': + // break; + // case 'close': + // canceler.current.abort(); + // canceler.current = new AbortController(); + // break; + // } + // interstitialModalClose(reason); + // }, + // [hyperparameterSearchModalOpen, interstitialModalClose], + // ); + + // const handleEditComplete = useCallback( + // (data: Partial) => { + // onComplete?.(ExperimentAction.Edit, id, data); + // }, + // [id, onComplete], + // ); + + // const handleMoveComplete = useCallback(() => { + // onComplete?.(ExperimentAction.Move, id); + // }, [id, onComplete]); + + // const handleRetainLogsComplete = useCallback(() => { + // onComplete?.(ExperimentAction.RetainLogs, id); + // }, [id, onComplete]); + + // const menuItems = getActionsForExperiment(experiment, dropdownActions, usePermissions()) + // .filter((action) => action !== Action.SwitchPin) + // .map((action) => { + // return { danger: action === Action.Delete, key: action, label: action }; + // }); + + const menuItems: MenuItem[] = useMemo(() => [], []); + + const dropdownMenu = useMemo(() => { + const items: MenuItem[] = [...menuItems]; + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ + if (cell && (cell.copyData || (cell as any).displayData)) { + items.unshift({ key: Action.Copy, label: Action.Copy }); + } + if (link) { + items.unshift( + { key: Action.NewTab, label: Action.NewTab }, + { key: Action.NewWindow, label: Action.NewWindow }, + { type: 'divider' }, + ); + } + return items; + }, [link, menuItems, cell]); + + const handleDropdown = useCallback( + async (action: string, e: DropdownEvent) => { + try { + switch (action) { + case Action.NewTab: + handlePath(e as MouseEvent, { path: link, popout: 'tab' }); + await onLink?.(); + break; + case Action.NewWindow: + handlePath(e as MouseEvent, { path: link, popout: 'window' }); + await onLink?.(); + break; + // case Action.Activate: + // await activateExperiment({ experimentId: id }); + // await onComplete?.(action, id); + // break; + // case Action.Archive: + // await archiveExperiment({ experimentId: id }); + // await onComplete?.(action, id); + // break; + // case Action.Cancel: + // await cancelExperiment({ experimentId: id }); + // await onComplete?.(action, id); + // break; + // case Action.OpenTensorBoard: { + // const commandResponse = await openOrCreateTensorBoard({ + // experimentIds: [id], + // workspaceId: experiment.workspaceId, + // }); + // openCommandResponse(commandResponse); + // break; + // } + // case Action.SwitchPin: { + // // TODO: leaving old code behind for when we want to enable this for our current experiment list. + // // const newPinned = { ...(settings?.pinned ?? {}) }; + // // const pinSet = new Set(newPinned[experiment.projectId]); + // // if (pinSet.has(id)) { + // // pinSet.delete(id); + // // } else { + // // if (pinSet.size >= 5) { + // // notification.warning({ + // // description: 'Up to 5 pinned items', + // // message: 'Unable to pin this item', + // // }); + // // break; + // // } + // // pinSet.add(id); + // // } + // // newPinned[experiment.projectId] = Array.from(pinSet); + // // updateSettings?.({ pinned: newPinned }); + // // await onComplete?.(action, id); + // break; + // } + // case Action.Kill: + // confirm({ + // content: `Are you sure you want to kill experiment ${id}?`, + // danger: true, + // okText: 'Kill', + // onConfirm: async () => { + // await killExperiment({ experimentId: id }); + // await onComplete?.(action, id); + // }, + // onError: handleError, + // title: 'Confirm Experiment Kill', + // }); + // break; + // case Action.Pause: + // await pauseExperiment({ experimentId: id }); + // await onComplete?.(action, id); + // break; + // case Action.Unarchive: + // await unarchiveExperiment({ experimentId: id }); + // await onComplete?.(action, id); + // break; + // case Action.Delete: + // confirm({ + // content: `Are you sure you want to delete experiment ${id}?`, + // danger: true, + // okText: 'Delete', + // onConfirm: async () => { + // await deleteExperiment({ experimentId: id }); + // await onComplete?.(action, id); + // }, + // onError: handleError, + // title: 'Confirm Experiment Deletion', + // }); + // break; + // case Action.Edit: + // ExperimentEditModal.open(); + // break; + // case Action.Move: + // ExperimentMoveModal.open(); + // break; + // case Action.RetainLogs: + // ExperimentRetainLogsModal.open(); + // break; + // case Action.HyperparameterSearch: + // interstitialModalOpen(); + // fetchedExperimentItem(); + // break; + case Action.Copy: + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ + await copyToClipboard((cell as any).displayData || cell?.copyData); + openToast({ + severity: 'Confirm', + title: 'Value has been copied to clipboard.', + }); + break; + } + } catch (e) { + handleError(e, { + level: ErrorLevel.Error, + publicMessage: `Unable to ${action} experiment ${id}.`, + publicSubject: `${capitalize(action)} failed.`, + silent: false, + type: ErrorType.Server, + }); + } finally { + onVisibleChange?.(false); + } + }, + [ + link, + onLink, + id, + // onComplete, + // confirm, + // ExperimentEditModal, + // ExperimentMoveModal, + // ExperimentRetainLogsModal, + // interstitialModalOpen, + // fetchedExperimentItem, + cell, + openToast, + // experiment.workspaceId, + onVisibleChange, + ], + ); + + if (dropdownMenu.length === 0) { + return ( + (children as JSX.Element) ?? ( +
+ +
+ ) + ); + } + + const shared = ( + <> + {/* + + + {experimentItem.isLoaded && ( + + )} + */} + + ); + + return children ? ( + <> + + {children} + + {shared} + + ) : ( +
+ +
+ ); +}; + +export default RunActionDropdown; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 954439eca55..1ba07372c9b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -11,7 +11,7 @@ import { MIN_COLUMN_WIDTH, MULTISELECT, } from 'hew/DataGrid/columns'; -import { ContextMenuCompleteHandlerProps } from 'hew/DataGrid/contextMenu'; +// import { ContextMenuCompleteHandlerProps } from 'hew/DataGrid/contextMenu'; import DataGrid, { DataGridHandle, HandleSelectionChangeType, @@ -27,6 +27,7 @@ import Link from 'hew/Link'; import Message from 'hew/Message'; import Pagination from 'hew/Pagination'; import Row from 'hew/Row'; +// import { useToast } from 'hew/Toast'; import { Loadable, Loaded, NotLoaded } from 'hew/utils/loadable'; import { isUndefined } from 'lodash'; import { useObservable } from 'micro-observables'; @@ -52,6 +53,7 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; +import RunActionDropdown from 'components/RunActionDropdown'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -67,8 +69,9 @@ import { getProjectColumns, searchRuns } from 'services/api'; import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; import userStore from 'stores/users'; import userSettings from 'stores/userSettings'; -import { DetailedUser, ExperimentAction, FlatRun, Project, ProjectColumn } from 'types'; +import { BulkExperimentItem, DetailedUser, ExperimentAction, FlatRun, Project, ProjectColumn } from 'types'; import handleError from 'utils/error'; +// import { getProjectExperimentForExperimentItem } from 'utils/experiment'; import { eagerSubscribe } from 'utils/observable'; import { pluralizer } from 'utils/string'; @@ -118,6 +121,7 @@ const FlatRuns: React.FC = ({ project }) => { const dataGridRef = useRef(null); const contentRef = useRef(null); const [searchParams, setSearchParams] = useSearchParams(); + // const { openToast } = useToast(); const settingsPath = useMemo(() => settingsPathForProject(project.id), [project.id]); const flatRunsSettingsObs = useMemo( @@ -296,8 +300,8 @@ const FlatRuns: React.FC = ({ project }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); break; @@ -306,8 +310,8 @@ const FlatRuns: React.FC = ({ project }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); break; @@ -318,8 +322,8 @@ const FlatRuns: React.FC = ({ project }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -549,9 +553,6 @@ const FlatRuns: React.FC = ({ project }) => { [rowRangeToIds, settings.selection, updateSettings], ); - const handleContextMenuComplete: ContextMenuCompleteHandlerProps = - useCallback(() => {}, []); - const handleColumnsOrderChange = useCallback( // changing both column order and pinned count should happen in one update: (newColumnsOrder: string[], pinnedCount?: number) => { @@ -600,12 +601,12 @@ const FlatRuns: React.FC = ({ project }) => { const items: MenuItem[] = [ settings.selection.type === 'ALL_EXCEPT' || settings.selection.selections.length > 0 ? { - key: 'select-none', - label: 'Clear selected', - onClick: () => { - handleSelectionChange?.('remove-all'); - }, - } + key: 'select-none', + label: 'Clear selected', + onClick: () => { + handleSelectionChange?.('remove-all'); + }, + } : null, ...[5, 10, 25].map((n) => ({ key: `select-${n}`, @@ -634,32 +635,32 @@ const FlatRuns: React.FC = ({ project }) => { ? null : !isPinned ? { - icon: , - key: 'pin', - label: 'Pin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), - ); - }, - } + icon: , + key: 'pin', + label: 'Pin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), + ); + }, + } : { - disabled: settings.pinnedColumnsCount <= 1, - icon: , - key: 'unpin', - label: 'Unpin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.max(settings.pinnedColumnsCount - 1, 0), - ); - }, + disabled: settings.pinnedColumnsCount <= 1, + icon: , + key: 'unpin', + label: 'Unpin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.max(settings.pinnedColumnsCount - 1, 0), + ); }, + }, { icon: , key: 'hide', @@ -716,9 +717,9 @@ const FlatRuns: React.FC = ({ project }) => { sortCount === 0 ? [] : [ - { type: 'divider' as const }, - ...sortMenuItemsForColumn(column, sorts, handleSortChange), - ]; + { type: 'divider' as const }, + ...sortMenuItemsForColumn(column, sorts, handleSortChange), + ]; items.push( ...sortMenuItems, @@ -821,7 +822,7 @@ const FlatRuns: React.FC = ({ project }) => { ) : ( <> - columns={columns} data={runs} getHeaderMenuItems={getHeaderMenuItems} @@ -831,6 +832,32 @@ const FlatRuns: React.FC = ({ project }) => { page={page} pageSize={PAGE_SIZE} pinnedColumnsCount={isLoadingSettings ? 0 : settings.pinnedColumnsCount} + renderContextMenuComponent={({ + cell, + rowData, + link, + open, + onComplete, + onClose, + onVisibleChange, + }) => { + return ( + +
+ + ); + }} rowHeight={rowHeightMap[globalSettings.rowHeight as RowHeight]} selection={selection} sorts={sorts} @@ -838,7 +865,7 @@ const FlatRuns: React.FC = ({ project }) => { total={total.getOrElse(PAGE_SIZE)} onColumnResize={handleColumnWidthChange} onColumnsOrderChange={handleColumnsOrderChange} - onContextMenuComplete={handleContextMenuComplete} + // onContextMenuComplete={handleContextMenuComplete} onPageUpdate={handlePageUpdate} onPinnedColumnsCountChange={handlePinnedColumnsCountChange} onSelectionChange={handleSelectionChange} From 98fc6156c4ae609945800ba7da0da58d3a0ada29 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 14 May 2024 16:38:12 -0700 Subject: [PATCH 012/161] feat: initial implementation of flat run actions --- .../pages/FlatRuns/FlatRunActionButton.tsx | 258 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 25 +- webui/react/src/services/api.ts | 24 ++ webui/react/src/services/apiConfig.ts | 53 +++- webui/react/src/services/decoder.ts | 8 +- 5 files changed, 350 insertions(+), 18 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx new file mode 100644 index 00000000000..2f8ebbd42f4 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -0,0 +1,258 @@ +import Button from 'hew/Button'; +import Dropdown, { MenuItem } from 'hew/Dropdown'; +import Icon, { IconName } from 'hew/Icon'; +import { useModal } from 'hew/Modal'; +import { useToast } from 'hew/Toast'; +import { useCallback, useMemo, useState } from 'react'; + +import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; +import { BatchAction } from 'components/TableActionBar'; +// import usePermissions from 'hooks/usePermissions'; +import { + archiveRuns, + deleteRuns, + killRuns, + openOrCreateTensorBoard, + unarchiveRuns, +} from 'services/api'; +import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { capitalizeWord } from 'utils/string'; +import { openCommandResponse } from 'utils/wait'; + +// export const getActionsForRunsUnion = ( +// experiments: FlatRun[], +// targets: ExperimentAction[], +// permissions: ExperimentPermissionSet, +// ): ExperimentAction[] => { +// if (!experiments.length) return []; // redundant, for clarity +// const actionsForExperiments = experiments.map((e) => +// getActionsForExperiment(e, targets, permissions), +// ); +// return targets.filter((action) => +// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), +// ); +// }; + +const BATCH_ACTIONS = [ + ExperimentAction.OpenTensorBoard, + ExperimentAction.Move, + ExperimentAction.RetainLogs, + ExperimentAction.Archive, + ExperimentAction.Unarchive, + ExperimentAction.Delete, + ExperimentAction.Activate, + ExperimentAction.Pause, + ExperimentAction.Cancel, + ExperimentAction.Kill, +] as const; + +const ACTION_ICONS: Record = { + [ExperimentAction.Activate]: 'play', + [ExperimentAction.Pause]: 'pause', + [ExperimentAction.Cancel]: 'stop', + [ExperimentAction.Archive]: 'archive', + [ExperimentAction.Unarchive]: 'document', + [ExperimentAction.Move]: 'workspaces', + [ExperimentAction.RetainLogs]: 'logs', + [ExperimentAction.OpenTensorBoard]: 'tensor-board', + [ExperimentAction.Kill]: 'cancelled', + [ExperimentAction.Delete]: 'error', +} as const; + +const LABEL_PLURAL = 'runs'; + +interface Props { + isMobile: boolean; + selectedRuns: FlatRun[]; + project: Project; + onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; +} + +const FlatRunActionButton = ({ + isMobile, + selectedRuns, + project, + onActionSuccess, +}: Props): JSX.Element => { + const [batchAction, setBatchAction] = useState(undefined); + // const permissions = usePermissions(); + const { openToast } = useToast(); + const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); + + const sendBatchActions = useCallback( + // TODO: remove this + // eslint-disable-next-line require-await + async (action: BatchAction): Promise => { + const validRunIds = selectedRuns + // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .map((run) => run.id); + const params = { + projectId: project.id, + runIds: validRunIds, + }; + switch (action) { + case ExperimentAction.OpenTensorBoard: { + if (validRunIds.length !== selectedRuns.length) { + // if unmanaged experiments are selected, open experimentTensorBoardModal + // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs + } else { + openCommandResponse( + await openOrCreateTensorBoard({ + experimentIds: params.runIds, + workspaceId: project.workspaceId, + }), + ); + } + return; + } + case ExperimentAction.Move: + // return ExperimentMoveModal.open(); + case ExperimentAction.RetainLogs: + // return ExperimentRetainLogsModal.open(); + case ExperimentAction.Activate: + // return await archiveRuns(params); + case ExperimentAction.Archive: + return await archiveRuns(params); + case ExperimentAction.Cancel: + // return await cancelExperiments(params); + case ExperimentAction.Kill: + return await killRuns(params); + case ExperimentAction.Pause: + // return await pauseExperiments(params); + case ExperimentAction.Unarchive: + return await unarchiveRuns(params); + case ExperimentAction.Delete: + return await deleteRuns(params); + } + }, + [project.id, project.workspaceId, selectedRuns], + ); + + const submitBatchAction = useCallback( + async (action: BatchAction) => { + try { + const results = await sendBatchActions(action); + if (results === undefined) return; + + onActionSuccess?.(action, results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: `No selected ${LABEL_PLURAL.toLowerCase()} were eligible for ${action.toLowerCase()}`, + title: `No eligible ${LABEL_PLURAL.toLowerCase()}`, + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, + title: `${action} Success`, + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to ${action.toLowerCase()} ${numFailures} ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `${action} Failure`, + }); + } else { + openToast({ + closeable: true, + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible + ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `Partial ${action} Failure`, + }); + } + } catch (e) { + const publicSubject = + action === ExperimentAction.OpenTensorBoard + ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` + : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + handleError(e, { + isUserTriggered: true, + publicMessage: 'Please try again later.', + publicSubject, + silent: false, + }); + } finally { + // onActionComplete?.(); + } + }, + [sendBatchActions, onActionSuccess, openToast], + ); + + const handleBatchAction = useCallback( + (action: string) => { + switch (action) { + case ExperimentAction.OpenTensorBoard: + submitBatchAction(action); + break; + case ExperimentAction.Move: + case ExperimentAction.RetainLogs: + sendBatchActions(action); + break; + default: + setBatchAction(action as BatchAction); + BatchActionConfirmModal.open(); + break; + } + }, + [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + ); + + // const availableBatchActions = useMemo(() => { + // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. + // }, [selectedExperimentIds, experimentMap, permissions]); + + const editMenuItems = useMemo(() => { + const groupedBatchActions = [ + BATCH_ACTIONS.slice(0, 1), // View in TensorBoard + BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete + BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill + ]; + const groupSize = groupedBatchActions.length; + return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { + const isLastGroup = index === groupSize - 1; + group.forEach((action) => + acc.push({ + danger: action === ExperimentAction.Delete, + // disabled: !availableBatchActions.includes(action), // TODO uncomment later + icon: , + key: action, + label: action, + }), + ); + if (!isLastGroup) acc.push({ type: 'divider' }); + return acc; + }, []); + }, []); + + return ( + <> + {selectedRuns.length > 0 && ( + + + + )} + {batchAction && ( + exp.unmanaged)} // TODO: is it needed for Runs? + onConfirm={() => submitBatchAction(batchAction)} + /> + )} + + ); +}; + +export default FlatRunActionButton; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ac8528b4606..96f5c2c1bca 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -63,6 +63,7 @@ import { DEFAULT_SELECTION, SelectionType as SelectionState, } from 'pages/F_ExpList/F_ExperimentList.settings'; +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { paths } from 'routes/utils'; import { getProjectColumns, getProjectNumericMetricsRange, searchRuns } from 'services/api'; import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; @@ -196,6 +197,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { } }, [projectId]); + const selectedRunIdSet = useMemo(() => { + return new Set(settings.selection.type === 'ONLY_IN' ? settings.selection.selections : []); + }, [settings.selection]); + const columnsIfLoaded = useMemo( () => (isLoadingSettings ? [] : settings.columns), [isLoadingSettings, settings.columns], @@ -214,18 +219,16 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { if (isLoadingSettings) { return selectedMap; } - const selectedIdSet = new Set( - settings.selection.type === 'ONLY_IN' ? settings.selection.selections : [], - ); + runs.forEach((r, index) => { Loadable.forEach(r, (run) => { - if (selectedIdSet.has(run.id)) { + if (selectedRunIdSet.has(run.id)) { selectedMap.set(run.id, { index, run }); } }); }); return selectedMap; - }, [isLoadingSettings, settings.selection, runs]); + }, [isLoadingSettings, runs, selectedRunIdSet]); const selection = useMemo(() => { let rows = CompactSelection.empty(); @@ -238,6 +241,13 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { }; }, [loadedSelectedRunIds]); + const selectedRuns: FlatRun[] = useMemo(() => { + const selected = runs.flatMap((run) => { + return run.isLoaded && selectedRunIdSet.has(run.data.id) ? [run.data] : []; + }); + return selected; + }, [runs, selectedRunIdSet]); + const handleIsOpenFilterChange = useCallback((newOpen: boolean) => { setIsOpenFilter(newOpen); if (!newOpen) { @@ -930,6 +940,11 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { rowHeight={globalSettings.rowHeight} onRowHeightChange={onRowHeightChange} /> + diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 0a6c975e646..39acbb16325 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -757,6 +757,30 @@ export const searchRuns = generateDetApi< Type.SearchFlatRunPagination >(Config.searchRuns); +export const archiveRuns = generateDetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +>(Config.archiveRuns); + +export const deleteRuns = generateDetApi( + Config.deleteRuns, +); + +export const killRuns = generateDetApi( + Config.killRuns, +); + +export const moveRuns = generateDetApi( + Config.moveRuns, +); + +export const unarchiveRuns = generateDetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + void +>(Config.unarchiveRuns); + /* Tasks */ export const getCommands = generateDetApi< diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index f9d34fd7a9b..7c8c01d55f3 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -717,7 +717,7 @@ export const archiveExperiments: DetApi< Type.BulkActionResult > = { name: 'archiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.archiveExperiments(params.projectId, params, options); }, @@ -741,7 +741,7 @@ export const deleteExperiments: DetApi< Type.BulkActionResult > = { name: 'deleteExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.deleteExperiments(params.projectId, params, options); }, @@ -765,7 +765,7 @@ export const unarchiveExperiments: DetApi< Type.BulkActionResult > = { name: 'unarchiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.unarchiveExperiments(params.projectId, params, options); }, @@ -789,7 +789,7 @@ export const activateExperiments: DetApi< Type.BulkActionResult > = { name: 'activateExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.activateExperiments(params.projectId, params, options); }, @@ -813,7 +813,7 @@ export const pauseExperiments: DetApi< Type.BulkActionResult > = { name: 'pauseExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.pauseExperiments(params.projectId, params, options); }, @@ -837,7 +837,7 @@ export const cancelExperiments: DetApi< Type.BulkActionResult > = { name: 'cancelExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.cancelExperiments(params.projectId, params, options); }, @@ -861,7 +861,7 @@ export const killExperiments: DetApi< Type.BulkActionResult > = { name: 'killExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.killExperiments(params.projectId, params, options); }, @@ -1014,7 +1014,7 @@ export const moveExperiments: DetApi< Type.BulkActionResult > = { name: 'moveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.moveExperiments(params.projectId, params, options), }; @@ -1025,7 +1025,7 @@ export const changeExperimentLogRetention: DetApi< Type.BulkActionResult > = { name: 'changeExperimentLogRetention', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.putExperimentsRetainLogs(params.projectId, params, options), }; @@ -1148,6 +1148,41 @@ export const searchRuns: DetApi< ), }; +export const archiveRuns: DetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'archiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.archiveRuns(params, options), +}; + +export const deleteRuns: DetApi = { + name: 'deleteRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.deleteRuns(params, options), +}; + +export const killRuns: DetApi = { + name: 'killRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.killRuns(params, options), +}; + +export const moveRuns: DetApi = { + name: 'moveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.moveRuns(params, options), +}; + +export const unarchiveRuns: DetApi = + { + name: 'unarchiveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), + }; + /* Tasks */ export const getTask: DetApi< diff --git a/webui/react/src/services/decoder.ts b/webui/react/src/services/decoder.ts index 6f15eb56447..23f4820e5b7 100644 --- a/webui/react/src/services/decoder.ts +++ b/webui/react/src/services/decoder.ts @@ -875,11 +875,11 @@ export const decodeJobStates = ( >; }; -export const mapV1ExperimentActionResults = ( - results: Sdk.V1ExperimentActionResult[], +export const mapV1ActionResults = ( + results: Sdk.V1ExperimentActionResult[] | Sdk.V1RunActionResult[], ): types.BulkActionResult => { return results.reduce( - (acc, cur) => { + (acc: types.BulkActionResult, cur) => { if (cur.error.length > 0) { acc.failed.push(cur); } else { @@ -887,7 +887,7 @@ export const mapV1ExperimentActionResults = ( } return acc; }, - { failed: [], successful: [] } as types.BulkActionResult, + { failed: [], successful: [] }, ); }; From ad60e624abf535848f645efc5b5d8114aba3f03d Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 22 May 2024 11:34:30 -0700 Subject: [PATCH 013/161] fix: minor changes --- .../react/src/pages/FlatRuns/FlatRunActionButton.tsx | 4 +--- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2f8ebbd42f4..2fbd2d13cd6 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -81,8 +81,6 @@ const FlatRunActionButton = ({ const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( - // TODO: remove this - // eslint-disable-next-line require-await async (action: BatchAction): Promise => { const validRunIds = selectedRuns // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission @@ -111,7 +109,7 @@ const FlatRunActionButton = ({ case ExperimentAction.RetainLogs: // return ExperimentRetainLogsModal.open(); case ExperimentAction.Activate: - // return await archiveRuns(params); + // return await activate(params); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Cancel: diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 96f5c2c1bca..d76315d33e9 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,6 +53,7 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; +import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -656,6 +657,15 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); + const onActionSuccess = useCallback( + // TODO: update this function + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (_action: BatchAction, _successfulIds: number[]) => { + handleSelectionChange('remove-all'); + }, + [handleSelectionChange], + ); + const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -944,6 +954,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} + onActionSuccess={onActionSuccess} /> From 8b8a20ce29d314f973043848ddc3e0c3ee2d9c0a Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 16:31:46 -0700 Subject: [PATCH 014/161] feat: add RBAC permissions for flatRuns --- webui/react/src/hooks/usePermissions.ts | 36 +++++- .../pages/FlatRuns/FlatRunActionButton.tsx | 112 +++++------------- webui/react/src/types.ts | 15 +++ webui/react/src/utils/flatRun.ts | 72 +++++++++++ 4 files changed, 151 insertions(+), 84 deletions(-) create mode 100644 webui/react/src/utils/flatRun.ts diff --git a/webui/react/src/hooks/usePermissions.ts b/webui/react/src/hooks/usePermissions.ts index e25ac702b98..ae909e64756 100644 --- a/webui/react/src/hooks/usePermissions.ts +++ b/webui/react/src/hooks/usePermissions.ts @@ -9,6 +9,8 @@ import userStore from 'stores/users'; import { DetailedUser, ExperimentPermissionsArgs, + FlatRun, + FlatRunPermissionsArgs, ModelItem, ModelVersion, Permission, @@ -53,7 +55,7 @@ interface MovePermissionsArgs { destination?: PermissionWorkspace; } -interface PermissionsHook { +export interface PermissionsHook { canAdministrateUsers: boolean; canAssignRoles: (arg0: WorkspacePermissionsArgs) => boolean; canCreateExperiment: (arg0: WorkspacePermissionsArgs) => boolean; @@ -67,6 +69,7 @@ interface PermissionsHook { canCreateWorkspace: boolean; canCreateWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canDeleteExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canDeleteFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canDeleteModel: (arg0: ModelPermissionsArgs) => boolean; canDeleteModelVersion: (arg0: ModelVersionPermissionsArgs) => boolean; canDeleteProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -88,6 +91,7 @@ interface PermissionsHook { canModifyWorkspaceCheckpointStorage: (arg0: WorkspacePermissionsArgs) => boolean; canModifyWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canMoveExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canMoveFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canMoveExperimentsTo: (arg0: MovePermissionsArgs) => boolean; canMoveModel: (arg0: MovePermissionsArgs) => boolean; canMoveProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -144,6 +148,7 @@ const usePermissions = (): PermissionsHook => { canCreateWorkspaceNSC(rbacOpts, args.workspace), canDeleteExperiment: (args: ExperimentPermissionsArgs) => canDeleteExperiment(rbacOpts, args.experiment), + canDeleteFlatRun: (args: FlatRunPermissionsArgs) => canDeleteFlatRun(rbacOpts, args.flatRun), canDeleteModel: (args: ModelPermissionsArgs) => canDeleteModel(rbacOpts, args.model), canDeleteModelVersion: (args: ModelVersionPermissionsArgs) => canDeleteModelVersion(rbacOpts, args.modelVersion), @@ -181,6 +186,7 @@ const usePermissions = (): PermissionsHook => { canMoveExperiment(rbacOpts, args.experiment), canMoveExperimentsTo: (args: MovePermissionsArgs) => canMoveExperimentsTo(rbacOpts, args.destination), + canMoveFlatRun: (args: FlatRunPermissionsArgs) => canMoveFlatRun(rbacOpts, args.flatRun), canMoveModel: (args: MovePermissionsArgs) => canMoveModel(rbacOpts, args.destination), canMoveProjects: (args: ProjectPermissionsArgs) => canMoveWorkspaceProjects(rbacOpts, args.project), @@ -679,4 +685,32 @@ const canManageResourcePoolBindings = ({ : !!currentUser && currentUser.isAdmin; }; +// Flat Runs + +const canDeleteFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const permitted = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? permitted.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + +const canMoveFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const srcPermit = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? srcPermit.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + export default usePermissions; diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2fbd2d13cd6..ee7130b4ddb 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -6,57 +6,32 @@ import { useToast } from 'hew/Toast'; import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; -import { BatchAction } from 'components/TableActionBar'; -// import usePermissions from 'hooks/usePermissions'; -import { - archiveRuns, - deleteRuns, - killRuns, - openOrCreateTensorBoard, - unarchiveRuns, -} from 'services/api'; +import usePermissions from 'hooks/usePermissions'; +import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; import handleError from 'utils/error'; +import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; -import { openCommandResponse } from 'utils/wait'; - -// export const getActionsForRunsUnion = ( -// experiments: FlatRun[], -// targets: ExperimentAction[], -// permissions: ExperimentPermissionSet, -// ): ExperimentAction[] => { -// if (!experiments.length) return []; // redundant, for clarity -// const actionsForExperiments = experiments.map((e) => -// getActionsForExperiment(e, targets, permissions), -// ); -// return targets.filter((action) => -// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), -// ); -// }; const BATCH_ACTIONS = [ - ExperimentAction.OpenTensorBoard, + // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, - ExperimentAction.RetainLogs, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - ExperimentAction.Activate, - ExperimentAction.Pause, - ExperimentAction.Cancel, + // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; +type BatchAction = (typeof BATCH_ACTIONS)[number]; + const ACTION_ICONS: Record = { - [ExperimentAction.Activate]: 'play', - [ExperimentAction.Pause]: 'pause', - [ExperimentAction.Cancel]: 'stop', + // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', - [ExperimentAction.RetainLogs]: 'logs', - [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Kill]: 'cancelled', + // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -67,6 +42,7 @@ interface Props { selectedRuns: FlatRun[]; project: Project; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunActionButton = ({ @@ -74,57 +50,39 @@ const FlatRunActionButton = ({ selectedRuns, project, onActionSuccess, + onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); - // const permissions = usePermissions(); + const permissions = usePermissions(); const { openToast } = useToast(); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( async (action: BatchAction): Promise => { const validRunIds = selectedRuns - // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { projectId: project.id, runIds: validRunIds, }; switch (action) { - case ExperimentAction.OpenTensorBoard: { - if (validRunIds.length !== selectedRuns.length) { - // if unmanaged experiments are selected, open experimentTensorBoardModal - // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs - } else { - openCommandResponse( - await openOrCreateTensorBoard({ - experimentIds: params.runIds, - workspaceId: project.workspaceId, - }), - ); - } - return; - } case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - case ExperimentAction.RetainLogs: - // return ExperimentRetainLogsModal.open(); - case ExperimentAction.Activate: - // return await activate(params); + // return ExperimentMoveModal.open(); + break; case ExperimentAction.Archive: return await archiveRuns(params); - case ExperimentAction.Cancel: - // return await cancelExperiments(params); case ExperimentAction.Kill: return await killRuns(params); - case ExperimentAction.Pause: - // return await pauseExperiments(params); case ExperimentAction.Unarchive: return await unarchiveRuns(params); case ExperimentAction.Delete: return await deleteRuns(params); + default: + break; } }, - [project.id, project.workspaceId, selectedRuns], + [project.id, selectedRuns], ); const submitBatchAction = useCallback( @@ -169,10 +127,7 @@ const FlatRunActionButton = ({ }); } } catch (e) { - const publicSubject = - action === ExperimentAction.OpenTensorBoard - ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` - : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { isUserTriggered: true, publicMessage: 'Please try again later.', @@ -180,20 +135,16 @@ const FlatRunActionButton = ({ silent: false, }); } finally { - // onActionComplete?.(); + onActionComplete?.(); } }, - [sendBatchActions, onActionSuccess, openToast], + [sendBatchActions, onActionSuccess, openToast, onActionComplete], ); const handleBatchAction = useCallback( (action: string) => { switch (action) { - case ExperimentAction.OpenTensorBoard: - submitBatchAction(action); - break; case ExperimentAction.Move: - case ExperimentAction.RetainLogs: sendBatchActions(action); break; default: @@ -202,27 +153,22 @@ const FlatRunActionButton = ({ break; } }, - [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + [BatchActionConfirmModal, sendBatchActions], ); - // const availableBatchActions = useMemo(() => { - // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); - // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. - // }, [selectedExperimentIds, experimentMap, permissions]); + const availableBatchActions = useMemo(() => { + return getActionsForFlatRunsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + }, [selectedRuns, permissions]); const editMenuItems = useMemo(() => { - const groupedBatchActions = [ - BATCH_ACTIONS.slice(0, 1), // View in TensorBoard - BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete - BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill - ]; + const groupedBatchActions = [BATCH_ACTIONS]; const groupSize = groupedBatchActions.length; return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { const isLastGroup = index === groupSize - 1; group.forEach((action) => acc.push({ danger: action === ExperimentAction.Delete, - // disabled: !availableBatchActions.includes(action), // TODO uncomment later + disabled: !availableBatchActions.includes(action), icon: , key: action, label: action, @@ -231,7 +177,7 @@ const FlatRunActionButton = ({ if (!isLastGroup) acc.push({ type: 'divider' }); return acc; }, []); - }, []); + }, [availableBatchActions]); return ( <> @@ -245,7 +191,7 @@ const FlatRunActionButton = ({ {batchAction && ( exp.unmanaged)} // TODO: is it needed for Runs? + isUnmanagedIncluded={selectedRuns.some((run) => run.experiment?.unmanaged ?? false)} onConfirm={() => submitBatchAction(batchAction)} /> )} diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 84463695548..22ab2ab6380 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1146,6 +1146,10 @@ export interface ExperimentPermissionsArgs { experiment: ProjectExperiment; } +export interface FlatRunPermissionsArgs { + flatRun: FlatRun; +} + export interface PermissionWorkspace { id: number; userId?: number; @@ -1253,3 +1257,14 @@ export interface FlatRunExperiment { export interface SearchFlatRunPagination extends WithPagination { runs: FlatRun[]; } + +export const FlatRunAction = { + Archive: 'Archive', + Delete: 'Delete', + Kill: 'Kill', + Move: 'Move', + // Pause: 'Pause', + Unarchive: 'Unarchive', +} as const; + +export type FlatRunAction = ValueOf; diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts new file mode 100644 index 00000000000..6375851fd24 --- /dev/null +++ b/webui/react/src/utils/flatRun.ts @@ -0,0 +1,72 @@ +import { deletableRunStates, killableRunStates, terminalRunStates } from 'constants/states'; +import { PermissionsHook } from 'hooks/usePermissions'; +import { FlatRun, FlatRunAction } from 'types'; + +type FlatRunChecker = (flatRun: FlatRun) => boolean; + +type FlatRunPermissionSet = Pick< + PermissionsHook, + 'canCreateExperiment' | 'canDeleteFlatRun' | 'canModifyExperiment' | 'canMoveFlatRun' +>; + +const flatRunCheckers: Record = { + [FlatRunAction.Archive]: (flatRun) => + !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + + [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), + + [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), + + [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + + // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), + + [FlatRunAction.Unarchive]: (flatRun) => + terminalRunStates.has(flatRun.state) && flatRun.parentArchived, +}; + +export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { + return flatRunCheckers[action](flatRun); +}; + +const getActionsForFlatRun = ( + flatRun: FlatRun, + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun) return []; // redundant, for clarity + const workspace = { id: flatRun.workspaceId }; + return targets + .filter((action) => canActionFlatRun(action, flatRun)) + .filter((action) => { + switch (action) { + case FlatRunAction.Delete: + return permissions.canDeleteFlatRun({ flatRun }); + + case FlatRunAction.Move: + return permissions.canMoveFlatRun({ flatRun }); + + case FlatRunAction.Archive: + case FlatRunAction.Unarchive: + return permissions.canModifyExperiment({ workspace }); + + case FlatRunAction.Kill: + return permissions.canModifyExperiment({ workspace }) && !flatRun.experiment?.unmanaged; + + default: + return true; + } + }); +}; + +export const getActionsForFlatRunsUnion = ( + flatRun: FlatRun[], + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun.length) return []; + const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); + return targets.filter((action) => + actionsForRuns.some((runActions) => runActions.includes(action)), + ); +}; From a6399d54fc34710591f25809d4163ff5bbcd6df4 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 17:28:07 -0700 Subject: [PATCH 015/161] feat: return `archived` for FlatRun --- harness/determined/common/api/bindings.py | 4 ++ master/internal/api_runs.go | 1 + proto/pkg/runv1/run.pb.go | 60 +++++++++++++--------- proto/src/determined/run/v1/run.proto | 5 +- webui/react/src/services/api-ts-sdk/api.ts | 6 +++ webui/react/src/services/apiConfig.ts | 15 +++--- webui/react/src/types.ts | 1 + webui/react/src/utils/flatRun.ts | 7 ++- 8 files changed, 64 insertions(+), 35 deletions(-) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index 84748e1c4b2..5c688167e37 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -4275,6 +4275,7 @@ class v1FlatRun(Printable): def __init__( self, *, + archived: bool, checkpointCount: int, checkpointSize: str, id: int, @@ -4295,6 +4296,7 @@ def __init__( summaryMetrics: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, userId: "typing.Union[int, None, Unset]" = _unset, ): + self.archived = archived self.checkpointCount = checkpointCount self.checkpointSize = checkpointSize self.id = id @@ -4327,6 +4329,7 @@ def __init__( @classmethod def from_json(cls, obj: Json) -> "v1FlatRun": kwargs: "typing.Dict[str, typing.Any]" = { + "archived": obj["archived"], "checkpointCount": obj["checkpointCount"], "checkpointSize": obj["checkpointSize"], "id": obj["id"], @@ -4360,6 +4363,7 @@ def from_json(cls, obj: Json) -> "v1FlatRun": def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out: "typing.Dict[str, typing.Any]" = { + "archived": self.archived, "checkpointCount": self.checkpointCount, "checkpointSize": self.checkpointSize, "id": self.id, diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index abc0eec2745..15620121591 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,6 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). + ColumnExpr("r.archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 7406eca7199..9816a359c85 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,6 +216,8 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` + // The archived status of this run + Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` } func (x *FlatRun) Reset() { @@ -383,6 +385,13 @@ func (x *FlatRun) GetExperiment() *FlatRunExperiment { return nil } +func (x *FlatRun) GetArchived() bool { + if x != nil { + return x.Archived + } + return false +} + var File_determined_run_v1_run_proto protoreflect.FileDescriptor var file_determined_run_v1_run_proto_rawDesc = []byte{ @@ -440,7 +449,7 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x70, 0x61, 0x63, 0x68, 0x79, 0x64, 0x65, 0x72, 0x6d, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xf9, 0x08, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0xa0, 0x09, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, @@ -493,29 +502,32 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x6e, 0x74, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x06, - 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x3a, - 0x9b, 0x01, 0x92, 0x41, 0x97, 0x01, 0x0a, 0x94, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, - 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0xd2, 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, - 0x01, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, - 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, - 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, - 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, - 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, - 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, - 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, - 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1a, 0x0a, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x3a, 0xa6, 0x01, 0x92, 0x41, + 0xa2, 0x01, 0x0a, 0x9f, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, 0x0a, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0xd2, + 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0a, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0xd2, 0x01, 0x08, 0x61, 0x72, 0x63, 0x68, + 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, + 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, + 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, + 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, + 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, + 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/proto/src/determined/run/v1/run.proto b/proto/src/determined/run/v1/run.proto index 62f4a54502f..6ea1b43e226 100644 --- a/proto/src/determined/run/v1/run.proto +++ b/proto/src/determined/run/v1/run.proto @@ -66,7 +66,8 @@ message FlatRun { "project_name", "workspace_id", "workspace_name", - "parent_archived" + "parent_archived", + "archived" ] } }; @@ -110,4 +111,6 @@ message FlatRun { bool parent_archived = 18; // Data related the the experiment associated with this run. optional FlatRunExperiment experiment = 19; + // The archived status of this run + bool archived = 20; } diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index 240bbab8018..004baf96a9d 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3494,6 +3494,12 @@ export interface V1FlatRun { * @memberof V1FlatRun */ experiment?: V1FlatRunExperiment; + /** + * The archived status of this run + * @type {boolean} + * @memberof V1FlatRun + */ + archived: boolean; } /** * diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index 7c8c01d55f3..b782ac8f284 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1176,12 +1176,15 @@ export const moveRuns: DetApi detApi.Internal.moveRuns(params, options), }; -export const unarchiveRuns: DetApi = - { - name: 'unarchiveRuns', - postProcess: noOp, - request: (params, options) => detApi.Internal.unarchiveRuns(params, options), - }; +export const unarchiveRuns: DetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'unarchiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), +}; /* Tasks */ diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 22ab2ab6380..6f633247b19 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1237,6 +1237,7 @@ export interface FlatRun { projectName: string; workspaceId: number; workspaceName: string; + archived: boolean; parentArchived: boolean; experiment?: FlatRunExperiment; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6375851fd24..6c2aef34d5e 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,18 +11,17 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), - [FlatRunAction.Unarchive]: (flatRun) => - terminalRunStates.has(flatRun.state) && flatRun.parentArchived, + [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { From 77c3343a2c56402d0def1d4c811d857992d32125 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 11:09:46 -0700 Subject: [PATCH 016/161] chore: minor changes --- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 3 +-- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 15 +++++---------- webui/react/src/utils/flatRun.ts | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index ee7130b4ddb..0413a0a35b3 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -126,6 +126,7 @@ const FlatRunActionButton = ({ title: `Partial ${action} Failure`, }); } + await onActionComplete?.(); } catch (e) { const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { @@ -134,8 +135,6 @@ const FlatRunActionButton = ({ publicSubject, silent: false, }); - } finally { - onActionComplete?.(); } }, [sendBatchActions, onActionSuccess, openToast, onActionComplete], diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index d76315d33e9..8425c37b528 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,7 +53,6 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; -import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -657,14 +656,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); - const onActionSuccess = useCallback( - // TODO: update this function - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (_action: BatchAction, _successfulIds: number[]) => { - handleSelectionChange('remove-all'); - }, - [handleSelectionChange], - ); + const onActionComplete = useCallback(async () => { + handleSelectionChange('remove-all'); + await fetchRuns(); + }, [fetchRuns, handleSelectionChange]); const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -954,7 +949,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} - onActionSuccess={onActionSuccess} + onActionComplete={onActionComplete} /> diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6c2aef34d5e..fb266d5c797 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,13 +11,13 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), + !flatRun.parentArchived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, + [FlatRunAction.Move]: (flatRun) => !flatRun.parentArchived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), From 2f7cb66f70cebdf01e8eb7b7600288f1b0c90dd6 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 15:15:43 -0700 Subject: [PATCH 017/161] test: `canActionFlatRun` test cases --- webui/react/src/constants/states.ts | 2 +- webui/react/src/utils/flatRun.test.ts | 218 ++++++++++++++++++++++++++ 2 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 webui/react/src/utils/flatRun.test.ts diff --git a/webui/react/src/constants/states.ts b/webui/react/src/constants/states.ts index c0cb4ab57e1..677c4477e99 100644 --- a/webui/react/src/constants/states.ts +++ b/webui/react/src/constants/states.ts @@ -65,7 +65,7 @@ export const terminalCommandStates: Set = new Set([ CommandState.Terminating, ]); -const runStateList = [ +export const runStateList = [ RunState.Canceled, RunState.Completed, RunState.Error, diff --git a/webui/react/src/utils/flatRun.test.ts b/webui/react/src/utils/flatRun.test.ts new file mode 100644 index 00000000000..3b7d97c29f7 --- /dev/null +++ b/webui/react/src/utils/flatRun.test.ts @@ -0,0 +1,218 @@ +import dayjs from 'dayjs'; + +import { + deletableRunStates, + killableRunStates, + runStateList, + terminalRunStates, +} from 'constants/states'; +import { FlatRun, FlatRunAction, RunState } from 'types'; +import { canActionFlatRun } from 'utils/flatRun'; + +describe('Flat Run Utilities', () => { + const BASE_FLAT_RUN: Readonly = { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }; + + describe('canActionFlatRun function', () => { + const terminatedRunStates: Set = new Set( + Object.values(RunState).filter((v) => terminalRunStates.has(v)), + ); + + describe('Archive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be archivable (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, flatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be archivable (%s)', + (terminatedRunState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, archivedFlatRun)).toBeFalsy(); + + // parentArchived and archived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, bothArchivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Unarchive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be unarchivable (%s)', + (terminatedRunState) => { + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeTruthy(); + + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, bothArchivedFlatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be unarchivable with Terminated Run State (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, parentArchivedFlatRun)).toBeFalsy(); + }, + ); + + it.each(Array.from(Object.values(RunState).filter((v) => !terminatedRunStates.has(v))))( + 'should not be unarchivable with non Terminated Run States (%s)', + (nonTerminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Delete Action', () => { + it.each(runStateList)('should be deletable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((state) => !deletableRunStates.has(state)))( + 'should not be deletable', + (nonDeletableRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonDeletableRunState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Kill Action', () => { + const killRunStates: Set = new Set( + Object.values(RunState).filter((v) => killableRunStates.includes(v)), + ); + + it.each(Array.from(killRunStates))('should be killable (%s)', (killRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: killRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((v) => !killRunStates.has(v)))( + 'should not be killable (%s)', + (nonKillRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonKillRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Move Action', () => { + it.each(Object.values(RunState))('should be movable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState))('should not be movable (%s)', (runState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, archivedFlatRun)).toBeFalsy(); + + // both archived and parentArchived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, bothArchivedFlatRun)).toBeFalsy(); + }); + }); + }); +}); From 43a1c21b97b3d8c4c66cd12788b09d24911e2873 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 11:49:57 -0700 Subject: [PATCH 018/161] chore: better type --- .../pages/FlatRuns/FlatRunActionButton.tsx | 4 ++-- webui/react/src/utils/flatRun.ts | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 0413a0a35b3..a1a650b836a 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -39,8 +39,8 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; - selectedRuns: FlatRun[]; - project: Project; + selectedRuns: ReadonlyArray>; + project: Readonly; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index fb266d5c797..8b52c9cb22c 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -2,7 +2,7 @@ import { deletableRunStates, killableRunStates, terminalRunStates } from 'consta import { PermissionsHook } from 'hooks/usePermissions'; import { FlatRun, FlatRunAction } from 'types'; -type FlatRunChecker = (flatRun: FlatRun) => boolean; +type FlatRunChecker = (flatRun: Readonly) => boolean; type FlatRunPermissionSet = Pick< PermissionsHook, @@ -24,15 +24,15 @@ const flatRunCheckers: Record = { [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; -export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { +export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly): boolean => { return flatRunCheckers[action](flatRun); }; const getActionsForFlatRun = ( - flatRun: FlatRun, - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: Readonly, + targets: ReadonlyArray, + permissions: Readonly, +): ReadonlyArray => { if (!flatRun) return []; // redundant, for clarity const workspace = { id: flatRun.workspaceId }; return targets @@ -59,10 +59,10 @@ const getActionsForFlatRun = ( }; export const getActionsForFlatRunsUnion = ( - flatRun: FlatRun[], - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: ReadonlyArray>, + targets: ReadonlyArray, + permissions: Readonly, +): Readonly => { if (!flatRun.length) return []; const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); return targets.filter((action) => From beb85d64a8fec7267ce15dda4ca02fb8750f2cae Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 12:18:04 -0700 Subject: [PATCH 019/161] test: `FlatRunActionButton` test --- .../FlatRuns/FlatRunActionButton.test.tsx | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx new file mode 100644 index 00000000000..9a9b1ba7aeb --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -0,0 +1,60 @@ +import { render, screen } from '@testing-library/react'; +import dayjs from 'dayjs'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; + +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; +import { FlatRun, Project, RunState, WorkspaceState } from 'types'; + +const setup = (selectedFlatRuns: ReadonlyArray>) => { + const project: Readonly = { + archived: false, + id: 1, + immutable: false, + name: 'proj', + notes: [], + state: WorkspaceState.Unspecified, + userId: 1, + workspaceId: 1, + }; + + render( + + + , + ); +}; + +describe('canActionFlatRun function', () => { + describe('Flat Run Action Button Visibility', () => { + it('should not be appeard without selected flat runs', () => { + setup([]); + expect(screen.queryByText('Actions')).not.toBeInTheDocument(); + }); + + it('should be appeard with selected flat runs', async () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + + setup(flatRuns); + expect(await screen.findByText('Actions')).toBeInTheDocument(); + }); + }); +}); From 8019e3bb186edd4cc061ecaad833044f0ed405cf Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 30 May 2024 09:59:52 -0700 Subject: [PATCH 020/161] fix: fix run `archived` logic in postgres --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 15620121591..d87923c3e4a 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,7 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived"). + ColumnExpr("r.archived OR e.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). From d538dfcbd827939a87d65fd9f7394cabd1a0e978 Mon Sep 17 00:00:00 2001 From: Ashton G Date: Mon, 3 Jun 2024 10:16:09 -0400 Subject: [PATCH 021/161] chore: run bulk action interstitial component (#9390) Co-authored-by: Keita Fish --- .../components/InterstitialModalComponent.tsx | 2 +- ...nFilterInterstitialModalComponent.test.tsx | 216 ++++++++++++++++++ .../RunFilterInterstitialModalComponent.tsx | 168 ++++++++++++++ .../RunMoveWarningModalComponent.test.tsx | 93 ++++++++ .../RunMoveWarningModalComponent.tsx | 54 +++++ webui/react/src/hooks/useTypedParams.test.tsx | 4 +- .../pages/TrialDetails/TrialDetailsLogs.tsx | 15 +- webui/react/src/setupTests.ts | 19 +- .../src/utils/mergeAbortControllers.test.ts | 87 +++++++ .../react/src/utils/mergeAbortControllers.ts | 20 ++ 10 files changed, 653 insertions(+), 25 deletions(-) create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.test.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.tsx create mode 100644 webui/react/src/utils/mergeAbortControllers.test.ts create mode 100644 webui/react/src/utils/mergeAbortControllers.ts diff --git a/webui/react/src/components/InterstitialModalComponent.tsx b/webui/react/src/components/InterstitialModalComponent.tsx index 0789b4a6b38..7eaff4c822e 100644 --- a/webui/react/src/components/InterstitialModalComponent.tsx +++ b/webui/react/src/components/InterstitialModalComponent.tsx @@ -6,7 +6,7 @@ import { useCallback, useEffect } from 'react'; export type onInterstitialCloseActionType = (reason: 'ok' | 'close' | 'failed') => void; interface Props { - onCloseAction: (reason: 'ok' | 'close' | 'failed') => void; + onCloseAction: onInterstitialCloseActionType; loadableData: Loadable; } diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx new file mode 100644 index 00000000000..3284273cdaf --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx @@ -0,0 +1,216 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { FilterFormSetWithoutId, FormField } from 'components/FilterForm/components/type'; +import RunFilterInterstitialModalComponent, { + CloseReason, + ControlledModalRef, + Props, +} from 'components/RunFilterInterstitialModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +vi.mock('services/api', async () => ({ + ...(await vi.importActual('services/api')), + searchRuns: vi.fn(() => + Promise.resolve({ + pagination: { + total: 0, + }, + }), + ), +})); + +const { searchRuns } = await import('services/api'); +const searchRunsMock = vi.mocked(searchRuns); + +const emptyFilterFormSetWithoutId: FilterFormSetWithoutId = { + filterGroup: { + children: [], + conjunction: 'or', + kind: 'group', + }, + showArchived: false, +}; + +const setupTest = (props: Partial = {}) => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunFilterInterstitialModalComponent', () => { + beforeEach(() => { + searchRunsMock.mockRestore(); + }); + + it('does not call server until opened', () => { + const { ref } = setupTest(); + + expect(searchRunsMock).not.toBeCalled(); + act(() => { + ref.current?.open(); + }); + expect(searchRunsMock).toBeCalled(); + }); + + it('calls server with filter describing filter selection', () => { + const expectedFilterGroup: FilterFormSetWithoutId['filterGroup'] = { + children: [ + { + columnName: 'experimentName', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator: 'contains', + type: 'COLUMN_TYPE_TEXT', + value: 'foo', + }, + ], + conjunction: 'and', + kind: 'group', + }; + const expectedExclusions = [1, 2, 3]; + const { ref } = setupTest({ + filterFormSet: { + filterGroup: expectedFilterGroup, + showArchived: true, + }, + selection: { + exclusions: expectedExclusions, + type: 'ALL_EXCEPT', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + // TODO: is there a better way to test this expectation? + expect(filterFormSet.showArchived).toBeTruthy(); + const [filterGroup, idFilterGroup] = filterFormSet.filterGroup.children?.[0].children || []; + expect(filterGroup).toEqual(expectedFilterGroup); + + const idFilters = idFilterGroup.children; + expect(idFilters.every((f: FormField) => f.operator === '!=')).toBeTruthy(); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedExclusions); + }); + + it('calls server with filter describing visual selection', () => { + const expectedSelection = [1, 2, 3]; + const { ref } = setupTest({ + selection: { + selections: expectedSelection, + type: 'ONLY_IN', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + expect(filterFormSet.showArchived).toBe(false); + const idFilters = filterFormSet.filterGroup.children?.[0].children || []; + expect(idFilters.every((f: FormField) => f.operator === '=')).toBe(true); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedSelection); + }); + + it('cancels request when modal is closed via close button', async () => { + searchRunsMock.mockImplementation((_params, options) => { + return new Promise((_resolve, reject) => { + options?.signal?.addEventListener('abort', () => { + reject(); + }); + }); + }); + const { ref } = setupTest(); + // explicit type here because typescript can't infer that the act function + // runs imperatively. + let lifecycle: Promise | undefined; + // we don't await the act because we need the render pipeline to flush + // before we get the close reason back + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('close'); + }); + + it('closes modal with has_search_runs when it has runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 1, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('has_search_runs'); + }); + + it('closes modal with no_search_runs when it lacks runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 0, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('no_search_runs'); + }); + + it('closes modal with failed when request errors outside of aborts', async () => { + searchRunsMock.mockImplementation(() => Promise.reject(new Error('uh oh!'))); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('failed'); + }); +}); diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx new file mode 100644 index 00000000000..a117b74202e --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx @@ -0,0 +1,168 @@ +import { useModal } from 'hew/Modal'; +import { Failed, NotLoaded } from 'hew/utils/loadable'; +import { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react'; + +import { FilterFormSetWithoutId, Operator } from 'components/FilterForm/components/type'; +import InterstitialModalComponent, { + onInterstitialCloseActionType, +} from 'components/InterstitialModalComponent'; +import { SelectionType } from 'components/Searches/Searches.settings'; +import { useAsync } from 'hooks/useAsync'; +import { searchRuns } from 'services/api'; +import { DetError } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; +import { observable } from 'utils/observable'; + +export type CloseReason = 'has_search_runs' | 'no_search_runs' | 'failed' | 'close' | 'manual'; + +export interface Props { + projectId?: number; + selection: SelectionType; + filterFormSet: FilterFormSetWithoutId; +} + +export interface ControlledModalRef { + open: () => Promise; + close: (reason?: CloseReason) => void; +} + +/** + * Modal component for checking selections for runs that are part of a search. + * is essentially a single purpose interstitial modal component. Because it + * wraps a modal and the intended use is within a user flow, this component does + * not use the `useModal` hook. instead, it exposes control via ref. the `open` + * method of the ref returns a promise that resolves when the modal is closed + * with the reason why the modal closed. + * + */ +export const RunFilterInterstitialModalComponent = forwardRef( + ({ projectId, selection, filterFormSet }: Props, ref): JSX.Element => { + const InterstitialModal = useModal(InterstitialModalComponent); + const [isOpen, setIsOpen] = useState(false); + const closeController = useRef(new AbortController()); + const lifecycleObservable = useRef(observable(null)); + + const { close: internalClose, open: internalOpen } = InterstitialModal; + + const open = async () => { + internalOpen(); + setIsOpen(true); + const closeReason = await lifecycleObservable.current.toPromise(); + if (closeReason === null) { + // this promise should never reject -- toPromise only resolves when the + // value changes, and no code sets the observavble to null + return Promise.reject(); + } + return closeReason; + }; + + const close = useCallback( + (reason: CloseReason = 'manual') => { + setIsOpen(false); + // encourage render with isOpen to false before closing to prevent + // firing onCloseAction twice + setTimeout(() => internalClose('close'), 0); + closeController.current.abort(); + closeController.current = new AbortController(); + lifecycleObservable.current.set(reason); + lifecycleObservable.current = observable(null); + }, + [internalClose], + ); + + useImperativeHandle(ref, () => ({ close, open })); + + const selectionHasSearchRuns = useAsync( + async (canceler) => { + if (!isOpen) return NotLoaded; + const mergedCanceler = mergeAbortControllers(canceler, closeController.current); + const idToFilter = (operator: Operator, id: number) => + ({ + columnName: 'id', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator, + type: 'COLUMN_TYPE_NUMBER', + value: id, + }) as const; + const filterGroup: FilterFormSetWithoutId['filterGroup'] = + selection.type === 'ALL_EXCEPT' + ? { + children: [ + filterFormSet.filterGroup, + { + children: selection.exclusions.map(idToFilter.bind(this, '!=')), + conjunction: 'and', + kind: 'group', + }, + ], + conjunction: 'and', + kind: 'group', + } + : { + children: selection.selections.map(idToFilter.bind(this, '=')), + conjunction: 'or', + kind: 'group', + }; + const filter: FilterFormSetWithoutId = { + ...filterFormSet, + filterGroup: { + children: [ + filterGroup, + { + columnName: 'numTrials', + kind: 'field', + location: 'LOCATION_TYPE_EXPERIMENT', + operator: '>', + type: 'COLUMN_TYPE_NUMBER', + value: 1, + } as const, + ], + conjunction: 'and', + kind: 'group', + }, + }; + try { + const results = await searchRuns( + { + filter: JSON.stringify(filter), + limit: 0, + projectId, + }, + { signal: mergedCanceler.signal }, + ); + + return (results.pagination.total || 0) > 0; + } catch (e) { + if (!mergedCanceler.signal.aborted) { + return Failed(e instanceof Error ? e : new DetError(e)); + } + return NotLoaded; + } + }, + [selection, filterFormSet, projectId, isOpen], + ); + + const interstitialClose: onInterstitialCloseActionType = useCallback( + (reason) => { + if (reason === 'ok') { + return selectionHasSearchRuns.forEach((bool) => { + const fixedReason = bool ? 'has_search_runs' : 'no_search_runs'; + close(fixedReason); + }); + } + close(reason); + }, + [close, selectionHasSearchRuns], + ); + + return ( + + ); + }, +); + +export default RunFilterInterstitialModalComponent; diff --git a/webui/react/src/components/RunMoveWarningModalComponent.test.tsx b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx new file mode 100644 index 00000000000..8847538b527 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx @@ -0,0 +1,93 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { + CloseReason, + RunMoveWarningFlowRef, + RunMoveWarningModalComponent, +} from 'components/RunMoveWarningModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +const setupTest = () => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunMoveWarningModalComponent', () => { + it('is not shown until opened', () => { + const { ref } = setupTest(); + + expect(screen.queryByText('Move Run Dependency Alert')).toBeNull(); + act(() => { + ref.current?.open(); + }); + expect(screen.queryByText('Move Run Dependency Alert')).not.toBeNull(); + }); + + it('closes modal with cancel when closed with the x button', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with cancel when cancel button is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const cancelButton = await screen.findByText('Cancel'); + await userEvent.click(cancelButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with ok when submit is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const okayButton = await screen.findByText('Move independent runs'); + await userEvent.click(okayButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('ok'); + }); + + it('closes modal with manual when manually closed with no arg', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + act(() => { + ref.current?.close(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('manual'); + }); +}); diff --git a/webui/react/src/components/RunMoveWarningModalComponent.tsx b/webui/react/src/components/RunMoveWarningModalComponent.tsx new file mode 100644 index 00000000000..3a2d0086e20 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.tsx @@ -0,0 +1,54 @@ +import { Modal, useModal } from 'hew/Modal'; +import { observable, WritableObservable } from 'micro-observables'; +import { forwardRef, useImperativeHandle, useRef } from 'react'; + +export type CloseReason = 'ok' | 'cancel' | 'manual'; + +import handleError from 'utils/error'; + +type RunMoveWarningProps = { + onClose: (reason: 'ok' | 'cancel') => void; +}; +const RunMoveWarningCopy = ({ onClose }: RunMoveWarningProps) => ( + onClose('ok'), text: 'Move independent runs' }} + title="Move Run Dependency Alert" + onClose={() => onClose('cancel')}> + Some runs you are trying to move belong to a Hyperparameter Search and cannot be moved + independently to maintain their contextual relationships. These runs will be skipped. + +); + +export type RunMoveWarningFlowRef = { + open: () => Promise; + close: () => void; +}; + +export const RunMoveWarningModalComponent = forwardRef((_, ref) => { + const RunMoveWarning = useModal(RunMoveWarningCopy); + const closeReason = useRef>(observable(null)); + + const { close: internalClose, open: internalOpen } = RunMoveWarning; + + const open = async () => { + internalOpen(); + const reason = await closeReason.current.toPromise(); + if (reason === null) { + return Promise.reject(); + } + return reason; + }; + + const close = (reason: CloseReason = 'manual') => { + internalClose(reason); + closeReason.current.set(reason); + closeReason.current = observable(null); + }; + + useImperativeHandle(ref, () => ({ close, open })); + + return ; +}); + +export default RunMoveWarningModalComponent; diff --git a/webui/react/src/hooks/useTypedParams.test.tsx b/webui/react/src/hooks/useTypedParams.test.tsx index 054c5aecdb9..dadaf631d7e 100644 --- a/webui/react/src/hooks/useTypedParams.test.tsx +++ b/webui/react/src/hooks/useTypedParams.test.tsx @@ -174,8 +174,8 @@ describe('useTypedParams', () => { .afterEach(() => navSpy.mockClear()), ); }); - it('does not update if params are not changed', () => { - fc.assert( + it('does not update if params are not changed', async () => { + await fc.assert( fc .asyncProperty(sameArbPartial, async ([params, partial]) => { const { hookRef } = setupTest(params); diff --git a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx index e75b75c99c7..8f93518fb7c 100644 --- a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx +++ b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx @@ -16,6 +16,7 @@ import { readStream } from 'services/utils'; import { ExperimentBase, TrialDetails } from 'types'; import { downloadTrialLogs } from 'utils/browser'; import handleError, { ErrorType } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; import css from './TrialDetailsLogs.module.scss'; @@ -26,20 +27,6 @@ export interface Props { type OrderBy = 'ORDER_BY_UNSPECIFIED' | 'ORDER_BY_ASC' | 'ORDER_BY_DESC'; -const mergeAbortControllers = (...controllers: AbortController[]) => { - const mergedController = new AbortController(); - - controllers.forEach((c) => { - const abort = () => { - mergedController.abort(); - c.signal.removeEventListener('abort', abort); - }; - c.signal.addEventListener('abort', abort); - }); - - return mergedController; -}; - const TrialDetailsLogs: React.FC = ({ experiment, trial }: Props) => { const { ui } = useUI(); const [filterOptions, setFilterOptions] = useState({}); diff --git a/webui/react/src/setupTests.ts b/webui/react/src/setupTests.ts index fe8c871c9f7..b8b22e32f0b 100644 --- a/webui/react/src/setupTests.ts +++ b/webui/react/src/setupTests.ts @@ -6,20 +6,23 @@ */ import '@testing-library/jest-dom/extend-expect'; import 'micro-observables/batchingForReactDom'; -import 'utils/prototypes'; import 'whatwg-fetch'; import Schema from 'async-validator'; -import { noOp } from 'utils/service'; +// this code doesn't work in node environments +if (globalThis.window) { + await import('utils/prototypes'); + const { noOp } = await import('utils/service'); -/** - * To clean up the async-validator console warning that get generated during testing. - * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning - */ -Schema.warning = noOp; + /** + * To clean up the async-validator console warning that get generated during testing. + * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning + */ + Schema.warning = noOp; +} -Object.defineProperty(window, 'matchMedia', { +Object.defineProperty(globalThis, 'matchMedia', { value: () => ({ addEventListener: vi.fn(), addListener: vi.fn(), // deprecated diff --git a/webui/react/src/utils/mergeAbortControllers.test.ts b/webui/react/src/utils/mergeAbortControllers.test.ts new file mode 100644 index 00000000000..51308bac61f --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.test.ts @@ -0,0 +1,87 @@ +// @vitest-environment node +// we're using node because the jsdom version of the abortcontroller doesn't have reasons on abortsignals +import fc from 'fast-check'; +import { zip } from 'lodash'; + +import { mergeAbortControllers } from 'utils/mergeAbortControllers'; + +// arbitrary to generate a list of abort controllers to pass to mergeAbortControllers +const argArb = fc.uniqueArray( + fc.constant(() => new AbortController()).map((f) => f()), + { minLength: 1 }, +); + +// return a subset of the above to control +const argArbWithSelection = (n?: number) => + argArb.chain((arr) => + fc.tuple(fc.constant(arr), fc.shuffledSubarray(arr, { maxLength: n, minLength: 1 })), + ); + +// the above, but the subset from the above returns with unique reason values to +// verify which abortController was the first to abort +const argArbWithSelectionAndReasons = (n?: number) => + argArbWithSelection(n).chain(([args, selection]) => { + const reasonsArb = fc.uniqueArray(fc.anything(), { + maxLength: selection.length, + minLength: selection.length, + }); + const selectionAndReasonArb = reasonsArb + .map((reasons) => zip(selection, reasons)) + .filter((tups): tups is [AbortController, unknown][] => + tups.every((tup) => tup.every((c) => c !== undefined)), + ); + + return fc.tuple(fc.constant(args), selectionAndReasonArb); + }); + +describe('mergeAbortControllers', () => { + it('merged abort controller aborts if any constituent aborts', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(); + expect(result.signal.aborted).toBe(true); + }), + ); + }); + it('merged abort controller aborts with constituent reason', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(1), ([args, abortControllers]) => { + const [[abortController, reason]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(reason); + expect(abortController.signal.reason).toBe(reason); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); + it('merged abort controller only reflects the first abort', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(), ([args, abortControllers]) => { + const [[firstAbortController]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortControllers.forEach(([abortController, reason]) => { + abortController.abort(reason); + }); + expect(result.signal.reason).toBe(firstAbortController.signal.reason); + }), + ); + }); + + it('merging an aborted controller results in an aborted controller', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + abortController.abort(); + const result = mergeAbortControllers(...args); + + expect(result.signal.aborted).toBe(true); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); +}); diff --git a/webui/react/src/utils/mergeAbortControllers.ts b/webui/react/src/utils/mergeAbortControllers.ts new file mode 100644 index 00000000000..98004fe3100 --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.ts @@ -0,0 +1,20 @@ +export const mergeAbortControllers = (...controllers: AbortController[]): AbortController => { + const mergedController = new AbortController(); + + controllers.forEach((c) => { + // resulting controller is aborted, just ignore the rest + if (mergedController.signal.aborted) return; + // preemptively abort if the signal's already aborted + if (c.signal.aborted) return mergedController.abort(c.signal.reason); + + const abort = () => { + mergedController.abort(c.signal.reason); + c.signal.removeEventListener('abort', abort); + }; + c.signal.addEventListener('abort', abort); + }); + + return mergedController; +}; + +export default mergeAbortControllers; From 597e09a2cfa20e942fe806efd778b1afc25efe40 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 11:02:29 -0700 Subject: [PATCH 022/161] chore: feedback --- .../pages/FlatRuns/FlatRunActionButton.test.tsx | 15 ++------------- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 10 +++++----- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 9a9b1ba7aeb..166fcd77d1b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -3,25 +3,14 @@ import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; -import { FlatRun, Project, RunState, WorkspaceState } from 'types'; +import { FlatRun, RunState } from 'types'; const setup = (selectedFlatRuns: ReadonlyArray>) => { - const project: Readonly = { - archived: false, - id: 1, - immutable: false, - name: 'proj', - notes: [], - state: WorkspaceState.Unspecified, - userId: 1, - workspaceId: 1, - }; - render( diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index a1a650b836a..e78658dcefa 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -8,7 +8,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; -import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; @@ -40,7 +40,7 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; - project: Readonly; + projectId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -48,7 +48,7 @@ interface Props { const FlatRunActionButton = ({ isMobile, selectedRuns, - project, + projectId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { @@ -63,7 +63,7 @@ const FlatRunActionButton = ({ .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { - projectId: project.id, + projectId, runIds: validRunIds, }; switch (action) { @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [project.id, selectedRuns], + [projectId, selectedRuns], ); const submitBatchAction = useCallback( diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 8425c37b528..460bc0b5ad2 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -947,7 +947,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { /> From eb7e4dec7a622be9efdb4ede927f5299fe2b7fef Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 16:11:38 -0700 Subject: [PATCH 023/161] feat: basic move action --- .../FlatRuns/FlatRunActionButton.test.tsx | 1 + .../pages/FlatRuns/FlatRunActionButton.tsx | 19 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 194 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 4 +- webui/react/src/pages/ProjectDetails.tsx | 2 +- webui/react/src/pages/SearchDetails.tsx | 6 +- webui/react/src/services/api.ts | 8 +- webui/react/src/services/apiConfig.ts | 8 +- 8 files changed, 227 insertions(+), 15 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 166fcd77d1b..25beefaa41e 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -12,6 +12,7 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { isMobile={false} projectId={1} selectedRuns={selectedFlatRuns} + workspaceId={1} onActionComplete={vi.fn()} /> , diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index e78658dcefa..b3929b0ae00 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -7,6 +7,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; +import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; @@ -14,24 +15,20 @@ import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; const BATCH_ACTIONS = [ - // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; type BatchAction = (typeof BATCH_ACTIONS)[number]; const ACTION_ICONS: Record = { - // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', [ExperimentAction.Kill]: 'cancelled', - // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -41,6 +38,7 @@ interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; projectId: number; + workspaceId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -49,12 +47,15 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + workspaceId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); const permissions = usePermissions(); const { openToast } = useToast(); + const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = + useModal(FlatRunMoveModalComponent); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( @@ -68,8 +69,7 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - break; + return flatRunMoveModalOpen(); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [projectId, selectedRuns], + [flatRunMoveModalOpen, projectId, selectedRuns], ); const submitBatchAction = useCallback( @@ -194,6 +194,11 @@ const FlatRunActionButton = ({ onConfirm={() => submitBatchAction(batchAction)} /> )} + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx new file mode 100644 index 00000000000..87d449e6bb8 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -0,0 +1,194 @@ +import Form from 'hew/Form'; +import Icon from 'hew/Icon'; +import { Modal } from 'hew/Modal'; +import Select, { Option } from 'hew/Select'; +import Spinner from 'hew/Spinner'; +import { useToast } from 'hew/Toast'; +import { Label } from 'hew/Typography'; +import { Loadable } from 'hew/utils/loadable'; +import { List } from 'immutable'; +import { useObservable } from 'micro-observables'; +import React, { useEffect, useId } from 'react'; + +import Link from 'components/Link'; +import usePermissions from 'hooks/usePermissions'; +import { paths } from 'routes/utils'; +import { moveRuns } from 'services/api'; +import projectStore from 'stores/projects'; +import workspaceStore from 'stores/workspaces'; +import { FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { pluralizer } from 'utils/string'; + +const FORM_ID = 'move-flat-run-form'; + +type FormInputs = { + projectId?: number; + workspaceId?: number; +}; + +interface Props { + flatRuns: Readonly[]; + onSubmit?: (successfulIds?: number[]) => void; + sourceProjectId: number; + sourceWorkspaceId?: number; +} + +const FlatRunMoveModalComponent: React.FC = ({ + flatRuns, + onSubmit, + sourceProjectId, + sourceWorkspaceId, +}: Props) => { + const idPrefix = useId(); + const { openToast } = useToast(); + const [form] = Form.useForm(); + const workspaceId = Form.useWatch('workspaceId', form); + const projectId = Form.useWatch('projectId', form); + + const { canMoveExperimentsTo } = usePermissions(); + const workspaces = Loadable.getOrElse([], useObservable(workspaceStore.unarchived)).filter((w) => + canMoveExperimentsTo({ destination: { id: w.id } }), + ); + const loadableProjects: Loadable> = useObservable( + projectStore.getProjectsByWorkspace(workspaceId), + ); + + useEffect(() => { + if (workspaceId !== undefined) { + projectStore.fetch(workspaceId, undefined, true); + } + }, [workspaceId]); + + const handleSubmit = async () => { + if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { + openToast({ title: 'No changes to save.' }); + return; + } + const values = await form.validateFields(); + const projId = values.projectId ?? 1; + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); + + onSubmit?.(results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + }; + + return ( + +
+ + + + {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} +
+
+ ); +}; + +export default FlatRunMoveModalComponent; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 460bc0b5ad2..ec09bb43108 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -100,6 +100,7 @@ const formStore = new FilterFormStore(); interface Props { projectId: number; + workspaceId: number; searchId?: number; } @@ -118,7 +119,7 @@ const parseSortString = (sortString: string): Sort[] => { }); }; -const FlatRuns: React.FC = ({ projectId, searchId }) => { +const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const dataGridRef = useRef(null); const contentRef = useRef(null); const [searchParams, setSearchParams] = useSearchParams(); @@ -949,6 +950,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} projectId={projectId} selectedRuns={selectedRuns} + workspaceId={workspaceId} onActionComplete={onActionComplete} /> diff --git a/webui/react/src/pages/ProjectDetails.tsx b/webui/react/src/pages/ProjectDetails.tsx index 3274b4f5d7f..de9e15815f1 100644 --- a/webui/react/src/pages/ProjectDetails.tsx +++ b/webui/react/src/pages/ProjectDetails.tsx @@ -94,7 +94,7 @@ const ProjectDetails: React.FC = () => { children: (
- +
), diff --git a/webui/react/src/pages/SearchDetails.tsx b/webui/react/src/pages/SearchDetails.tsx index 369003a4c2e..f9a66783f1e 100644 --- a/webui/react/src/pages/SearchDetails.tsx +++ b/webui/react/src/pages/SearchDetails.tsx @@ -138,7 +138,11 @@ const SearchDetails: React.FC = () => { const tabItems: PivotProps['items'] = [ { children: experiment?.projectId && ( - + ), key: TabType.Trials, label: 'Trials', diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 39acbb16325..561101669bf 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -771,9 +771,11 @@ export const killRuns = generateDetApi( - Config.moveRuns, -); +export const moveRuns = generateDetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +>(Config.moveRuns); export const unarchiveRuns = generateDetApi< Api.V1UnarchiveRunsRequest, diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index b782ac8f284..fd92b846f39 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1170,9 +1170,13 @@ export const killRuns: DetApi detApi.Internal.killRuns(params, options), }; -export const moveRuns: DetApi = { +export const moveRuns: DetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +> = { name: 'moveRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.moveRuns(params, options), }; From c5c8ad7afeca07b8320b8c08109011a4c65bf3a4 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 17:13:24 -0700 Subject: [PATCH 024/161] feat: move warning modal --- .../FilterForm/components/FilterFormStore.ts | 21 ++ .../FlatRuns/FlatRunActionButton.test.tsx | 5 + .../pages/FlatRuns/FlatRunActionButton.tsx | 8 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 286 +++++++++++------- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 + 5 files changed, 206 insertions(+), 116 deletions(-) diff --git a/webui/react/src/components/FilterForm/components/FilterFormStore.ts b/webui/react/src/components/FilterForm/components/FilterFormStore.ts index b04658d53f0..e27c7c457b4 100644 --- a/webui/react/src/components/FilterForm/components/FilterFormStore.ts +++ b/webui/react/src/components/FilterForm/components/FilterFormStore.ts @@ -74,6 +74,27 @@ export class FilterFormStore { ); } + public get filterFormSetWithoutId(): Observable { + const replacer = (key: string, value: unknown): unknown => { + return key === 'id' ? undefined : value; + }; + return this.#formset.select((loadableFormset) => + Loadable.match(loadableFormset, { + _: () => ({ + filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, + showArchived: true, + }), + Loaded: (formset) => { + const sweepedForm = this.#sweepInvalid(structuredClone(formset.filterGroup)); + const newFormSet: FilterFormSetWithoutId = JSON.parse( + JSON.stringify({ ...formset, filterGroup: sweepedForm }, replacer), + ); + return newFormSet; + }, + }), + ); + } + public get fieldCount(): Observable { return this.getFieldCount(); } diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 25beefaa41e..b02bfaf216d 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Conjunction, FormKind } from 'components/FilterForm/components/type'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; @@ -9,6 +10,10 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { render( >; projectId: number; workspaceId: number; + filterFormSetWithoutId: FilterFormSetWithoutId; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -47,6 +49,7 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + filterFormSetWithoutId, workspaceId, onActionSuccess, onActionComplete, @@ -69,7 +72,8 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - return flatRunMoveModalOpen(); + flatRunMoveModalOpen(); + break; case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -195,9 +199,11 @@ const FlatRunActionButton = ({ /> )} ); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 87d449e6bb8..1c6c5ebc3de 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -8,9 +8,16 @@ import { Label } from 'hew/Typography'; import { Loadable } from 'hew/utils/loadable'; import { List } from 'immutable'; import { useObservable } from 'micro-observables'; -import React, { useEffect, useId } from 'react'; +import React, { Ref, useCallback, useEffect, useId, useRef } from 'react'; +import { FilterFormSetWithoutId } from 'components/FilterForm/components/type'; import Link from 'components/Link'; +import RunFilterInterstitialModalComponent, { + ControlledModalRef, +} from 'components/RunFilterInterstitialModalComponent'; +import RunMoveWarningModalComponent, { + RunMoveWarningFlowRef, +} from 'components/RunMoveWarningModalComponent'; import usePermissions from 'hooks/usePermissions'; import { paths } from 'routes/utils'; import { moveRuns } from 'services/api'; @@ -29,17 +36,23 @@ type FormInputs = { interface Props { flatRuns: Readonly[]; - onSubmit?: (successfulIds?: number[]) => void; sourceProjectId: number; sourceWorkspaceId?: number; + filterFormSetWithoutId: FilterFormSetWithoutId; + onSubmit?: (successfulIds?: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunMoveModalComponent: React.FC = ({ flatRuns, - onSubmit, + filterFormSetWithoutId, sourceProjectId, sourceWorkspaceId, + onSubmit, + onActionComplete, }: Props) => { + const controlledModalRef: Ref = useRef(null); + const runMoveWarningFlowRef: Ref = useRef(null); const idPrefix = useId(); const { openToast } = useToast(); const [form] = Form.useForm(); @@ -60,7 +73,7 @@ const FlatRunMoveModalComponent: React.FC = ({ } }, [workspaceId]); - const handleSubmit = async () => { + const handleSubmit = useCallback(async () => { if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { openToast({ title: 'No changes to save.' }); return; @@ -68,126 +81,169 @@ const FlatRunMoveModalComponent: React.FC = ({ const values = await form.validateFields(); const projId = values.projectId ?? 1; - const results = await moveRuns({ - destinationProjectId: projId, - runIds: flatRuns.map((flatRun) => flatRun.id), - sourceProjectId, - }); + try { + const closeReason = (await controlledModalRef.current?.open()) ?? 'failed'; + switch (closeReason) { + case 'has_search_runs': { + const closeWarningReason = await runMoveWarningFlowRef.current?.open(); + if (closeWarningReason === 'cancel') { + openToast({ title: 'Cancelled Move Action' }); + return; + } + break; + } + case 'no_search_runs': + break; + case 'manual': + case 'failed': + case 'close': + openToast({ title: 'Cancelled Move Action' }); + return; + } + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); - onSubmit?.(results.successful); + onSubmit?.(results.successful); - const numSuccesses = results.successful.length; - const numFailures = results.failed.length; + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; - const destinationProjectName = - Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? - ''; + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; - if (numSuccesses === 0 && numFailures === 0) { - openToast({ - description: 'No selected runs were eligible for moving', - title: 'No eligible runs', - }); - } else if (numFailures === 0) { - openToast({ - closeable: true, - description: `${results.successful.length} runs moved to project ${destinationProjectName}`, - link: View Project, - title: 'Move Success', - }); - } else if (numSuccesses === 0) { - openToast({ - description: `Unable to move ${numFailures} runs`, - severity: 'Warning', - title: 'Move Failure', - }); - } else { - openToast({ - closeable: true, - description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, - link: View Project, - severity: 'Warning', - title: 'Partial Move Failure', - }); + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + await onActionComplete?.(); + } catch (e) { + handleError(e, { publicSubject: 'Unable to move runs' }); } - form.resetFields(); - }; + }, [ + flatRuns, + form, + loadableProjects, + onActionComplete, + onSubmit, + openToast, + projectId, + sourceProjectId, + sourceWorkspaceId, + workspaceId, + ]); return ( - -
- - - - {workspaceId && workspaceId !== 1 && ( + <> + + - {Loadable.match(loadableProjects, { - Failed: () =>
Failed to load
, - Loaded: (loadableProjects) => ( - - ), - NotLoaded: () => , - })} + initialValue={sourceWorkspaceId ?? 1} + label="Workspace" + name="workspaceId" + rules={[{ message: 'Workspace is required', required: true }]}> +
- )} - -
+ {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} + +
+ + flatRun.id), type: 'ONLY_IN' }} + /> + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ec09bb43108..75f2c381925 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -162,6 +162,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const sortString = useMemo(() => makeSortString(sorts.filter(validSort.is)), [sorts]); const loadableFormset = useObservable(formStore.formset); const filtersString = useObservable(formStore.asJsonString); + const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [total, setTotal] = useState>(NotLoaded); const isMobile = useMobile(); const [isLoading, setIsLoading] = useState(true); @@ -947,6 +948,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { onRowHeightChange={onRowHeightChange} /> Date: Tue, 4 Jun 2024 11:02:45 -0400 Subject: [PATCH 025/161] Archive Unarchive Kill Delete --- .../src/components/RunActionDropdown.tsx | 145 ++++++++-------- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 163 ++++++++++++------ webui/react/src/utils/flatRun.ts | 2 +- 3 files changed, 191 insertions(+), 119 deletions(-) diff --git a/webui/react/src/components/RunActionDropdown.tsx b/webui/react/src/components/RunActionDropdown.tsx index c38f3298d4b..fa78688fec2 100644 --- a/webui/react/src/components/RunActionDropdown.tsx +++ b/webui/react/src/components/RunActionDropdown.tsx @@ -5,11 +5,13 @@ import Dropdown, { DropdownEvent, MenuItem } from 'hew/Dropdown'; import Icon from 'hew/Icon'; // import { useModal } from 'hew/Modal'; import { useToast } from 'hew/Toast'; -// import useConfirm from 'hew/useConfirm'; +import useConfirm from 'hew/useConfirm'; import { copyToClipboard } from 'hew/utils/functions'; // import { Failed, Loadable, Loaded, NotLoaded } from 'hew/utils/loadable'; import React, { - MouseEvent, useCallback, useMemo, + MouseEvent, + useCallback, + useMemo, // useRef, useState } from 'react'; @@ -21,7 +23,7 @@ import css from 'components/ActionDropdown/ActionDropdown.module.scss'; // import InterstitialModalComponent, { // type onInterstitialCloseActionType, // } from 'components/InterstitialModalComponent'; -// import usePermissions from 'hooks/usePermissions'; +import usePermissions from 'hooks/usePermissions'; import { handlePath } from 'routes/utils'; // import { // activateExperiment, @@ -34,16 +36,18 @@ import { handlePath } from 'routes/utils'; // pauseExperiment, // unarchiveExperiment, // } from 'services/api'; +import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { - BulkExperimentItem, - ExperimentAction, + // BulkExperimentItem, FlatRun, + FlatRunAction, // FullExperimentItem, // ProjectExperiment, ValueOf, } from 'types'; import handleError, { ErrorLevel, ErrorType } from 'utils/error'; // import { getActionsForExperiment } from 'utils/experiment'; +import { getActionsForFlatRun } from 'utils/flatRun'; import { capitalize } from 'utils/string'; // import { openCommandResponse } from 'utils/wait'; @@ -55,36 +59,37 @@ interface Props { isContextMenu?: boolean; link?: string; makeOpen?: boolean; - onComplete?: ContextMenuCompleteHandlerProps; + onComplete?: ContextMenuCompleteHandlerProps; onLink?: () => void; onVisibleChange?: (visible: boolean) => void; workspaceId?: number; + projectId: number; } const Action = { Copy: 'Copy Value', NewTab: 'Open Link in New Tab', NewWindow: 'Open Link in New Window', - ...ExperimentAction, + ...FlatRunAction, }; type Action = ValueOf; -// const dropdownActions = [ -// Action.SwitchPin, -// Action.Activate, -// Action.Pause, -// Action.Archive, -// Action.Unarchive, -// Action.Cancel, -// Action.Kill, -// Action.Edit, -// Action.Move, -// Action.RetainLogs, -// Action.OpenTensorBoard, -// Action.HyperparameterSearch, -// Action.Delete, -// ]; +const dropdownActions = [ + // Action.SwitchPin, + // Action.Activate, + // Action.Pause, + Action.Archive, + Action.Unarchive, + // Action.Cancel, + Action.Kill, + // Action.Edit, + // Action.Move, + // Action.RetainLogs, + // Action.OpenTensorBoard, + // Action.HyperparameterSearch, + Action.Delete, +]; const RunActionDropdown: React.FC = ({ run, @@ -92,10 +97,11 @@ const RunActionDropdown: React.FC = ({ isContextMenu, link, makeOpen, - // onComplete, + onComplete, onLink, onVisibleChange, children, + projectId, }: Props) => { // const id = experiment.id; const id = run.id; @@ -114,7 +120,7 @@ const RunActionDropdown: React.FC = ({ // } = useModal(InterstitialModalComponent); // const [experimentItem, setExperimentItem] = useState>(NotLoaded); // const canceler = useRef(new AbortController()); - // const confirm = useConfirm(); + const confirm = useConfirm(); const { openToast } = useToast(); // this is required when experiment does not contain `config`. @@ -153,26 +159,26 @@ const RunActionDropdown: React.FC = ({ // const handleEditComplete = useCallback( // (data: Partial) => { - // onComplete?.(ExperimentAction.Edit, id, data); + // onComplete?.(FlatRunAction.Edit, id, data); // }, // [id, onComplete], // ); // const handleMoveComplete = useCallback(() => { - // onComplete?.(ExperimentAction.Move, id); + // onComplete?.(FlatRunAction.Move, id); // }, [id, onComplete]); // const handleRetainLogsComplete = useCallback(() => { - // onComplete?.(ExperimentAction.RetainLogs, id); + // onComplete?.(FlatRunAction.RetainLogs, id); // }, [id, onComplete]); - // const menuItems = getActionsForExperiment(experiment, dropdownActions, usePermissions()) - // .filter((action) => action !== Action.SwitchPin) - // .map((action) => { - // return { danger: action === Action.Delete, key: action, label: action }; - // }); + const menuItems = getActionsForFlatRun(run, dropdownActions, usePermissions()) + // .filter((action) => action !== Action.SwitchPin) + .map((action: FlatRunAction) => { + return { danger: action === Action.Delete, key: action, label: action }; + }); - const menuItems: MenuItem[] = useMemo(() => [], []); + // const menuItems: MenuItem[] = useMemo(() => [], []); const dropdownMenu = useMemo(() => { const items: MenuItem[] = [...menuItems]; @@ -206,10 +212,10 @@ const RunActionDropdown: React.FC = ({ // await activateExperiment({ experimentId: id }); // await onComplete?.(action, id); // break; - // case Action.Archive: - // await archiveExperiment({ experimentId: id }); - // await onComplete?.(action, id); - // break; + case Action.Archive: + await archiveRuns({ projectId, runIds: [id] }); + await onComplete?.(action, id); + break; // case Action.Cancel: // await cancelExperiment({ experimentId: id }); // await onComplete?.(action, id); @@ -243,40 +249,40 @@ const RunActionDropdown: React.FC = ({ // // await onComplete?.(action, id); // break; // } - // case Action.Kill: - // confirm({ - // content: `Are you sure you want to kill experiment ${id}?`, - // danger: true, - // okText: 'Kill', - // onConfirm: async () => { - // await killExperiment({ experimentId: id }); - // await onComplete?.(action, id); - // }, - // onError: handleError, - // title: 'Confirm Experiment Kill', - // }); - // break; + case Action.Kill: + confirm({ + content: `Are you sure you want to kill run ${id}?`, + danger: true, + okText: 'Kill', + onConfirm: async () => { + await killRuns({ projectId, runIds: [id] }); + await onComplete?.(action, id); + }, + onError: handleError, + title: 'Confirm Run Kill', + }); + break; // case Action.Pause: // await pauseExperiment({ experimentId: id }); // await onComplete?.(action, id); // break; - // case Action.Unarchive: - // await unarchiveExperiment({ experimentId: id }); - // await onComplete?.(action, id); - // break; - // case Action.Delete: - // confirm({ - // content: `Are you sure you want to delete experiment ${id}?`, - // danger: true, - // okText: 'Delete', - // onConfirm: async () => { - // await deleteExperiment({ experimentId: id }); - // await onComplete?.(action, id); - // }, - // onError: handleError, - // title: 'Confirm Experiment Deletion', - // }); - // break; + case Action.Unarchive: + await unarchiveRuns({ projectId, runIds: [id] }); + await onComplete?.(action, id); + break; + case Action.Delete: + confirm({ + content: `Are you sure you want to delete run ${id}?`, + danger: true, + okText: 'Delete', + onConfirm: async () => { + await deleteRuns({ projectId, runIds: [id] }); + await onComplete?.(action, id); + }, + onError: handleError, + title: 'Confirm Run Deletion', + }); + break; // case Action.Edit: // ExperimentEditModal.open(); // break; @@ -315,8 +321,8 @@ const RunActionDropdown: React.FC = ({ link, onLink, id, - // onComplete, - // confirm, + onComplete, + confirm, // ExperimentEditModal, // ExperimentMoveModal, // ExperimentRetainLogsModal, @@ -326,6 +332,7 @@ const RunActionDropdown: React.FC = ({ openToast, // experiment.workspaceId, onVisibleChange, + projectId, ], ); diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ff33958fc75..23ac5e9322b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -71,7 +71,7 @@ import { getProjectColumns, getProjectNumericMetricsRange, searchRuns } from 'se import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; import userStore from 'stores/users'; import userSettings from 'stores/userSettings'; -import { BulkExperimentItem, DetailedUser, ExperimentAction, FlatRun, ProjectColumn } from 'types'; +import { DetailedUser, ExperimentAction, FlatRun, ProjectColumn, RunState } from 'types'; import handleError from 'utils/error'; // import { getProjectExperimentForExperimentItem } from 'utils/experiment'; import { eagerSubscribe } from 'utils/observable'; @@ -330,8 +330,8 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, { max: heatmap.max, @@ -343,8 +343,8 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -355,8 +355,8 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); break; @@ -367,8 +367,8 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -381,9 +381,9 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { settings.columnWidths[currentColumn.column], heatmap && settings.heatmapOn && !settings.heatmapSkipped.includes(currentColumn.column) ? { - max: heatmap.max, - min: heatmap.min, - } + max: heatmap.max, + min: heatmap.min, + } : undefined, ); } @@ -665,8 +665,72 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { // await fetchRuns(); // }, [fetchRuns, handleSelectionChange]); - // const handleContextMenuComplete: ContextMenuCompleteHandlerProps = - // useCallback(() => { }, []); + const handleActionSuccess = useCallback( + ( + action: ExperimentAction, + successfulIds: number[], + // data?: Partial, + ): void => { + const idSet = new Set(successfulIds); + const updateExperiment = (updated: Partial) => { + setRuns((prev) => + prev.map((runsLoadable) => + Loadable.map(runsLoadable, (run) => (idSet.has(run.id) ? { ...run, ...updated } : run)), + ), + ); + }; + switch (action) { + case ExperimentAction.Activate: + updateExperiment({ state: RunState.Active }); + break; + case ExperimentAction.Archive: + updateExperiment({ archived: true }); + break; + case ExperimentAction.Cancel: + updateExperiment({ state: RunState.StoppingCanceled }); + break; + case ExperimentAction.Kill: + updateExperiment({ state: RunState.StoppingKilled }); + break; + case ExperimentAction.Pause: + updateExperiment({ state: RunState.Paused }); + break; + case ExperimentAction.Unarchive: + updateExperiment({ archived: false }); + break; + // case ExperimentAction.Edit: + // if (data) updateExperiment(data); + // openToast({ severity: 'Confirm', title: 'Experiment updated successfully' }); + // break; + // case ExperimentAction.Move: + case ExperimentAction.Delete: + setRuns((prev) => + prev.filter((runLoadable) => + Loadable.match(runLoadable, { + _: () => true, + Loaded: (run) => !idSet.has(run.id), + }), + ), + ); + break; + case ExperimentAction.RetainLogs: + break; + // Exhaustive cases to ignore. + default: + break; + } + handleSelectionChange('remove-all'); + }, + [ + handleSelectionChange, + // openToast, + ], + ); + + const handleContextMenuComplete = useCallback( + (action: ExperimentAction, id: number) => handleActionSuccess(action, [id]), + [handleActionSuccess], + ); const handleColumnsOrderChange = useCallback( // changing both column order and pinned count should happen in one update: @@ -716,12 +780,12 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { const items: MenuItem[] = [ settings.selection.type === 'ALL_EXCEPT' || settings.selection.selections.length > 0 ? { - key: 'select-none', - label: 'Clear selected', - onClick: () => { - handleSelectionChange?.('remove-all'); - }, - } + key: 'select-none', + label: 'Clear selected', + onClick: () => { + handleSelectionChange?.('remove-all'); + }, + } : null, ...[5, 10, 25].map((n) => ({ key: `select-${n}`, @@ -750,32 +814,32 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { ? null : !isPinned ? { - icon: , - key: 'pin', - label: 'Pin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), - ); - }, - } + icon: , + key: 'pin', + label: 'Pin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), + ); + }, + } : { - disabled: settings.pinnedColumnsCount <= 1, - icon: , - key: 'unpin', - label: 'Unpin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.max(settings.pinnedColumnsCount - 1, 0), - ); + disabled: settings.pinnedColumnsCount <= 1, + icon: , + key: 'unpin', + label: 'Unpin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.max(settings.pinnedColumnsCount - 1, 0), + ); + }, }, - }, { icon: , key: 'hide', @@ -832,9 +896,9 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { sortCount === 0 ? [] : [ - { type: 'divider' as const }, - ...sortMenuItemsForColumn(column, sorts, handleSortChange), - ]; + { type: 'divider' as const }, + ...sortMenuItemsForColumn(column, sorts, handleSortChange), + ]; items.push( ...sortMenuItems, @@ -989,7 +1053,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { ) : ( <> - + columns={columns} data={runs} getHeaderMenuItems={getHeaderMenuItems} @@ -1017,6 +1081,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { // )} link={link} makeOpen={open} + projectId={projectId} run={rowData} onComplete={onComplete} onLink={onClose} @@ -1032,7 +1097,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { total={total.getOrElse(PAGE_SIZE)} onColumnResize={handleColumnWidthChange} onColumnsOrderChange={handleColumnsOrderChange} - // onContextMenuComplete={handleContextMenuComplete} + onContextMenuComplete={handleContextMenuComplete} onPageUpdate={handlePageUpdate} onPinnedColumnsCountChange={handlePinnedColumnsCountChange} onSelectionChange={handleSelectionChange} diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 8b52c9cb22c..978622a2d7c 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -28,7 +28,7 @@ export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly, targets: ReadonlyArray, permissions: Readonly, From 6b0e315bada3a43dd09fdaa56b8eb77148d9e998 Mon Sep 17 00:00:00 2001 From: John Kim Date: Tue, 4 Jun 2024 11:15:45 -0400 Subject: [PATCH 026/161] merge errors fixes and fmt --- .../pages/FlatRuns/FlatRunActionButton.tsx | 10 +- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 96 +++++++++---------- webui/react/src/utils/flatRun.ts | 2 +- 3 files changed, 55 insertions(+), 53 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 08e67c05252..7da82f00219 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -108,8 +108,9 @@ const FlatRunActionButton = ({ } else if (numFailures === 0) { openToast({ closeable: true, - description: `${action} succeeded for ${results.successful.length - } ${LABEL_PLURAL.toLowerCase()}`, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, title: `${action} Success`, }); } else if (numSuccesses === 0) { @@ -121,8 +122,9 @@ const FlatRunActionButton = ({ } else { openToast({ closeable: true, - description: `${action} succeeded for ${numSuccesses} out of ${numFailures + numSuccesses - } eligible + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible ${LABEL_PLURAL.toLowerCase()}`, severity: 'Warning', title: `Partial ${action} Failure`, diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 9bf82be24a0..67012b0a9b9 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -71,7 +71,7 @@ import { getProjectColumns, getProjectNumericMetricsRange, searchRuns } from 'se import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; import userStore from 'stores/users'; import userSettings from 'stores/userSettings'; -import { DetailedUser, ExperimentAction, FlatRun, ProjectColumn, RunState } from 'types'; +import { DetailedUser, FlatRun, FlatRunAction, ProjectColumn } from 'types'; import handleError from 'utils/error'; // import { getProjectExperimentForExperimentItem } from 'utils/experiment'; import { eagerSubscribe } from 'utils/observable'; @@ -332,8 +332,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, { max: heatmap.max, @@ -345,8 +345,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -357,8 +357,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); break; @@ -369,8 +369,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -383,9 +383,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { settings.columnWidths[currentColumn.column], heatmap && settings.heatmapOn && !settings.heatmapSkipped.includes(currentColumn.column) ? { - max: heatmap.max, - min: heatmap.min, - } + max: heatmap.max, + min: heatmap.min, + } : undefined, ); } @@ -667,8 +667,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { await fetchRuns(); }, [fetchRuns, handleSelectionChange]); - const handleContextMenuComplete: ContextMenuCompleteHandlerProps = - useCallback(() => { }, []); + const handleContextMenuComplete: ContextMenuCompleteHandlerProps = + useCallback(() => {}, []); const handleColumnsOrderChange = useCallback( // changing both column order and pinned count should happen in one update: @@ -718,12 +718,12 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const items: MenuItem[] = [ settings.selection.type === 'ALL_EXCEPT' || settings.selection.selections.length > 0 ? { - key: 'select-none', - label: 'Clear selected', - onClick: () => { - handleSelectionChange?.('remove-all'); - }, - } + key: 'select-none', + label: 'Clear selected', + onClick: () => { + handleSelectionChange?.('remove-all'); + }, + } : null, ...[5, 10, 25].map((n) => ({ key: `select-${n}`, @@ -752,32 +752,32 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { ? null : !isPinned ? { - icon: , - key: 'pin', - label: 'Pin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), - ); - }, - } + icon: , + key: 'pin', + label: 'Pin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), + ); + }, + } : { - disabled: settings.pinnedColumnsCount <= 1, - icon: , - key: 'unpin', - label: 'Unpin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.max(settings.pinnedColumnsCount - 1, 0), - ); + disabled: settings.pinnedColumnsCount <= 1, + icon: , + key: 'unpin', + label: 'Unpin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.max(settings.pinnedColumnsCount - 1, 0), + ); + }, }, - }, { icon: , key: 'hide', @@ -834,9 +834,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { sortCount === 0 ? [] : [ - { type: 'divider' as const }, - ...sortMenuItemsForColumn(column, sorts, handleSortChange), - ]; + { type: 'divider' as const }, + ...sortMenuItemsForColumn(column, sorts, handleSortChange), + ]; items.push( ...sortMenuItems, @@ -993,7 +993,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { ) : ( <> - + columns={columns} data={runs} getHeaderMenuItems={getHeaderMenuItems} diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 8b52c9cb22c..978622a2d7c 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -28,7 +28,7 @@ export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly, targets: ReadonlyArray, permissions: Readonly, From d92bc89debc90be04352039ced3a85a4b107ce3f Mon Sep 17 00:00:00 2001 From: John Kim Date: Tue, 4 Jun 2024 17:32:50 -0400 Subject: [PATCH 027/161] move modal --- .../src/components/RunActionDropdown.tsx | 25 ++++++++++++++++--- .../pages/FlatRuns/FlatRunActionButton.tsx | 2 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 2 +- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 1 + 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/webui/react/src/components/RunActionDropdown.tsx b/webui/react/src/components/RunActionDropdown.tsx index fa78688fec2..a36a5e088d9 100644 --- a/webui/react/src/components/RunActionDropdown.tsx +++ b/webui/react/src/components/RunActionDropdown.tsx @@ -4,6 +4,7 @@ import { ContextMenuCompleteHandlerProps } from 'hew/DataGrid/contextMenu'; import Dropdown, { DropdownEvent, MenuItem } from 'hew/Dropdown'; import Icon from 'hew/Icon'; // import { useModal } from 'hew/Modal'; +import { useModal } from 'hew/Modal'; import { useToast } from 'hew/Toast'; import useConfirm from 'hew/useConfirm'; import { copyToClipboard } from 'hew/utils/functions'; @@ -24,6 +25,7 @@ import css from 'components/ActionDropdown/ActionDropdown.module.scss'; // type onInterstitialCloseActionType, // } from 'components/InterstitialModalComponent'; import usePermissions from 'hooks/usePermissions'; +import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; import { handlePath } from 'routes/utils'; // import { // activateExperiment, @@ -49,6 +51,8 @@ import handleError, { ErrorLevel, ErrorType } from 'utils/error'; // import { getActionsForExperiment } from 'utils/experiment'; import { getActionsForFlatRun } from 'utils/flatRun'; import { capitalize } from 'utils/string'; + +import { FilterFormSetWithoutId } from './FilterForm/components/type'; // import { openCommandResponse } from 'utils/wait'; interface Props { @@ -64,6 +68,7 @@ interface Props { onVisibleChange?: (visible: boolean) => void; workspaceId?: number; projectId: number; + filterFormSetWithoutId: FilterFormSetWithoutId; } const Action = { @@ -84,7 +89,7 @@ const dropdownActions = [ // Action.Cancel, Action.Kill, // Action.Edit, - // Action.Move, + Action.Move, // Action.RetainLogs, // Action.OpenTensorBoard, // Action.HyperparameterSearch, @@ -101,10 +106,13 @@ const RunActionDropdown: React.FC = ({ onLink, onVisibleChange, children, + filterFormSetWithoutId, projectId, }: Props) => { // const id = experiment.id; const id = run.id; + const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = + useModal(FlatRunMoveModalComponent); // const ExperimentEditModal = useModal(ExperimentEditModalComponent); // const ExperimentMoveModal = useModal(ExperimentMoveModalComponent); // const ExperimentRetainLogsModal = useModal(ExperimentRetainLogsModalComponent); @@ -286,9 +294,10 @@ const RunActionDropdown: React.FC = ({ // case Action.Edit: // ExperimentEditModal.open(); // break; - // case Action.Move: - // ExperimentMoveModal.open(); - // break; + case Action.Move: + // ExperimentMoveModal.open(); + flatRunMoveModalOpen(); + break; // case Action.RetainLogs: // ExperimentRetainLogsModal.open(); // break; @@ -333,6 +342,7 @@ const RunActionDropdown: React.FC = ({ // experiment.workspaceId, onVisibleChange, projectId, + flatRunMoveModalOpen, ], ); @@ -350,6 +360,13 @@ const RunActionDropdown: React.FC = ({ const shared = ( <> + onComplete?.(FlatRunAction.Move, id)} + /> {/* void; - onActionComplete?: () => Promise; + onActionComplete?: () => void; } const FlatRunActionButton = ({ diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 1c6c5ebc3de..5acbd0f3b68 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -40,7 +40,7 @@ interface Props { sourceWorkspaceId?: number; filterFormSetWithoutId: FilterFormSetWithoutId; onSubmit?: (successfulIds?: number[]) => void; - onActionComplete?: () => Promise; + onActionComplete?: () => void; } const FlatRunMoveModalComponent: React.FC = ({ diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 67012b0a9b9..6bb1c66e2bb 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -1019,6 +1019,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { // rowData.experiment, // project, // )} + filterFormSetWithoutId={filterFormSetWithoutId} link={link} makeOpen={open} projectId={projectId} From f67ac6db018bf266c112aa0d4c8afe5bd977a119 Mon Sep 17 00:00:00 2001 From: John Kim Date: Tue, 4 Jun 2024 17:44:56 -0400 Subject: [PATCH 028/161] cleanup --- .../src/components/RunActionDropdown.tsx | 248 +----------------- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 9 +- 2 files changed, 11 insertions(+), 246 deletions(-) diff --git a/webui/react/src/components/RunActionDropdown.tsx b/webui/react/src/components/RunActionDropdown.tsx index a36a5e088d9..a124badd07c 100644 --- a/webui/react/src/components/RunActionDropdown.tsx +++ b/webui/react/src/components/RunActionDropdown.tsx @@ -1,72 +1,32 @@ import { GridCell } from '@glideapps/glide-data-grid'; -import Button from 'hew/Button'; import { ContextMenuCompleteHandlerProps } from 'hew/DataGrid/contextMenu'; import Dropdown, { DropdownEvent, MenuItem } from 'hew/Dropdown'; -import Icon from 'hew/Icon'; -// import { useModal } from 'hew/Modal'; import { useModal } from 'hew/Modal'; import { useToast } from 'hew/Toast'; import useConfirm from 'hew/useConfirm'; import { copyToClipboard } from 'hew/utils/functions'; -// import { Failed, Loadable, Loaded, NotLoaded } from 'hew/utils/loadable'; -import React, { - MouseEvent, - useCallback, - useMemo, - // useRef, useState -} from 'react'; +import React, { MouseEvent, useCallback, useMemo } from 'react'; -import css from 'components/ActionDropdown/ActionDropdown.module.scss'; -// import ExperimentEditModalComponent from 'components/ExperimentEditModal'; -// import ExperimentMoveModalComponent from 'components/ExperimentMoveModal'; -// import ExperimentRetainLogsModalComponent from 'components/ExperimentRetainLogsModal'; -// import HyperparameterSearchModalComponent from 'components/HyperparameterSearchModal'; -// import InterstitialModalComponent, { -// type onInterstitialCloseActionType, -// } from 'components/InterstitialModalComponent'; import usePermissions from 'hooks/usePermissions'; import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; import { handlePath } from 'routes/utils'; -// import { -// activateExperiment, -// archiveExperiment, -// cancelExperiment, -// deleteExperiment, -// getExperiment, -// killExperiment, -// openOrCreateTensorBoard, -// pauseExperiment, -// unarchiveExperiment, -// } from 'services/api'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; -import { - // BulkExperimentItem, - FlatRun, - FlatRunAction, - // FullExperimentItem, - // ProjectExperiment, - ValueOf, -} from 'types'; +import { FlatRun, FlatRunAction, ValueOf } from 'types'; import handleError, { ErrorLevel, ErrorType } from 'utils/error'; -// import { getActionsForExperiment } from 'utils/experiment'; import { getActionsForFlatRun } from 'utils/flatRun'; import { capitalize } from 'utils/string'; import { FilterFormSetWithoutId } from './FilterForm/components/type'; -// import { openCommandResponse } from 'utils/wait'; interface Props { children?: React.ReactNode; cell?: GridCell; - // experiment: ProjectExperiment; run: FlatRun; - isContextMenu?: boolean; link?: string; makeOpen?: boolean; onComplete?: ContextMenuCompleteHandlerProps; onLink?: () => void; onVisibleChange?: (visible: boolean) => void; - workspaceId?: number; projectId: number; filterFormSetWithoutId: FilterFormSetWithoutId; } @@ -80,113 +40,30 @@ const Action = { type Action = ValueOf; -const dropdownActions = [ - // Action.SwitchPin, - // Action.Activate, - // Action.Pause, - Action.Archive, - Action.Unarchive, - // Action.Cancel, - Action.Kill, - // Action.Edit, - Action.Move, - // Action.RetainLogs, - // Action.OpenTensorBoard, - // Action.HyperparameterSearch, - Action.Delete, -]; +const dropdownActions = [Action.Archive, Action.Unarchive, Action.Kill, Action.Move, Action.Delete]; const RunActionDropdown: React.FC = ({ run, cell, - isContextMenu, link, makeOpen, onComplete, onLink, onVisibleChange, - children, filterFormSetWithoutId, projectId, }: Props) => { - // const id = experiment.id; const id = run.id; const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = useModal(FlatRunMoveModalComponent); - // const ExperimentEditModal = useModal(ExperimentEditModalComponent); - // const ExperimentMoveModal = useModal(ExperimentMoveModalComponent); - // const ExperimentRetainLogsModal = useModal(ExperimentRetainLogsModalComponent); - // const { - // Component: HyperparameterSearchModal, - // open: hyperparameterSearchModalOpen, - // close: hyperparameterSearchModalClose, - // } = useModal(HyperparameterSearchModalComponent); - // const { - // Component: InterstitialModal, - // open: interstitialModalOpen, - // close: interstitialModalClose, - // } = useModal(InterstitialModalComponent); - // const [experimentItem, setExperimentItem] = useState>(NotLoaded); - // const canceler = useRef(new AbortController()); const confirm = useConfirm(); const { openToast } = useToast(); - // this is required when experiment does not contain `config`. - // since we removed config. See #8765 on GitHub - // const fetchedExperimentItem = useCallback(async () => { - // try { - // setExperimentItem(NotLoaded); - // const response: FullExperimentItem = await getExperiment( - // { id: experiment.id }, - // { signal: canceler.current.signal }, - // ); - // setExperimentItem(Loaded(response)); - // } catch (e) { - // handleError(e, { publicSubject: 'Unable to fetch experiment data.' }); - // setExperimentItem(Failed(new Error('experiment data failure'))); - // } - // }, [experiment.id]); - - // const onInterstitalClose: onInterstitialCloseActionType = useCallback( - // (reason) => { - // switch (reason) { - // case 'ok': - // hyperparameterSearchModalOpen(); - // break; - // case 'failed': - // break; - // case 'close': - // canceler.current.abort(); - // canceler.current = new AbortController(); - // break; - // } - // interstitialModalClose(reason); - // }, - // [hyperparameterSearchModalOpen, interstitialModalClose], - // ); - - // const handleEditComplete = useCallback( - // (data: Partial) => { - // onComplete?.(FlatRunAction.Edit, id, data); - // }, - // [id, onComplete], - // ); - - // const handleMoveComplete = useCallback(() => { - // onComplete?.(FlatRunAction.Move, id); - // }, [id, onComplete]); - - // const handleRetainLogsComplete = useCallback(() => { - // onComplete?.(FlatRunAction.RetainLogs, id); - // }, [id, onComplete]); - - const menuItems = getActionsForFlatRun(run, dropdownActions, usePermissions()) - // .filter((action) => action !== Action.SwitchPin) - .map((action: FlatRunAction) => { + const menuItems = getActionsForFlatRun(run, dropdownActions, usePermissions()).map( + (action: FlatRunAction) => { return { danger: action === Action.Delete, key: action, label: action }; - }); - - // const menuItems: MenuItem[] = useMemo(() => [], []); + }, + ); const dropdownMenu = useMemo(() => { const items: MenuItem[] = [...menuItems]; @@ -216,47 +93,10 @@ const RunActionDropdown: React.FC = ({ handlePath(e as MouseEvent, { path: link, popout: 'window' }); await onLink?.(); break; - // case Action.Activate: - // await activateExperiment({ experimentId: id }); - // await onComplete?.(action, id); - // break; case Action.Archive: await archiveRuns({ projectId, runIds: [id] }); await onComplete?.(action, id); break; - // case Action.Cancel: - // await cancelExperiment({ experimentId: id }); - // await onComplete?.(action, id); - // break; - // case Action.OpenTensorBoard: { - // const commandResponse = await openOrCreateTensorBoard({ - // experimentIds: [id], - // workspaceId: experiment.workspaceId, - // }); - // openCommandResponse(commandResponse); - // break; - // } - // case Action.SwitchPin: { - // // TODO: leaving old code behind for when we want to enable this for our current experiment list. - // // const newPinned = { ...(settings?.pinned ?? {}) }; - // // const pinSet = new Set(newPinned[experiment.projectId]); - // // if (pinSet.has(id)) { - // // pinSet.delete(id); - // // } else { - // // if (pinSet.size >= 5) { - // // notification.warning({ - // // description: 'Up to 5 pinned items', - // // message: 'Unable to pin this item', - // // }); - // // break; - // // } - // // pinSet.add(id); - // // } - // // newPinned[experiment.projectId] = Array.from(pinSet); - // // updateSettings?.({ pinned: newPinned }); - // // await onComplete?.(action, id); - // break; - // } case Action.Kill: confirm({ content: `Are you sure you want to kill run ${id}?`, @@ -270,10 +110,6 @@ const RunActionDropdown: React.FC = ({ title: 'Confirm Run Kill', }); break; - // case Action.Pause: - // await pauseExperiment({ experimentId: id }); - // await onComplete?.(action, id); - // break; case Action.Unarchive: await unarchiveRuns({ projectId, runIds: [id] }); await onComplete?.(action, id); @@ -291,20 +127,9 @@ const RunActionDropdown: React.FC = ({ title: 'Confirm Run Deletion', }); break; - // case Action.Edit: - // ExperimentEditModal.open(); - // break; case Action.Move: - // ExperimentMoveModal.open(); flatRunMoveModalOpen(); break; - // case Action.RetainLogs: - // ExperimentRetainLogsModal.open(); - // break; - // case Action.HyperparameterSearch: - // interstitialModalOpen(); - // fetchedExperimentItem(); - // break; case Action.Copy: /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ await copyToClipboard((cell as any).displayData || cell?.copyData); @@ -332,32 +157,14 @@ const RunActionDropdown: React.FC = ({ id, onComplete, confirm, - // ExperimentEditModal, - // ExperimentMoveModal, - // ExperimentRetainLogsModal, - // interstitialModalOpen, - // fetchedExperimentItem, cell, openToast, - // experiment.workspaceId, onVisibleChange, projectId, flatRunMoveModalOpen, ], ); - if (dropdownMenu.length === 0) { - return ( - (children as JSX.Element) ?? ( -
- -
- ) - ); - } - const shared = ( <> = ({ sourceWorkspaceId={run.workspaceId} onActionComplete={() => onComplete?.(FlatRunAction.Move, id)} /> - {/* - - - {experimentItem.isLoaded && ( - - )} - */} ); - return children ? ( + return ( <> - - {children} + +
{shared} - ) : ( -
- -
); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 6bb1c66e2bb..c30cb978780 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -28,7 +28,6 @@ import Link from 'hew/Link'; import Message from 'hew/Message'; import Pagination from 'hew/Pagination'; import Row from 'hew/Row'; -// import { useToast } from 'hew/Toast'; import { Loadable, Loaded, NotLoaded } from 'hew/utils/loadable'; import { isUndefined } from 'lodash'; import { useObservable } from 'micro-observables'; @@ -73,7 +72,6 @@ import userStore from 'stores/users'; import userSettings from 'stores/userSettings'; import { DetailedUser, FlatRun, FlatRunAction, ProjectColumn } from 'types'; import handleError from 'utils/error'; -// import { getProjectExperimentForExperimentItem } from 'utils/experiment'; import { eagerSubscribe } from 'utils/observable'; import { pluralizer } from 'utils/string'; @@ -126,7 +124,6 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const dataGridRef = useRef(null); const contentRef = useRef(null); const [searchParams, setSearchParams] = useSearchParams(); - // const { openToast } = useToast(); const settingsPath = useMemo(() => settingsPathForProject(projectId), [projectId]); const flatRunsSettingsObs = useMemo( @@ -1015,10 +1012,6 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { return ( = ({ projectId, workspaceId, searchId }) => { onComplete={onComplete} onLink={onClose} onVisibleChange={onVisibleChange}> -
+ {/*
*/} ); }} From daf0c4aa4ea06c0b7180ac486f48825cce2c4d64 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 14 May 2024 16:38:12 -0700 Subject: [PATCH 029/161] feat: initial implementation of flat run actions --- .../pages/FlatRuns/FlatRunActionButton.tsx | 258 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 25 +- webui/react/src/services/api.ts | 24 ++ webui/react/src/services/apiConfig.ts | 53 +++- webui/react/src/services/decoder.ts | 8 +- 5 files changed, 350 insertions(+), 18 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx new file mode 100644 index 00000000000..2f8ebbd42f4 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -0,0 +1,258 @@ +import Button from 'hew/Button'; +import Dropdown, { MenuItem } from 'hew/Dropdown'; +import Icon, { IconName } from 'hew/Icon'; +import { useModal } from 'hew/Modal'; +import { useToast } from 'hew/Toast'; +import { useCallback, useMemo, useState } from 'react'; + +import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; +import { BatchAction } from 'components/TableActionBar'; +// import usePermissions from 'hooks/usePermissions'; +import { + archiveRuns, + deleteRuns, + killRuns, + openOrCreateTensorBoard, + unarchiveRuns, +} from 'services/api'; +import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { capitalizeWord } from 'utils/string'; +import { openCommandResponse } from 'utils/wait'; + +// export const getActionsForRunsUnion = ( +// experiments: FlatRun[], +// targets: ExperimentAction[], +// permissions: ExperimentPermissionSet, +// ): ExperimentAction[] => { +// if (!experiments.length) return []; // redundant, for clarity +// const actionsForExperiments = experiments.map((e) => +// getActionsForExperiment(e, targets, permissions), +// ); +// return targets.filter((action) => +// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), +// ); +// }; + +const BATCH_ACTIONS = [ + ExperimentAction.OpenTensorBoard, + ExperimentAction.Move, + ExperimentAction.RetainLogs, + ExperimentAction.Archive, + ExperimentAction.Unarchive, + ExperimentAction.Delete, + ExperimentAction.Activate, + ExperimentAction.Pause, + ExperimentAction.Cancel, + ExperimentAction.Kill, +] as const; + +const ACTION_ICONS: Record = { + [ExperimentAction.Activate]: 'play', + [ExperimentAction.Pause]: 'pause', + [ExperimentAction.Cancel]: 'stop', + [ExperimentAction.Archive]: 'archive', + [ExperimentAction.Unarchive]: 'document', + [ExperimentAction.Move]: 'workspaces', + [ExperimentAction.RetainLogs]: 'logs', + [ExperimentAction.OpenTensorBoard]: 'tensor-board', + [ExperimentAction.Kill]: 'cancelled', + [ExperimentAction.Delete]: 'error', +} as const; + +const LABEL_PLURAL = 'runs'; + +interface Props { + isMobile: boolean; + selectedRuns: FlatRun[]; + project: Project; + onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; +} + +const FlatRunActionButton = ({ + isMobile, + selectedRuns, + project, + onActionSuccess, +}: Props): JSX.Element => { + const [batchAction, setBatchAction] = useState(undefined); + // const permissions = usePermissions(); + const { openToast } = useToast(); + const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); + + const sendBatchActions = useCallback( + // TODO: remove this + // eslint-disable-next-line require-await + async (action: BatchAction): Promise => { + const validRunIds = selectedRuns + // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .map((run) => run.id); + const params = { + projectId: project.id, + runIds: validRunIds, + }; + switch (action) { + case ExperimentAction.OpenTensorBoard: { + if (validRunIds.length !== selectedRuns.length) { + // if unmanaged experiments are selected, open experimentTensorBoardModal + // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs + } else { + openCommandResponse( + await openOrCreateTensorBoard({ + experimentIds: params.runIds, + workspaceId: project.workspaceId, + }), + ); + } + return; + } + case ExperimentAction.Move: + // return ExperimentMoveModal.open(); + case ExperimentAction.RetainLogs: + // return ExperimentRetainLogsModal.open(); + case ExperimentAction.Activate: + // return await archiveRuns(params); + case ExperimentAction.Archive: + return await archiveRuns(params); + case ExperimentAction.Cancel: + // return await cancelExperiments(params); + case ExperimentAction.Kill: + return await killRuns(params); + case ExperimentAction.Pause: + // return await pauseExperiments(params); + case ExperimentAction.Unarchive: + return await unarchiveRuns(params); + case ExperimentAction.Delete: + return await deleteRuns(params); + } + }, + [project.id, project.workspaceId, selectedRuns], + ); + + const submitBatchAction = useCallback( + async (action: BatchAction) => { + try { + const results = await sendBatchActions(action); + if (results === undefined) return; + + onActionSuccess?.(action, results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: `No selected ${LABEL_PLURAL.toLowerCase()} were eligible for ${action.toLowerCase()}`, + title: `No eligible ${LABEL_PLURAL.toLowerCase()}`, + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, + title: `${action} Success`, + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to ${action.toLowerCase()} ${numFailures} ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `${action} Failure`, + }); + } else { + openToast({ + closeable: true, + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible + ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `Partial ${action} Failure`, + }); + } + } catch (e) { + const publicSubject = + action === ExperimentAction.OpenTensorBoard + ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` + : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + handleError(e, { + isUserTriggered: true, + publicMessage: 'Please try again later.', + publicSubject, + silent: false, + }); + } finally { + // onActionComplete?.(); + } + }, + [sendBatchActions, onActionSuccess, openToast], + ); + + const handleBatchAction = useCallback( + (action: string) => { + switch (action) { + case ExperimentAction.OpenTensorBoard: + submitBatchAction(action); + break; + case ExperimentAction.Move: + case ExperimentAction.RetainLogs: + sendBatchActions(action); + break; + default: + setBatchAction(action as BatchAction); + BatchActionConfirmModal.open(); + break; + } + }, + [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + ); + + // const availableBatchActions = useMemo(() => { + // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. + // }, [selectedExperimentIds, experimentMap, permissions]); + + const editMenuItems = useMemo(() => { + const groupedBatchActions = [ + BATCH_ACTIONS.slice(0, 1), // View in TensorBoard + BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete + BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill + ]; + const groupSize = groupedBatchActions.length; + return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { + const isLastGroup = index === groupSize - 1; + group.forEach((action) => + acc.push({ + danger: action === ExperimentAction.Delete, + // disabled: !availableBatchActions.includes(action), // TODO uncomment later + icon: , + key: action, + label: action, + }), + ); + if (!isLastGroup) acc.push({ type: 'divider' }); + return acc; + }, []); + }, []); + + return ( + <> + {selectedRuns.length > 0 && ( + + + + )} + {batchAction && ( + exp.unmanaged)} // TODO: is it needed for Runs? + onConfirm={() => submitBatchAction(batchAction)} + /> + )} + + ); +}; + +export default FlatRunActionButton; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ac8528b4606..96f5c2c1bca 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -63,6 +63,7 @@ import { DEFAULT_SELECTION, SelectionType as SelectionState, } from 'pages/F_ExpList/F_ExperimentList.settings'; +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { paths } from 'routes/utils'; import { getProjectColumns, getProjectNumericMetricsRange, searchRuns } from 'services/api'; import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; @@ -196,6 +197,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { } }, [projectId]); + const selectedRunIdSet = useMemo(() => { + return new Set(settings.selection.type === 'ONLY_IN' ? settings.selection.selections : []); + }, [settings.selection]); + const columnsIfLoaded = useMemo( () => (isLoadingSettings ? [] : settings.columns), [isLoadingSettings, settings.columns], @@ -214,18 +219,16 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { if (isLoadingSettings) { return selectedMap; } - const selectedIdSet = new Set( - settings.selection.type === 'ONLY_IN' ? settings.selection.selections : [], - ); + runs.forEach((r, index) => { Loadable.forEach(r, (run) => { - if (selectedIdSet.has(run.id)) { + if (selectedRunIdSet.has(run.id)) { selectedMap.set(run.id, { index, run }); } }); }); return selectedMap; - }, [isLoadingSettings, settings.selection, runs]); + }, [isLoadingSettings, runs, selectedRunIdSet]); const selection = useMemo(() => { let rows = CompactSelection.empty(); @@ -238,6 +241,13 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { }; }, [loadedSelectedRunIds]); + const selectedRuns: FlatRun[] = useMemo(() => { + const selected = runs.flatMap((run) => { + return run.isLoaded && selectedRunIdSet.has(run.data.id) ? [run.data] : []; + }); + return selected; + }, [runs, selectedRunIdSet]); + const handleIsOpenFilterChange = useCallback((newOpen: boolean) => { setIsOpenFilter(newOpen); if (!newOpen) { @@ -930,6 +940,11 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { rowHeight={globalSettings.rowHeight} onRowHeightChange={onRowHeightChange} /> + diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 0a6c975e646..39acbb16325 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -757,6 +757,30 @@ export const searchRuns = generateDetApi< Type.SearchFlatRunPagination >(Config.searchRuns); +export const archiveRuns = generateDetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +>(Config.archiveRuns); + +export const deleteRuns = generateDetApi( + Config.deleteRuns, +); + +export const killRuns = generateDetApi( + Config.killRuns, +); + +export const moveRuns = generateDetApi( + Config.moveRuns, +); + +export const unarchiveRuns = generateDetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + void +>(Config.unarchiveRuns); + /* Tasks */ export const getCommands = generateDetApi< diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index f9d34fd7a9b..7c8c01d55f3 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -717,7 +717,7 @@ export const archiveExperiments: DetApi< Type.BulkActionResult > = { name: 'archiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.archiveExperiments(params.projectId, params, options); }, @@ -741,7 +741,7 @@ export const deleteExperiments: DetApi< Type.BulkActionResult > = { name: 'deleteExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.deleteExperiments(params.projectId, params, options); }, @@ -765,7 +765,7 @@ export const unarchiveExperiments: DetApi< Type.BulkActionResult > = { name: 'unarchiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.unarchiveExperiments(params.projectId, params, options); }, @@ -789,7 +789,7 @@ export const activateExperiments: DetApi< Type.BulkActionResult > = { name: 'activateExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.activateExperiments(params.projectId, params, options); }, @@ -813,7 +813,7 @@ export const pauseExperiments: DetApi< Type.BulkActionResult > = { name: 'pauseExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.pauseExperiments(params.projectId, params, options); }, @@ -837,7 +837,7 @@ export const cancelExperiments: DetApi< Type.BulkActionResult > = { name: 'cancelExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.cancelExperiments(params.projectId, params, options); }, @@ -861,7 +861,7 @@ export const killExperiments: DetApi< Type.BulkActionResult > = { name: 'killExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.killExperiments(params.projectId, params, options); }, @@ -1014,7 +1014,7 @@ export const moveExperiments: DetApi< Type.BulkActionResult > = { name: 'moveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.moveExperiments(params.projectId, params, options), }; @@ -1025,7 +1025,7 @@ export const changeExperimentLogRetention: DetApi< Type.BulkActionResult > = { name: 'changeExperimentLogRetention', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.putExperimentsRetainLogs(params.projectId, params, options), }; @@ -1148,6 +1148,41 @@ export const searchRuns: DetApi< ), }; +export const archiveRuns: DetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'archiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.archiveRuns(params, options), +}; + +export const deleteRuns: DetApi = { + name: 'deleteRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.deleteRuns(params, options), +}; + +export const killRuns: DetApi = { + name: 'killRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.killRuns(params, options), +}; + +export const moveRuns: DetApi = { + name: 'moveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.moveRuns(params, options), +}; + +export const unarchiveRuns: DetApi = + { + name: 'unarchiveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), + }; + /* Tasks */ export const getTask: DetApi< diff --git a/webui/react/src/services/decoder.ts b/webui/react/src/services/decoder.ts index 6f15eb56447..23f4820e5b7 100644 --- a/webui/react/src/services/decoder.ts +++ b/webui/react/src/services/decoder.ts @@ -875,11 +875,11 @@ export const decodeJobStates = ( >; }; -export const mapV1ExperimentActionResults = ( - results: Sdk.V1ExperimentActionResult[], +export const mapV1ActionResults = ( + results: Sdk.V1ExperimentActionResult[] | Sdk.V1RunActionResult[], ): types.BulkActionResult => { return results.reduce( - (acc, cur) => { + (acc: types.BulkActionResult, cur) => { if (cur.error.length > 0) { acc.failed.push(cur); } else { @@ -887,7 +887,7 @@ export const mapV1ExperimentActionResults = ( } return acc; }, - { failed: [], successful: [] } as types.BulkActionResult, + { failed: [], successful: [] }, ); }; From ebe8dc203f3c9e84f6ae8c3db2784115b417ace5 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 22 May 2024 11:34:30 -0700 Subject: [PATCH 030/161] fix: minor changes --- .../react/src/pages/FlatRuns/FlatRunActionButton.tsx | 4 +--- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2f8ebbd42f4..2fbd2d13cd6 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -81,8 +81,6 @@ const FlatRunActionButton = ({ const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( - // TODO: remove this - // eslint-disable-next-line require-await async (action: BatchAction): Promise => { const validRunIds = selectedRuns // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission @@ -111,7 +109,7 @@ const FlatRunActionButton = ({ case ExperimentAction.RetainLogs: // return ExperimentRetainLogsModal.open(); case ExperimentAction.Activate: - // return await archiveRuns(params); + // return await activate(params); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Cancel: diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 96f5c2c1bca..d76315d33e9 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,6 +53,7 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; +import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -656,6 +657,15 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); + const onActionSuccess = useCallback( + // TODO: update this function + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (_action: BatchAction, _successfulIds: number[]) => { + handleSelectionChange('remove-all'); + }, + [handleSelectionChange], + ); + const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -944,6 +954,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} + onActionSuccess={onActionSuccess} /> From cb7699d1a2d5240a3259bed45d206a13cb0cd5b0 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 16:31:46 -0700 Subject: [PATCH 031/161] feat: add RBAC permissions for flatRuns --- webui/react/src/hooks/usePermissions.ts | 36 +++++- .../pages/FlatRuns/FlatRunActionButton.tsx | 112 +++++------------- webui/react/src/types.ts | 15 +++ webui/react/src/utils/flatRun.ts | 72 +++++++++++ 4 files changed, 151 insertions(+), 84 deletions(-) create mode 100644 webui/react/src/utils/flatRun.ts diff --git a/webui/react/src/hooks/usePermissions.ts b/webui/react/src/hooks/usePermissions.ts index e25ac702b98..ae909e64756 100644 --- a/webui/react/src/hooks/usePermissions.ts +++ b/webui/react/src/hooks/usePermissions.ts @@ -9,6 +9,8 @@ import userStore from 'stores/users'; import { DetailedUser, ExperimentPermissionsArgs, + FlatRun, + FlatRunPermissionsArgs, ModelItem, ModelVersion, Permission, @@ -53,7 +55,7 @@ interface MovePermissionsArgs { destination?: PermissionWorkspace; } -interface PermissionsHook { +export interface PermissionsHook { canAdministrateUsers: boolean; canAssignRoles: (arg0: WorkspacePermissionsArgs) => boolean; canCreateExperiment: (arg0: WorkspacePermissionsArgs) => boolean; @@ -67,6 +69,7 @@ interface PermissionsHook { canCreateWorkspace: boolean; canCreateWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canDeleteExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canDeleteFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canDeleteModel: (arg0: ModelPermissionsArgs) => boolean; canDeleteModelVersion: (arg0: ModelVersionPermissionsArgs) => boolean; canDeleteProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -88,6 +91,7 @@ interface PermissionsHook { canModifyWorkspaceCheckpointStorage: (arg0: WorkspacePermissionsArgs) => boolean; canModifyWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canMoveExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canMoveFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canMoveExperimentsTo: (arg0: MovePermissionsArgs) => boolean; canMoveModel: (arg0: MovePermissionsArgs) => boolean; canMoveProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -144,6 +148,7 @@ const usePermissions = (): PermissionsHook => { canCreateWorkspaceNSC(rbacOpts, args.workspace), canDeleteExperiment: (args: ExperimentPermissionsArgs) => canDeleteExperiment(rbacOpts, args.experiment), + canDeleteFlatRun: (args: FlatRunPermissionsArgs) => canDeleteFlatRun(rbacOpts, args.flatRun), canDeleteModel: (args: ModelPermissionsArgs) => canDeleteModel(rbacOpts, args.model), canDeleteModelVersion: (args: ModelVersionPermissionsArgs) => canDeleteModelVersion(rbacOpts, args.modelVersion), @@ -181,6 +186,7 @@ const usePermissions = (): PermissionsHook => { canMoveExperiment(rbacOpts, args.experiment), canMoveExperimentsTo: (args: MovePermissionsArgs) => canMoveExperimentsTo(rbacOpts, args.destination), + canMoveFlatRun: (args: FlatRunPermissionsArgs) => canMoveFlatRun(rbacOpts, args.flatRun), canMoveModel: (args: MovePermissionsArgs) => canMoveModel(rbacOpts, args.destination), canMoveProjects: (args: ProjectPermissionsArgs) => canMoveWorkspaceProjects(rbacOpts, args.project), @@ -679,4 +685,32 @@ const canManageResourcePoolBindings = ({ : !!currentUser && currentUser.isAdmin; }; +// Flat Runs + +const canDeleteFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const permitted = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? permitted.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + +const canMoveFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const srcPermit = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? srcPermit.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + export default usePermissions; diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2fbd2d13cd6..ee7130b4ddb 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -6,57 +6,32 @@ import { useToast } from 'hew/Toast'; import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; -import { BatchAction } from 'components/TableActionBar'; -// import usePermissions from 'hooks/usePermissions'; -import { - archiveRuns, - deleteRuns, - killRuns, - openOrCreateTensorBoard, - unarchiveRuns, -} from 'services/api'; +import usePermissions from 'hooks/usePermissions'; +import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; import handleError from 'utils/error'; +import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; -import { openCommandResponse } from 'utils/wait'; - -// export const getActionsForRunsUnion = ( -// experiments: FlatRun[], -// targets: ExperimentAction[], -// permissions: ExperimentPermissionSet, -// ): ExperimentAction[] => { -// if (!experiments.length) return []; // redundant, for clarity -// const actionsForExperiments = experiments.map((e) => -// getActionsForExperiment(e, targets, permissions), -// ); -// return targets.filter((action) => -// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), -// ); -// }; const BATCH_ACTIONS = [ - ExperimentAction.OpenTensorBoard, + // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, - ExperimentAction.RetainLogs, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - ExperimentAction.Activate, - ExperimentAction.Pause, - ExperimentAction.Cancel, + // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; +type BatchAction = (typeof BATCH_ACTIONS)[number]; + const ACTION_ICONS: Record = { - [ExperimentAction.Activate]: 'play', - [ExperimentAction.Pause]: 'pause', - [ExperimentAction.Cancel]: 'stop', + // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', - [ExperimentAction.RetainLogs]: 'logs', - [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Kill]: 'cancelled', + // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -67,6 +42,7 @@ interface Props { selectedRuns: FlatRun[]; project: Project; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunActionButton = ({ @@ -74,57 +50,39 @@ const FlatRunActionButton = ({ selectedRuns, project, onActionSuccess, + onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); - // const permissions = usePermissions(); + const permissions = usePermissions(); const { openToast } = useToast(); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( async (action: BatchAction): Promise => { const validRunIds = selectedRuns - // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { projectId: project.id, runIds: validRunIds, }; switch (action) { - case ExperimentAction.OpenTensorBoard: { - if (validRunIds.length !== selectedRuns.length) { - // if unmanaged experiments are selected, open experimentTensorBoardModal - // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs - } else { - openCommandResponse( - await openOrCreateTensorBoard({ - experimentIds: params.runIds, - workspaceId: project.workspaceId, - }), - ); - } - return; - } case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - case ExperimentAction.RetainLogs: - // return ExperimentRetainLogsModal.open(); - case ExperimentAction.Activate: - // return await activate(params); + // return ExperimentMoveModal.open(); + break; case ExperimentAction.Archive: return await archiveRuns(params); - case ExperimentAction.Cancel: - // return await cancelExperiments(params); case ExperimentAction.Kill: return await killRuns(params); - case ExperimentAction.Pause: - // return await pauseExperiments(params); case ExperimentAction.Unarchive: return await unarchiveRuns(params); case ExperimentAction.Delete: return await deleteRuns(params); + default: + break; } }, - [project.id, project.workspaceId, selectedRuns], + [project.id, selectedRuns], ); const submitBatchAction = useCallback( @@ -169,10 +127,7 @@ const FlatRunActionButton = ({ }); } } catch (e) { - const publicSubject = - action === ExperimentAction.OpenTensorBoard - ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` - : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { isUserTriggered: true, publicMessage: 'Please try again later.', @@ -180,20 +135,16 @@ const FlatRunActionButton = ({ silent: false, }); } finally { - // onActionComplete?.(); + onActionComplete?.(); } }, - [sendBatchActions, onActionSuccess, openToast], + [sendBatchActions, onActionSuccess, openToast, onActionComplete], ); const handleBatchAction = useCallback( (action: string) => { switch (action) { - case ExperimentAction.OpenTensorBoard: - submitBatchAction(action); - break; case ExperimentAction.Move: - case ExperimentAction.RetainLogs: sendBatchActions(action); break; default: @@ -202,27 +153,22 @@ const FlatRunActionButton = ({ break; } }, - [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + [BatchActionConfirmModal, sendBatchActions], ); - // const availableBatchActions = useMemo(() => { - // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); - // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. - // }, [selectedExperimentIds, experimentMap, permissions]); + const availableBatchActions = useMemo(() => { + return getActionsForFlatRunsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + }, [selectedRuns, permissions]); const editMenuItems = useMemo(() => { - const groupedBatchActions = [ - BATCH_ACTIONS.slice(0, 1), // View in TensorBoard - BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete - BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill - ]; + const groupedBatchActions = [BATCH_ACTIONS]; const groupSize = groupedBatchActions.length; return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { const isLastGroup = index === groupSize - 1; group.forEach((action) => acc.push({ danger: action === ExperimentAction.Delete, - // disabled: !availableBatchActions.includes(action), // TODO uncomment later + disabled: !availableBatchActions.includes(action), icon: , key: action, label: action, @@ -231,7 +177,7 @@ const FlatRunActionButton = ({ if (!isLastGroup) acc.push({ type: 'divider' }); return acc; }, []); - }, []); + }, [availableBatchActions]); return ( <> @@ -245,7 +191,7 @@ const FlatRunActionButton = ({ {batchAction && ( exp.unmanaged)} // TODO: is it needed for Runs? + isUnmanagedIncluded={selectedRuns.some((run) => run.experiment?.unmanaged ?? false)} onConfirm={() => submitBatchAction(batchAction)} /> )} diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 84463695548..22ab2ab6380 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1146,6 +1146,10 @@ export interface ExperimentPermissionsArgs { experiment: ProjectExperiment; } +export interface FlatRunPermissionsArgs { + flatRun: FlatRun; +} + export interface PermissionWorkspace { id: number; userId?: number; @@ -1253,3 +1257,14 @@ export interface FlatRunExperiment { export interface SearchFlatRunPagination extends WithPagination { runs: FlatRun[]; } + +export const FlatRunAction = { + Archive: 'Archive', + Delete: 'Delete', + Kill: 'Kill', + Move: 'Move', + // Pause: 'Pause', + Unarchive: 'Unarchive', +} as const; + +export type FlatRunAction = ValueOf; diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts new file mode 100644 index 00000000000..6375851fd24 --- /dev/null +++ b/webui/react/src/utils/flatRun.ts @@ -0,0 +1,72 @@ +import { deletableRunStates, killableRunStates, terminalRunStates } from 'constants/states'; +import { PermissionsHook } from 'hooks/usePermissions'; +import { FlatRun, FlatRunAction } from 'types'; + +type FlatRunChecker = (flatRun: FlatRun) => boolean; + +type FlatRunPermissionSet = Pick< + PermissionsHook, + 'canCreateExperiment' | 'canDeleteFlatRun' | 'canModifyExperiment' | 'canMoveFlatRun' +>; + +const flatRunCheckers: Record = { + [FlatRunAction.Archive]: (flatRun) => + !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + + [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), + + [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), + + [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + + // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), + + [FlatRunAction.Unarchive]: (flatRun) => + terminalRunStates.has(flatRun.state) && flatRun.parentArchived, +}; + +export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { + return flatRunCheckers[action](flatRun); +}; + +const getActionsForFlatRun = ( + flatRun: FlatRun, + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun) return []; // redundant, for clarity + const workspace = { id: flatRun.workspaceId }; + return targets + .filter((action) => canActionFlatRun(action, flatRun)) + .filter((action) => { + switch (action) { + case FlatRunAction.Delete: + return permissions.canDeleteFlatRun({ flatRun }); + + case FlatRunAction.Move: + return permissions.canMoveFlatRun({ flatRun }); + + case FlatRunAction.Archive: + case FlatRunAction.Unarchive: + return permissions.canModifyExperiment({ workspace }); + + case FlatRunAction.Kill: + return permissions.canModifyExperiment({ workspace }) && !flatRun.experiment?.unmanaged; + + default: + return true; + } + }); +}; + +export const getActionsForFlatRunsUnion = ( + flatRun: FlatRun[], + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun.length) return []; + const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); + return targets.filter((action) => + actionsForRuns.some((runActions) => runActions.includes(action)), + ); +}; From 4ed42b4ee0e915cff365f3d397c21a0db90b90ab Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 17:28:07 -0700 Subject: [PATCH 032/161] feat: return `archived` for FlatRun --- harness/determined/common/api/bindings.py | 4 ++ master/internal/api_runs.go | 1 + proto/pkg/runv1/run.pb.go | 60 +++++++++++++--------- proto/src/determined/run/v1/run.proto | 5 +- webui/react/src/services/api-ts-sdk/api.ts | 6 +++ webui/react/src/services/apiConfig.ts | 15 +++--- webui/react/src/types.ts | 1 + webui/react/src/utils/flatRun.ts | 7 ++- 8 files changed, 64 insertions(+), 35 deletions(-) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index 84748e1c4b2..5c688167e37 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -4275,6 +4275,7 @@ class v1FlatRun(Printable): def __init__( self, *, + archived: bool, checkpointCount: int, checkpointSize: str, id: int, @@ -4295,6 +4296,7 @@ def __init__( summaryMetrics: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, userId: "typing.Union[int, None, Unset]" = _unset, ): + self.archived = archived self.checkpointCount = checkpointCount self.checkpointSize = checkpointSize self.id = id @@ -4327,6 +4329,7 @@ def __init__( @classmethod def from_json(cls, obj: Json) -> "v1FlatRun": kwargs: "typing.Dict[str, typing.Any]" = { + "archived": obj["archived"], "checkpointCount": obj["checkpointCount"], "checkpointSize": obj["checkpointSize"], "id": obj["id"], @@ -4360,6 +4363,7 @@ def from_json(cls, obj: Json) -> "v1FlatRun": def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out: "typing.Dict[str, typing.Any]" = { + "archived": self.archived, "checkpointCount": self.checkpointCount, "checkpointSize": self.checkpointSize, "id": self.id, diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index abc0eec2745..15620121591 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,6 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). + ColumnExpr("r.archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 7406eca7199..9816a359c85 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,6 +216,8 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` + // The archived status of this run + Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` } func (x *FlatRun) Reset() { @@ -383,6 +385,13 @@ func (x *FlatRun) GetExperiment() *FlatRunExperiment { return nil } +func (x *FlatRun) GetArchived() bool { + if x != nil { + return x.Archived + } + return false +} + var File_determined_run_v1_run_proto protoreflect.FileDescriptor var file_determined_run_v1_run_proto_rawDesc = []byte{ @@ -440,7 +449,7 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x70, 0x61, 0x63, 0x68, 0x79, 0x64, 0x65, 0x72, 0x6d, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xf9, 0x08, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0xa0, 0x09, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, @@ -493,29 +502,32 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x6e, 0x74, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x06, - 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x3a, - 0x9b, 0x01, 0x92, 0x41, 0x97, 0x01, 0x0a, 0x94, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, - 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0xd2, 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, - 0x01, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, - 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, - 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, - 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, - 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, - 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, - 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, - 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1a, 0x0a, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x3a, 0xa6, 0x01, 0x92, 0x41, + 0xa2, 0x01, 0x0a, 0x9f, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, 0x0a, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0xd2, + 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0a, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0xd2, 0x01, 0x08, 0x61, 0x72, 0x63, 0x68, + 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, + 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, + 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, + 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, + 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, + 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/proto/src/determined/run/v1/run.proto b/proto/src/determined/run/v1/run.proto index 62f4a54502f..6ea1b43e226 100644 --- a/proto/src/determined/run/v1/run.proto +++ b/proto/src/determined/run/v1/run.proto @@ -66,7 +66,8 @@ message FlatRun { "project_name", "workspace_id", "workspace_name", - "parent_archived" + "parent_archived", + "archived" ] } }; @@ -110,4 +111,6 @@ message FlatRun { bool parent_archived = 18; // Data related the the experiment associated with this run. optional FlatRunExperiment experiment = 19; + // The archived status of this run + bool archived = 20; } diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index 240bbab8018..004baf96a9d 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3494,6 +3494,12 @@ export interface V1FlatRun { * @memberof V1FlatRun */ experiment?: V1FlatRunExperiment; + /** + * The archived status of this run + * @type {boolean} + * @memberof V1FlatRun + */ + archived: boolean; } /** * diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index 7c8c01d55f3..b782ac8f284 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1176,12 +1176,15 @@ export const moveRuns: DetApi detApi.Internal.moveRuns(params, options), }; -export const unarchiveRuns: DetApi = - { - name: 'unarchiveRuns', - postProcess: noOp, - request: (params, options) => detApi.Internal.unarchiveRuns(params, options), - }; +export const unarchiveRuns: DetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'unarchiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), +}; /* Tasks */ diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 22ab2ab6380..6f633247b19 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1237,6 +1237,7 @@ export interface FlatRun { projectName: string; workspaceId: number; workspaceName: string; + archived: boolean; parentArchived: boolean; experiment?: FlatRunExperiment; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6375851fd24..6c2aef34d5e 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,18 +11,17 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), - [FlatRunAction.Unarchive]: (flatRun) => - terminalRunStates.has(flatRun.state) && flatRun.parentArchived, + [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { From 5b0b681b7f2c532c25f5cb5feba9c57e7faead8c Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 11:09:46 -0700 Subject: [PATCH 033/161] chore: minor changes --- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 3 +-- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 15 +++++---------- webui/react/src/utils/flatRun.ts | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index ee7130b4ddb..0413a0a35b3 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -126,6 +126,7 @@ const FlatRunActionButton = ({ title: `Partial ${action} Failure`, }); } + await onActionComplete?.(); } catch (e) { const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { @@ -134,8 +135,6 @@ const FlatRunActionButton = ({ publicSubject, silent: false, }); - } finally { - onActionComplete?.(); } }, [sendBatchActions, onActionSuccess, openToast, onActionComplete], diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index d76315d33e9..8425c37b528 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,7 +53,6 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; -import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -657,14 +656,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); - const onActionSuccess = useCallback( - // TODO: update this function - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (_action: BatchAction, _successfulIds: number[]) => { - handleSelectionChange('remove-all'); - }, - [handleSelectionChange], - ); + const onActionComplete = useCallback(async () => { + handleSelectionChange('remove-all'); + await fetchRuns(); + }, [fetchRuns, handleSelectionChange]); const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -954,7 +949,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} - onActionSuccess={onActionSuccess} + onActionComplete={onActionComplete} /> diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6c2aef34d5e..fb266d5c797 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,13 +11,13 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), + !flatRun.parentArchived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, + [FlatRunAction.Move]: (flatRun) => !flatRun.parentArchived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), From 430fe3c6d917371803dce59d11d554a0af02ef12 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 15:15:43 -0700 Subject: [PATCH 034/161] test: `canActionFlatRun` test cases --- webui/react/src/constants/states.ts | 2 +- webui/react/src/utils/flatRun.test.ts | 218 ++++++++++++++++++++++++++ 2 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 webui/react/src/utils/flatRun.test.ts diff --git a/webui/react/src/constants/states.ts b/webui/react/src/constants/states.ts index c0cb4ab57e1..677c4477e99 100644 --- a/webui/react/src/constants/states.ts +++ b/webui/react/src/constants/states.ts @@ -65,7 +65,7 @@ export const terminalCommandStates: Set = new Set([ CommandState.Terminating, ]); -const runStateList = [ +export const runStateList = [ RunState.Canceled, RunState.Completed, RunState.Error, diff --git a/webui/react/src/utils/flatRun.test.ts b/webui/react/src/utils/flatRun.test.ts new file mode 100644 index 00000000000..3b7d97c29f7 --- /dev/null +++ b/webui/react/src/utils/flatRun.test.ts @@ -0,0 +1,218 @@ +import dayjs from 'dayjs'; + +import { + deletableRunStates, + killableRunStates, + runStateList, + terminalRunStates, +} from 'constants/states'; +import { FlatRun, FlatRunAction, RunState } from 'types'; +import { canActionFlatRun } from 'utils/flatRun'; + +describe('Flat Run Utilities', () => { + const BASE_FLAT_RUN: Readonly = { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }; + + describe('canActionFlatRun function', () => { + const terminatedRunStates: Set = new Set( + Object.values(RunState).filter((v) => terminalRunStates.has(v)), + ); + + describe('Archive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be archivable (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, flatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be archivable (%s)', + (terminatedRunState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, archivedFlatRun)).toBeFalsy(); + + // parentArchived and archived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, bothArchivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Unarchive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be unarchivable (%s)', + (terminatedRunState) => { + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeTruthy(); + + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, bothArchivedFlatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be unarchivable with Terminated Run State (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, parentArchivedFlatRun)).toBeFalsy(); + }, + ); + + it.each(Array.from(Object.values(RunState).filter((v) => !terminatedRunStates.has(v))))( + 'should not be unarchivable with non Terminated Run States (%s)', + (nonTerminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Delete Action', () => { + it.each(runStateList)('should be deletable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((state) => !deletableRunStates.has(state)))( + 'should not be deletable', + (nonDeletableRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonDeletableRunState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Kill Action', () => { + const killRunStates: Set = new Set( + Object.values(RunState).filter((v) => killableRunStates.includes(v)), + ); + + it.each(Array.from(killRunStates))('should be killable (%s)', (killRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: killRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((v) => !killRunStates.has(v)))( + 'should not be killable (%s)', + (nonKillRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonKillRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Move Action', () => { + it.each(Object.values(RunState))('should be movable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState))('should not be movable (%s)', (runState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, archivedFlatRun)).toBeFalsy(); + + // both archived and parentArchived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, bothArchivedFlatRun)).toBeFalsy(); + }); + }); + }); +}); From b2aa066c2af318b196dabd940e83f981e12bdb0c Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 11:49:57 -0700 Subject: [PATCH 035/161] chore: better type --- .../pages/FlatRuns/FlatRunActionButton.tsx | 4 ++-- webui/react/src/utils/flatRun.ts | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 0413a0a35b3..a1a650b836a 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -39,8 +39,8 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; - selectedRuns: FlatRun[]; - project: Project; + selectedRuns: ReadonlyArray>; + project: Readonly; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index fb266d5c797..8b52c9cb22c 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -2,7 +2,7 @@ import { deletableRunStates, killableRunStates, terminalRunStates } from 'consta import { PermissionsHook } from 'hooks/usePermissions'; import { FlatRun, FlatRunAction } from 'types'; -type FlatRunChecker = (flatRun: FlatRun) => boolean; +type FlatRunChecker = (flatRun: Readonly) => boolean; type FlatRunPermissionSet = Pick< PermissionsHook, @@ -24,15 +24,15 @@ const flatRunCheckers: Record = { [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; -export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { +export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly): boolean => { return flatRunCheckers[action](flatRun); }; const getActionsForFlatRun = ( - flatRun: FlatRun, - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: Readonly, + targets: ReadonlyArray, + permissions: Readonly, +): ReadonlyArray => { if (!flatRun) return []; // redundant, for clarity const workspace = { id: flatRun.workspaceId }; return targets @@ -59,10 +59,10 @@ const getActionsForFlatRun = ( }; export const getActionsForFlatRunsUnion = ( - flatRun: FlatRun[], - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: ReadonlyArray>, + targets: ReadonlyArray, + permissions: Readonly, +): Readonly => { if (!flatRun.length) return []; const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); return targets.filter((action) => From fe955d409754ae3a35d661854d3e4be82a38b61b Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 12:18:04 -0700 Subject: [PATCH 036/161] test: `FlatRunActionButton` test --- .../FlatRuns/FlatRunActionButton.test.tsx | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx new file mode 100644 index 00000000000..9a9b1ba7aeb --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -0,0 +1,60 @@ +import { render, screen } from '@testing-library/react'; +import dayjs from 'dayjs'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; + +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; +import { FlatRun, Project, RunState, WorkspaceState } from 'types'; + +const setup = (selectedFlatRuns: ReadonlyArray>) => { + const project: Readonly = { + archived: false, + id: 1, + immutable: false, + name: 'proj', + notes: [], + state: WorkspaceState.Unspecified, + userId: 1, + workspaceId: 1, + }; + + render( + + + , + ); +}; + +describe('canActionFlatRun function', () => { + describe('Flat Run Action Button Visibility', () => { + it('should not be appeard without selected flat runs', () => { + setup([]); + expect(screen.queryByText('Actions')).not.toBeInTheDocument(); + }); + + it('should be appeard with selected flat runs', async () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + + setup(flatRuns); + expect(await screen.findByText('Actions')).toBeInTheDocument(); + }); + }); +}); From f3c4c656fd5df671863400b5a811a3e8086e96c9 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 30 May 2024 09:59:52 -0700 Subject: [PATCH 037/161] fix: fix run `archived` logic in postgres --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 15620121591..d87923c3e4a 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,7 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived"). + ColumnExpr("r.archived OR e.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). From 5b9be44e8d95088e1514225d0f082bd48c3f5af1 Mon Sep 17 00:00:00 2001 From: Ashton G Date: Mon, 3 Jun 2024 10:16:09 -0400 Subject: [PATCH 038/161] chore: run bulk action interstitial component (#9390) Co-authored-by: Keita Fish --- .../components/InterstitialModalComponent.tsx | 2 +- ...nFilterInterstitialModalComponent.test.tsx | 216 ++++++++++++++++++ .../RunFilterInterstitialModalComponent.tsx | 168 ++++++++++++++ .../RunMoveWarningModalComponent.test.tsx | 93 ++++++++ .../RunMoveWarningModalComponent.tsx | 54 +++++ webui/react/src/hooks/useTypedParams.test.tsx | 4 +- .../pages/TrialDetails/TrialDetailsLogs.tsx | 15 +- webui/react/src/setupTests.ts | 19 +- .../src/utils/mergeAbortControllers.test.ts | 87 +++++++ .../react/src/utils/mergeAbortControllers.ts | 20 ++ 10 files changed, 653 insertions(+), 25 deletions(-) create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.test.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.tsx create mode 100644 webui/react/src/utils/mergeAbortControllers.test.ts create mode 100644 webui/react/src/utils/mergeAbortControllers.ts diff --git a/webui/react/src/components/InterstitialModalComponent.tsx b/webui/react/src/components/InterstitialModalComponent.tsx index 0789b4a6b38..7eaff4c822e 100644 --- a/webui/react/src/components/InterstitialModalComponent.tsx +++ b/webui/react/src/components/InterstitialModalComponent.tsx @@ -6,7 +6,7 @@ import { useCallback, useEffect } from 'react'; export type onInterstitialCloseActionType = (reason: 'ok' | 'close' | 'failed') => void; interface Props { - onCloseAction: (reason: 'ok' | 'close' | 'failed') => void; + onCloseAction: onInterstitialCloseActionType; loadableData: Loadable; } diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx new file mode 100644 index 00000000000..3284273cdaf --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx @@ -0,0 +1,216 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { FilterFormSetWithoutId, FormField } from 'components/FilterForm/components/type'; +import RunFilterInterstitialModalComponent, { + CloseReason, + ControlledModalRef, + Props, +} from 'components/RunFilterInterstitialModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +vi.mock('services/api', async () => ({ + ...(await vi.importActual('services/api')), + searchRuns: vi.fn(() => + Promise.resolve({ + pagination: { + total: 0, + }, + }), + ), +})); + +const { searchRuns } = await import('services/api'); +const searchRunsMock = vi.mocked(searchRuns); + +const emptyFilterFormSetWithoutId: FilterFormSetWithoutId = { + filterGroup: { + children: [], + conjunction: 'or', + kind: 'group', + }, + showArchived: false, +}; + +const setupTest = (props: Partial = {}) => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunFilterInterstitialModalComponent', () => { + beforeEach(() => { + searchRunsMock.mockRestore(); + }); + + it('does not call server until opened', () => { + const { ref } = setupTest(); + + expect(searchRunsMock).not.toBeCalled(); + act(() => { + ref.current?.open(); + }); + expect(searchRunsMock).toBeCalled(); + }); + + it('calls server with filter describing filter selection', () => { + const expectedFilterGroup: FilterFormSetWithoutId['filterGroup'] = { + children: [ + { + columnName: 'experimentName', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator: 'contains', + type: 'COLUMN_TYPE_TEXT', + value: 'foo', + }, + ], + conjunction: 'and', + kind: 'group', + }; + const expectedExclusions = [1, 2, 3]; + const { ref } = setupTest({ + filterFormSet: { + filterGroup: expectedFilterGroup, + showArchived: true, + }, + selection: { + exclusions: expectedExclusions, + type: 'ALL_EXCEPT', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + // TODO: is there a better way to test this expectation? + expect(filterFormSet.showArchived).toBeTruthy(); + const [filterGroup, idFilterGroup] = filterFormSet.filterGroup.children?.[0].children || []; + expect(filterGroup).toEqual(expectedFilterGroup); + + const idFilters = idFilterGroup.children; + expect(idFilters.every((f: FormField) => f.operator === '!=')).toBeTruthy(); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedExclusions); + }); + + it('calls server with filter describing visual selection', () => { + const expectedSelection = [1, 2, 3]; + const { ref } = setupTest({ + selection: { + selections: expectedSelection, + type: 'ONLY_IN', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + expect(filterFormSet.showArchived).toBe(false); + const idFilters = filterFormSet.filterGroup.children?.[0].children || []; + expect(idFilters.every((f: FormField) => f.operator === '=')).toBe(true); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedSelection); + }); + + it('cancels request when modal is closed via close button', async () => { + searchRunsMock.mockImplementation((_params, options) => { + return new Promise((_resolve, reject) => { + options?.signal?.addEventListener('abort', () => { + reject(); + }); + }); + }); + const { ref } = setupTest(); + // explicit type here because typescript can't infer that the act function + // runs imperatively. + let lifecycle: Promise | undefined; + // we don't await the act because we need the render pipeline to flush + // before we get the close reason back + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('close'); + }); + + it('closes modal with has_search_runs when it has runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 1, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('has_search_runs'); + }); + + it('closes modal with no_search_runs when it lacks runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 0, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('no_search_runs'); + }); + + it('closes modal with failed when request errors outside of aborts', async () => { + searchRunsMock.mockImplementation(() => Promise.reject(new Error('uh oh!'))); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('failed'); + }); +}); diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx new file mode 100644 index 00000000000..a117b74202e --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx @@ -0,0 +1,168 @@ +import { useModal } from 'hew/Modal'; +import { Failed, NotLoaded } from 'hew/utils/loadable'; +import { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react'; + +import { FilterFormSetWithoutId, Operator } from 'components/FilterForm/components/type'; +import InterstitialModalComponent, { + onInterstitialCloseActionType, +} from 'components/InterstitialModalComponent'; +import { SelectionType } from 'components/Searches/Searches.settings'; +import { useAsync } from 'hooks/useAsync'; +import { searchRuns } from 'services/api'; +import { DetError } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; +import { observable } from 'utils/observable'; + +export type CloseReason = 'has_search_runs' | 'no_search_runs' | 'failed' | 'close' | 'manual'; + +export interface Props { + projectId?: number; + selection: SelectionType; + filterFormSet: FilterFormSetWithoutId; +} + +export interface ControlledModalRef { + open: () => Promise; + close: (reason?: CloseReason) => void; +} + +/** + * Modal component for checking selections for runs that are part of a search. + * is essentially a single purpose interstitial modal component. Because it + * wraps a modal and the intended use is within a user flow, this component does + * not use the `useModal` hook. instead, it exposes control via ref. the `open` + * method of the ref returns a promise that resolves when the modal is closed + * with the reason why the modal closed. + * + */ +export const RunFilterInterstitialModalComponent = forwardRef( + ({ projectId, selection, filterFormSet }: Props, ref): JSX.Element => { + const InterstitialModal = useModal(InterstitialModalComponent); + const [isOpen, setIsOpen] = useState(false); + const closeController = useRef(new AbortController()); + const lifecycleObservable = useRef(observable(null)); + + const { close: internalClose, open: internalOpen } = InterstitialModal; + + const open = async () => { + internalOpen(); + setIsOpen(true); + const closeReason = await lifecycleObservable.current.toPromise(); + if (closeReason === null) { + // this promise should never reject -- toPromise only resolves when the + // value changes, and no code sets the observavble to null + return Promise.reject(); + } + return closeReason; + }; + + const close = useCallback( + (reason: CloseReason = 'manual') => { + setIsOpen(false); + // encourage render with isOpen to false before closing to prevent + // firing onCloseAction twice + setTimeout(() => internalClose('close'), 0); + closeController.current.abort(); + closeController.current = new AbortController(); + lifecycleObservable.current.set(reason); + lifecycleObservable.current = observable(null); + }, + [internalClose], + ); + + useImperativeHandle(ref, () => ({ close, open })); + + const selectionHasSearchRuns = useAsync( + async (canceler) => { + if (!isOpen) return NotLoaded; + const mergedCanceler = mergeAbortControllers(canceler, closeController.current); + const idToFilter = (operator: Operator, id: number) => + ({ + columnName: 'id', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator, + type: 'COLUMN_TYPE_NUMBER', + value: id, + }) as const; + const filterGroup: FilterFormSetWithoutId['filterGroup'] = + selection.type === 'ALL_EXCEPT' + ? { + children: [ + filterFormSet.filterGroup, + { + children: selection.exclusions.map(idToFilter.bind(this, '!=')), + conjunction: 'and', + kind: 'group', + }, + ], + conjunction: 'and', + kind: 'group', + } + : { + children: selection.selections.map(idToFilter.bind(this, '=')), + conjunction: 'or', + kind: 'group', + }; + const filter: FilterFormSetWithoutId = { + ...filterFormSet, + filterGroup: { + children: [ + filterGroup, + { + columnName: 'numTrials', + kind: 'field', + location: 'LOCATION_TYPE_EXPERIMENT', + operator: '>', + type: 'COLUMN_TYPE_NUMBER', + value: 1, + } as const, + ], + conjunction: 'and', + kind: 'group', + }, + }; + try { + const results = await searchRuns( + { + filter: JSON.stringify(filter), + limit: 0, + projectId, + }, + { signal: mergedCanceler.signal }, + ); + + return (results.pagination.total || 0) > 0; + } catch (e) { + if (!mergedCanceler.signal.aborted) { + return Failed(e instanceof Error ? e : new DetError(e)); + } + return NotLoaded; + } + }, + [selection, filterFormSet, projectId, isOpen], + ); + + const interstitialClose: onInterstitialCloseActionType = useCallback( + (reason) => { + if (reason === 'ok') { + return selectionHasSearchRuns.forEach((bool) => { + const fixedReason = bool ? 'has_search_runs' : 'no_search_runs'; + close(fixedReason); + }); + } + close(reason); + }, + [close, selectionHasSearchRuns], + ); + + return ( + + ); + }, +); + +export default RunFilterInterstitialModalComponent; diff --git a/webui/react/src/components/RunMoveWarningModalComponent.test.tsx b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx new file mode 100644 index 00000000000..8847538b527 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx @@ -0,0 +1,93 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { + CloseReason, + RunMoveWarningFlowRef, + RunMoveWarningModalComponent, +} from 'components/RunMoveWarningModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +const setupTest = () => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunMoveWarningModalComponent', () => { + it('is not shown until opened', () => { + const { ref } = setupTest(); + + expect(screen.queryByText('Move Run Dependency Alert')).toBeNull(); + act(() => { + ref.current?.open(); + }); + expect(screen.queryByText('Move Run Dependency Alert')).not.toBeNull(); + }); + + it('closes modal with cancel when closed with the x button', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with cancel when cancel button is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const cancelButton = await screen.findByText('Cancel'); + await userEvent.click(cancelButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with ok when submit is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const okayButton = await screen.findByText('Move independent runs'); + await userEvent.click(okayButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('ok'); + }); + + it('closes modal with manual when manually closed with no arg', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + act(() => { + ref.current?.close(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('manual'); + }); +}); diff --git a/webui/react/src/components/RunMoveWarningModalComponent.tsx b/webui/react/src/components/RunMoveWarningModalComponent.tsx new file mode 100644 index 00000000000..3a2d0086e20 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.tsx @@ -0,0 +1,54 @@ +import { Modal, useModal } from 'hew/Modal'; +import { observable, WritableObservable } from 'micro-observables'; +import { forwardRef, useImperativeHandle, useRef } from 'react'; + +export type CloseReason = 'ok' | 'cancel' | 'manual'; + +import handleError from 'utils/error'; + +type RunMoveWarningProps = { + onClose: (reason: 'ok' | 'cancel') => void; +}; +const RunMoveWarningCopy = ({ onClose }: RunMoveWarningProps) => ( + onClose('ok'), text: 'Move independent runs' }} + title="Move Run Dependency Alert" + onClose={() => onClose('cancel')}> + Some runs you are trying to move belong to a Hyperparameter Search and cannot be moved + independently to maintain their contextual relationships. These runs will be skipped. + +); + +export type RunMoveWarningFlowRef = { + open: () => Promise; + close: () => void; +}; + +export const RunMoveWarningModalComponent = forwardRef((_, ref) => { + const RunMoveWarning = useModal(RunMoveWarningCopy); + const closeReason = useRef>(observable(null)); + + const { close: internalClose, open: internalOpen } = RunMoveWarning; + + const open = async () => { + internalOpen(); + const reason = await closeReason.current.toPromise(); + if (reason === null) { + return Promise.reject(); + } + return reason; + }; + + const close = (reason: CloseReason = 'manual') => { + internalClose(reason); + closeReason.current.set(reason); + closeReason.current = observable(null); + }; + + useImperativeHandle(ref, () => ({ close, open })); + + return ; +}); + +export default RunMoveWarningModalComponent; diff --git a/webui/react/src/hooks/useTypedParams.test.tsx b/webui/react/src/hooks/useTypedParams.test.tsx index 054c5aecdb9..dadaf631d7e 100644 --- a/webui/react/src/hooks/useTypedParams.test.tsx +++ b/webui/react/src/hooks/useTypedParams.test.tsx @@ -174,8 +174,8 @@ describe('useTypedParams', () => { .afterEach(() => navSpy.mockClear()), ); }); - it('does not update if params are not changed', () => { - fc.assert( + it('does not update if params are not changed', async () => { + await fc.assert( fc .asyncProperty(sameArbPartial, async ([params, partial]) => { const { hookRef } = setupTest(params); diff --git a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx index e75b75c99c7..8f93518fb7c 100644 --- a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx +++ b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx @@ -16,6 +16,7 @@ import { readStream } from 'services/utils'; import { ExperimentBase, TrialDetails } from 'types'; import { downloadTrialLogs } from 'utils/browser'; import handleError, { ErrorType } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; import css from './TrialDetailsLogs.module.scss'; @@ -26,20 +27,6 @@ export interface Props { type OrderBy = 'ORDER_BY_UNSPECIFIED' | 'ORDER_BY_ASC' | 'ORDER_BY_DESC'; -const mergeAbortControllers = (...controllers: AbortController[]) => { - const mergedController = new AbortController(); - - controllers.forEach((c) => { - const abort = () => { - mergedController.abort(); - c.signal.removeEventListener('abort', abort); - }; - c.signal.addEventListener('abort', abort); - }); - - return mergedController; -}; - const TrialDetailsLogs: React.FC = ({ experiment, trial }: Props) => { const { ui } = useUI(); const [filterOptions, setFilterOptions] = useState({}); diff --git a/webui/react/src/setupTests.ts b/webui/react/src/setupTests.ts index fe8c871c9f7..b8b22e32f0b 100644 --- a/webui/react/src/setupTests.ts +++ b/webui/react/src/setupTests.ts @@ -6,20 +6,23 @@ */ import '@testing-library/jest-dom/extend-expect'; import 'micro-observables/batchingForReactDom'; -import 'utils/prototypes'; import 'whatwg-fetch'; import Schema from 'async-validator'; -import { noOp } from 'utils/service'; +// this code doesn't work in node environments +if (globalThis.window) { + await import('utils/prototypes'); + const { noOp } = await import('utils/service'); -/** - * To clean up the async-validator console warning that get generated during testing. - * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning - */ -Schema.warning = noOp; + /** + * To clean up the async-validator console warning that get generated during testing. + * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning + */ + Schema.warning = noOp; +} -Object.defineProperty(window, 'matchMedia', { +Object.defineProperty(globalThis, 'matchMedia', { value: () => ({ addEventListener: vi.fn(), addListener: vi.fn(), // deprecated diff --git a/webui/react/src/utils/mergeAbortControllers.test.ts b/webui/react/src/utils/mergeAbortControllers.test.ts new file mode 100644 index 00000000000..51308bac61f --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.test.ts @@ -0,0 +1,87 @@ +// @vitest-environment node +// we're using node because the jsdom version of the abortcontroller doesn't have reasons on abortsignals +import fc from 'fast-check'; +import { zip } from 'lodash'; + +import { mergeAbortControllers } from 'utils/mergeAbortControllers'; + +// arbitrary to generate a list of abort controllers to pass to mergeAbortControllers +const argArb = fc.uniqueArray( + fc.constant(() => new AbortController()).map((f) => f()), + { minLength: 1 }, +); + +// return a subset of the above to control +const argArbWithSelection = (n?: number) => + argArb.chain((arr) => + fc.tuple(fc.constant(arr), fc.shuffledSubarray(arr, { maxLength: n, minLength: 1 })), + ); + +// the above, but the subset from the above returns with unique reason values to +// verify which abortController was the first to abort +const argArbWithSelectionAndReasons = (n?: number) => + argArbWithSelection(n).chain(([args, selection]) => { + const reasonsArb = fc.uniqueArray(fc.anything(), { + maxLength: selection.length, + minLength: selection.length, + }); + const selectionAndReasonArb = reasonsArb + .map((reasons) => zip(selection, reasons)) + .filter((tups): tups is [AbortController, unknown][] => + tups.every((tup) => tup.every((c) => c !== undefined)), + ); + + return fc.tuple(fc.constant(args), selectionAndReasonArb); + }); + +describe('mergeAbortControllers', () => { + it('merged abort controller aborts if any constituent aborts', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(); + expect(result.signal.aborted).toBe(true); + }), + ); + }); + it('merged abort controller aborts with constituent reason', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(1), ([args, abortControllers]) => { + const [[abortController, reason]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(reason); + expect(abortController.signal.reason).toBe(reason); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); + it('merged abort controller only reflects the first abort', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(), ([args, abortControllers]) => { + const [[firstAbortController]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortControllers.forEach(([abortController, reason]) => { + abortController.abort(reason); + }); + expect(result.signal.reason).toBe(firstAbortController.signal.reason); + }), + ); + }); + + it('merging an aborted controller results in an aborted controller', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + abortController.abort(); + const result = mergeAbortControllers(...args); + + expect(result.signal.aborted).toBe(true); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); +}); diff --git a/webui/react/src/utils/mergeAbortControllers.ts b/webui/react/src/utils/mergeAbortControllers.ts new file mode 100644 index 00000000000..98004fe3100 --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.ts @@ -0,0 +1,20 @@ +export const mergeAbortControllers = (...controllers: AbortController[]): AbortController => { + const mergedController = new AbortController(); + + controllers.forEach((c) => { + // resulting controller is aborted, just ignore the rest + if (mergedController.signal.aborted) return; + // preemptively abort if the signal's already aborted + if (c.signal.aborted) return mergedController.abort(c.signal.reason); + + const abort = () => { + mergedController.abort(c.signal.reason); + c.signal.removeEventListener('abort', abort); + }; + c.signal.addEventListener('abort', abort); + }); + + return mergedController; +}; + +export default mergeAbortControllers; From f685f884d39eccff0780a2b6d172a2010a47dfcc Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 11:02:29 -0700 Subject: [PATCH 039/161] chore: feedback --- .../pages/FlatRuns/FlatRunActionButton.test.tsx | 15 ++------------- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 10 +++++----- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 9a9b1ba7aeb..166fcd77d1b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -3,25 +3,14 @@ import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; -import { FlatRun, Project, RunState, WorkspaceState } from 'types'; +import { FlatRun, RunState } from 'types'; const setup = (selectedFlatRuns: ReadonlyArray>) => { - const project: Readonly = { - archived: false, - id: 1, - immutable: false, - name: 'proj', - notes: [], - state: WorkspaceState.Unspecified, - userId: 1, - workspaceId: 1, - }; - render( diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index a1a650b836a..e78658dcefa 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -8,7 +8,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; -import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; @@ -40,7 +40,7 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; - project: Readonly; + projectId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -48,7 +48,7 @@ interface Props { const FlatRunActionButton = ({ isMobile, selectedRuns, - project, + projectId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { @@ -63,7 +63,7 @@ const FlatRunActionButton = ({ .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { - projectId: project.id, + projectId, runIds: validRunIds, }; switch (action) { @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [project.id, selectedRuns], + [projectId, selectedRuns], ); const submitBatchAction = useCallback( diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 8425c37b528..460bc0b5ad2 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -947,7 +947,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { /> From a5a8f0b2b6e91f653d307e23f4fce19567586910 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 16:11:38 -0700 Subject: [PATCH 040/161] feat: basic move action --- .../FlatRuns/FlatRunActionButton.test.tsx | 1 + .../pages/FlatRuns/FlatRunActionButton.tsx | 19 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 194 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 4 +- webui/react/src/pages/ProjectDetails.tsx | 2 +- webui/react/src/pages/SearchDetails.tsx | 6 +- webui/react/src/services/api.ts | 8 +- webui/react/src/services/apiConfig.ts | 8 +- 8 files changed, 227 insertions(+), 15 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 166fcd77d1b..25beefaa41e 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -12,6 +12,7 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { isMobile={false} projectId={1} selectedRuns={selectedFlatRuns} + workspaceId={1} onActionComplete={vi.fn()} /> , diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index e78658dcefa..b3929b0ae00 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -7,6 +7,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; +import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; @@ -14,24 +15,20 @@ import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; const BATCH_ACTIONS = [ - // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; type BatchAction = (typeof BATCH_ACTIONS)[number]; const ACTION_ICONS: Record = { - // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', [ExperimentAction.Kill]: 'cancelled', - // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -41,6 +38,7 @@ interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; projectId: number; + workspaceId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -49,12 +47,15 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + workspaceId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); const permissions = usePermissions(); const { openToast } = useToast(); + const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = + useModal(FlatRunMoveModalComponent); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( @@ -68,8 +69,7 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - break; + return flatRunMoveModalOpen(); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [projectId, selectedRuns], + [flatRunMoveModalOpen, projectId, selectedRuns], ); const submitBatchAction = useCallback( @@ -194,6 +194,11 @@ const FlatRunActionButton = ({ onConfirm={() => submitBatchAction(batchAction)} /> )} + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx new file mode 100644 index 00000000000..87d449e6bb8 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -0,0 +1,194 @@ +import Form from 'hew/Form'; +import Icon from 'hew/Icon'; +import { Modal } from 'hew/Modal'; +import Select, { Option } from 'hew/Select'; +import Spinner from 'hew/Spinner'; +import { useToast } from 'hew/Toast'; +import { Label } from 'hew/Typography'; +import { Loadable } from 'hew/utils/loadable'; +import { List } from 'immutable'; +import { useObservable } from 'micro-observables'; +import React, { useEffect, useId } from 'react'; + +import Link from 'components/Link'; +import usePermissions from 'hooks/usePermissions'; +import { paths } from 'routes/utils'; +import { moveRuns } from 'services/api'; +import projectStore from 'stores/projects'; +import workspaceStore from 'stores/workspaces'; +import { FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { pluralizer } from 'utils/string'; + +const FORM_ID = 'move-flat-run-form'; + +type FormInputs = { + projectId?: number; + workspaceId?: number; +}; + +interface Props { + flatRuns: Readonly[]; + onSubmit?: (successfulIds?: number[]) => void; + sourceProjectId: number; + sourceWorkspaceId?: number; +} + +const FlatRunMoveModalComponent: React.FC = ({ + flatRuns, + onSubmit, + sourceProjectId, + sourceWorkspaceId, +}: Props) => { + const idPrefix = useId(); + const { openToast } = useToast(); + const [form] = Form.useForm(); + const workspaceId = Form.useWatch('workspaceId', form); + const projectId = Form.useWatch('projectId', form); + + const { canMoveExperimentsTo } = usePermissions(); + const workspaces = Loadable.getOrElse([], useObservable(workspaceStore.unarchived)).filter((w) => + canMoveExperimentsTo({ destination: { id: w.id } }), + ); + const loadableProjects: Loadable> = useObservable( + projectStore.getProjectsByWorkspace(workspaceId), + ); + + useEffect(() => { + if (workspaceId !== undefined) { + projectStore.fetch(workspaceId, undefined, true); + } + }, [workspaceId]); + + const handleSubmit = async () => { + if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { + openToast({ title: 'No changes to save.' }); + return; + } + const values = await form.validateFields(); + const projId = values.projectId ?? 1; + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); + + onSubmit?.(results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + }; + + return ( + +
+ + + + {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} +
+
+ ); +}; + +export default FlatRunMoveModalComponent; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 460bc0b5ad2..ec09bb43108 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -100,6 +100,7 @@ const formStore = new FilterFormStore(); interface Props { projectId: number; + workspaceId: number; searchId?: number; } @@ -118,7 +119,7 @@ const parseSortString = (sortString: string): Sort[] => { }); }; -const FlatRuns: React.FC = ({ projectId, searchId }) => { +const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const dataGridRef = useRef(null); const contentRef = useRef(null); const [searchParams, setSearchParams] = useSearchParams(); @@ -949,6 +950,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} projectId={projectId} selectedRuns={selectedRuns} + workspaceId={workspaceId} onActionComplete={onActionComplete} /> diff --git a/webui/react/src/pages/ProjectDetails.tsx b/webui/react/src/pages/ProjectDetails.tsx index 3274b4f5d7f..de9e15815f1 100644 --- a/webui/react/src/pages/ProjectDetails.tsx +++ b/webui/react/src/pages/ProjectDetails.tsx @@ -94,7 +94,7 @@ const ProjectDetails: React.FC = () => { children: (
- +
), diff --git a/webui/react/src/pages/SearchDetails.tsx b/webui/react/src/pages/SearchDetails.tsx index 369003a4c2e..f9a66783f1e 100644 --- a/webui/react/src/pages/SearchDetails.tsx +++ b/webui/react/src/pages/SearchDetails.tsx @@ -138,7 +138,11 @@ const SearchDetails: React.FC = () => { const tabItems: PivotProps['items'] = [ { children: experiment?.projectId && ( - + ), key: TabType.Trials, label: 'Trials', diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 39acbb16325..561101669bf 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -771,9 +771,11 @@ export const killRuns = generateDetApi( - Config.moveRuns, -); +export const moveRuns = generateDetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +>(Config.moveRuns); export const unarchiveRuns = generateDetApi< Api.V1UnarchiveRunsRequest, diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index b782ac8f284..fd92b846f39 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1170,9 +1170,13 @@ export const killRuns: DetApi detApi.Internal.killRuns(params, options), }; -export const moveRuns: DetApi = { +export const moveRuns: DetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +> = { name: 'moveRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.moveRuns(params, options), }; From dcac64ba47b0f18e623263d7bdbf0db36f3c0794 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 17:13:24 -0700 Subject: [PATCH 041/161] feat: move warning modal --- .../FilterForm/components/FilterFormStore.ts | 21 ++ .../FlatRuns/FlatRunActionButton.test.tsx | 5 + .../pages/FlatRuns/FlatRunActionButton.tsx | 8 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 286 +++++++++++------- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 + 5 files changed, 206 insertions(+), 116 deletions(-) diff --git a/webui/react/src/components/FilterForm/components/FilterFormStore.ts b/webui/react/src/components/FilterForm/components/FilterFormStore.ts index b04658d53f0..e27c7c457b4 100644 --- a/webui/react/src/components/FilterForm/components/FilterFormStore.ts +++ b/webui/react/src/components/FilterForm/components/FilterFormStore.ts @@ -74,6 +74,27 @@ export class FilterFormStore { ); } + public get filterFormSetWithoutId(): Observable { + const replacer = (key: string, value: unknown): unknown => { + return key === 'id' ? undefined : value; + }; + return this.#formset.select((loadableFormset) => + Loadable.match(loadableFormset, { + _: () => ({ + filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, + showArchived: true, + }), + Loaded: (formset) => { + const sweepedForm = this.#sweepInvalid(structuredClone(formset.filterGroup)); + const newFormSet: FilterFormSetWithoutId = JSON.parse( + JSON.stringify({ ...formset, filterGroup: sweepedForm }, replacer), + ); + return newFormSet; + }, + }), + ); + } + public get fieldCount(): Observable { return this.getFieldCount(); } diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 25beefaa41e..b02bfaf216d 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Conjunction, FormKind } from 'components/FilterForm/components/type'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; @@ -9,6 +10,10 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { render( >; projectId: number; workspaceId: number; + filterFormSetWithoutId: FilterFormSetWithoutId; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -47,6 +49,7 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + filterFormSetWithoutId, workspaceId, onActionSuccess, onActionComplete, @@ -69,7 +72,8 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - return flatRunMoveModalOpen(); + flatRunMoveModalOpen(); + break; case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -195,9 +199,11 @@ const FlatRunActionButton = ({ /> )} ); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 87d449e6bb8..1c6c5ebc3de 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -8,9 +8,16 @@ import { Label } from 'hew/Typography'; import { Loadable } from 'hew/utils/loadable'; import { List } from 'immutable'; import { useObservable } from 'micro-observables'; -import React, { useEffect, useId } from 'react'; +import React, { Ref, useCallback, useEffect, useId, useRef } from 'react'; +import { FilterFormSetWithoutId } from 'components/FilterForm/components/type'; import Link from 'components/Link'; +import RunFilterInterstitialModalComponent, { + ControlledModalRef, +} from 'components/RunFilterInterstitialModalComponent'; +import RunMoveWarningModalComponent, { + RunMoveWarningFlowRef, +} from 'components/RunMoveWarningModalComponent'; import usePermissions from 'hooks/usePermissions'; import { paths } from 'routes/utils'; import { moveRuns } from 'services/api'; @@ -29,17 +36,23 @@ type FormInputs = { interface Props { flatRuns: Readonly[]; - onSubmit?: (successfulIds?: number[]) => void; sourceProjectId: number; sourceWorkspaceId?: number; + filterFormSetWithoutId: FilterFormSetWithoutId; + onSubmit?: (successfulIds?: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunMoveModalComponent: React.FC = ({ flatRuns, - onSubmit, + filterFormSetWithoutId, sourceProjectId, sourceWorkspaceId, + onSubmit, + onActionComplete, }: Props) => { + const controlledModalRef: Ref = useRef(null); + const runMoveWarningFlowRef: Ref = useRef(null); const idPrefix = useId(); const { openToast } = useToast(); const [form] = Form.useForm(); @@ -60,7 +73,7 @@ const FlatRunMoveModalComponent: React.FC = ({ } }, [workspaceId]); - const handleSubmit = async () => { + const handleSubmit = useCallback(async () => { if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { openToast({ title: 'No changes to save.' }); return; @@ -68,126 +81,169 @@ const FlatRunMoveModalComponent: React.FC = ({ const values = await form.validateFields(); const projId = values.projectId ?? 1; - const results = await moveRuns({ - destinationProjectId: projId, - runIds: flatRuns.map((flatRun) => flatRun.id), - sourceProjectId, - }); + try { + const closeReason = (await controlledModalRef.current?.open()) ?? 'failed'; + switch (closeReason) { + case 'has_search_runs': { + const closeWarningReason = await runMoveWarningFlowRef.current?.open(); + if (closeWarningReason === 'cancel') { + openToast({ title: 'Cancelled Move Action' }); + return; + } + break; + } + case 'no_search_runs': + break; + case 'manual': + case 'failed': + case 'close': + openToast({ title: 'Cancelled Move Action' }); + return; + } + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); - onSubmit?.(results.successful); + onSubmit?.(results.successful); - const numSuccesses = results.successful.length; - const numFailures = results.failed.length; + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; - const destinationProjectName = - Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? - ''; + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; - if (numSuccesses === 0 && numFailures === 0) { - openToast({ - description: 'No selected runs were eligible for moving', - title: 'No eligible runs', - }); - } else if (numFailures === 0) { - openToast({ - closeable: true, - description: `${results.successful.length} runs moved to project ${destinationProjectName}`, - link: View Project, - title: 'Move Success', - }); - } else if (numSuccesses === 0) { - openToast({ - description: `Unable to move ${numFailures} runs`, - severity: 'Warning', - title: 'Move Failure', - }); - } else { - openToast({ - closeable: true, - description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, - link: View Project, - severity: 'Warning', - title: 'Partial Move Failure', - }); + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + await onActionComplete?.(); + } catch (e) { + handleError(e, { publicSubject: 'Unable to move runs' }); } - form.resetFields(); - }; + }, [ + flatRuns, + form, + loadableProjects, + onActionComplete, + onSubmit, + openToast, + projectId, + sourceProjectId, + sourceWorkspaceId, + workspaceId, + ]); return ( - -
- - - - {workspaceId && workspaceId !== 1 && ( + <> + + - {Loadable.match(loadableProjects, { - Failed: () =>
Failed to load
, - Loaded: (loadableProjects) => ( - - ), - NotLoaded: () => , - })} + initialValue={sourceWorkspaceId ?? 1} + label="Workspace" + name="workspaceId" + rules={[{ message: 'Workspace is required', required: true }]}> +
- )} - -
+ {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} + +
+ + flatRun.id), type: 'ONLY_IN' }} + /> + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ec09bb43108..75f2c381925 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -162,6 +162,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const sortString = useMemo(() => makeSortString(sorts.filter(validSort.is)), [sorts]); const loadableFormset = useObservable(formStore.formset); const filtersString = useObservable(formStore.asJsonString); + const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [total, setTotal] = useState>(NotLoaded); const isMobile = useMobile(); const [isLoading, setIsLoading] = useState(true); @@ -947,6 +948,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { onRowHeightChange={onRowHeightChange} /> Date: Wed, 5 Jun 2024 15:39:12 -0700 Subject: [PATCH 042/161] fix: feedback --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 1c6c5ebc3de..5acbd0f3b68 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -40,7 +40,7 @@ interface Props { sourceWorkspaceId?: number; filterFormSetWithoutId: FilterFormSetWithoutId; onSubmit?: (successfulIds?: number[]) => void; - onActionComplete?: () => Promise; + onActionComplete?: () => void; } const FlatRunMoveModalComponent: React.FC = ({ From fe7254f514c10c8236f44c83bc57ef7a321fcc2b Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 5 Jun 2024 15:42:35 -0700 Subject: [PATCH 043/161] fix: unarchive behavior --- master/internal/api_runs.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index d87923c3e4a..df4cf6b0690 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -33,6 +33,7 @@ import ( type runCandidateResult struct { Archived bool + ExpArchived bool ID int32 ExpID *int32 IsMultitrial bool @@ -139,7 +140,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived OR e.archived AS archived"). + ColumnExpr("r.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). @@ -692,6 +693,7 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, Model(&runCandidates). Column("r.id"). Column("r.archived"). + ColumnExpr("e.archived AS exp_archived"). ColumnExpr("r.experiment_id as exp_id"). ColumnExpr("false as is_multitrial"). ColumnExpr("r.state IN (?) AS is_terminal", bun.In(model.StatesToStrings(model.TerminalStates))). @@ -727,6 +729,11 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, for _, cand := range runCandidates { visibleIDs.Insert(cand.ID) switch { + case cand.ExpArchived: + results = append(results, &apiv1.RunActionResult{ + Error: "Parent is archived.", + Id: cand.ID, + }) case cand.Archived && archive: results = append(results, &apiv1.RunActionResult{ Error: "", From 79d42019f6ef424a9351de717414898ef5f7e11c Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 5 Jun 2024 16:01:54 -0700 Subject: [PATCH 044/161] fix: minor fixes --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 5acbd0f3b68..b7715a5452b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -205,7 +205,6 @@ const FlatRunMoveModalComponent: React.FC = ({ {workspaceId && workspaceId !== 1 && ( From ced6c5ae2a4230edf626bead0e83ce74d82c5495 Mon Sep 17 00:00:00 2001 From: John Kim Date: Thu, 6 Jun 2024 11:08:24 -0400 Subject: [PATCH 045/161] tests --- .../RunActionDropdown.test.mock.tsx | 108 +++++++++++ .../src/components/RunActionDropdown.test.tsx | 180 ++++++++++++++++++ 2 files changed, 288 insertions(+) create mode 100644 webui/react/src/components/RunActionDropdown.test.mock.tsx create mode 100644 webui/react/src/components/RunActionDropdown.test.tsx diff --git a/webui/react/src/components/RunActionDropdown.test.mock.tsx b/webui/react/src/components/RunActionDropdown.test.mock.tsx new file mode 100644 index 00000000000..0857ad1213c --- /dev/null +++ b/webui/react/src/components/RunActionDropdown.test.mock.tsx @@ -0,0 +1,108 @@ +import { GridCell, GridCellKind } from '@glideapps/glide-data-grid'; + +import { DateString } from 'ioTypes'; +import { FlatRun } from 'types'; + +import { FilterFormSetWithoutId } from './FilterForm/components/type'; + +export const run: FlatRun = { + archived: false, + checkpointCount: 1, + checkpointSize: 43090, + duration: 256, + endTime: '2024-06-03T17:50:38.703259Z' as DateString, + experiment: { + description: '', + forkedFrom: 6634, + id: 6833, + isMultitrial: true, + name: 'iris_tf_keras_adaptive_search', + progress: 0.9444444, + resourcePool: 'compute-pool', + searcherMetric: 'val_categorical_accuracy', + searcherType: 'adaptive_asha', + unmanaged: false, + }, + hyperparameters: { + global_batch_size: 22, + layer1_dense_size: 29, + learning_rate: 0.00004998215062737775, + learning_rate_decay: 0.000001, + }, + id: 45888, + labels: ['a', 'b'], + parentArchived: false, + projectId: 1, + projectName: 'Uncategorized', + searcherMetricValue: 0.46666666865348816, + startTime: '2024-06-03T17:46:22.682019Z' as DateString, + state: 'COMPLETED', + summaryMetrics: { + avgMetrics: { + categorical_accuracy: { + count: 1, + last: 0.2968127429485321, + max: 0.2968127429485321, + min: 0.2968127429485321, + sum: 0.2968127429485321, + type: 'number', + }, + loss: { + count: 1, + last: 2.4582924842834473, + max: 2.4582924842834473, + min: 2.4582924842834473, + sum: 2.4582924842834473, + type: 'number', + }, + }, + validationMetrics: { + val_categorical_accuracy: { + count: 1, + last: 0.46666666865348816, + max: 0.46666666865348816, + min: 0.46666666865348816, + sum: 0.46666666865348816, + type: 'number', + }, + val_loss: { + count: 1, + last: 1.8627476692199707, + max: 1.8627476692199707, + min: 1.8627476692199707, + sum: 1.8627476692199707, + type: 'number', + }, + }, + }, + userId: 1354, + workspaceId: 1, + workspaceName: 'Uncategorized', +}; + +export const cell: GridCell = { + allowOverlay: false, + copyData: '45888', + cursor: 'pointer', + data: { + kind: 'link-cell', + link: { + href: '/experiments/6833/trials/45888', + title: '45888', + unmanaged: false, + }, + navigateOn: 'click', + underlineOffset: 6, + }, + kind: GridCellKind.Custom, + readonly: true, +}; + +export const filterFormSetWithoutId: FilterFormSetWithoutId = { + filterGroup: { + children: [], + conjunction: 'and', + kind: 'group', + }, + showArchived: false, +}; diff --git a/webui/react/src/components/RunActionDropdown.test.tsx b/webui/react/src/components/RunActionDropdown.test.tsx new file mode 100644 index 00000000000..10b983c855c --- /dev/null +++ b/webui/react/src/components/RunActionDropdown.test.tsx @@ -0,0 +1,180 @@ +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { ConfirmationProvider } from 'hew/useConfirm'; +import _ from 'lodash'; + +import { handlePath } from 'routes/utils'; +import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; +import { RunState } from 'types'; + +import RunActionDropdown from './RunActionDropdown'; +import { cell, filterFormSetWithoutId, run } from './RunActionDropdown.test.mock'; + +const mockNavigatorClipboard = () => { + Object.defineProperty(navigator, 'clipboard', { + configurable: true, + value: { + readText: vi.fn(), + writeText: vi.fn(), + }, + writable: true, + }); +}; + +vi.mock('routes/utils', () => ({ + handlePath: vi.fn(), +})); + +vi.mock('services/api', () => ({ + archiveRuns: vi.fn(), + deleteRuns: vi.fn(), + killRuns: vi.fn(), + unarchiveRuns: vi.fn(), +})); + +const mocks = vi.hoisted(() => { + return { + canDeleteFlatRuns: vi.fn(), + canModifyExperiment: vi.fn(), + canMoveFlatRun: vi.fn(), + }; +}); + +vi.mock('hooks/usePermissions', () => { + const usePermissions = vi.fn(() => { + return { + canDeleteFlatRun: mocks.canDeleteFlatRuns, + canModifyExperiment: mocks.canModifyExperiment, + canMoveFlatRun: mocks.canMoveFlatRun, + }; + }); + return { + default: usePermissions, + }; +}); + +const setup = (link?: string, state?: RunState, archived?: boolean) => { + const onComplete = vi.fn(); + const onVisibleChange = vi.fn(); + render( + + + + + , + ); + return { + onComplete, + onVisibleChange, + }; +}; + +const user = userEvent.setup(); + +describe('RunActionDropdown', () => { + it('should provide Copy Data option', async () => { + setup(); + mockNavigatorClipboard(); + await user.click(screen.getByText('Copy Value')); + expect(navigator.clipboard.writeText).toHaveBeenCalledWith(cell.copyData); + }); + + it('should provide Link option', async () => { + const link = 'https://www.google.com/'; + setup(link); + await user.click(screen.getByText('Open Link in New Tab')); + const tabClick = vi.mocked(handlePath).mock.calls[0]; + expect(tabClick[0]).toMatchObject({ type: 'click' }); + expect(tabClick[1]).toMatchObject({ + path: link, + popout: 'tab', + }); + await user.click(screen.getByText('Open Link in New Window')); + const windowClick = vi.mocked(handlePath).mock.calls[1]; + expect(windowClick[0]).toMatchObject({ type: 'click' }); + expect(windowClick[1]).toMatchObject({ + path: link, + popout: 'window', + }); + }); + + it('should provide Delete option', async () => { + mocks.canDeleteFlatRuns.mockImplementation(() => true); + setup(); + await user.click(screen.getByText('Delete')); + await user.click(screen.getByRole('button', { name: 'Delete' })); + expect(vi.mocked(deleteRuns)).toBeCalled(); + }); + + it('should hide Delete option without permissions', () => { + mocks.canDeleteFlatRuns.mockImplementation(() => false); + setup(); + expect(screen.queryByText('Delete')).not.toBeInTheDocument(); + }); + + it('should provide Kill option', async () => { + mocks.canModifyExperiment.mockImplementation(() => true); + setup(undefined, RunState.Paused, undefined); + await user.click(screen.getByText('Kill')); + await user.click(screen.getByRole('button', { name: 'Kill' })); + expect(vi.mocked(killRuns)).toBeCalled(); + }); + + it('should hide Kill option without permissions', () => { + mocks.canModifyExperiment.mockImplementation(() => false); + setup(undefined, RunState.Paused, undefined); + expect(screen.queryByText('Kill')).not.toBeInTheDocument(); + }); + + it('should provide Archive option', async () => { + mocks.canModifyExperiment.mockImplementation(() => true); + setup(); + await user.click(screen.getByText('Archive')); + expect(vi.mocked(archiveRuns)).toBeCalled(); + }); + + it('should hide Archive option without permissions', () => { + mocks.canModifyExperiment.mockImplementation(() => false); + setup(); + expect(screen.queryByText('Archive')).not.toBeInTheDocument(); + }); + + it('should provide Unarchive option', async () => { + mocks.canModifyExperiment.mockImplementation(() => true); + setup(undefined, undefined, true); + await user.click(screen.getByText('Unarchive')); + expect(vi.mocked(unarchiveRuns)).toBeCalled(); + }); + + it('should hide Unarchive option without permissions', () => { + mocks.canModifyExperiment.mockImplementation(() => false); + setup(undefined, undefined, true); + expect(screen.queryByText('Unarchive')).not.toBeInTheDocument(); + }); + + it('should provide Move option', () => { + mocks.canMoveFlatRun.mockImplementation(() => true); + setup(); + expect(screen.getByText('Move')).toBeInTheDocument(); + }); + + it('should hide Move option without permissions', () => { + mocks.canMoveFlatRun.mockImplementation(() => false); + setup(); + expect(screen.queryByText('Move')).not.toBeInTheDocument(); + }); +}); From 9fb83b4652d29701471f7da9a0f1abf29b98cf30 Mon Sep 17 00:00:00 2001 From: John Kim Date: Thu, 6 Jun 2024 12:24:58 -0400 Subject: [PATCH 046/161] fmt --- .../pages/FlatRuns/FlatRunActionButton.tsx | 10 ++- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 90 +++++++++---------- 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index c5c4aadec12..716253a8f2f 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -108,8 +108,9 @@ const FlatRunActionButton = ({ } else if (numFailures === 0) { openToast({ closeable: true, - description: `${action} succeeded for ${results.successful.length - } ${LABEL_PLURAL.toLowerCase()}`, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, title: `${action} Success`, }); } else if (numSuccesses === 0) { @@ -121,8 +122,9 @@ const FlatRunActionButton = ({ } else { openToast({ closeable: true, - description: `${action} succeeded for ${numSuccesses} out of ${numFailures + numSuccesses - } eligible + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible ${LABEL_PLURAL.toLowerCase()}`, severity: 'Warning', title: `Partial ${action} Failure`, diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index d8d83957525..c30cb978780 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -329,8 +329,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, { max: heatmap.max, @@ -342,8 +342,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -354,8 +354,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); break; @@ -366,8 +366,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -380,9 +380,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { settings.columnWidths[currentColumn.column], heatmap && settings.heatmapOn && !settings.heatmapSkipped.includes(currentColumn.column) ? { - max: heatmap.max, - min: heatmap.min, - } + max: heatmap.max, + min: heatmap.min, + } : undefined, ); } @@ -665,7 +665,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { }, [fetchRuns, handleSelectionChange]); const handleContextMenuComplete: ContextMenuCompleteHandlerProps = - useCallback(() => { }, []); + useCallback(() => {}, []); const handleColumnsOrderChange = useCallback( // changing both column order and pinned count should happen in one update: @@ -715,12 +715,12 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const items: MenuItem[] = [ settings.selection.type === 'ALL_EXCEPT' || settings.selection.selections.length > 0 ? { - key: 'select-none', - label: 'Clear selected', - onClick: () => { - handleSelectionChange?.('remove-all'); - }, - } + key: 'select-none', + label: 'Clear selected', + onClick: () => { + handleSelectionChange?.('remove-all'); + }, + } : null, ...[5, 10, 25].map((n) => ({ key: `select-${n}`, @@ -749,32 +749,32 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { ? null : !isPinned ? { - icon: , - key: 'pin', - label: 'Pin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), - ); - }, - } + icon: , + key: 'pin', + label: 'Pin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), + ); + }, + } : { - disabled: settings.pinnedColumnsCount <= 1, - icon: , - key: 'unpin', - label: 'Unpin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.max(settings.pinnedColumnsCount - 1, 0), - ); + disabled: settings.pinnedColumnsCount <= 1, + icon: , + key: 'unpin', + label: 'Unpin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.max(settings.pinnedColumnsCount - 1, 0), + ); + }, }, - }, { icon: , key: 'hide', @@ -831,9 +831,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { sortCount === 0 ? [] : [ - { type: 'divider' as const }, - ...sortMenuItemsForColumn(column, sorts, handleSortChange), - ]; + { type: 'divider' as const }, + ...sortMenuItemsForColumn(column, sorts, handleSortChange), + ]; items.push( ...sortMenuItems, From eb2fd3a32733c4a152b21d8fe8ea3a5376bad82f Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 14 May 2024 16:38:12 -0700 Subject: [PATCH 047/161] feat: initial implementation of flat run actions --- .../pages/FlatRuns/FlatRunActionButton.tsx | 258 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 25 +- webui/react/src/services/api.ts | 24 ++ webui/react/src/services/apiConfig.ts | 53 +++- webui/react/src/services/decoder.ts | 8 +- 5 files changed, 350 insertions(+), 18 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx new file mode 100644 index 00000000000..2f8ebbd42f4 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -0,0 +1,258 @@ +import Button from 'hew/Button'; +import Dropdown, { MenuItem } from 'hew/Dropdown'; +import Icon, { IconName } from 'hew/Icon'; +import { useModal } from 'hew/Modal'; +import { useToast } from 'hew/Toast'; +import { useCallback, useMemo, useState } from 'react'; + +import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; +import { BatchAction } from 'components/TableActionBar'; +// import usePermissions from 'hooks/usePermissions'; +import { + archiveRuns, + deleteRuns, + killRuns, + openOrCreateTensorBoard, + unarchiveRuns, +} from 'services/api'; +import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { capitalizeWord } from 'utils/string'; +import { openCommandResponse } from 'utils/wait'; + +// export const getActionsForRunsUnion = ( +// experiments: FlatRun[], +// targets: ExperimentAction[], +// permissions: ExperimentPermissionSet, +// ): ExperimentAction[] => { +// if (!experiments.length) return []; // redundant, for clarity +// const actionsForExperiments = experiments.map((e) => +// getActionsForExperiment(e, targets, permissions), +// ); +// return targets.filter((action) => +// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), +// ); +// }; + +const BATCH_ACTIONS = [ + ExperimentAction.OpenTensorBoard, + ExperimentAction.Move, + ExperimentAction.RetainLogs, + ExperimentAction.Archive, + ExperimentAction.Unarchive, + ExperimentAction.Delete, + ExperimentAction.Activate, + ExperimentAction.Pause, + ExperimentAction.Cancel, + ExperimentAction.Kill, +] as const; + +const ACTION_ICONS: Record = { + [ExperimentAction.Activate]: 'play', + [ExperimentAction.Pause]: 'pause', + [ExperimentAction.Cancel]: 'stop', + [ExperimentAction.Archive]: 'archive', + [ExperimentAction.Unarchive]: 'document', + [ExperimentAction.Move]: 'workspaces', + [ExperimentAction.RetainLogs]: 'logs', + [ExperimentAction.OpenTensorBoard]: 'tensor-board', + [ExperimentAction.Kill]: 'cancelled', + [ExperimentAction.Delete]: 'error', +} as const; + +const LABEL_PLURAL = 'runs'; + +interface Props { + isMobile: boolean; + selectedRuns: FlatRun[]; + project: Project; + onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; +} + +const FlatRunActionButton = ({ + isMobile, + selectedRuns, + project, + onActionSuccess, +}: Props): JSX.Element => { + const [batchAction, setBatchAction] = useState(undefined); + // const permissions = usePermissions(); + const { openToast } = useToast(); + const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); + + const sendBatchActions = useCallback( + // TODO: remove this + // eslint-disable-next-line require-await + async (action: BatchAction): Promise => { + const validRunIds = selectedRuns + // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .map((run) => run.id); + const params = { + projectId: project.id, + runIds: validRunIds, + }; + switch (action) { + case ExperimentAction.OpenTensorBoard: { + if (validRunIds.length !== selectedRuns.length) { + // if unmanaged experiments are selected, open experimentTensorBoardModal + // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs + } else { + openCommandResponse( + await openOrCreateTensorBoard({ + experimentIds: params.runIds, + workspaceId: project.workspaceId, + }), + ); + } + return; + } + case ExperimentAction.Move: + // return ExperimentMoveModal.open(); + case ExperimentAction.RetainLogs: + // return ExperimentRetainLogsModal.open(); + case ExperimentAction.Activate: + // return await archiveRuns(params); + case ExperimentAction.Archive: + return await archiveRuns(params); + case ExperimentAction.Cancel: + // return await cancelExperiments(params); + case ExperimentAction.Kill: + return await killRuns(params); + case ExperimentAction.Pause: + // return await pauseExperiments(params); + case ExperimentAction.Unarchive: + return await unarchiveRuns(params); + case ExperimentAction.Delete: + return await deleteRuns(params); + } + }, + [project.id, project.workspaceId, selectedRuns], + ); + + const submitBatchAction = useCallback( + async (action: BatchAction) => { + try { + const results = await sendBatchActions(action); + if (results === undefined) return; + + onActionSuccess?.(action, results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: `No selected ${LABEL_PLURAL.toLowerCase()} were eligible for ${action.toLowerCase()}`, + title: `No eligible ${LABEL_PLURAL.toLowerCase()}`, + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, + title: `${action} Success`, + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to ${action.toLowerCase()} ${numFailures} ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `${action} Failure`, + }); + } else { + openToast({ + closeable: true, + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible + ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `Partial ${action} Failure`, + }); + } + } catch (e) { + const publicSubject = + action === ExperimentAction.OpenTensorBoard + ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` + : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + handleError(e, { + isUserTriggered: true, + publicMessage: 'Please try again later.', + publicSubject, + silent: false, + }); + } finally { + // onActionComplete?.(); + } + }, + [sendBatchActions, onActionSuccess, openToast], + ); + + const handleBatchAction = useCallback( + (action: string) => { + switch (action) { + case ExperimentAction.OpenTensorBoard: + submitBatchAction(action); + break; + case ExperimentAction.Move: + case ExperimentAction.RetainLogs: + sendBatchActions(action); + break; + default: + setBatchAction(action as BatchAction); + BatchActionConfirmModal.open(); + break; + } + }, + [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + ); + + // const availableBatchActions = useMemo(() => { + // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. + // }, [selectedExperimentIds, experimentMap, permissions]); + + const editMenuItems = useMemo(() => { + const groupedBatchActions = [ + BATCH_ACTIONS.slice(0, 1), // View in TensorBoard + BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete + BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill + ]; + const groupSize = groupedBatchActions.length; + return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { + const isLastGroup = index === groupSize - 1; + group.forEach((action) => + acc.push({ + danger: action === ExperimentAction.Delete, + // disabled: !availableBatchActions.includes(action), // TODO uncomment later + icon: , + key: action, + label: action, + }), + ); + if (!isLastGroup) acc.push({ type: 'divider' }); + return acc; + }, []); + }, []); + + return ( + <> + {selectedRuns.length > 0 && ( + + + + )} + {batchAction && ( + exp.unmanaged)} // TODO: is it needed for Runs? + onConfirm={() => submitBatchAction(batchAction)} + /> + )} + + ); +}; + +export default FlatRunActionButton; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ac8528b4606..96f5c2c1bca 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -63,6 +63,7 @@ import { DEFAULT_SELECTION, SelectionType as SelectionState, } from 'pages/F_ExpList/F_ExperimentList.settings'; +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { paths } from 'routes/utils'; import { getProjectColumns, getProjectNumericMetricsRange, searchRuns } from 'services/api'; import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; @@ -196,6 +197,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { } }, [projectId]); + const selectedRunIdSet = useMemo(() => { + return new Set(settings.selection.type === 'ONLY_IN' ? settings.selection.selections : []); + }, [settings.selection]); + const columnsIfLoaded = useMemo( () => (isLoadingSettings ? [] : settings.columns), [isLoadingSettings, settings.columns], @@ -214,18 +219,16 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { if (isLoadingSettings) { return selectedMap; } - const selectedIdSet = new Set( - settings.selection.type === 'ONLY_IN' ? settings.selection.selections : [], - ); + runs.forEach((r, index) => { Loadable.forEach(r, (run) => { - if (selectedIdSet.has(run.id)) { + if (selectedRunIdSet.has(run.id)) { selectedMap.set(run.id, { index, run }); } }); }); return selectedMap; - }, [isLoadingSettings, settings.selection, runs]); + }, [isLoadingSettings, runs, selectedRunIdSet]); const selection = useMemo(() => { let rows = CompactSelection.empty(); @@ -238,6 +241,13 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { }; }, [loadedSelectedRunIds]); + const selectedRuns: FlatRun[] = useMemo(() => { + const selected = runs.flatMap((run) => { + return run.isLoaded && selectedRunIdSet.has(run.data.id) ? [run.data] : []; + }); + return selected; + }, [runs, selectedRunIdSet]); + const handleIsOpenFilterChange = useCallback((newOpen: boolean) => { setIsOpenFilter(newOpen); if (!newOpen) { @@ -930,6 +940,11 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { rowHeight={globalSettings.rowHeight} onRowHeightChange={onRowHeightChange} /> + diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 0a6c975e646..39acbb16325 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -757,6 +757,30 @@ export const searchRuns = generateDetApi< Type.SearchFlatRunPagination >(Config.searchRuns); +export const archiveRuns = generateDetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +>(Config.archiveRuns); + +export const deleteRuns = generateDetApi( + Config.deleteRuns, +); + +export const killRuns = generateDetApi( + Config.killRuns, +); + +export const moveRuns = generateDetApi( + Config.moveRuns, +); + +export const unarchiveRuns = generateDetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + void +>(Config.unarchiveRuns); + /* Tasks */ export const getCommands = generateDetApi< diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index f9d34fd7a9b..7c8c01d55f3 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -717,7 +717,7 @@ export const archiveExperiments: DetApi< Type.BulkActionResult > = { name: 'archiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.archiveExperiments(params.projectId, params, options); }, @@ -741,7 +741,7 @@ export const deleteExperiments: DetApi< Type.BulkActionResult > = { name: 'deleteExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.deleteExperiments(params.projectId, params, options); }, @@ -765,7 +765,7 @@ export const unarchiveExperiments: DetApi< Type.BulkActionResult > = { name: 'unarchiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.unarchiveExperiments(params.projectId, params, options); }, @@ -789,7 +789,7 @@ export const activateExperiments: DetApi< Type.BulkActionResult > = { name: 'activateExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.activateExperiments(params.projectId, params, options); }, @@ -813,7 +813,7 @@ export const pauseExperiments: DetApi< Type.BulkActionResult > = { name: 'pauseExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.pauseExperiments(params.projectId, params, options); }, @@ -837,7 +837,7 @@ export const cancelExperiments: DetApi< Type.BulkActionResult > = { name: 'cancelExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.cancelExperiments(params.projectId, params, options); }, @@ -861,7 +861,7 @@ export const killExperiments: DetApi< Type.BulkActionResult > = { name: 'killExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.killExperiments(params.projectId, params, options); }, @@ -1014,7 +1014,7 @@ export const moveExperiments: DetApi< Type.BulkActionResult > = { name: 'moveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.moveExperiments(params.projectId, params, options), }; @@ -1025,7 +1025,7 @@ export const changeExperimentLogRetention: DetApi< Type.BulkActionResult > = { name: 'changeExperimentLogRetention', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.putExperimentsRetainLogs(params.projectId, params, options), }; @@ -1148,6 +1148,41 @@ export const searchRuns: DetApi< ), }; +export const archiveRuns: DetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'archiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.archiveRuns(params, options), +}; + +export const deleteRuns: DetApi = { + name: 'deleteRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.deleteRuns(params, options), +}; + +export const killRuns: DetApi = { + name: 'killRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.killRuns(params, options), +}; + +export const moveRuns: DetApi = { + name: 'moveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.moveRuns(params, options), +}; + +export const unarchiveRuns: DetApi = + { + name: 'unarchiveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), + }; + /* Tasks */ export const getTask: DetApi< diff --git a/webui/react/src/services/decoder.ts b/webui/react/src/services/decoder.ts index 6f15eb56447..23f4820e5b7 100644 --- a/webui/react/src/services/decoder.ts +++ b/webui/react/src/services/decoder.ts @@ -875,11 +875,11 @@ export const decodeJobStates = ( >; }; -export const mapV1ExperimentActionResults = ( - results: Sdk.V1ExperimentActionResult[], +export const mapV1ActionResults = ( + results: Sdk.V1ExperimentActionResult[] | Sdk.V1RunActionResult[], ): types.BulkActionResult => { return results.reduce( - (acc, cur) => { + (acc: types.BulkActionResult, cur) => { if (cur.error.length > 0) { acc.failed.push(cur); } else { @@ -887,7 +887,7 @@ export const mapV1ExperimentActionResults = ( } return acc; }, - { failed: [], successful: [] } as types.BulkActionResult, + { failed: [], successful: [] }, ); }; From 25c155b157f51b8442dbaee98591b87782213141 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 22 May 2024 11:34:30 -0700 Subject: [PATCH 048/161] fix: minor changes --- .../react/src/pages/FlatRuns/FlatRunActionButton.tsx | 4 +--- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2f8ebbd42f4..2fbd2d13cd6 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -81,8 +81,6 @@ const FlatRunActionButton = ({ const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( - // TODO: remove this - // eslint-disable-next-line require-await async (action: BatchAction): Promise => { const validRunIds = selectedRuns // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission @@ -111,7 +109,7 @@ const FlatRunActionButton = ({ case ExperimentAction.RetainLogs: // return ExperimentRetainLogsModal.open(); case ExperimentAction.Activate: - // return await archiveRuns(params); + // return await activate(params); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Cancel: diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 96f5c2c1bca..d76315d33e9 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,6 +53,7 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; +import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -656,6 +657,15 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); + const onActionSuccess = useCallback( + // TODO: update this function + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (_action: BatchAction, _successfulIds: number[]) => { + handleSelectionChange('remove-all'); + }, + [handleSelectionChange], + ); + const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -944,6 +954,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} + onActionSuccess={onActionSuccess} /> From 54cfd9cf71829568610ffc47b50a0f4173b12161 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 16:31:46 -0700 Subject: [PATCH 049/161] feat: add RBAC permissions for flatRuns --- webui/react/src/hooks/usePermissions.ts | 36 +++++- .../pages/FlatRuns/FlatRunActionButton.tsx | 112 +++++------------- webui/react/src/types.ts | 15 +++ webui/react/src/utils/flatRun.ts | 72 +++++++++++ 4 files changed, 151 insertions(+), 84 deletions(-) create mode 100644 webui/react/src/utils/flatRun.ts diff --git a/webui/react/src/hooks/usePermissions.ts b/webui/react/src/hooks/usePermissions.ts index e25ac702b98..ae909e64756 100644 --- a/webui/react/src/hooks/usePermissions.ts +++ b/webui/react/src/hooks/usePermissions.ts @@ -9,6 +9,8 @@ import userStore from 'stores/users'; import { DetailedUser, ExperimentPermissionsArgs, + FlatRun, + FlatRunPermissionsArgs, ModelItem, ModelVersion, Permission, @@ -53,7 +55,7 @@ interface MovePermissionsArgs { destination?: PermissionWorkspace; } -interface PermissionsHook { +export interface PermissionsHook { canAdministrateUsers: boolean; canAssignRoles: (arg0: WorkspacePermissionsArgs) => boolean; canCreateExperiment: (arg0: WorkspacePermissionsArgs) => boolean; @@ -67,6 +69,7 @@ interface PermissionsHook { canCreateWorkspace: boolean; canCreateWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canDeleteExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canDeleteFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canDeleteModel: (arg0: ModelPermissionsArgs) => boolean; canDeleteModelVersion: (arg0: ModelVersionPermissionsArgs) => boolean; canDeleteProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -88,6 +91,7 @@ interface PermissionsHook { canModifyWorkspaceCheckpointStorage: (arg0: WorkspacePermissionsArgs) => boolean; canModifyWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canMoveExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canMoveFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canMoveExperimentsTo: (arg0: MovePermissionsArgs) => boolean; canMoveModel: (arg0: MovePermissionsArgs) => boolean; canMoveProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -144,6 +148,7 @@ const usePermissions = (): PermissionsHook => { canCreateWorkspaceNSC(rbacOpts, args.workspace), canDeleteExperiment: (args: ExperimentPermissionsArgs) => canDeleteExperiment(rbacOpts, args.experiment), + canDeleteFlatRun: (args: FlatRunPermissionsArgs) => canDeleteFlatRun(rbacOpts, args.flatRun), canDeleteModel: (args: ModelPermissionsArgs) => canDeleteModel(rbacOpts, args.model), canDeleteModelVersion: (args: ModelVersionPermissionsArgs) => canDeleteModelVersion(rbacOpts, args.modelVersion), @@ -181,6 +186,7 @@ const usePermissions = (): PermissionsHook => { canMoveExperiment(rbacOpts, args.experiment), canMoveExperimentsTo: (args: MovePermissionsArgs) => canMoveExperimentsTo(rbacOpts, args.destination), + canMoveFlatRun: (args: FlatRunPermissionsArgs) => canMoveFlatRun(rbacOpts, args.flatRun), canMoveModel: (args: MovePermissionsArgs) => canMoveModel(rbacOpts, args.destination), canMoveProjects: (args: ProjectPermissionsArgs) => canMoveWorkspaceProjects(rbacOpts, args.project), @@ -679,4 +685,32 @@ const canManageResourcePoolBindings = ({ : !!currentUser && currentUser.isAdmin; }; +// Flat Runs + +const canDeleteFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const permitted = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? permitted.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + +const canMoveFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const srcPermit = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? srcPermit.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + export default usePermissions; diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2fbd2d13cd6..ee7130b4ddb 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -6,57 +6,32 @@ import { useToast } from 'hew/Toast'; import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; -import { BatchAction } from 'components/TableActionBar'; -// import usePermissions from 'hooks/usePermissions'; -import { - archiveRuns, - deleteRuns, - killRuns, - openOrCreateTensorBoard, - unarchiveRuns, -} from 'services/api'; +import usePermissions from 'hooks/usePermissions'; +import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; import handleError from 'utils/error'; +import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; -import { openCommandResponse } from 'utils/wait'; - -// export const getActionsForRunsUnion = ( -// experiments: FlatRun[], -// targets: ExperimentAction[], -// permissions: ExperimentPermissionSet, -// ): ExperimentAction[] => { -// if (!experiments.length) return []; // redundant, for clarity -// const actionsForExperiments = experiments.map((e) => -// getActionsForExperiment(e, targets, permissions), -// ); -// return targets.filter((action) => -// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), -// ); -// }; const BATCH_ACTIONS = [ - ExperimentAction.OpenTensorBoard, + // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, - ExperimentAction.RetainLogs, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - ExperimentAction.Activate, - ExperimentAction.Pause, - ExperimentAction.Cancel, + // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; +type BatchAction = (typeof BATCH_ACTIONS)[number]; + const ACTION_ICONS: Record = { - [ExperimentAction.Activate]: 'play', - [ExperimentAction.Pause]: 'pause', - [ExperimentAction.Cancel]: 'stop', + // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', - [ExperimentAction.RetainLogs]: 'logs', - [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Kill]: 'cancelled', + // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -67,6 +42,7 @@ interface Props { selectedRuns: FlatRun[]; project: Project; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunActionButton = ({ @@ -74,57 +50,39 @@ const FlatRunActionButton = ({ selectedRuns, project, onActionSuccess, + onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); - // const permissions = usePermissions(); + const permissions = usePermissions(); const { openToast } = useToast(); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( async (action: BatchAction): Promise => { const validRunIds = selectedRuns - // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { projectId: project.id, runIds: validRunIds, }; switch (action) { - case ExperimentAction.OpenTensorBoard: { - if (validRunIds.length !== selectedRuns.length) { - // if unmanaged experiments are selected, open experimentTensorBoardModal - // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs - } else { - openCommandResponse( - await openOrCreateTensorBoard({ - experimentIds: params.runIds, - workspaceId: project.workspaceId, - }), - ); - } - return; - } case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - case ExperimentAction.RetainLogs: - // return ExperimentRetainLogsModal.open(); - case ExperimentAction.Activate: - // return await activate(params); + // return ExperimentMoveModal.open(); + break; case ExperimentAction.Archive: return await archiveRuns(params); - case ExperimentAction.Cancel: - // return await cancelExperiments(params); case ExperimentAction.Kill: return await killRuns(params); - case ExperimentAction.Pause: - // return await pauseExperiments(params); case ExperimentAction.Unarchive: return await unarchiveRuns(params); case ExperimentAction.Delete: return await deleteRuns(params); + default: + break; } }, - [project.id, project.workspaceId, selectedRuns], + [project.id, selectedRuns], ); const submitBatchAction = useCallback( @@ -169,10 +127,7 @@ const FlatRunActionButton = ({ }); } } catch (e) { - const publicSubject = - action === ExperimentAction.OpenTensorBoard - ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` - : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { isUserTriggered: true, publicMessage: 'Please try again later.', @@ -180,20 +135,16 @@ const FlatRunActionButton = ({ silent: false, }); } finally { - // onActionComplete?.(); + onActionComplete?.(); } }, - [sendBatchActions, onActionSuccess, openToast], + [sendBatchActions, onActionSuccess, openToast, onActionComplete], ); const handleBatchAction = useCallback( (action: string) => { switch (action) { - case ExperimentAction.OpenTensorBoard: - submitBatchAction(action); - break; case ExperimentAction.Move: - case ExperimentAction.RetainLogs: sendBatchActions(action); break; default: @@ -202,27 +153,22 @@ const FlatRunActionButton = ({ break; } }, - [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + [BatchActionConfirmModal, sendBatchActions], ); - // const availableBatchActions = useMemo(() => { - // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); - // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. - // }, [selectedExperimentIds, experimentMap, permissions]); + const availableBatchActions = useMemo(() => { + return getActionsForFlatRunsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + }, [selectedRuns, permissions]); const editMenuItems = useMemo(() => { - const groupedBatchActions = [ - BATCH_ACTIONS.slice(0, 1), // View in TensorBoard - BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete - BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill - ]; + const groupedBatchActions = [BATCH_ACTIONS]; const groupSize = groupedBatchActions.length; return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { const isLastGroup = index === groupSize - 1; group.forEach((action) => acc.push({ danger: action === ExperimentAction.Delete, - // disabled: !availableBatchActions.includes(action), // TODO uncomment later + disabled: !availableBatchActions.includes(action), icon: , key: action, label: action, @@ -231,7 +177,7 @@ const FlatRunActionButton = ({ if (!isLastGroup) acc.push({ type: 'divider' }); return acc; }, []); - }, []); + }, [availableBatchActions]); return ( <> @@ -245,7 +191,7 @@ const FlatRunActionButton = ({ {batchAction && ( exp.unmanaged)} // TODO: is it needed for Runs? + isUnmanagedIncluded={selectedRuns.some((run) => run.experiment?.unmanaged ?? false)} onConfirm={() => submitBatchAction(batchAction)} /> )} diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 84463695548..22ab2ab6380 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1146,6 +1146,10 @@ export interface ExperimentPermissionsArgs { experiment: ProjectExperiment; } +export interface FlatRunPermissionsArgs { + flatRun: FlatRun; +} + export interface PermissionWorkspace { id: number; userId?: number; @@ -1253,3 +1257,14 @@ export interface FlatRunExperiment { export interface SearchFlatRunPagination extends WithPagination { runs: FlatRun[]; } + +export const FlatRunAction = { + Archive: 'Archive', + Delete: 'Delete', + Kill: 'Kill', + Move: 'Move', + // Pause: 'Pause', + Unarchive: 'Unarchive', +} as const; + +export type FlatRunAction = ValueOf; diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts new file mode 100644 index 00000000000..6375851fd24 --- /dev/null +++ b/webui/react/src/utils/flatRun.ts @@ -0,0 +1,72 @@ +import { deletableRunStates, killableRunStates, terminalRunStates } from 'constants/states'; +import { PermissionsHook } from 'hooks/usePermissions'; +import { FlatRun, FlatRunAction } from 'types'; + +type FlatRunChecker = (flatRun: FlatRun) => boolean; + +type FlatRunPermissionSet = Pick< + PermissionsHook, + 'canCreateExperiment' | 'canDeleteFlatRun' | 'canModifyExperiment' | 'canMoveFlatRun' +>; + +const flatRunCheckers: Record = { + [FlatRunAction.Archive]: (flatRun) => + !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + + [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), + + [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), + + [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + + // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), + + [FlatRunAction.Unarchive]: (flatRun) => + terminalRunStates.has(flatRun.state) && flatRun.parentArchived, +}; + +export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { + return flatRunCheckers[action](flatRun); +}; + +const getActionsForFlatRun = ( + flatRun: FlatRun, + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun) return []; // redundant, for clarity + const workspace = { id: flatRun.workspaceId }; + return targets + .filter((action) => canActionFlatRun(action, flatRun)) + .filter((action) => { + switch (action) { + case FlatRunAction.Delete: + return permissions.canDeleteFlatRun({ flatRun }); + + case FlatRunAction.Move: + return permissions.canMoveFlatRun({ flatRun }); + + case FlatRunAction.Archive: + case FlatRunAction.Unarchive: + return permissions.canModifyExperiment({ workspace }); + + case FlatRunAction.Kill: + return permissions.canModifyExperiment({ workspace }) && !flatRun.experiment?.unmanaged; + + default: + return true; + } + }); +}; + +export const getActionsForFlatRunsUnion = ( + flatRun: FlatRun[], + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun.length) return []; + const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); + return targets.filter((action) => + actionsForRuns.some((runActions) => runActions.includes(action)), + ); +}; From 85ab36e0c0f35853c207b86f2bd4b754f6f10e9b Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 17:28:07 -0700 Subject: [PATCH 050/161] feat: return `archived` for FlatRun --- harness/determined/common/api/bindings.py | 4 ++ master/internal/api_runs.go | 1 + proto/pkg/runv1/run.pb.go | 60 +++++++++++++--------- proto/src/determined/run/v1/run.proto | 5 +- webui/react/src/services/api-ts-sdk/api.ts | 6 +++ webui/react/src/services/apiConfig.ts | 15 +++--- webui/react/src/types.ts | 1 + webui/react/src/utils/flatRun.ts | 7 ++- 8 files changed, 64 insertions(+), 35 deletions(-) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index 9a3974e55f2..ee09100bb36 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -4275,6 +4275,7 @@ class v1FlatRun(Printable): def __init__( self, *, + archived: bool, checkpointCount: int, checkpointSize: str, id: int, @@ -4295,6 +4296,7 @@ def __init__( summaryMetrics: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, userId: "typing.Union[int, None, Unset]" = _unset, ): + self.archived = archived self.checkpointCount = checkpointCount self.checkpointSize = checkpointSize self.id = id @@ -4327,6 +4329,7 @@ def __init__( @classmethod def from_json(cls, obj: Json) -> "v1FlatRun": kwargs: "typing.Dict[str, typing.Any]" = { + "archived": obj["archived"], "checkpointCount": obj["checkpointCount"], "checkpointSize": obj["checkpointSize"], "id": obj["id"], @@ -4360,6 +4363,7 @@ def from_json(cls, obj: Json) -> "v1FlatRun": def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out: "typing.Dict[str, typing.Any]" = { + "archived": self.archived, "checkpointCount": self.checkpointCount, "checkpointSize": self.checkpointSize, "id": self.id, diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 239b85b24ac..39b5bda15d1 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,6 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). + ColumnExpr("r.archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 7406eca7199..9816a359c85 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,6 +216,8 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` + // The archived status of this run + Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` } func (x *FlatRun) Reset() { @@ -383,6 +385,13 @@ func (x *FlatRun) GetExperiment() *FlatRunExperiment { return nil } +func (x *FlatRun) GetArchived() bool { + if x != nil { + return x.Archived + } + return false +} + var File_determined_run_v1_run_proto protoreflect.FileDescriptor var file_determined_run_v1_run_proto_rawDesc = []byte{ @@ -440,7 +449,7 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x70, 0x61, 0x63, 0x68, 0x79, 0x64, 0x65, 0x72, 0x6d, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xf9, 0x08, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0xa0, 0x09, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, @@ -493,29 +502,32 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x6e, 0x74, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x06, - 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x3a, - 0x9b, 0x01, 0x92, 0x41, 0x97, 0x01, 0x0a, 0x94, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, - 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0xd2, 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, - 0x01, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, - 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, - 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, - 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, - 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, - 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, - 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, - 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1a, 0x0a, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x3a, 0xa6, 0x01, 0x92, 0x41, + 0xa2, 0x01, 0x0a, 0x9f, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, 0x0a, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0xd2, + 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0a, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0xd2, 0x01, 0x08, 0x61, 0x72, 0x63, 0x68, + 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, + 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, + 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, + 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, + 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, + 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/proto/src/determined/run/v1/run.proto b/proto/src/determined/run/v1/run.proto index 62f4a54502f..6ea1b43e226 100644 --- a/proto/src/determined/run/v1/run.proto +++ b/proto/src/determined/run/v1/run.proto @@ -66,7 +66,8 @@ message FlatRun { "project_name", "workspace_id", "workspace_name", - "parent_archived" + "parent_archived", + "archived" ] } }; @@ -110,4 +111,6 @@ message FlatRun { bool parent_archived = 18; // Data related the the experiment associated with this run. optional FlatRunExperiment experiment = 19; + // The archived status of this run + bool archived = 20; } diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index 3045ce743ef..e213bc5c6db 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3494,6 +3494,12 @@ export interface V1FlatRun { * @memberof V1FlatRun */ experiment?: V1FlatRunExperiment; + /** + * The archived status of this run + * @type {boolean} + * @memberof V1FlatRun + */ + archived: boolean; } /** * diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index 7c8c01d55f3..b782ac8f284 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1176,12 +1176,15 @@ export const moveRuns: DetApi detApi.Internal.moveRuns(params, options), }; -export const unarchiveRuns: DetApi = - { - name: 'unarchiveRuns', - postProcess: noOp, - request: (params, options) => detApi.Internal.unarchiveRuns(params, options), - }; +export const unarchiveRuns: DetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'unarchiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), +}; /* Tasks */ diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 22ab2ab6380..6f633247b19 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1237,6 +1237,7 @@ export interface FlatRun { projectName: string; workspaceId: number; workspaceName: string; + archived: boolean; parentArchived: boolean; experiment?: FlatRunExperiment; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6375851fd24..6c2aef34d5e 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,18 +11,17 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), - [FlatRunAction.Unarchive]: (flatRun) => - terminalRunStates.has(flatRun.state) && flatRun.parentArchived, + [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { From 4bd19c0949f02054eee0898b448faa68ae64b6fd Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 11:09:46 -0700 Subject: [PATCH 051/161] chore: minor changes --- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 3 +-- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 15 +++++---------- webui/react/src/utils/flatRun.ts | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index ee7130b4ddb..0413a0a35b3 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -126,6 +126,7 @@ const FlatRunActionButton = ({ title: `Partial ${action} Failure`, }); } + await onActionComplete?.(); } catch (e) { const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { @@ -134,8 +135,6 @@ const FlatRunActionButton = ({ publicSubject, silent: false, }); - } finally { - onActionComplete?.(); } }, [sendBatchActions, onActionSuccess, openToast, onActionComplete], diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index d76315d33e9..8425c37b528 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,7 +53,6 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; -import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -657,14 +656,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); - const onActionSuccess = useCallback( - // TODO: update this function - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (_action: BatchAction, _successfulIds: number[]) => { - handleSelectionChange('remove-all'); - }, - [handleSelectionChange], - ); + const onActionComplete = useCallback(async () => { + handleSelectionChange('remove-all'); + await fetchRuns(); + }, [fetchRuns, handleSelectionChange]); const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -954,7 +949,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} - onActionSuccess={onActionSuccess} + onActionComplete={onActionComplete} /> diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6c2aef34d5e..fb266d5c797 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,13 +11,13 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), + !flatRun.parentArchived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, + [FlatRunAction.Move]: (flatRun) => !flatRun.parentArchived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), From 272a1448706ea3df86ecaf5e1a1efb921d5d3353 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 15:15:43 -0700 Subject: [PATCH 052/161] test: `canActionFlatRun` test cases --- webui/react/src/constants/states.ts | 2 +- webui/react/src/utils/flatRun.test.ts | 218 ++++++++++++++++++++++++++ 2 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 webui/react/src/utils/flatRun.test.ts diff --git a/webui/react/src/constants/states.ts b/webui/react/src/constants/states.ts index c0cb4ab57e1..677c4477e99 100644 --- a/webui/react/src/constants/states.ts +++ b/webui/react/src/constants/states.ts @@ -65,7 +65,7 @@ export const terminalCommandStates: Set = new Set([ CommandState.Terminating, ]); -const runStateList = [ +export const runStateList = [ RunState.Canceled, RunState.Completed, RunState.Error, diff --git a/webui/react/src/utils/flatRun.test.ts b/webui/react/src/utils/flatRun.test.ts new file mode 100644 index 00000000000..3b7d97c29f7 --- /dev/null +++ b/webui/react/src/utils/flatRun.test.ts @@ -0,0 +1,218 @@ +import dayjs from 'dayjs'; + +import { + deletableRunStates, + killableRunStates, + runStateList, + terminalRunStates, +} from 'constants/states'; +import { FlatRun, FlatRunAction, RunState } from 'types'; +import { canActionFlatRun } from 'utils/flatRun'; + +describe('Flat Run Utilities', () => { + const BASE_FLAT_RUN: Readonly = { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }; + + describe('canActionFlatRun function', () => { + const terminatedRunStates: Set = new Set( + Object.values(RunState).filter((v) => terminalRunStates.has(v)), + ); + + describe('Archive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be archivable (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, flatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be archivable (%s)', + (terminatedRunState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, archivedFlatRun)).toBeFalsy(); + + // parentArchived and archived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, bothArchivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Unarchive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be unarchivable (%s)', + (terminatedRunState) => { + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeTruthy(); + + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, bothArchivedFlatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be unarchivable with Terminated Run State (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, parentArchivedFlatRun)).toBeFalsy(); + }, + ); + + it.each(Array.from(Object.values(RunState).filter((v) => !terminatedRunStates.has(v))))( + 'should not be unarchivable with non Terminated Run States (%s)', + (nonTerminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Delete Action', () => { + it.each(runStateList)('should be deletable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((state) => !deletableRunStates.has(state)))( + 'should not be deletable', + (nonDeletableRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonDeletableRunState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Kill Action', () => { + const killRunStates: Set = new Set( + Object.values(RunState).filter((v) => killableRunStates.includes(v)), + ); + + it.each(Array.from(killRunStates))('should be killable (%s)', (killRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: killRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((v) => !killRunStates.has(v)))( + 'should not be killable (%s)', + (nonKillRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonKillRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Move Action', () => { + it.each(Object.values(RunState))('should be movable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState))('should not be movable (%s)', (runState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, archivedFlatRun)).toBeFalsy(); + + // both archived and parentArchived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, bothArchivedFlatRun)).toBeFalsy(); + }); + }); + }); +}); From 85b3ed99aa212f2561d91f24a9312fcdbe91e84a Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 11:49:57 -0700 Subject: [PATCH 053/161] chore: better type --- .../pages/FlatRuns/FlatRunActionButton.tsx | 4 ++-- webui/react/src/utils/flatRun.ts | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 0413a0a35b3..a1a650b836a 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -39,8 +39,8 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; - selectedRuns: FlatRun[]; - project: Project; + selectedRuns: ReadonlyArray>; + project: Readonly; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index fb266d5c797..8b52c9cb22c 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -2,7 +2,7 @@ import { deletableRunStates, killableRunStates, terminalRunStates } from 'consta import { PermissionsHook } from 'hooks/usePermissions'; import { FlatRun, FlatRunAction } from 'types'; -type FlatRunChecker = (flatRun: FlatRun) => boolean; +type FlatRunChecker = (flatRun: Readonly) => boolean; type FlatRunPermissionSet = Pick< PermissionsHook, @@ -24,15 +24,15 @@ const flatRunCheckers: Record = { [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; -export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { +export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly): boolean => { return flatRunCheckers[action](flatRun); }; const getActionsForFlatRun = ( - flatRun: FlatRun, - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: Readonly, + targets: ReadonlyArray, + permissions: Readonly, +): ReadonlyArray => { if (!flatRun) return []; // redundant, for clarity const workspace = { id: flatRun.workspaceId }; return targets @@ -59,10 +59,10 @@ const getActionsForFlatRun = ( }; export const getActionsForFlatRunsUnion = ( - flatRun: FlatRun[], - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: ReadonlyArray>, + targets: ReadonlyArray, + permissions: Readonly, +): Readonly => { if (!flatRun.length) return []; const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); return targets.filter((action) => From 46c97b48e7db12ec9b42bbde340f7354104ed7fd Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 12:18:04 -0700 Subject: [PATCH 054/161] test: `FlatRunActionButton` test --- .../FlatRuns/FlatRunActionButton.test.tsx | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx new file mode 100644 index 00000000000..9a9b1ba7aeb --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -0,0 +1,60 @@ +import { render, screen } from '@testing-library/react'; +import dayjs from 'dayjs'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; + +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; +import { FlatRun, Project, RunState, WorkspaceState } from 'types'; + +const setup = (selectedFlatRuns: ReadonlyArray>) => { + const project: Readonly = { + archived: false, + id: 1, + immutable: false, + name: 'proj', + notes: [], + state: WorkspaceState.Unspecified, + userId: 1, + workspaceId: 1, + }; + + render( + + + , + ); +}; + +describe('canActionFlatRun function', () => { + describe('Flat Run Action Button Visibility', () => { + it('should not be appeard without selected flat runs', () => { + setup([]); + expect(screen.queryByText('Actions')).not.toBeInTheDocument(); + }); + + it('should be appeard with selected flat runs', async () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + + setup(flatRuns); + expect(await screen.findByText('Actions')).toBeInTheDocument(); + }); + }); +}); From cf536ca59f9991b6740faaece4f80fe246969741 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 30 May 2024 09:59:52 -0700 Subject: [PATCH 055/161] fix: fix run `archived` logic in postgres --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 39b5bda15d1..ead375b705b 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,7 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived"). + ColumnExpr("r.archived OR e.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). From b5755cf1a28e800b781572d31d959ea5bb178ce5 Mon Sep 17 00:00:00 2001 From: Ashton G Date: Mon, 3 Jun 2024 10:16:09 -0400 Subject: [PATCH 056/161] chore: run bulk action interstitial component (#9390) Co-authored-by: Keita Fish --- .../components/InterstitialModalComponent.tsx | 2 +- ...nFilterInterstitialModalComponent.test.tsx | 216 ++++++++++++++++++ .../RunFilterInterstitialModalComponent.tsx | 168 ++++++++++++++ .../RunMoveWarningModalComponent.test.tsx | 93 ++++++++ .../RunMoveWarningModalComponent.tsx | 54 +++++ webui/react/src/hooks/useTypedParams.test.tsx | 4 +- .../pages/TrialDetails/TrialDetailsLogs.tsx | 15 +- webui/react/src/setupTests.ts | 19 +- .../src/utils/mergeAbortControllers.test.ts | 87 +++++++ .../react/src/utils/mergeAbortControllers.ts | 20 ++ 10 files changed, 653 insertions(+), 25 deletions(-) create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.test.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.tsx create mode 100644 webui/react/src/utils/mergeAbortControllers.test.ts create mode 100644 webui/react/src/utils/mergeAbortControllers.ts diff --git a/webui/react/src/components/InterstitialModalComponent.tsx b/webui/react/src/components/InterstitialModalComponent.tsx index 0789b4a6b38..7eaff4c822e 100644 --- a/webui/react/src/components/InterstitialModalComponent.tsx +++ b/webui/react/src/components/InterstitialModalComponent.tsx @@ -6,7 +6,7 @@ import { useCallback, useEffect } from 'react'; export type onInterstitialCloseActionType = (reason: 'ok' | 'close' | 'failed') => void; interface Props { - onCloseAction: (reason: 'ok' | 'close' | 'failed') => void; + onCloseAction: onInterstitialCloseActionType; loadableData: Loadable; } diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx new file mode 100644 index 00000000000..3284273cdaf --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx @@ -0,0 +1,216 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { FilterFormSetWithoutId, FormField } from 'components/FilterForm/components/type'; +import RunFilterInterstitialModalComponent, { + CloseReason, + ControlledModalRef, + Props, +} from 'components/RunFilterInterstitialModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +vi.mock('services/api', async () => ({ + ...(await vi.importActual('services/api')), + searchRuns: vi.fn(() => + Promise.resolve({ + pagination: { + total: 0, + }, + }), + ), +})); + +const { searchRuns } = await import('services/api'); +const searchRunsMock = vi.mocked(searchRuns); + +const emptyFilterFormSetWithoutId: FilterFormSetWithoutId = { + filterGroup: { + children: [], + conjunction: 'or', + kind: 'group', + }, + showArchived: false, +}; + +const setupTest = (props: Partial = {}) => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunFilterInterstitialModalComponent', () => { + beforeEach(() => { + searchRunsMock.mockRestore(); + }); + + it('does not call server until opened', () => { + const { ref } = setupTest(); + + expect(searchRunsMock).not.toBeCalled(); + act(() => { + ref.current?.open(); + }); + expect(searchRunsMock).toBeCalled(); + }); + + it('calls server with filter describing filter selection', () => { + const expectedFilterGroup: FilterFormSetWithoutId['filterGroup'] = { + children: [ + { + columnName: 'experimentName', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator: 'contains', + type: 'COLUMN_TYPE_TEXT', + value: 'foo', + }, + ], + conjunction: 'and', + kind: 'group', + }; + const expectedExclusions = [1, 2, 3]; + const { ref } = setupTest({ + filterFormSet: { + filterGroup: expectedFilterGroup, + showArchived: true, + }, + selection: { + exclusions: expectedExclusions, + type: 'ALL_EXCEPT', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + // TODO: is there a better way to test this expectation? + expect(filterFormSet.showArchived).toBeTruthy(); + const [filterGroup, idFilterGroup] = filterFormSet.filterGroup.children?.[0].children || []; + expect(filterGroup).toEqual(expectedFilterGroup); + + const idFilters = idFilterGroup.children; + expect(idFilters.every((f: FormField) => f.operator === '!=')).toBeTruthy(); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedExclusions); + }); + + it('calls server with filter describing visual selection', () => { + const expectedSelection = [1, 2, 3]; + const { ref } = setupTest({ + selection: { + selections: expectedSelection, + type: 'ONLY_IN', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + expect(filterFormSet.showArchived).toBe(false); + const idFilters = filterFormSet.filterGroup.children?.[0].children || []; + expect(idFilters.every((f: FormField) => f.operator === '=')).toBe(true); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedSelection); + }); + + it('cancels request when modal is closed via close button', async () => { + searchRunsMock.mockImplementation((_params, options) => { + return new Promise((_resolve, reject) => { + options?.signal?.addEventListener('abort', () => { + reject(); + }); + }); + }); + const { ref } = setupTest(); + // explicit type here because typescript can't infer that the act function + // runs imperatively. + let lifecycle: Promise | undefined; + // we don't await the act because we need the render pipeline to flush + // before we get the close reason back + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('close'); + }); + + it('closes modal with has_search_runs when it has runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 1, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('has_search_runs'); + }); + + it('closes modal with no_search_runs when it lacks runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 0, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('no_search_runs'); + }); + + it('closes modal with failed when request errors outside of aborts', async () => { + searchRunsMock.mockImplementation(() => Promise.reject(new Error('uh oh!'))); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('failed'); + }); +}); diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx new file mode 100644 index 00000000000..a117b74202e --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx @@ -0,0 +1,168 @@ +import { useModal } from 'hew/Modal'; +import { Failed, NotLoaded } from 'hew/utils/loadable'; +import { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react'; + +import { FilterFormSetWithoutId, Operator } from 'components/FilterForm/components/type'; +import InterstitialModalComponent, { + onInterstitialCloseActionType, +} from 'components/InterstitialModalComponent'; +import { SelectionType } from 'components/Searches/Searches.settings'; +import { useAsync } from 'hooks/useAsync'; +import { searchRuns } from 'services/api'; +import { DetError } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; +import { observable } from 'utils/observable'; + +export type CloseReason = 'has_search_runs' | 'no_search_runs' | 'failed' | 'close' | 'manual'; + +export interface Props { + projectId?: number; + selection: SelectionType; + filterFormSet: FilterFormSetWithoutId; +} + +export interface ControlledModalRef { + open: () => Promise; + close: (reason?: CloseReason) => void; +} + +/** + * Modal component for checking selections for runs that are part of a search. + * is essentially a single purpose interstitial modal component. Because it + * wraps a modal and the intended use is within a user flow, this component does + * not use the `useModal` hook. instead, it exposes control via ref. the `open` + * method of the ref returns a promise that resolves when the modal is closed + * with the reason why the modal closed. + * + */ +export const RunFilterInterstitialModalComponent = forwardRef( + ({ projectId, selection, filterFormSet }: Props, ref): JSX.Element => { + const InterstitialModal = useModal(InterstitialModalComponent); + const [isOpen, setIsOpen] = useState(false); + const closeController = useRef(new AbortController()); + const lifecycleObservable = useRef(observable(null)); + + const { close: internalClose, open: internalOpen } = InterstitialModal; + + const open = async () => { + internalOpen(); + setIsOpen(true); + const closeReason = await lifecycleObservable.current.toPromise(); + if (closeReason === null) { + // this promise should never reject -- toPromise only resolves when the + // value changes, and no code sets the observavble to null + return Promise.reject(); + } + return closeReason; + }; + + const close = useCallback( + (reason: CloseReason = 'manual') => { + setIsOpen(false); + // encourage render with isOpen to false before closing to prevent + // firing onCloseAction twice + setTimeout(() => internalClose('close'), 0); + closeController.current.abort(); + closeController.current = new AbortController(); + lifecycleObservable.current.set(reason); + lifecycleObservable.current = observable(null); + }, + [internalClose], + ); + + useImperativeHandle(ref, () => ({ close, open })); + + const selectionHasSearchRuns = useAsync( + async (canceler) => { + if (!isOpen) return NotLoaded; + const mergedCanceler = mergeAbortControllers(canceler, closeController.current); + const idToFilter = (operator: Operator, id: number) => + ({ + columnName: 'id', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator, + type: 'COLUMN_TYPE_NUMBER', + value: id, + }) as const; + const filterGroup: FilterFormSetWithoutId['filterGroup'] = + selection.type === 'ALL_EXCEPT' + ? { + children: [ + filterFormSet.filterGroup, + { + children: selection.exclusions.map(idToFilter.bind(this, '!=')), + conjunction: 'and', + kind: 'group', + }, + ], + conjunction: 'and', + kind: 'group', + } + : { + children: selection.selections.map(idToFilter.bind(this, '=')), + conjunction: 'or', + kind: 'group', + }; + const filter: FilterFormSetWithoutId = { + ...filterFormSet, + filterGroup: { + children: [ + filterGroup, + { + columnName: 'numTrials', + kind: 'field', + location: 'LOCATION_TYPE_EXPERIMENT', + operator: '>', + type: 'COLUMN_TYPE_NUMBER', + value: 1, + } as const, + ], + conjunction: 'and', + kind: 'group', + }, + }; + try { + const results = await searchRuns( + { + filter: JSON.stringify(filter), + limit: 0, + projectId, + }, + { signal: mergedCanceler.signal }, + ); + + return (results.pagination.total || 0) > 0; + } catch (e) { + if (!mergedCanceler.signal.aborted) { + return Failed(e instanceof Error ? e : new DetError(e)); + } + return NotLoaded; + } + }, + [selection, filterFormSet, projectId, isOpen], + ); + + const interstitialClose: onInterstitialCloseActionType = useCallback( + (reason) => { + if (reason === 'ok') { + return selectionHasSearchRuns.forEach((bool) => { + const fixedReason = bool ? 'has_search_runs' : 'no_search_runs'; + close(fixedReason); + }); + } + close(reason); + }, + [close, selectionHasSearchRuns], + ); + + return ( + + ); + }, +); + +export default RunFilterInterstitialModalComponent; diff --git a/webui/react/src/components/RunMoveWarningModalComponent.test.tsx b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx new file mode 100644 index 00000000000..8847538b527 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx @@ -0,0 +1,93 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { + CloseReason, + RunMoveWarningFlowRef, + RunMoveWarningModalComponent, +} from 'components/RunMoveWarningModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +const setupTest = () => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunMoveWarningModalComponent', () => { + it('is not shown until opened', () => { + const { ref } = setupTest(); + + expect(screen.queryByText('Move Run Dependency Alert')).toBeNull(); + act(() => { + ref.current?.open(); + }); + expect(screen.queryByText('Move Run Dependency Alert')).not.toBeNull(); + }); + + it('closes modal with cancel when closed with the x button', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with cancel when cancel button is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const cancelButton = await screen.findByText('Cancel'); + await userEvent.click(cancelButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with ok when submit is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const okayButton = await screen.findByText('Move independent runs'); + await userEvent.click(okayButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('ok'); + }); + + it('closes modal with manual when manually closed with no arg', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + act(() => { + ref.current?.close(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('manual'); + }); +}); diff --git a/webui/react/src/components/RunMoveWarningModalComponent.tsx b/webui/react/src/components/RunMoveWarningModalComponent.tsx new file mode 100644 index 00000000000..3a2d0086e20 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.tsx @@ -0,0 +1,54 @@ +import { Modal, useModal } from 'hew/Modal'; +import { observable, WritableObservable } from 'micro-observables'; +import { forwardRef, useImperativeHandle, useRef } from 'react'; + +export type CloseReason = 'ok' | 'cancel' | 'manual'; + +import handleError from 'utils/error'; + +type RunMoveWarningProps = { + onClose: (reason: 'ok' | 'cancel') => void; +}; +const RunMoveWarningCopy = ({ onClose }: RunMoveWarningProps) => ( + onClose('ok'), text: 'Move independent runs' }} + title="Move Run Dependency Alert" + onClose={() => onClose('cancel')}> + Some runs you are trying to move belong to a Hyperparameter Search and cannot be moved + independently to maintain their contextual relationships. These runs will be skipped. + +); + +export type RunMoveWarningFlowRef = { + open: () => Promise; + close: () => void; +}; + +export const RunMoveWarningModalComponent = forwardRef((_, ref) => { + const RunMoveWarning = useModal(RunMoveWarningCopy); + const closeReason = useRef>(observable(null)); + + const { close: internalClose, open: internalOpen } = RunMoveWarning; + + const open = async () => { + internalOpen(); + const reason = await closeReason.current.toPromise(); + if (reason === null) { + return Promise.reject(); + } + return reason; + }; + + const close = (reason: CloseReason = 'manual') => { + internalClose(reason); + closeReason.current.set(reason); + closeReason.current = observable(null); + }; + + useImperativeHandle(ref, () => ({ close, open })); + + return ; +}); + +export default RunMoveWarningModalComponent; diff --git a/webui/react/src/hooks/useTypedParams.test.tsx b/webui/react/src/hooks/useTypedParams.test.tsx index 054c5aecdb9..dadaf631d7e 100644 --- a/webui/react/src/hooks/useTypedParams.test.tsx +++ b/webui/react/src/hooks/useTypedParams.test.tsx @@ -174,8 +174,8 @@ describe('useTypedParams', () => { .afterEach(() => navSpy.mockClear()), ); }); - it('does not update if params are not changed', () => { - fc.assert( + it('does not update if params are not changed', async () => { + await fc.assert( fc .asyncProperty(sameArbPartial, async ([params, partial]) => { const { hookRef } = setupTest(params); diff --git a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx index e75b75c99c7..8f93518fb7c 100644 --- a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx +++ b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx @@ -16,6 +16,7 @@ import { readStream } from 'services/utils'; import { ExperimentBase, TrialDetails } from 'types'; import { downloadTrialLogs } from 'utils/browser'; import handleError, { ErrorType } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; import css from './TrialDetailsLogs.module.scss'; @@ -26,20 +27,6 @@ export interface Props { type OrderBy = 'ORDER_BY_UNSPECIFIED' | 'ORDER_BY_ASC' | 'ORDER_BY_DESC'; -const mergeAbortControllers = (...controllers: AbortController[]) => { - const mergedController = new AbortController(); - - controllers.forEach((c) => { - const abort = () => { - mergedController.abort(); - c.signal.removeEventListener('abort', abort); - }; - c.signal.addEventListener('abort', abort); - }); - - return mergedController; -}; - const TrialDetailsLogs: React.FC = ({ experiment, trial }: Props) => { const { ui } = useUI(); const [filterOptions, setFilterOptions] = useState({}); diff --git a/webui/react/src/setupTests.ts b/webui/react/src/setupTests.ts index fe8c871c9f7..b8b22e32f0b 100644 --- a/webui/react/src/setupTests.ts +++ b/webui/react/src/setupTests.ts @@ -6,20 +6,23 @@ */ import '@testing-library/jest-dom/extend-expect'; import 'micro-observables/batchingForReactDom'; -import 'utils/prototypes'; import 'whatwg-fetch'; import Schema from 'async-validator'; -import { noOp } from 'utils/service'; +// this code doesn't work in node environments +if (globalThis.window) { + await import('utils/prototypes'); + const { noOp } = await import('utils/service'); -/** - * To clean up the async-validator console warning that get generated during testing. - * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning - */ -Schema.warning = noOp; + /** + * To clean up the async-validator console warning that get generated during testing. + * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning + */ + Schema.warning = noOp; +} -Object.defineProperty(window, 'matchMedia', { +Object.defineProperty(globalThis, 'matchMedia', { value: () => ({ addEventListener: vi.fn(), addListener: vi.fn(), // deprecated diff --git a/webui/react/src/utils/mergeAbortControllers.test.ts b/webui/react/src/utils/mergeAbortControllers.test.ts new file mode 100644 index 00000000000..51308bac61f --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.test.ts @@ -0,0 +1,87 @@ +// @vitest-environment node +// we're using node because the jsdom version of the abortcontroller doesn't have reasons on abortsignals +import fc from 'fast-check'; +import { zip } from 'lodash'; + +import { mergeAbortControllers } from 'utils/mergeAbortControllers'; + +// arbitrary to generate a list of abort controllers to pass to mergeAbortControllers +const argArb = fc.uniqueArray( + fc.constant(() => new AbortController()).map((f) => f()), + { minLength: 1 }, +); + +// return a subset of the above to control +const argArbWithSelection = (n?: number) => + argArb.chain((arr) => + fc.tuple(fc.constant(arr), fc.shuffledSubarray(arr, { maxLength: n, minLength: 1 })), + ); + +// the above, but the subset from the above returns with unique reason values to +// verify which abortController was the first to abort +const argArbWithSelectionAndReasons = (n?: number) => + argArbWithSelection(n).chain(([args, selection]) => { + const reasonsArb = fc.uniqueArray(fc.anything(), { + maxLength: selection.length, + minLength: selection.length, + }); + const selectionAndReasonArb = reasonsArb + .map((reasons) => zip(selection, reasons)) + .filter((tups): tups is [AbortController, unknown][] => + tups.every((tup) => tup.every((c) => c !== undefined)), + ); + + return fc.tuple(fc.constant(args), selectionAndReasonArb); + }); + +describe('mergeAbortControllers', () => { + it('merged abort controller aborts if any constituent aborts', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(); + expect(result.signal.aborted).toBe(true); + }), + ); + }); + it('merged abort controller aborts with constituent reason', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(1), ([args, abortControllers]) => { + const [[abortController, reason]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(reason); + expect(abortController.signal.reason).toBe(reason); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); + it('merged abort controller only reflects the first abort', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(), ([args, abortControllers]) => { + const [[firstAbortController]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortControllers.forEach(([abortController, reason]) => { + abortController.abort(reason); + }); + expect(result.signal.reason).toBe(firstAbortController.signal.reason); + }), + ); + }); + + it('merging an aborted controller results in an aborted controller', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + abortController.abort(); + const result = mergeAbortControllers(...args); + + expect(result.signal.aborted).toBe(true); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); +}); diff --git a/webui/react/src/utils/mergeAbortControllers.ts b/webui/react/src/utils/mergeAbortControllers.ts new file mode 100644 index 00000000000..98004fe3100 --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.ts @@ -0,0 +1,20 @@ +export const mergeAbortControllers = (...controllers: AbortController[]): AbortController => { + const mergedController = new AbortController(); + + controllers.forEach((c) => { + // resulting controller is aborted, just ignore the rest + if (mergedController.signal.aborted) return; + // preemptively abort if the signal's already aborted + if (c.signal.aborted) return mergedController.abort(c.signal.reason); + + const abort = () => { + mergedController.abort(c.signal.reason); + c.signal.removeEventListener('abort', abort); + }; + c.signal.addEventListener('abort', abort); + }); + + return mergedController; +}; + +export default mergeAbortControllers; From d92a990c658ff8301fc0877dcdffaac7c7b55ffa Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 11:02:29 -0700 Subject: [PATCH 057/161] chore: feedback --- .../pages/FlatRuns/FlatRunActionButton.test.tsx | 15 ++------------- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 10 +++++----- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 9a9b1ba7aeb..166fcd77d1b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -3,25 +3,14 @@ import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; -import { FlatRun, Project, RunState, WorkspaceState } from 'types'; +import { FlatRun, RunState } from 'types'; const setup = (selectedFlatRuns: ReadonlyArray>) => { - const project: Readonly = { - archived: false, - id: 1, - immutable: false, - name: 'proj', - notes: [], - state: WorkspaceState.Unspecified, - userId: 1, - workspaceId: 1, - }; - render( diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index a1a650b836a..e78658dcefa 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -8,7 +8,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; -import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; @@ -40,7 +40,7 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; - project: Readonly; + projectId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -48,7 +48,7 @@ interface Props { const FlatRunActionButton = ({ isMobile, selectedRuns, - project, + projectId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { @@ -63,7 +63,7 @@ const FlatRunActionButton = ({ .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { - projectId: project.id, + projectId, runIds: validRunIds, }; switch (action) { @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [project.id, selectedRuns], + [projectId, selectedRuns], ); const submitBatchAction = useCallback( diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 8425c37b528..460bc0b5ad2 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -947,7 +947,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { /> From dd8017048d67baaf39a4a44254654eb972b27984 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 16:11:38 -0700 Subject: [PATCH 058/161] feat: basic move action --- .../FlatRuns/FlatRunActionButton.test.tsx | 1 + .../pages/FlatRuns/FlatRunActionButton.tsx | 19 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 194 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 4 +- webui/react/src/pages/ProjectDetails.tsx | 2 +- webui/react/src/pages/SearchDetails.tsx | 6 +- webui/react/src/services/api.ts | 8 +- webui/react/src/services/apiConfig.ts | 8 +- 8 files changed, 227 insertions(+), 15 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 166fcd77d1b..25beefaa41e 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -12,6 +12,7 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { isMobile={false} projectId={1} selectedRuns={selectedFlatRuns} + workspaceId={1} onActionComplete={vi.fn()} /> , diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index e78658dcefa..b3929b0ae00 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -7,6 +7,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; +import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; @@ -14,24 +15,20 @@ import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; const BATCH_ACTIONS = [ - // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; type BatchAction = (typeof BATCH_ACTIONS)[number]; const ACTION_ICONS: Record = { - // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', [ExperimentAction.Kill]: 'cancelled', - // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -41,6 +38,7 @@ interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; projectId: number; + workspaceId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -49,12 +47,15 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + workspaceId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); const permissions = usePermissions(); const { openToast } = useToast(); + const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = + useModal(FlatRunMoveModalComponent); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( @@ -68,8 +69,7 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - break; + return flatRunMoveModalOpen(); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [projectId, selectedRuns], + [flatRunMoveModalOpen, projectId, selectedRuns], ); const submitBatchAction = useCallback( @@ -194,6 +194,11 @@ const FlatRunActionButton = ({ onConfirm={() => submitBatchAction(batchAction)} /> )} + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx new file mode 100644 index 00000000000..87d449e6bb8 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -0,0 +1,194 @@ +import Form from 'hew/Form'; +import Icon from 'hew/Icon'; +import { Modal } from 'hew/Modal'; +import Select, { Option } from 'hew/Select'; +import Spinner from 'hew/Spinner'; +import { useToast } from 'hew/Toast'; +import { Label } from 'hew/Typography'; +import { Loadable } from 'hew/utils/loadable'; +import { List } from 'immutable'; +import { useObservable } from 'micro-observables'; +import React, { useEffect, useId } from 'react'; + +import Link from 'components/Link'; +import usePermissions from 'hooks/usePermissions'; +import { paths } from 'routes/utils'; +import { moveRuns } from 'services/api'; +import projectStore from 'stores/projects'; +import workspaceStore from 'stores/workspaces'; +import { FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { pluralizer } from 'utils/string'; + +const FORM_ID = 'move-flat-run-form'; + +type FormInputs = { + projectId?: number; + workspaceId?: number; +}; + +interface Props { + flatRuns: Readonly[]; + onSubmit?: (successfulIds?: number[]) => void; + sourceProjectId: number; + sourceWorkspaceId?: number; +} + +const FlatRunMoveModalComponent: React.FC = ({ + flatRuns, + onSubmit, + sourceProjectId, + sourceWorkspaceId, +}: Props) => { + const idPrefix = useId(); + const { openToast } = useToast(); + const [form] = Form.useForm(); + const workspaceId = Form.useWatch('workspaceId', form); + const projectId = Form.useWatch('projectId', form); + + const { canMoveExperimentsTo } = usePermissions(); + const workspaces = Loadable.getOrElse([], useObservable(workspaceStore.unarchived)).filter((w) => + canMoveExperimentsTo({ destination: { id: w.id } }), + ); + const loadableProjects: Loadable> = useObservable( + projectStore.getProjectsByWorkspace(workspaceId), + ); + + useEffect(() => { + if (workspaceId !== undefined) { + projectStore.fetch(workspaceId, undefined, true); + } + }, [workspaceId]); + + const handleSubmit = async () => { + if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { + openToast({ title: 'No changes to save.' }); + return; + } + const values = await form.validateFields(); + const projId = values.projectId ?? 1; + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); + + onSubmit?.(results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + }; + + return ( + +
+ + + + {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} +
+
+ ); +}; + +export default FlatRunMoveModalComponent; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 460bc0b5ad2..ec09bb43108 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -100,6 +100,7 @@ const formStore = new FilterFormStore(); interface Props { projectId: number; + workspaceId: number; searchId?: number; } @@ -118,7 +119,7 @@ const parseSortString = (sortString: string): Sort[] => { }); }; -const FlatRuns: React.FC = ({ projectId, searchId }) => { +const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const dataGridRef = useRef(null); const contentRef = useRef(null); const [searchParams, setSearchParams] = useSearchParams(); @@ -949,6 +950,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} projectId={projectId} selectedRuns={selectedRuns} + workspaceId={workspaceId} onActionComplete={onActionComplete} /> diff --git a/webui/react/src/pages/ProjectDetails.tsx b/webui/react/src/pages/ProjectDetails.tsx index 3274b4f5d7f..de9e15815f1 100644 --- a/webui/react/src/pages/ProjectDetails.tsx +++ b/webui/react/src/pages/ProjectDetails.tsx @@ -94,7 +94,7 @@ const ProjectDetails: React.FC = () => { children: (
- +
), diff --git a/webui/react/src/pages/SearchDetails.tsx b/webui/react/src/pages/SearchDetails.tsx index 369003a4c2e..f9a66783f1e 100644 --- a/webui/react/src/pages/SearchDetails.tsx +++ b/webui/react/src/pages/SearchDetails.tsx @@ -138,7 +138,11 @@ const SearchDetails: React.FC = () => { const tabItems: PivotProps['items'] = [ { children: experiment?.projectId && ( - + ), key: TabType.Trials, label: 'Trials', diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 39acbb16325..561101669bf 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -771,9 +771,11 @@ export const killRuns = generateDetApi( - Config.moveRuns, -); +export const moveRuns = generateDetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +>(Config.moveRuns); export const unarchiveRuns = generateDetApi< Api.V1UnarchiveRunsRequest, diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index b782ac8f284..fd92b846f39 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1170,9 +1170,13 @@ export const killRuns: DetApi detApi.Internal.killRuns(params, options), }; -export const moveRuns: DetApi = { +export const moveRuns: DetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +> = { name: 'moveRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.moveRuns(params, options), }; From 39be2e6838892ddb5ca1281a97c0df7780633859 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 17:13:24 -0700 Subject: [PATCH 059/161] feat: move warning modal --- .../FilterForm/components/FilterFormStore.ts | 21 ++ .../FlatRuns/FlatRunActionButton.test.tsx | 5 + .../pages/FlatRuns/FlatRunActionButton.tsx | 8 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 286 +++++++++++------- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 + 5 files changed, 206 insertions(+), 116 deletions(-) diff --git a/webui/react/src/components/FilterForm/components/FilterFormStore.ts b/webui/react/src/components/FilterForm/components/FilterFormStore.ts index b04658d53f0..e27c7c457b4 100644 --- a/webui/react/src/components/FilterForm/components/FilterFormStore.ts +++ b/webui/react/src/components/FilterForm/components/FilterFormStore.ts @@ -74,6 +74,27 @@ export class FilterFormStore { ); } + public get filterFormSetWithoutId(): Observable { + const replacer = (key: string, value: unknown): unknown => { + return key === 'id' ? undefined : value; + }; + return this.#formset.select((loadableFormset) => + Loadable.match(loadableFormset, { + _: () => ({ + filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, + showArchived: true, + }), + Loaded: (formset) => { + const sweepedForm = this.#sweepInvalid(structuredClone(formset.filterGroup)); + const newFormSet: FilterFormSetWithoutId = JSON.parse( + JSON.stringify({ ...formset, filterGroup: sweepedForm }, replacer), + ); + return newFormSet; + }, + }), + ); + } + public get fieldCount(): Observable { return this.getFieldCount(); } diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 25beefaa41e..b02bfaf216d 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Conjunction, FormKind } from 'components/FilterForm/components/type'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; @@ -9,6 +10,10 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { render( >; projectId: number; workspaceId: number; + filterFormSetWithoutId: FilterFormSetWithoutId; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -47,6 +49,7 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + filterFormSetWithoutId, workspaceId, onActionSuccess, onActionComplete, @@ -69,7 +72,8 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - return flatRunMoveModalOpen(); + flatRunMoveModalOpen(); + break; case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -195,9 +199,11 @@ const FlatRunActionButton = ({ /> )} ); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 87d449e6bb8..1c6c5ebc3de 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -8,9 +8,16 @@ import { Label } from 'hew/Typography'; import { Loadable } from 'hew/utils/loadable'; import { List } from 'immutable'; import { useObservable } from 'micro-observables'; -import React, { useEffect, useId } from 'react'; +import React, { Ref, useCallback, useEffect, useId, useRef } from 'react'; +import { FilterFormSetWithoutId } from 'components/FilterForm/components/type'; import Link from 'components/Link'; +import RunFilterInterstitialModalComponent, { + ControlledModalRef, +} from 'components/RunFilterInterstitialModalComponent'; +import RunMoveWarningModalComponent, { + RunMoveWarningFlowRef, +} from 'components/RunMoveWarningModalComponent'; import usePermissions from 'hooks/usePermissions'; import { paths } from 'routes/utils'; import { moveRuns } from 'services/api'; @@ -29,17 +36,23 @@ type FormInputs = { interface Props { flatRuns: Readonly[]; - onSubmit?: (successfulIds?: number[]) => void; sourceProjectId: number; sourceWorkspaceId?: number; + filterFormSetWithoutId: FilterFormSetWithoutId; + onSubmit?: (successfulIds?: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunMoveModalComponent: React.FC = ({ flatRuns, - onSubmit, + filterFormSetWithoutId, sourceProjectId, sourceWorkspaceId, + onSubmit, + onActionComplete, }: Props) => { + const controlledModalRef: Ref = useRef(null); + const runMoveWarningFlowRef: Ref = useRef(null); const idPrefix = useId(); const { openToast } = useToast(); const [form] = Form.useForm(); @@ -60,7 +73,7 @@ const FlatRunMoveModalComponent: React.FC = ({ } }, [workspaceId]); - const handleSubmit = async () => { + const handleSubmit = useCallback(async () => { if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { openToast({ title: 'No changes to save.' }); return; @@ -68,126 +81,169 @@ const FlatRunMoveModalComponent: React.FC = ({ const values = await form.validateFields(); const projId = values.projectId ?? 1; - const results = await moveRuns({ - destinationProjectId: projId, - runIds: flatRuns.map((flatRun) => flatRun.id), - sourceProjectId, - }); + try { + const closeReason = (await controlledModalRef.current?.open()) ?? 'failed'; + switch (closeReason) { + case 'has_search_runs': { + const closeWarningReason = await runMoveWarningFlowRef.current?.open(); + if (closeWarningReason === 'cancel') { + openToast({ title: 'Cancelled Move Action' }); + return; + } + break; + } + case 'no_search_runs': + break; + case 'manual': + case 'failed': + case 'close': + openToast({ title: 'Cancelled Move Action' }); + return; + } + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); - onSubmit?.(results.successful); + onSubmit?.(results.successful); - const numSuccesses = results.successful.length; - const numFailures = results.failed.length; + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; - const destinationProjectName = - Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? - ''; + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; - if (numSuccesses === 0 && numFailures === 0) { - openToast({ - description: 'No selected runs were eligible for moving', - title: 'No eligible runs', - }); - } else if (numFailures === 0) { - openToast({ - closeable: true, - description: `${results.successful.length} runs moved to project ${destinationProjectName}`, - link: View Project, - title: 'Move Success', - }); - } else if (numSuccesses === 0) { - openToast({ - description: `Unable to move ${numFailures} runs`, - severity: 'Warning', - title: 'Move Failure', - }); - } else { - openToast({ - closeable: true, - description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, - link: View Project, - severity: 'Warning', - title: 'Partial Move Failure', - }); + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + await onActionComplete?.(); + } catch (e) { + handleError(e, { publicSubject: 'Unable to move runs' }); } - form.resetFields(); - }; + }, [ + flatRuns, + form, + loadableProjects, + onActionComplete, + onSubmit, + openToast, + projectId, + sourceProjectId, + sourceWorkspaceId, + workspaceId, + ]); return ( - -
- - - - {workspaceId && workspaceId !== 1 && ( + <> + + - {Loadable.match(loadableProjects, { - Failed: () =>
Failed to load
, - Loaded: (loadableProjects) => ( - - ), - NotLoaded: () => , - })} + initialValue={sourceWorkspaceId ?? 1} + label="Workspace" + name="workspaceId" + rules={[{ message: 'Workspace is required', required: true }]}> +
- )} - -
+ {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} + +
+ + flatRun.id), type: 'ONLY_IN' }} + /> + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ec09bb43108..75f2c381925 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -162,6 +162,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const sortString = useMemo(() => makeSortString(sorts.filter(validSort.is)), [sorts]); const loadableFormset = useObservable(formStore.formset); const filtersString = useObservable(formStore.asJsonString); + const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [total, setTotal] = useState>(NotLoaded); const isMobile = useMobile(); const [isLoading, setIsLoading] = useState(true); @@ -947,6 +948,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { onRowHeightChange={onRowHeightChange} /> Date: Wed, 5 Jun 2024 15:39:12 -0700 Subject: [PATCH 060/161] fix: feedback --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 1c6c5ebc3de..5acbd0f3b68 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -40,7 +40,7 @@ interface Props { sourceWorkspaceId?: number; filterFormSetWithoutId: FilterFormSetWithoutId; onSubmit?: (successfulIds?: number[]) => void; - onActionComplete?: () => Promise; + onActionComplete?: () => void; } const FlatRunMoveModalComponent: React.FC = ({ From 8e5679d96f790680e0e83bd714ec88f32ba22a35 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 5 Jun 2024 15:42:35 -0700 Subject: [PATCH 061/161] fix: unarchive behavior --- master/internal/api_runs.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index ead375b705b..767fcaf2791 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -33,6 +33,7 @@ import ( type runCandidateResult struct { Archived bool + ExpArchived bool ID int32 ExpID *int32 IsMultitrial bool @@ -139,7 +140,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived OR e.archived AS archived"). + ColumnExpr("r.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). @@ -692,6 +693,7 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, Model(&runCandidates). Column("r.id"). Column("r.archived"). + ColumnExpr("e.archived AS exp_archived"). ColumnExpr("r.experiment_id as exp_id"). ColumnExpr("false as is_multitrial"). ColumnExpr("r.state IN (?) AS is_terminal", bun.In(model.StatesToStrings(model.TerminalStates))). @@ -727,6 +729,11 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, for _, cand := range runCandidates { visibleIDs.Insert(cand.ID) switch { + case cand.ExpArchived: + results = append(results, &apiv1.RunActionResult{ + Error: "Parent is archived.", + Id: cand.ID, + }) case cand.Archived && archive: results = append(results, &apiv1.RunActionResult{ Error: "", From ff27abcf2466410b9a66d64ff63f14f1d24f0b2b Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 5 Jun 2024 16:01:54 -0700 Subject: [PATCH 062/161] fix: minor fixes --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 5acbd0f3b68..b7715a5452b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -205,7 +205,6 @@ const FlatRunMoveModalComponent: React.FC = ({
{workspaceId && workspaceId !== 1 && ( From f32488b4e2bb88b3f26bbe029adaa8936ed5629e Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 6 Jun 2024 22:53:33 -0700 Subject: [PATCH 063/161] fix: archive/unarchive error text fix --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 767fcaf2791..21439127136 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -731,7 +731,7 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, switch { case cand.ExpArchived: results = append(results, &apiv1.RunActionResult{ - Error: "Parent is archived.", + Error: "Run is part of archived Search.", Id: cand.ID, }) case cand.Archived && archive: From 4e1a32509f93e8fd886e7074f800704e0de54efe Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 01:03:31 -0700 Subject: [PATCH 064/161] test: `FlatRunMoveModal` --- .../FlatRuns/FlatRunActionButton.test.tsx | 51 +++++++--- .../pages/FlatRuns/FlatRunMoveModal.test.tsx | 98 +++++++++++++++++++ 2 files changed, 133 insertions(+), 16 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index b02bfaf216d..bf62f069710 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -1,4 +1,5 @@ import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; @@ -7,6 +8,8 @@ import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; const setup = (selectedFlatRuns: ReadonlyArray>) => { + const user = userEvent.setup(); + render( >) => { /> , ); + + return { + user, + }; }; describe('canActionFlatRun function', () => { describe('Flat Run Action Button Visibility', () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + it('should not be appeard without selected flat runs', () => { setup([]); expect(screen.queryByText('Actions')).not.toBeInTheDocument(); }); it('should be appeard with selected flat runs', async () => { - const flatRuns: ReadonlyArray> = [ - { - archived: false, - checkpointCount: 0, - checkpointSize: 0, - id: 1, - parentArchived: false, - projectId: 1, - projectName: 'test', - startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), - state: RunState.Active, - workspaceId: 10, - workspaceName: 'test', - }, - ]; - setup(flatRuns); expect(await screen.findByText('Actions')).toBeInTheDocument(); }); + + it('should show action list', async () => { + const { user } = setup(flatRuns); + + const actionButton = await screen.findByText('Actions'); + await user.click(actionButton); + expect(await screen.findByText('Move')).toBeInTheDocument(); + expect(await screen.findByText('Archive')).toBeInTheDocument(); + expect(await screen.findByText('Unarchive')).toBeInTheDocument(); + expect(await screen.findByText('Delete')).toBeInTheDocument(); + expect(await screen.findByText('Kill')).toBeInTheDocument(); + }); }); }); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx new file mode 100644 index 00000000000..d9b48dee593 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx @@ -0,0 +1,98 @@ +import { render, screen } from '@testing-library/react'; +import userEvent, { UserEvent } from '@testing-library/user-event'; +import dayjs from 'dayjs'; +import Button from 'hew/Button'; +import { useModal } from 'hew/Modal'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { useMemo } from 'react'; + +import { + Conjunction, + FilterFormSetWithoutId, + FormKind, +} from 'components/FilterForm/components/type'; +import { V1MoveRunsRequest } from 'services/api-ts-sdk'; +import { FlatRun, RunState } from 'types'; + +import FlatRunMoveModalComponent from './FlatRunMoveModal'; + +const OPEN_MODAL_TEXT = 'Open Modal'; + +vi.mock('services/api', () => ({ + createGroup: vi.fn(), + getWorkspaceProjects: vi.fn(() => + Promise.resolve({ projects: [{ id: 1, name: 'project_1', workspaceId: 1 }] }), + ), + moveRuns: (params: V1MoveRunsRequest) => { + return Promise.resolve({ + failed: [], + successful: params.runIds, + }); + }, +})); + +const Container = (): JSX.Element => { + const BASE_FLAT_RUNS: FlatRun[] = useMemo(() => { + return [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + }, []); + + const filterFormSetWithoutId: FilterFormSetWithoutId = useMemo(() => { + return { + filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, + showArchived: false, + }; + }, []); + + const flatRunMoveModal = useModal(FlatRunMoveModalComponent); + + return ( +
+ + +
+ ); +}; + +const setup = (): { user: UserEvent } => { + const user = userEvent.setup(); + + render( + + + , + ); + + return { + user, + }; +}; + +describe('FlatRunMoveModalComponent', () => { + it('should open modal', async () => { + const { user } = setup(); + + await user.click(screen.getByRole('button', { name: OPEN_MODAL_TEXT })); + expect((await screen.findAllByText('Move Runs')).length).toBe(2); + expect(await screen.findByText('Workspace')).toBeInTheDocument(); + expect(await screen.findByRole('button', { name: 'Cancel' })).toBeInTheDocument(); + expect(await screen.findByRole('button', { name: 'Move Runs' })).toBeInTheDocument(); + }); +}); From 8acd0a1033d9d3d01d6a9ca90540269dd59c4b9d Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 11:37:40 -0700 Subject: [PATCH 065/161] test: ignore `bindings.py` for codecov --- codecov.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/codecov.yml b/codecov.yml index d1fd2e00b0e..5d293f5f733 100644 --- a/codecov.yml +++ b/codecov.yml @@ -12,16 +12,16 @@ coverage: backend: target: 42% threshold: 3% - flags: + flags: - backend informational: false - patch: + patch: default: informational: true - backend: + backend: target: 80% threshold: 5% - flags: + flags: - backend informational: false only_pulls: true @@ -29,14 +29,17 @@ coverage: flags: backend: carryforward: true - + github_checks: annotations: false -comment: +comment: layout: "diff, flags, files" behavior: default parsers: go: partials_as_hits: true + +ignore: + - "harness/determined/common/api/bindings.py" From 63fd58daece4cbf1181bce300815cf4e78839ccc Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 12:48:12 -0700 Subject: [PATCH 066/161] test: backend test --- master/internal/api_runs_intg_test.go | 74 +++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/master/internal/api_runs_intg_test.go b/master/internal/api_runs_intg_test.go index 15b7745e4ee..3fcd9ca359b 100644 --- a/master/internal/api_runs_intg_test.go +++ b/master/internal/api_runs_intg_test.go @@ -18,6 +18,7 @@ import ( "github.com/determined-ai/determined/master/pkg/model" "github.com/determined-ai/determined/master/pkg/ptrs" "github.com/determined-ai/determined/master/pkg/schemas" + "github.com/determined-ai/determined/master/pkg/schemas/expconf" "github.com/determined-ai/determined/proto/pkg/apiv1" "github.com/determined-ai/determined/proto/pkg/taskv1" ) @@ -1099,3 +1100,76 @@ func TestArchiveUnarchiveNoInput(t *testing.T) { require.NoError(t, err) require.Empty(t, unarchRes.Results) } + +func TestArchiveUnarchiveWithArchivedParent(t *testing.T) { + api, curUser, ctx := setupAPITest(t, nil) + _, projectID := createProjectAndWorkspace(ctx, t, api) + + activeConfig := schemas.WithDefaults(schemas.Merge(minExpConfig, expconf.ExperimentConfig{ + RawDescription: ptrs.Ptr("desc"), + RawName: expconf.Name{RawString: ptrs.Ptr("name")}, + })) + + exp := &model.Experiment{ + JobID: model.JobID(uuid.New().String()), + State: model.CompletedState, + OwnerID: &curUser.ID, + ProjectID: projectID, + StartTime: time.Now(), + Config: activeConfig.AsLegacy(), + } + require.NoError(t, api.m.db.AddExperiment(exp, []byte{10, 11, 12}, activeConfig)) + + task1 := &model.Task{TaskType: model.TaskTypeTrial, TaskID: model.NewTaskID()} + require.NoError(t, db.AddTask(ctx, task1)) + require.NoError(t, db.AddTrial(ctx, &model.Trial{ + State: model.CompletedState, + ExperimentID: exp.ID, + StartTime: time.Now(), + }, task1.TaskID)) + + task2 := &model.Task{TaskType: model.TaskTypeTrial, TaskID: model.NewTaskID()} + require.NoError(t, db.AddTask(ctx, task2)) + require.NoError(t, db.AddTrial(ctx, &model.Trial{ + State: model.CompletedState, + ExperimentID: exp.ID, + StartTime: time.Now(), + }, task2.TaskID)) + + sourceprojectID := int32(projectID) + req := &apiv1.SearchRunsRequest{ + ProjectId: &sourceprojectID, + Sort: ptrs.Ptr("id=asc"), + } + + resp, err := api.SearchRuns(ctx, req) + require.NoError(t, err) + require.Len(t, resp.Runs, 2) + + runID1, runID2 := resp.Runs[0].Id, resp.Runs[1].Id + + // Set the parent experiment as archived + _, err = api.ArchiveExperiment(ctx, &apiv1.ArchiveExperimentRequest{Id: int32(exp.ID)}) + require.NoError(t, err) + + runIDs := []int32{runID1, runID2} + unarchRes, err := api.ArchiveRuns(ctx, &apiv1.ArchiveRunsRequest{ + RunIds: runIDs, + ProjectId: sourceprojectID, + }) + + errMsg := "Run is part of archived Search." + require.NoError(t, err) + require.Len(t, unarchRes.Results, 2) + require.Equal(t, errMsg, unarchRes.Results[0].Error) + require.Equal(t, errMsg, unarchRes.Results[1].Error) + + _, err = api.UnarchiveRuns(ctx, &apiv1.UnarchiveRunsRequest{ + RunIds: runIDs, + ProjectId: sourceprojectID, + }) + require.NoError(t, err) + require.Len(t, unarchRes.Results, 2) + require.Equal(t, errMsg, unarchRes.Results[0].Error) + require.Equal(t, errMsg, unarchRes.Results[1].Error) +} From ce5817bdb302bbd282d865e49ce36e81552942ad Mon Sep 17 00:00:00 2001 From: John Kim Date: Mon, 10 Jun 2024 11:34:56 -0400 Subject: [PATCH 067/161] fixes --- .../components/ExperimentActionDropdown.tsx | 91 ++++++++++--------- .../RunActionDropdown.test.mock.tsx | 6 +- .../src/components/RunActionDropdown.test.tsx | 5 +- .../src/components/RunActionDropdown.tsx | 77 +++++++++------- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 60 +++++++++++- webui/react/src/pages/FlatRuns/columns.ts | 2 +- webui/react/src/routes/utils.ts | 8 +- 7 files changed, 158 insertions(+), 91 deletions(-) diff --git a/webui/react/src/components/ExperimentActionDropdown.tsx b/webui/react/src/components/ExperimentActionDropdown.tsx index bcfe8256de9..327b48ef8b8 100644 --- a/webui/react/src/components/ExperimentActionDropdown.tsx +++ b/webui/react/src/components/ExperimentActionDropdown.tsx @@ -8,7 +8,8 @@ import { useToast } from 'hew/Toast'; import useConfirm from 'hew/useConfirm'; import { copyToClipboard } from 'hew/utils/functions'; import { Failed, Loadable, Loaded, NotLoaded } from 'hew/utils/loadable'; -import React, { MouseEvent, useCallback, useMemo, useRef, useState } from 'react'; +import { isString } from 'lodash'; +import React, { useCallback, useMemo, useRef, useState } from 'react'; import css from 'components/ActionDropdown/ActionDropdown.module.scss'; import ExperimentEditModalComponent from 'components/ExperimentEditModal'; @@ -92,7 +93,6 @@ const ExperimentActionDropdown: React.FC = ({ onVisibleChange, children, }: Props) => { - const id = experiment.id; const ExperimentEditModal = useModal(ExperimentEditModalComponent); const ExperimentMoveModal = useModal(ExperimentMoveModalComponent); const ExperimentRetainLogsModal = useModal(ExperimentRetainLogsModalComponent); @@ -147,18 +147,18 @@ const ExperimentActionDropdown: React.FC = ({ const handleEditComplete = useCallback( (data: Partial) => { - onComplete?.(ExperimentAction.Edit, id, data); + onComplete?.(ExperimentAction.Edit, experiment.id, data); }, - [id, onComplete], + [experiment.id, onComplete], ); const handleMoveComplete = useCallback(() => { - onComplete?.(ExperimentAction.Move, id); - }, [id, onComplete]); + onComplete?.(ExperimentAction.Move, experiment.id); + }, [experiment.id, onComplete]); const handleRetainLogsComplete = useCallback(() => { - onComplete?.(ExperimentAction.RetainLogs, id); - }, [id, onComplete]); + onComplete?.(ExperimentAction.RetainLogs, experiment.id); + }, [experiment.id, onComplete]); const menuItems = getActionsForExperiment(experiment, dropdownActions, usePermissions()) .filter((action) => action !== Action.SwitchPin) @@ -166,49 +166,59 @@ const ExperimentActionDropdown: React.FC = ({ return { danger: action === Action.Delete, key: action, label: action }; }); - const dropdownMenu = useMemo(() => { - const items: MenuItem[] = [...menuItems]; - /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ - if (cell && (cell.copyData || (cell as any).displayData)) { - items.unshift({ key: Action.Copy, label: Action.Copy }); + const cellCopyData = useMemo(() => { + if (cell) { + if ('displayData' in cell && isString(cell.displayData)) { + return cell.displayData; + } + if (cell.copyData) return cell.copyData; } + return undefined; + }, [cell]); + + const dropdownMenu = useMemo(() => { + const items: MenuItem[] = []; if (link) { - items.unshift( + items.push( { key: Action.NewTab, label: Action.NewTab }, { key: Action.NewWindow, label: Action.NewWindow }, { type: 'divider' }, ); } + if (cellCopyData) { + items.push({ key: Action.Copy, label: Action.Copy }); + } + items.push(...menuItems); return items; - }, [link, menuItems, cell]); + }, [link, menuItems, cellCopyData]); const handleDropdown = useCallback( async (action: string, e: DropdownEvent) => { try { switch (action) { case Action.NewTab: - handlePath(e as MouseEvent, { path: link, popout: 'tab' }); + handlePath(e, { path: link, popout: 'tab' }); await onLink?.(); break; case Action.NewWindow: - handlePath(e as MouseEvent, { path: link, popout: 'window' }); + handlePath(e, { path: link, popout: 'window' }); await onLink?.(); break; case Action.Activate: - await activateExperiment({ experimentId: id }); - await onComplete?.(action, id); + await activateExperiment({ experimentId: experiment.id }); + await onComplete?.(action, experiment.id); break; case Action.Archive: - await archiveExperiment({ experimentId: id }); - await onComplete?.(action, id); + await archiveExperiment({ experimentId: experiment.id }); + await onComplete?.(action, experiment.id); break; case Action.Cancel: - await cancelExperiment({ experimentId: id }); - await onComplete?.(action, id); + await cancelExperiment({ experimentId: experiment.id }); + await onComplete?.(action, experiment.id); break; case Action.OpenTensorBoard: { const commandResponse = await openOrCreateTensorBoard({ - experimentIds: [id], + experimentIds: [experiment.id], workspaceId: experiment.workspaceId, }); openCommandResponse(commandResponse); @@ -237,33 +247,33 @@ const ExperimentActionDropdown: React.FC = ({ } case Action.Kill: confirm({ - content: `Are you sure you want to kill experiment ${id}?`, + content: `Are you sure you want to kill experiment ${experiment.id}?`, danger: true, okText: 'Kill', onConfirm: async () => { - await killExperiment({ experimentId: id }); - await onComplete?.(action, id); + await killExperiment({ experimentId: experiment.id }); + await onComplete?.(action, experiment.id); }, onError: handleError, title: 'Confirm Experiment Kill', }); break; case Action.Pause: - await pauseExperiment({ experimentId: id }); - await onComplete?.(action, id); + await pauseExperiment({ experimentId: experiment.id }); + await onComplete?.(action, experiment.id); break; case Action.Unarchive: - await unarchiveExperiment({ experimentId: id }); - await onComplete?.(action, id); + await unarchiveExperiment({ experimentId: experiment.id }); + await onComplete?.(action, experiment.id); break; case Action.Delete: confirm({ - content: `Are you sure you want to delete experiment ${id}?`, + content: `Are you sure you want to delete experiment ${experiment.id}?`, danger: true, okText: 'Delete', onConfirm: async () => { - await deleteExperiment({ experimentId: id }); - await onComplete?.(action, id); + await deleteExperiment({ experimentId: experiment.id }); + await onComplete?.(action, experiment.id); }, onError: handleError, title: 'Confirm Experiment Deletion', @@ -283,8 +293,7 @@ const ExperimentActionDropdown: React.FC = ({ fetchedExperimentItem(); break; case Action.Copy: - /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ - await copyToClipboard((cell as any).displayData || cell?.copyData); + await copyToClipboard(cellCopyData ?? ''); openToast({ severity: 'Confirm', title: 'Value has been copied to clipboard.', @@ -294,7 +303,7 @@ const ExperimentActionDropdown: React.FC = ({ } catch (e) { handleError(e, { level: ErrorLevel.Error, - publicMessage: `Unable to ${action} experiment ${id}.`, + publicMessage: `Unable to ${action} experiment ${experiment.id}.`, publicSubject: `${capitalize(action)} failed.`, silent: false, type: ErrorType.Server, @@ -306,7 +315,7 @@ const ExperimentActionDropdown: React.FC = ({ [ link, onLink, - id, + experiment.id, onComplete, confirm, ExperimentEditModal, @@ -314,7 +323,7 @@ const ExperimentActionDropdown: React.FC = ({ ExperimentRetainLogsModal, interstitialModalOpen, fetchedExperimentItem, - cell, + cellCopyData, openToast, experiment.workspaceId, onVisibleChange, @@ -342,13 +351,13 @@ const ExperimentActionDropdown: React.FC = ({ onEditComplete={handleEditComplete} /> diff --git a/webui/react/src/components/RunActionDropdown.test.mock.tsx b/webui/react/src/components/RunActionDropdown.test.mock.tsx index 0857ad1213c..67defcde2c2 100644 --- a/webui/react/src/components/RunActionDropdown.test.mock.tsx +++ b/webui/react/src/components/RunActionDropdown.test.mock.tsx @@ -1,6 +1,6 @@ import { GridCell, GridCellKind } from '@glideapps/glide-data-grid'; -import { DateString } from 'ioTypes'; +import { DateString, decode, optional } from 'ioTypes'; import { FlatRun } from 'types'; import { FilterFormSetWithoutId } from './FilterForm/components/type'; @@ -10,7 +10,7 @@ export const run: FlatRun = { checkpointCount: 1, checkpointSize: 43090, duration: 256, - endTime: '2024-06-03T17:50:38.703259Z' as DateString, + endTime: decode(optional(DateString), '2024-06-03T17:50:38.703259Z'), experiment: { description: '', forkedFrom: 6634, @@ -35,7 +35,7 @@ export const run: FlatRun = { projectId: 1, projectName: 'Uncategorized', searcherMetricValue: 0.46666666865348816, - startTime: '2024-06-03T17:46:22.682019Z' as DateString, + startTime: decode(optional(DateString), '2024-06-03T17:46:22.682019Z'), state: 'COMPLETED', summaryMetrics: { avgMetrics: { diff --git a/webui/react/src/components/RunActionDropdown.test.tsx b/webui/react/src/components/RunActionDropdown.test.tsx index 10b983c855c..0dd65bd6ec8 100644 --- a/webui/react/src/components/RunActionDropdown.test.tsx +++ b/webui/react/src/components/RunActionDropdown.test.tsx @@ -2,7 +2,6 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import UIProvider, { DefaultTheme } from 'hew/Theme'; import { ConfirmationProvider } from 'hew/useConfirm'; -import _ from 'lodash'; import { handlePath } from 'routes/utils'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; @@ -68,8 +67,8 @@ const setup = (link?: string, state?: RunState, archived?: boolean) => { projectId={run.projectId} run={{ ...run, - archived: _.isUndefined(archived) ? run.archived : archived, - state: _.isUndefined(state) ? run.state : state, + archived: archived === undefined ? run.archived : archived, + state: state === undefined ? run.state : state, }} onComplete={onComplete} onVisibleChange={onVisibleChange} diff --git a/webui/react/src/components/RunActionDropdown.tsx b/webui/react/src/components/RunActionDropdown.tsx index a124badd07c..49ba74ed595 100644 --- a/webui/react/src/components/RunActionDropdown.tsx +++ b/webui/react/src/components/RunActionDropdown.tsx @@ -5,7 +5,8 @@ import { useModal } from 'hew/Modal'; import { useToast } from 'hew/Toast'; import useConfirm from 'hew/useConfirm'; import { copyToClipboard } from 'hew/utils/functions'; -import React, { MouseEvent, useCallback, useMemo } from 'react'; +import { isString } from 'lodash'; +import React, { useCallback, useMemo } from 'react'; import usePermissions from 'hooks/usePermissions'; import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; @@ -53,7 +54,6 @@ const RunActionDropdown: React.FC = ({ filterFormSetWithoutId, projectId, }: Props) => { - const id = run.id; const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = useModal(FlatRunMoveModalComponent); const confirm = useConfirm(); @@ -65,63 +65,73 @@ const RunActionDropdown: React.FC = ({ }, ); - const dropdownMenu = useMemo(() => { - const items: MenuItem[] = [...menuItems]; - /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ - if (cell && (cell.copyData || (cell as any).displayData)) { - items.unshift({ key: Action.Copy, label: Action.Copy }); + const cellCopyData = useMemo(() => { + if (cell) { + if ('displayData' in cell && isString(cell.displayData)) { + return cell.displayData; + } + if (cell.copyData) return cell.copyData; } + return undefined; + }, [cell]); + + const dropdownMenu = useMemo(() => { + const items: MenuItem[] = []; if (link) { - items.unshift( + items.push( { key: Action.NewTab, label: Action.NewTab }, { key: Action.NewWindow, label: Action.NewWindow }, { type: 'divider' }, ); } + if (cellCopyData) { + items.push({ key: Action.Copy, label: Action.Copy }); + } + items.push(...menuItems); return items; - }, [link, menuItems, cell]); + }, [link, menuItems, cellCopyData]); const handleDropdown = useCallback( async (action: string, e: DropdownEvent) => { try { switch (action) { case Action.NewTab: - handlePath(e as MouseEvent, { path: link, popout: 'tab' }); + handlePath(e, { path: link, popout: 'tab' }); await onLink?.(); break; case Action.NewWindow: - handlePath(e as MouseEvent, { path: link, popout: 'window' }); + handlePath(e, { path: link, popout: 'window' }); await onLink?.(); break; case Action.Archive: - await archiveRuns({ projectId, runIds: [id] }); - await onComplete?.(action, id); + await archiveRuns({ projectId, runIds: [run.id] }); + await onComplete?.(action, run.id); break; case Action.Kill: confirm({ - content: `Are you sure you want to kill run ${id}?`, + content: `Are you sure you want to kill run ${run.id}?`, danger: true, okText: 'Kill', onConfirm: async () => { - await killRuns({ projectId, runIds: [id] }); - await onComplete?.(action, id); + await killRuns({ projectId, runIds: [run.id] }); + await onComplete?.(action, run.id); }, onError: handleError, title: 'Confirm Run Kill', }); break; case Action.Unarchive: - await unarchiveRuns({ projectId, runIds: [id] }); - await onComplete?.(action, id); + await unarchiveRuns({ projectId, runIds: [run.id] }); + await onComplete?.(action, run.id); break; case Action.Delete: confirm({ - content: `Are you sure you want to delete run ${id}?`, + content: `Are you sure you want to delete run ${run.id}?`, danger: true, okText: 'Delete', onConfirm: async () => { - await deleteRuns({ projectId, runIds: [id] }); - await onComplete?.(action, id); + await deleteRuns({ projectId, runIds: [run.id] }); + await onComplete?.(action, run.id); }, onError: handleError, title: 'Confirm Run Deletion', @@ -131,8 +141,7 @@ const RunActionDropdown: React.FC = ({ flatRunMoveModalOpen(); break; case Action.Copy: - /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ - await copyToClipboard((cell as any).displayData || cell?.copyData); + await copyToClipboard(cellCopyData ?? ''); openToast({ severity: 'Confirm', title: 'Value has been copied to clipboard.', @@ -142,7 +151,7 @@ const RunActionDropdown: React.FC = ({ } catch (e) { handleError(e, { level: ErrorLevel.Error, - publicMessage: `Unable to ${action} experiment ${id}.`, + publicMessage: `Unable to ${action} experiment ${run.id}.`, publicSubject: `${capitalize(action)} failed.`, silent: false, type: ErrorType.Server, @@ -154,10 +163,10 @@ const RunActionDropdown: React.FC = ({ [ link, onLink, - id, + run.id, onComplete, confirm, - cell, + cellCopyData, openToast, onVisibleChange, projectId, @@ -166,15 +175,13 @@ const RunActionDropdown: React.FC = ({ ); const shared = ( - <> - onComplete?.(FlatRunAction.Move, id)} - /> - + onComplete?.(FlatRunAction.Move, run.id)} + /> ); return ( diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index c30cb978780..5f11ca1cbee 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -28,6 +28,7 @@ import Link from 'hew/Link'; import Message from 'hew/Message'; import Pagination from 'hew/Pagination'; import Row from 'hew/Row'; +import { useToast } from 'hew/Toast'; import { Loadable, Loaded, NotLoaded } from 'hew/utils/loadable'; import { isUndefined } from 'lodash'; import { useObservable } from 'micro-observables'; @@ -70,7 +71,7 @@ import { getProjectColumns, getProjectNumericMetricsRange, searchRuns } from 'se import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; import userStore from 'stores/users'; import userSettings from 'stores/userSettings'; -import { DetailedUser, FlatRun, FlatRunAction, ProjectColumn } from 'types'; +import { DetailedUser, FlatRun, FlatRunAction, ProjectColumn, RunState } from 'types'; import handleError from 'utils/error'; import { eagerSubscribe } from 'utils/observable'; import { pluralizer } from 'utils/string'; @@ -171,6 +172,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const [canceler] = useState(new AbortController()); const users = useObservable>(userStore.getUsers()); + const { openToast } = useToast(); + const { ui: { theme: appTheme }, isDarkMode, @@ -664,8 +667,56 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { await fetchRuns(); }, [fetchRuns, handleSelectionChange]); + const handleActionSuccess = useCallback( + (action: FlatRunAction, id: number): void => { + const updateRun = (updated: Partial) => { + setRuns((prev) => + prev.map((runs) => + Loadable.map(runs, (run) => { + if (run.id === id) { + return { ...run, ...updated }; + } + return run; + }), + ), + ); + }; + switch (action) { + case FlatRunAction.Archive: + updateRun({ archived: true }); + break; + case FlatRunAction.Kill: + updateRun({ state: RunState.StoppingKilled }); + break; + case FlatRunAction.Unarchive: + updateRun({ archived: false }); + break; + case FlatRunAction.Move: + case FlatRunAction.Delete: + setRuns((prev) => + prev.filter((runs) => + Loadable.match(runs, { + _: () => true, + Loaded: (run) => run.id !== id, + }), + ), + ); + break; + default: + break; + } + openToast({ severity: 'Confirm', title: `Run ${action.toLowerCase()}d successfully` }); + }, + [openToast], + ); + const handleContextMenuComplete: ContextMenuCompleteHandlerProps = - useCallback(() => {}, []); + useCallback( + (action: FlatRunAction, id: number) => { + handleActionSuccess(action, id); + }, + [handleActionSuccess], + ); const handleColumnsOrderChange = useCallback( // changing both column order and pinned count should happen in one update: @@ -1019,9 +1070,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { run={rowData} onComplete={onComplete} onLink={onClose} - onVisibleChange={onVisibleChange}> - {/*
*/} - + onVisibleChange={onVisibleChange} + /> ); }} rowHeight={rowHeightMap[globalSettings.rowHeight as RowHeight]} diff --git a/webui/react/src/pages/FlatRuns/columns.ts b/webui/react/src/pages/FlatRuns/columns.ts index 4d29a7ca8ec..6fe5e08c886 100644 --- a/webui/react/src/pages/FlatRuns/columns.ts +++ b/webui/react/src/pages/FlatRuns/columns.ts @@ -463,7 +463,7 @@ export const getColumnDefs = ({ }); return { allowOverlay: true, - copyData: String(record.userId), + copyData: String(displayName), data: { image: undefined, initials: getInitials(displayName), diff --git a/webui/react/src/routes/utils.ts b/webui/react/src/routes/utils.ts index 03ef0f83b5b..14494d4d10e 100644 --- a/webui/react/src/routes/utils.ts +++ b/webui/react/src/routes/utils.ts @@ -1,4 +1,5 @@ import { pathToRegexp } from 'path-to-regexp'; +import { KeyboardEvent } from 'react'; import { globalStorage } from 'globalStorage'; import { ClusterApi, Configuration } from 'services/api-ts-sdk'; @@ -9,6 +10,7 @@ import { AnyMouseEventHandler, isAbsolutePath, isFullPath, + isMouseEvent, isNewTabClickEvent, openBlank, reactHostAddress, @@ -200,7 +202,7 @@ export const routeAll = (path: string): void => { } }; export const handlePath = ( - event: AnyMouseEvent, + event: AnyMouseEvent | KeyboardEvent, options: { external?: boolean; onClick?: AnyMouseEventHandler; @@ -212,10 +214,10 @@ export const handlePath = ( const href = options.path ? linkPath(options.path, options.external) : undefined; - if (options.onClick) { + if (options.onClick && isMouseEvent(event)) { options.onClick(event); } else if (href) { - if (isNewTabClickEvent(event) || options.popout) { + if ((isMouseEvent(event) && isNewTabClickEvent(event)) || options.popout) { /** * `location=0` forces a new window instead of a tab to open. * https://stackoverflow.com/questions/726761/javascript-open-in-a-new-window-not-tab From 6ac7f1287005d8612df194b3940acf65af2fcdd6 Mon Sep 17 00:00:00 2001 From: John Kim Date: Mon, 10 Jun 2024 11:44:59 -0400 Subject: [PATCH 068/161] merge error --- harness/determined/common/api/bindings.py | 158 ++++++++++++++++++++++ 1 file changed, 158 insertions(+) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index 5c688167e37..ee09100bb36 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -10288,6 +10288,64 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: } return out +class v1PauseRunsRequest(Printable): + """Request to pause the experiment associated witha run.""" + filter: "typing.Optional[str]" = None + + def __init__( + self, + *, + projectId: int, + runIds: "typing.Sequence[int]", + filter: "typing.Union[str, None, Unset]" = _unset, + ): + self.projectId = projectId + self.runIds = runIds + if not isinstance(filter, Unset): + self.filter = filter + + @classmethod + def from_json(cls, obj: Json) -> "v1PauseRunsRequest": + kwargs: "typing.Dict[str, typing.Any]" = { + "projectId": obj["projectId"], + "runIds": obj["runIds"], + } + if "filter" in obj: + kwargs["filter"] = obj["filter"] + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + "projectId": self.projectId, + "runIds": self.runIds, + } + if not omit_unset or "filter" in vars(self): + out["filter"] = self.filter + return out + +class v1PauseRunsResponse(Printable): + """Response to PauseRunsRequest.""" + + def __init__( + self, + *, + results: "typing.Sequence[v1RunActionResult]", + ): + self.results = results + + @classmethod + def from_json(cls, obj: Json) -> "v1PauseRunsResponse": + kwargs: "typing.Dict[str, typing.Any]" = { + "results": [v1RunActionResult.from_json(x) for x in obj["results"]], + } + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + "results": [x.to_json(omit_unset) for x in self.results], + } + return out + class v1Permission(Printable): name: "typing.Optional[str]" = None scopeTypeMask: "typing.Optional[v1ScopeTypeMask]" = None @@ -12897,6 +12955,64 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out["started"] = None if self.started is None else self.started.to_json(omit_unset) return out +class v1ResumeRunsRequest(Printable): + """Request to unpause the experiment associated witha run.""" + filter: "typing.Optional[str]" = None + + def __init__( + self, + *, + projectId: int, + runIds: "typing.Sequence[int]", + filter: "typing.Union[str, None, Unset]" = _unset, + ): + self.projectId = projectId + self.runIds = runIds + if not isinstance(filter, Unset): + self.filter = filter + + @classmethod + def from_json(cls, obj: Json) -> "v1ResumeRunsRequest": + kwargs: "typing.Dict[str, typing.Any]" = { + "projectId": obj["projectId"], + "runIds": obj["runIds"], + } + if "filter" in obj: + kwargs["filter"] = obj["filter"] + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + "projectId": self.projectId, + "runIds": self.runIds, + } + if not omit_unset or "filter" in vars(self): + out["filter"] = self.filter + return out + +class v1ResumeRunsResponse(Printable): + """Response to ResumeRunsRequest.""" + + def __init__( + self, + *, + results: "typing.Sequence[v1RunActionResult]", + ): + self.results = results + + @classmethod + def from_json(cls, obj: Json) -> "v1ResumeRunsResponse": + kwargs: "typing.Dict[str, typing.Any]" = { + "results": [v1RunActionResult.from_json(x) for x in obj["results"]], + } + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + "results": [x.to_json(omit_unset) for x in self.results], + } + return out + class v1Role(Printable): name: "typing.Optional[str]" = None permissions: "typing.Optional[typing.Sequence[v1Permission]]" = None @@ -21501,6 +21617,27 @@ def post_PauseGenericTask( return raise APIHttpError("post_PauseGenericTask", _resp) +def post_PauseRuns( + session: "api.BaseSession", + *, + body: "v1PauseRunsRequest", +) -> "v1PauseRunsResponse": + """Pause experiment associated with provided runs.""" + _params = None + _resp = session._do_request( + method="POST", + path="/api/v1/runs/pause", + params=_params, + json=body.to_json(True), + data=None, + headers=None, + timeout=None, + stream=False, + ) + if _resp.status_code == 200: + return v1PauseRunsResponse.from_json(_resp.json()) + raise APIHttpError("post_PauseRuns", _resp) + def post_PinWorkspace( session: "api.BaseSession", *, @@ -22423,6 +22560,27 @@ def get_ResourceAllocationRaw( return v1ResourceAllocationRawResponse.from_json(_resp.json()) raise APIHttpError("get_ResourceAllocationRaw", _resp) +def post_ResumeRuns( + session: "api.BaseSession", + *, + body: "v1ResumeRunsRequest", +) -> "v1ResumeRunsResponse": + """Unpause experiment associated with provided runs.""" + _params = None + _resp = session._do_request( + method="POST", + path="/api/v1/runs/resume", + params=_params, + json=body.to_json(True), + data=None, + headers=None, + timeout=None, + stream=False, + ) + if _resp.status_code == 200: + return v1ResumeRunsResponse.from_json(_resp.json()) + raise APIHttpError("post_ResumeRuns", _resp) + def post_RunPrepareForReporting( session: "api.BaseSession", *, From be3d7162f5506ca29bf2505231da751716195239 Mon Sep 17 00:00:00 2001 From: John Kim Date: Mon, 10 Jun 2024 11:51:52 -0400 Subject: [PATCH 069/161] fmt --- .../pages/FlatRuns/FlatRunActionButton.tsx | 10 ++- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 88 +++++++++---------- 2 files changed, 50 insertions(+), 48 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index c5c4aadec12..716253a8f2f 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -108,8 +108,9 @@ const FlatRunActionButton = ({ } else if (numFailures === 0) { openToast({ closeable: true, - description: `${action} succeeded for ${results.successful.length - } ${LABEL_PLURAL.toLowerCase()}`, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, title: `${action} Success`, }); } else if (numSuccesses === 0) { @@ -121,8 +122,9 @@ const FlatRunActionButton = ({ } else { openToast({ closeable: true, - description: `${action} succeeded for ${numSuccesses} out of ${numFailures + numSuccesses - } eligible + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible ${LABEL_PLURAL.toLowerCase()}`, severity: 'Warning', title: `Partial ${action} Failure`, diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 57f30bcf5db..5f11ca1cbee 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -332,8 +332,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, { max: heatmap.max, @@ -345,8 +345,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -357,8 +357,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); break; @@ -369,8 +369,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -383,9 +383,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { settings.columnWidths[currentColumn.column], heatmap && settings.heatmapOn && !settings.heatmapSkipped.includes(currentColumn.column) ? { - max: heatmap.max, - min: heatmap.min, - } + max: heatmap.max, + min: heatmap.min, + } : undefined, ); } @@ -766,12 +766,12 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const items: MenuItem[] = [ settings.selection.type === 'ALL_EXCEPT' || settings.selection.selections.length > 0 ? { - key: 'select-none', - label: 'Clear selected', - onClick: () => { - handleSelectionChange?.('remove-all'); - }, - } + key: 'select-none', + label: 'Clear selected', + onClick: () => { + handleSelectionChange?.('remove-all'); + }, + } : null, ...[5, 10, 25].map((n) => ({ key: `select-${n}`, @@ -800,32 +800,32 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { ? null : !isPinned ? { - icon: , - key: 'pin', - label: 'Pin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), - ); - }, - } + icon: , + key: 'pin', + label: 'Pin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), + ); + }, + } : { - disabled: settings.pinnedColumnsCount <= 1, - icon: , - key: 'unpin', - label: 'Unpin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.max(settings.pinnedColumnsCount - 1, 0), - ); + disabled: settings.pinnedColumnsCount <= 1, + icon: , + key: 'unpin', + label: 'Unpin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.max(settings.pinnedColumnsCount - 1, 0), + ); + }, }, - }, { icon: , key: 'hide', @@ -882,9 +882,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { sortCount === 0 ? [] : [ - { type: 'divider' as const }, - ...sortMenuItemsForColumn(column, sorts, handleSortChange), - ]; + { type: 'divider' as const }, + ...sortMenuItemsForColumn(column, sorts, handleSortChange), + ]; items.push( ...sortMenuItems, From 751715292b6b89852c3feede8ca1743177886d85 Mon Sep 17 00:00:00 2001 From: John Kim Date: Mon, 10 Jun 2024 11:58:26 -0400 Subject: [PATCH 070/161] merge error --- webui/react/src/services/api-ts-sdk/api.ts | 234 +++++++++++++++++++++ 1 file changed, 234 insertions(+) diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index 004baf96a9d..e213bc5c6db 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -7547,6 +7547,44 @@ export interface V1PauseExperimentsResponse { */ export interface V1PauseGenericTaskResponse { } +/** + * Request to pause the experiment associated witha run. + * @export + * @interface V1PauseRunsRequest + */ +export interface V1PauseRunsRequest { + /** + * The ids of the runs being moved. + * @type {Array} + * @memberof V1PauseRunsRequest + */ + runIds: Array; + /** + * The id of the project of the runs being paused. + * @type {number} + * @memberof V1PauseRunsRequest + */ + projectId: number; + /** + * Filter expression + * @type {string} + * @memberof V1PauseRunsRequest + */ + filter?: string; +} +/** + * Response to PauseRunsRequest. + * @export + * @interface V1PauseRunsResponse + */ +export interface V1PauseRunsResponse { + /** + * Details on success or error for each run. + * @type {Array} + * @memberof V1PauseRunsResponse + */ + results: Array; +} /** * * @export @@ -9541,6 +9579,44 @@ export interface V1ResourcesSummary { */ exited?: V1ResourcesStopped; } +/** + * Request to unpause the experiment associated witha run. + * @export + * @interface V1ResumeRunsRequest + */ +export interface V1ResumeRunsRequest { + /** + * The ids of the runs being moved. + * @type {Array} + * @memberof V1ResumeRunsRequest + */ + runIds: Array; + /** + * The id of the project of the runs being unpaused. + * @type {number} + * @memberof V1ResumeRunsRequest + */ + projectId: number; + /** + * Filter expression + * @type {string} + * @memberof V1ResumeRunsRequest + */ + filter?: string; +} +/** + * Response to ResumeRunsRequest. + * @export + * @interface V1ResumeRunsResponse + */ +export interface V1ResumeRunsResponse { + /** + * Details on success or error for each run. + * @type {Array} + * @memberof V1ResumeRunsResponse + */ + results: Array; +} /** * * @export @@ -20559,6 +20635,44 @@ export const InternalApiFetchParamCreator = function (configuration?: Configurat options: localVarRequestOptions, }; }, + /** + * + * @summary Pause experiment associated with provided runs. + * @param {V1PauseRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseRuns(body: V1PauseRunsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling pauseRuns.'); + } + const localVarPath = `/api/v1/runs/pause`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, /** * * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. @@ -21145,6 +21259,44 @@ export const InternalApiFetchParamCreator = function (configuration?: Configurat options: localVarRequestOptions, }; }, + /** + * + * @summary Unpause experiment associated with provided runs. + * @param {V1ResumeRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resumeRuns(body: V1ResumeRunsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling resumeRuns.'); + } + const localVarPath = `/api/v1/runs/resume`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, /** * * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. @@ -22756,6 +22908,25 @@ export const InternalApiFp = function (configuration?: Configuration) { }); }; }, + /** + * + * @summary Pause experiment associated with provided runs. + * @param {V1PauseRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseRuns(body: V1PauseRunsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).pauseRuns(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. @@ -23031,6 +23202,25 @@ export const InternalApiFp = function (configuration?: Configuration) { }); }; }, + /** + * + * @summary Unpause experiment associated with provided runs. + * @param {V1ResumeRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resumeRuns(body: V1ResumeRunsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).resumeRuns(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. @@ -23853,6 +24043,16 @@ export const InternalApiFactory = function (configuration?: Configuration, fetch pauseGenericTask(taskId: string, options?: any) { return InternalApiFp(configuration).pauseGenericTask(taskId, options)(fetch, basePath); }, + /** + * + * @summary Pause experiment associated with provided runs. + * @param {V1PauseRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseRuns(body: V1PauseRunsRequest, options?: any) { + return InternalApiFp(configuration).pauseRuns(body, options)(fetch, basePath); + }, /** * * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. @@ -24002,6 +24202,16 @@ export const InternalApiFactory = function (configuration?: Configuration, fetch reportTrialValidationMetrics(validationMetricsTrialId: number, body: V1TrialMetrics, options?: any) { return InternalApiFp(configuration).reportTrialValidationMetrics(validationMetricsTrialId, body, options)(fetch, basePath); }, + /** + * + * @summary Unpause experiment associated with provided runs. + * @param {V1ResumeRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resumeRuns(body: V1ResumeRunsRequest, options?: any) { + return InternalApiFp(configuration).resumeRuns(body, options)(fetch, basePath); + }, /** * * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. @@ -24832,6 +25042,18 @@ export class InternalApi extends BaseAPI { return InternalApiFp(this.configuration).pauseGenericTask(taskId, options)(this.fetch, this.basePath) } + /** + * + * @summary Pause experiment associated with provided runs. + * @param {V1PauseRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InternalApi + */ + public pauseRuns(body: V1PauseRunsRequest, options?: any) { + return InternalApiFp(this.configuration).pauseRuns(body, options)(this.fetch, this.basePath) + } + /** * * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. @@ -25009,6 +25231,18 @@ export class InternalApi extends BaseAPI { return InternalApiFp(this.configuration).reportTrialValidationMetrics(validationMetricsTrialId, body, options)(this.fetch, this.basePath) } + /** + * + * @summary Unpause experiment associated with provided runs. + * @param {V1ResumeRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InternalApi + */ + public resumeRuns(body: V1ResumeRunsRequest, options?: any) { + return InternalApiFp(this.configuration).resumeRuns(body, options)(this.fetch, this.basePath) + } + /** * * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. From 0549bf23aaf125eb99cd63ed302d26d7b4f01699 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 14 May 2024 16:38:12 -0700 Subject: [PATCH 071/161] feat: initial implementation of flat run actions --- .../pages/FlatRuns/FlatRunActionButton.tsx | 258 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 25 +- webui/react/src/services/api.ts | 24 ++ webui/react/src/services/apiConfig.ts | 53 +++- webui/react/src/services/decoder.ts | 8 +- 5 files changed, 350 insertions(+), 18 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx new file mode 100644 index 00000000000..2f8ebbd42f4 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -0,0 +1,258 @@ +import Button from 'hew/Button'; +import Dropdown, { MenuItem } from 'hew/Dropdown'; +import Icon, { IconName } from 'hew/Icon'; +import { useModal } from 'hew/Modal'; +import { useToast } from 'hew/Toast'; +import { useCallback, useMemo, useState } from 'react'; + +import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; +import { BatchAction } from 'components/TableActionBar'; +// import usePermissions from 'hooks/usePermissions'; +import { + archiveRuns, + deleteRuns, + killRuns, + openOrCreateTensorBoard, + unarchiveRuns, +} from 'services/api'; +import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { capitalizeWord } from 'utils/string'; +import { openCommandResponse } from 'utils/wait'; + +// export const getActionsForRunsUnion = ( +// experiments: FlatRun[], +// targets: ExperimentAction[], +// permissions: ExperimentPermissionSet, +// ): ExperimentAction[] => { +// if (!experiments.length) return []; // redundant, for clarity +// const actionsForExperiments = experiments.map((e) => +// getActionsForExperiment(e, targets, permissions), +// ); +// return targets.filter((action) => +// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), +// ); +// }; + +const BATCH_ACTIONS = [ + ExperimentAction.OpenTensorBoard, + ExperimentAction.Move, + ExperimentAction.RetainLogs, + ExperimentAction.Archive, + ExperimentAction.Unarchive, + ExperimentAction.Delete, + ExperimentAction.Activate, + ExperimentAction.Pause, + ExperimentAction.Cancel, + ExperimentAction.Kill, +] as const; + +const ACTION_ICONS: Record = { + [ExperimentAction.Activate]: 'play', + [ExperimentAction.Pause]: 'pause', + [ExperimentAction.Cancel]: 'stop', + [ExperimentAction.Archive]: 'archive', + [ExperimentAction.Unarchive]: 'document', + [ExperimentAction.Move]: 'workspaces', + [ExperimentAction.RetainLogs]: 'logs', + [ExperimentAction.OpenTensorBoard]: 'tensor-board', + [ExperimentAction.Kill]: 'cancelled', + [ExperimentAction.Delete]: 'error', +} as const; + +const LABEL_PLURAL = 'runs'; + +interface Props { + isMobile: boolean; + selectedRuns: FlatRun[]; + project: Project; + onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; +} + +const FlatRunActionButton = ({ + isMobile, + selectedRuns, + project, + onActionSuccess, +}: Props): JSX.Element => { + const [batchAction, setBatchAction] = useState(undefined); + // const permissions = usePermissions(); + const { openToast } = useToast(); + const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); + + const sendBatchActions = useCallback( + // TODO: remove this + // eslint-disable-next-line require-await + async (action: BatchAction): Promise => { + const validRunIds = selectedRuns + // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .map((run) => run.id); + const params = { + projectId: project.id, + runIds: validRunIds, + }; + switch (action) { + case ExperimentAction.OpenTensorBoard: { + if (validRunIds.length !== selectedRuns.length) { + // if unmanaged experiments are selected, open experimentTensorBoardModal + // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs + } else { + openCommandResponse( + await openOrCreateTensorBoard({ + experimentIds: params.runIds, + workspaceId: project.workspaceId, + }), + ); + } + return; + } + case ExperimentAction.Move: + // return ExperimentMoveModal.open(); + case ExperimentAction.RetainLogs: + // return ExperimentRetainLogsModal.open(); + case ExperimentAction.Activate: + // return await archiveRuns(params); + case ExperimentAction.Archive: + return await archiveRuns(params); + case ExperimentAction.Cancel: + // return await cancelExperiments(params); + case ExperimentAction.Kill: + return await killRuns(params); + case ExperimentAction.Pause: + // return await pauseExperiments(params); + case ExperimentAction.Unarchive: + return await unarchiveRuns(params); + case ExperimentAction.Delete: + return await deleteRuns(params); + } + }, + [project.id, project.workspaceId, selectedRuns], + ); + + const submitBatchAction = useCallback( + async (action: BatchAction) => { + try { + const results = await sendBatchActions(action); + if (results === undefined) return; + + onActionSuccess?.(action, results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: `No selected ${LABEL_PLURAL.toLowerCase()} were eligible for ${action.toLowerCase()}`, + title: `No eligible ${LABEL_PLURAL.toLowerCase()}`, + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, + title: `${action} Success`, + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to ${action.toLowerCase()} ${numFailures} ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `${action} Failure`, + }); + } else { + openToast({ + closeable: true, + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible + ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `Partial ${action} Failure`, + }); + } + } catch (e) { + const publicSubject = + action === ExperimentAction.OpenTensorBoard + ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` + : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + handleError(e, { + isUserTriggered: true, + publicMessage: 'Please try again later.', + publicSubject, + silent: false, + }); + } finally { + // onActionComplete?.(); + } + }, + [sendBatchActions, onActionSuccess, openToast], + ); + + const handleBatchAction = useCallback( + (action: string) => { + switch (action) { + case ExperimentAction.OpenTensorBoard: + submitBatchAction(action); + break; + case ExperimentAction.Move: + case ExperimentAction.RetainLogs: + sendBatchActions(action); + break; + default: + setBatchAction(action as BatchAction); + BatchActionConfirmModal.open(); + break; + } + }, + [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + ); + + // const availableBatchActions = useMemo(() => { + // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. + // }, [selectedExperimentIds, experimentMap, permissions]); + + const editMenuItems = useMemo(() => { + const groupedBatchActions = [ + BATCH_ACTIONS.slice(0, 1), // View in TensorBoard + BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete + BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill + ]; + const groupSize = groupedBatchActions.length; + return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { + const isLastGroup = index === groupSize - 1; + group.forEach((action) => + acc.push({ + danger: action === ExperimentAction.Delete, + // disabled: !availableBatchActions.includes(action), // TODO uncomment later + icon: , + key: action, + label: action, + }), + ); + if (!isLastGroup) acc.push({ type: 'divider' }); + return acc; + }, []); + }, []); + + return ( + <> + {selectedRuns.length > 0 && ( + + + + )} + {batchAction && ( + exp.unmanaged)} // TODO: is it needed for Runs? + onConfirm={() => submitBatchAction(batchAction)} + /> + )} + + ); +}; + +export default FlatRunActionButton; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ac8528b4606..96f5c2c1bca 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -63,6 +63,7 @@ import { DEFAULT_SELECTION, SelectionType as SelectionState, } from 'pages/F_ExpList/F_ExperimentList.settings'; +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { paths } from 'routes/utils'; import { getProjectColumns, getProjectNumericMetricsRange, searchRuns } from 'services/api'; import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; @@ -196,6 +197,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { } }, [projectId]); + const selectedRunIdSet = useMemo(() => { + return new Set(settings.selection.type === 'ONLY_IN' ? settings.selection.selections : []); + }, [settings.selection]); + const columnsIfLoaded = useMemo( () => (isLoadingSettings ? [] : settings.columns), [isLoadingSettings, settings.columns], @@ -214,18 +219,16 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { if (isLoadingSettings) { return selectedMap; } - const selectedIdSet = new Set( - settings.selection.type === 'ONLY_IN' ? settings.selection.selections : [], - ); + runs.forEach((r, index) => { Loadable.forEach(r, (run) => { - if (selectedIdSet.has(run.id)) { + if (selectedRunIdSet.has(run.id)) { selectedMap.set(run.id, { index, run }); } }); }); return selectedMap; - }, [isLoadingSettings, settings.selection, runs]); + }, [isLoadingSettings, runs, selectedRunIdSet]); const selection = useMemo(() => { let rows = CompactSelection.empty(); @@ -238,6 +241,13 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { }; }, [loadedSelectedRunIds]); + const selectedRuns: FlatRun[] = useMemo(() => { + const selected = runs.flatMap((run) => { + return run.isLoaded && selectedRunIdSet.has(run.data.id) ? [run.data] : []; + }); + return selected; + }, [runs, selectedRunIdSet]); + const handleIsOpenFilterChange = useCallback((newOpen: boolean) => { setIsOpenFilter(newOpen); if (!newOpen) { @@ -930,6 +940,11 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { rowHeight={globalSettings.rowHeight} onRowHeightChange={onRowHeightChange} /> + diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 0a6c975e646..39acbb16325 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -757,6 +757,30 @@ export const searchRuns = generateDetApi< Type.SearchFlatRunPagination >(Config.searchRuns); +export const archiveRuns = generateDetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +>(Config.archiveRuns); + +export const deleteRuns = generateDetApi( + Config.deleteRuns, +); + +export const killRuns = generateDetApi( + Config.killRuns, +); + +export const moveRuns = generateDetApi( + Config.moveRuns, +); + +export const unarchiveRuns = generateDetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + void +>(Config.unarchiveRuns); + /* Tasks */ export const getCommands = generateDetApi< diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index f9d34fd7a9b..7c8c01d55f3 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -717,7 +717,7 @@ export const archiveExperiments: DetApi< Type.BulkActionResult > = { name: 'archiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.archiveExperiments(params.projectId, params, options); }, @@ -741,7 +741,7 @@ export const deleteExperiments: DetApi< Type.BulkActionResult > = { name: 'deleteExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.deleteExperiments(params.projectId, params, options); }, @@ -765,7 +765,7 @@ export const unarchiveExperiments: DetApi< Type.BulkActionResult > = { name: 'unarchiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.unarchiveExperiments(params.projectId, params, options); }, @@ -789,7 +789,7 @@ export const activateExperiments: DetApi< Type.BulkActionResult > = { name: 'activateExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.activateExperiments(params.projectId, params, options); }, @@ -813,7 +813,7 @@ export const pauseExperiments: DetApi< Type.BulkActionResult > = { name: 'pauseExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.pauseExperiments(params.projectId, params, options); }, @@ -837,7 +837,7 @@ export const cancelExperiments: DetApi< Type.BulkActionResult > = { name: 'cancelExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.cancelExperiments(params.projectId, params, options); }, @@ -861,7 +861,7 @@ export const killExperiments: DetApi< Type.BulkActionResult > = { name: 'killExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.killExperiments(params.projectId, params, options); }, @@ -1014,7 +1014,7 @@ export const moveExperiments: DetApi< Type.BulkActionResult > = { name: 'moveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.moveExperiments(params.projectId, params, options), }; @@ -1025,7 +1025,7 @@ export const changeExperimentLogRetention: DetApi< Type.BulkActionResult > = { name: 'changeExperimentLogRetention', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.putExperimentsRetainLogs(params.projectId, params, options), }; @@ -1148,6 +1148,41 @@ export const searchRuns: DetApi< ), }; +export const archiveRuns: DetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'archiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.archiveRuns(params, options), +}; + +export const deleteRuns: DetApi = { + name: 'deleteRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.deleteRuns(params, options), +}; + +export const killRuns: DetApi = { + name: 'killRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.killRuns(params, options), +}; + +export const moveRuns: DetApi = { + name: 'moveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.moveRuns(params, options), +}; + +export const unarchiveRuns: DetApi = + { + name: 'unarchiveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), + }; + /* Tasks */ export const getTask: DetApi< diff --git a/webui/react/src/services/decoder.ts b/webui/react/src/services/decoder.ts index 6f15eb56447..23f4820e5b7 100644 --- a/webui/react/src/services/decoder.ts +++ b/webui/react/src/services/decoder.ts @@ -875,11 +875,11 @@ export const decodeJobStates = ( >; }; -export const mapV1ExperimentActionResults = ( - results: Sdk.V1ExperimentActionResult[], +export const mapV1ActionResults = ( + results: Sdk.V1ExperimentActionResult[] | Sdk.V1RunActionResult[], ): types.BulkActionResult => { return results.reduce( - (acc, cur) => { + (acc: types.BulkActionResult, cur) => { if (cur.error.length > 0) { acc.failed.push(cur); } else { @@ -887,7 +887,7 @@ export const mapV1ExperimentActionResults = ( } return acc; }, - { failed: [], successful: [] } as types.BulkActionResult, + { failed: [], successful: [] }, ); }; From ade2a4f5dce65e6c8a9ce4947b8fbb4bdfa22b82 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 22 May 2024 11:34:30 -0700 Subject: [PATCH 072/161] fix: minor changes --- .../react/src/pages/FlatRuns/FlatRunActionButton.tsx | 4 +--- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2f8ebbd42f4..2fbd2d13cd6 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -81,8 +81,6 @@ const FlatRunActionButton = ({ const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( - // TODO: remove this - // eslint-disable-next-line require-await async (action: BatchAction): Promise => { const validRunIds = selectedRuns // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission @@ -111,7 +109,7 @@ const FlatRunActionButton = ({ case ExperimentAction.RetainLogs: // return ExperimentRetainLogsModal.open(); case ExperimentAction.Activate: - // return await archiveRuns(params); + // return await activate(params); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Cancel: diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 96f5c2c1bca..d76315d33e9 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,6 +53,7 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; +import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -656,6 +657,15 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); + const onActionSuccess = useCallback( + // TODO: update this function + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (_action: BatchAction, _successfulIds: number[]) => { + handleSelectionChange('remove-all'); + }, + [handleSelectionChange], + ); + const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -944,6 +954,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} + onActionSuccess={onActionSuccess} /> From c2a2203ff85e462902b727ec807e6815100627ac Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 16:31:46 -0700 Subject: [PATCH 073/161] feat: add RBAC permissions for flatRuns --- webui/react/src/hooks/usePermissions.ts | 36 +++++- .../pages/FlatRuns/FlatRunActionButton.tsx | 112 +++++------------- webui/react/src/types.ts | 15 +++ webui/react/src/utils/flatRun.ts | 72 +++++++++++ 4 files changed, 151 insertions(+), 84 deletions(-) create mode 100644 webui/react/src/utils/flatRun.ts diff --git a/webui/react/src/hooks/usePermissions.ts b/webui/react/src/hooks/usePermissions.ts index e25ac702b98..ae909e64756 100644 --- a/webui/react/src/hooks/usePermissions.ts +++ b/webui/react/src/hooks/usePermissions.ts @@ -9,6 +9,8 @@ import userStore from 'stores/users'; import { DetailedUser, ExperimentPermissionsArgs, + FlatRun, + FlatRunPermissionsArgs, ModelItem, ModelVersion, Permission, @@ -53,7 +55,7 @@ interface MovePermissionsArgs { destination?: PermissionWorkspace; } -interface PermissionsHook { +export interface PermissionsHook { canAdministrateUsers: boolean; canAssignRoles: (arg0: WorkspacePermissionsArgs) => boolean; canCreateExperiment: (arg0: WorkspacePermissionsArgs) => boolean; @@ -67,6 +69,7 @@ interface PermissionsHook { canCreateWorkspace: boolean; canCreateWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canDeleteExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canDeleteFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canDeleteModel: (arg0: ModelPermissionsArgs) => boolean; canDeleteModelVersion: (arg0: ModelVersionPermissionsArgs) => boolean; canDeleteProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -88,6 +91,7 @@ interface PermissionsHook { canModifyWorkspaceCheckpointStorage: (arg0: WorkspacePermissionsArgs) => boolean; canModifyWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canMoveExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canMoveFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canMoveExperimentsTo: (arg0: MovePermissionsArgs) => boolean; canMoveModel: (arg0: MovePermissionsArgs) => boolean; canMoveProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -144,6 +148,7 @@ const usePermissions = (): PermissionsHook => { canCreateWorkspaceNSC(rbacOpts, args.workspace), canDeleteExperiment: (args: ExperimentPermissionsArgs) => canDeleteExperiment(rbacOpts, args.experiment), + canDeleteFlatRun: (args: FlatRunPermissionsArgs) => canDeleteFlatRun(rbacOpts, args.flatRun), canDeleteModel: (args: ModelPermissionsArgs) => canDeleteModel(rbacOpts, args.model), canDeleteModelVersion: (args: ModelVersionPermissionsArgs) => canDeleteModelVersion(rbacOpts, args.modelVersion), @@ -181,6 +186,7 @@ const usePermissions = (): PermissionsHook => { canMoveExperiment(rbacOpts, args.experiment), canMoveExperimentsTo: (args: MovePermissionsArgs) => canMoveExperimentsTo(rbacOpts, args.destination), + canMoveFlatRun: (args: FlatRunPermissionsArgs) => canMoveFlatRun(rbacOpts, args.flatRun), canMoveModel: (args: MovePermissionsArgs) => canMoveModel(rbacOpts, args.destination), canMoveProjects: (args: ProjectPermissionsArgs) => canMoveWorkspaceProjects(rbacOpts, args.project), @@ -679,4 +685,32 @@ const canManageResourcePoolBindings = ({ : !!currentUser && currentUser.isAdmin; }; +// Flat Runs + +const canDeleteFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const permitted = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? permitted.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + +const canMoveFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const srcPermit = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? srcPermit.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + export default usePermissions; diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2fbd2d13cd6..ee7130b4ddb 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -6,57 +6,32 @@ import { useToast } from 'hew/Toast'; import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; -import { BatchAction } from 'components/TableActionBar'; -// import usePermissions from 'hooks/usePermissions'; -import { - archiveRuns, - deleteRuns, - killRuns, - openOrCreateTensorBoard, - unarchiveRuns, -} from 'services/api'; +import usePermissions from 'hooks/usePermissions'; +import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; import handleError from 'utils/error'; +import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; -import { openCommandResponse } from 'utils/wait'; - -// export const getActionsForRunsUnion = ( -// experiments: FlatRun[], -// targets: ExperimentAction[], -// permissions: ExperimentPermissionSet, -// ): ExperimentAction[] => { -// if (!experiments.length) return []; // redundant, for clarity -// const actionsForExperiments = experiments.map((e) => -// getActionsForExperiment(e, targets, permissions), -// ); -// return targets.filter((action) => -// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), -// ); -// }; const BATCH_ACTIONS = [ - ExperimentAction.OpenTensorBoard, + // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, - ExperimentAction.RetainLogs, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - ExperimentAction.Activate, - ExperimentAction.Pause, - ExperimentAction.Cancel, + // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; +type BatchAction = (typeof BATCH_ACTIONS)[number]; + const ACTION_ICONS: Record = { - [ExperimentAction.Activate]: 'play', - [ExperimentAction.Pause]: 'pause', - [ExperimentAction.Cancel]: 'stop', + // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', - [ExperimentAction.RetainLogs]: 'logs', - [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Kill]: 'cancelled', + // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -67,6 +42,7 @@ interface Props { selectedRuns: FlatRun[]; project: Project; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunActionButton = ({ @@ -74,57 +50,39 @@ const FlatRunActionButton = ({ selectedRuns, project, onActionSuccess, + onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); - // const permissions = usePermissions(); + const permissions = usePermissions(); const { openToast } = useToast(); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( async (action: BatchAction): Promise => { const validRunIds = selectedRuns - // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { projectId: project.id, runIds: validRunIds, }; switch (action) { - case ExperimentAction.OpenTensorBoard: { - if (validRunIds.length !== selectedRuns.length) { - // if unmanaged experiments are selected, open experimentTensorBoardModal - // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs - } else { - openCommandResponse( - await openOrCreateTensorBoard({ - experimentIds: params.runIds, - workspaceId: project.workspaceId, - }), - ); - } - return; - } case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - case ExperimentAction.RetainLogs: - // return ExperimentRetainLogsModal.open(); - case ExperimentAction.Activate: - // return await activate(params); + // return ExperimentMoveModal.open(); + break; case ExperimentAction.Archive: return await archiveRuns(params); - case ExperimentAction.Cancel: - // return await cancelExperiments(params); case ExperimentAction.Kill: return await killRuns(params); - case ExperimentAction.Pause: - // return await pauseExperiments(params); case ExperimentAction.Unarchive: return await unarchiveRuns(params); case ExperimentAction.Delete: return await deleteRuns(params); + default: + break; } }, - [project.id, project.workspaceId, selectedRuns], + [project.id, selectedRuns], ); const submitBatchAction = useCallback( @@ -169,10 +127,7 @@ const FlatRunActionButton = ({ }); } } catch (e) { - const publicSubject = - action === ExperimentAction.OpenTensorBoard - ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` - : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { isUserTriggered: true, publicMessage: 'Please try again later.', @@ -180,20 +135,16 @@ const FlatRunActionButton = ({ silent: false, }); } finally { - // onActionComplete?.(); + onActionComplete?.(); } }, - [sendBatchActions, onActionSuccess, openToast], + [sendBatchActions, onActionSuccess, openToast, onActionComplete], ); const handleBatchAction = useCallback( (action: string) => { switch (action) { - case ExperimentAction.OpenTensorBoard: - submitBatchAction(action); - break; case ExperimentAction.Move: - case ExperimentAction.RetainLogs: sendBatchActions(action); break; default: @@ -202,27 +153,22 @@ const FlatRunActionButton = ({ break; } }, - [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + [BatchActionConfirmModal, sendBatchActions], ); - // const availableBatchActions = useMemo(() => { - // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); - // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. - // }, [selectedExperimentIds, experimentMap, permissions]); + const availableBatchActions = useMemo(() => { + return getActionsForFlatRunsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + }, [selectedRuns, permissions]); const editMenuItems = useMemo(() => { - const groupedBatchActions = [ - BATCH_ACTIONS.slice(0, 1), // View in TensorBoard - BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete - BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill - ]; + const groupedBatchActions = [BATCH_ACTIONS]; const groupSize = groupedBatchActions.length; return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { const isLastGroup = index === groupSize - 1; group.forEach((action) => acc.push({ danger: action === ExperimentAction.Delete, - // disabled: !availableBatchActions.includes(action), // TODO uncomment later + disabled: !availableBatchActions.includes(action), icon: , key: action, label: action, @@ -231,7 +177,7 @@ const FlatRunActionButton = ({ if (!isLastGroup) acc.push({ type: 'divider' }); return acc; }, []); - }, []); + }, [availableBatchActions]); return ( <> @@ -245,7 +191,7 @@ const FlatRunActionButton = ({ {batchAction && ( exp.unmanaged)} // TODO: is it needed for Runs? + isUnmanagedIncluded={selectedRuns.some((run) => run.experiment?.unmanaged ?? false)} onConfirm={() => submitBatchAction(batchAction)} /> )} diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 84463695548..22ab2ab6380 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1146,6 +1146,10 @@ export interface ExperimentPermissionsArgs { experiment: ProjectExperiment; } +export interface FlatRunPermissionsArgs { + flatRun: FlatRun; +} + export interface PermissionWorkspace { id: number; userId?: number; @@ -1253,3 +1257,14 @@ export interface FlatRunExperiment { export interface SearchFlatRunPagination extends WithPagination { runs: FlatRun[]; } + +export const FlatRunAction = { + Archive: 'Archive', + Delete: 'Delete', + Kill: 'Kill', + Move: 'Move', + // Pause: 'Pause', + Unarchive: 'Unarchive', +} as const; + +export type FlatRunAction = ValueOf; diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts new file mode 100644 index 00000000000..6375851fd24 --- /dev/null +++ b/webui/react/src/utils/flatRun.ts @@ -0,0 +1,72 @@ +import { deletableRunStates, killableRunStates, terminalRunStates } from 'constants/states'; +import { PermissionsHook } from 'hooks/usePermissions'; +import { FlatRun, FlatRunAction } from 'types'; + +type FlatRunChecker = (flatRun: FlatRun) => boolean; + +type FlatRunPermissionSet = Pick< + PermissionsHook, + 'canCreateExperiment' | 'canDeleteFlatRun' | 'canModifyExperiment' | 'canMoveFlatRun' +>; + +const flatRunCheckers: Record = { + [FlatRunAction.Archive]: (flatRun) => + !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + + [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), + + [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), + + [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + + // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), + + [FlatRunAction.Unarchive]: (flatRun) => + terminalRunStates.has(flatRun.state) && flatRun.parentArchived, +}; + +export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { + return flatRunCheckers[action](flatRun); +}; + +const getActionsForFlatRun = ( + flatRun: FlatRun, + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun) return []; // redundant, for clarity + const workspace = { id: flatRun.workspaceId }; + return targets + .filter((action) => canActionFlatRun(action, flatRun)) + .filter((action) => { + switch (action) { + case FlatRunAction.Delete: + return permissions.canDeleteFlatRun({ flatRun }); + + case FlatRunAction.Move: + return permissions.canMoveFlatRun({ flatRun }); + + case FlatRunAction.Archive: + case FlatRunAction.Unarchive: + return permissions.canModifyExperiment({ workspace }); + + case FlatRunAction.Kill: + return permissions.canModifyExperiment({ workspace }) && !flatRun.experiment?.unmanaged; + + default: + return true; + } + }); +}; + +export const getActionsForFlatRunsUnion = ( + flatRun: FlatRun[], + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun.length) return []; + const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); + return targets.filter((action) => + actionsForRuns.some((runActions) => runActions.includes(action)), + ); +}; From 0c6dc9cbaffd1648c42ef86493eeaff37c388dcf Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 17:28:07 -0700 Subject: [PATCH 074/161] feat: return `archived` for FlatRun --- harness/determined/common/api/bindings.py | 4 ++ master/internal/api_runs.go | 1 + proto/pkg/runv1/run.pb.go | 60 +++++++++++++--------- proto/src/determined/run/v1/run.proto | 5 +- webui/react/src/services/api-ts-sdk/api.ts | 6 +++ webui/react/src/services/apiConfig.ts | 15 +++--- webui/react/src/types.ts | 1 + webui/react/src/utils/flatRun.ts | 7 ++- 8 files changed, 64 insertions(+), 35 deletions(-) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index 52e3eb1edf6..dcc085d560f 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -4275,6 +4275,7 @@ class v1FlatRun(Printable): def __init__( self, *, + archived: bool, checkpointCount: int, checkpointSize: str, id: int, @@ -4295,6 +4296,7 @@ def __init__( summaryMetrics: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, userId: "typing.Union[int, None, Unset]" = _unset, ): + self.archived = archived self.checkpointCount = checkpointCount self.checkpointSize = checkpointSize self.id = id @@ -4327,6 +4329,7 @@ def __init__( @classmethod def from_json(cls, obj: Json) -> "v1FlatRun": kwargs: "typing.Dict[str, typing.Any]" = { + "archived": obj["archived"], "checkpointCount": obj["checkpointCount"], "checkpointSize": obj["checkpointSize"], "id": obj["id"], @@ -4360,6 +4363,7 @@ def from_json(cls, obj: Json) -> "v1FlatRun": def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out: "typing.Dict[str, typing.Any]" = { + "archived": self.archived, "checkpointCount": self.checkpointCount, "checkpointSize": self.checkpointSize, "id": self.id, diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 239b85b24ac..39b5bda15d1 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,6 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). + ColumnExpr("r.archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 7406eca7199..9816a359c85 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,6 +216,8 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` + // The archived status of this run + Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` } func (x *FlatRun) Reset() { @@ -383,6 +385,13 @@ func (x *FlatRun) GetExperiment() *FlatRunExperiment { return nil } +func (x *FlatRun) GetArchived() bool { + if x != nil { + return x.Archived + } + return false +} + var File_determined_run_v1_run_proto protoreflect.FileDescriptor var file_determined_run_v1_run_proto_rawDesc = []byte{ @@ -440,7 +449,7 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x70, 0x61, 0x63, 0x68, 0x79, 0x64, 0x65, 0x72, 0x6d, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xf9, 0x08, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0xa0, 0x09, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, @@ -493,29 +502,32 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x6e, 0x74, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x06, - 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x3a, - 0x9b, 0x01, 0x92, 0x41, 0x97, 0x01, 0x0a, 0x94, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, - 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0xd2, 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, - 0x01, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, - 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, - 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, - 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, - 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, - 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, - 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, - 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1a, 0x0a, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x3a, 0xa6, 0x01, 0x92, 0x41, + 0xa2, 0x01, 0x0a, 0x9f, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, 0x0a, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0xd2, + 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0a, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0xd2, 0x01, 0x08, 0x61, 0x72, 0x63, 0x68, + 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, + 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, + 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, + 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, + 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, + 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/proto/src/determined/run/v1/run.proto b/proto/src/determined/run/v1/run.proto index 62f4a54502f..6ea1b43e226 100644 --- a/proto/src/determined/run/v1/run.proto +++ b/proto/src/determined/run/v1/run.proto @@ -66,7 +66,8 @@ message FlatRun { "project_name", "workspace_id", "workspace_name", - "parent_archived" + "parent_archived", + "archived" ] } }; @@ -110,4 +111,6 @@ message FlatRun { bool parent_archived = 18; // Data related the the experiment associated with this run. optional FlatRunExperiment experiment = 19; + // The archived status of this run + bool archived = 20; } diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index a5f12afc19c..ff4613b3b9e 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3494,6 +3494,12 @@ export interface V1FlatRun { * @memberof V1FlatRun */ experiment?: V1FlatRunExperiment; + /** + * The archived status of this run + * @type {boolean} + * @memberof V1FlatRun + */ + archived: boolean; } /** * diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index 7c8c01d55f3..b782ac8f284 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1176,12 +1176,15 @@ export const moveRuns: DetApi detApi.Internal.moveRuns(params, options), }; -export const unarchiveRuns: DetApi = - { - name: 'unarchiveRuns', - postProcess: noOp, - request: (params, options) => detApi.Internal.unarchiveRuns(params, options), - }; +export const unarchiveRuns: DetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'unarchiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), +}; /* Tasks */ diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 22ab2ab6380..6f633247b19 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1237,6 +1237,7 @@ export interface FlatRun { projectName: string; workspaceId: number; workspaceName: string; + archived: boolean; parentArchived: boolean; experiment?: FlatRunExperiment; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6375851fd24..6c2aef34d5e 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,18 +11,17 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), - [FlatRunAction.Unarchive]: (flatRun) => - terminalRunStates.has(flatRun.state) && flatRun.parentArchived, + [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { From ed89b13d4a9279285bfa7fea53e8d89fb3c9ebf8 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 11:09:46 -0700 Subject: [PATCH 075/161] chore: minor changes --- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 3 +-- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 15 +++++---------- webui/react/src/utils/flatRun.ts | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index ee7130b4ddb..0413a0a35b3 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -126,6 +126,7 @@ const FlatRunActionButton = ({ title: `Partial ${action} Failure`, }); } + await onActionComplete?.(); } catch (e) { const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { @@ -134,8 +135,6 @@ const FlatRunActionButton = ({ publicSubject, silent: false, }); - } finally { - onActionComplete?.(); } }, [sendBatchActions, onActionSuccess, openToast, onActionComplete], diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index d76315d33e9..8425c37b528 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,7 +53,6 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; -import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -657,14 +656,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); - const onActionSuccess = useCallback( - // TODO: update this function - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (_action: BatchAction, _successfulIds: number[]) => { - handleSelectionChange('remove-all'); - }, - [handleSelectionChange], - ); + const onActionComplete = useCallback(async () => { + handleSelectionChange('remove-all'); + await fetchRuns(); + }, [fetchRuns, handleSelectionChange]); const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -954,7 +949,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} - onActionSuccess={onActionSuccess} + onActionComplete={onActionComplete} /> diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6c2aef34d5e..fb266d5c797 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,13 +11,13 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), + !flatRun.parentArchived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, + [FlatRunAction.Move]: (flatRun) => !flatRun.parentArchived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), From 9358bee96625164a321c267cfd51d1f61e59d241 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 15:15:43 -0700 Subject: [PATCH 076/161] test: `canActionFlatRun` test cases --- webui/react/src/constants/states.ts | 2 +- webui/react/src/utils/flatRun.test.ts | 218 ++++++++++++++++++++++++++ 2 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 webui/react/src/utils/flatRun.test.ts diff --git a/webui/react/src/constants/states.ts b/webui/react/src/constants/states.ts index c0cb4ab57e1..677c4477e99 100644 --- a/webui/react/src/constants/states.ts +++ b/webui/react/src/constants/states.ts @@ -65,7 +65,7 @@ export const terminalCommandStates: Set = new Set([ CommandState.Terminating, ]); -const runStateList = [ +export const runStateList = [ RunState.Canceled, RunState.Completed, RunState.Error, diff --git a/webui/react/src/utils/flatRun.test.ts b/webui/react/src/utils/flatRun.test.ts new file mode 100644 index 00000000000..3b7d97c29f7 --- /dev/null +++ b/webui/react/src/utils/flatRun.test.ts @@ -0,0 +1,218 @@ +import dayjs from 'dayjs'; + +import { + deletableRunStates, + killableRunStates, + runStateList, + terminalRunStates, +} from 'constants/states'; +import { FlatRun, FlatRunAction, RunState } from 'types'; +import { canActionFlatRun } from 'utils/flatRun'; + +describe('Flat Run Utilities', () => { + const BASE_FLAT_RUN: Readonly = { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }; + + describe('canActionFlatRun function', () => { + const terminatedRunStates: Set = new Set( + Object.values(RunState).filter((v) => terminalRunStates.has(v)), + ); + + describe('Archive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be archivable (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, flatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be archivable (%s)', + (terminatedRunState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, archivedFlatRun)).toBeFalsy(); + + // parentArchived and archived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, bothArchivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Unarchive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be unarchivable (%s)', + (terminatedRunState) => { + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeTruthy(); + + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, bothArchivedFlatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be unarchivable with Terminated Run State (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, parentArchivedFlatRun)).toBeFalsy(); + }, + ); + + it.each(Array.from(Object.values(RunState).filter((v) => !terminatedRunStates.has(v))))( + 'should not be unarchivable with non Terminated Run States (%s)', + (nonTerminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Delete Action', () => { + it.each(runStateList)('should be deletable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((state) => !deletableRunStates.has(state)))( + 'should not be deletable', + (nonDeletableRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonDeletableRunState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Kill Action', () => { + const killRunStates: Set = new Set( + Object.values(RunState).filter((v) => killableRunStates.includes(v)), + ); + + it.each(Array.from(killRunStates))('should be killable (%s)', (killRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: killRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((v) => !killRunStates.has(v)))( + 'should not be killable (%s)', + (nonKillRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonKillRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Move Action', () => { + it.each(Object.values(RunState))('should be movable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState))('should not be movable (%s)', (runState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, archivedFlatRun)).toBeFalsy(); + + // both archived and parentArchived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, bothArchivedFlatRun)).toBeFalsy(); + }); + }); + }); +}); From 75c0da6c6b0bab7151d9c33d6dd02161b782852b Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 11:49:57 -0700 Subject: [PATCH 077/161] chore: better type --- .../pages/FlatRuns/FlatRunActionButton.tsx | 4 ++-- webui/react/src/utils/flatRun.ts | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 0413a0a35b3..a1a650b836a 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -39,8 +39,8 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; - selectedRuns: FlatRun[]; - project: Project; + selectedRuns: ReadonlyArray>; + project: Readonly; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index fb266d5c797..8b52c9cb22c 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -2,7 +2,7 @@ import { deletableRunStates, killableRunStates, terminalRunStates } from 'consta import { PermissionsHook } from 'hooks/usePermissions'; import { FlatRun, FlatRunAction } from 'types'; -type FlatRunChecker = (flatRun: FlatRun) => boolean; +type FlatRunChecker = (flatRun: Readonly) => boolean; type FlatRunPermissionSet = Pick< PermissionsHook, @@ -24,15 +24,15 @@ const flatRunCheckers: Record = { [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; -export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { +export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly): boolean => { return flatRunCheckers[action](flatRun); }; const getActionsForFlatRun = ( - flatRun: FlatRun, - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: Readonly, + targets: ReadonlyArray, + permissions: Readonly, +): ReadonlyArray => { if (!flatRun) return []; // redundant, for clarity const workspace = { id: flatRun.workspaceId }; return targets @@ -59,10 +59,10 @@ const getActionsForFlatRun = ( }; export const getActionsForFlatRunsUnion = ( - flatRun: FlatRun[], - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: ReadonlyArray>, + targets: ReadonlyArray, + permissions: Readonly, +): Readonly => { if (!flatRun.length) return []; const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); return targets.filter((action) => From d4b1cfe49a925aa84fc3b0a76adefacf479560f2 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 12:18:04 -0700 Subject: [PATCH 078/161] test: `FlatRunActionButton` test --- .../FlatRuns/FlatRunActionButton.test.tsx | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx new file mode 100644 index 00000000000..9a9b1ba7aeb --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -0,0 +1,60 @@ +import { render, screen } from '@testing-library/react'; +import dayjs from 'dayjs'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; + +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; +import { FlatRun, Project, RunState, WorkspaceState } from 'types'; + +const setup = (selectedFlatRuns: ReadonlyArray>) => { + const project: Readonly = { + archived: false, + id: 1, + immutable: false, + name: 'proj', + notes: [], + state: WorkspaceState.Unspecified, + userId: 1, + workspaceId: 1, + }; + + render( + + + , + ); +}; + +describe('canActionFlatRun function', () => { + describe('Flat Run Action Button Visibility', () => { + it('should not be appeard without selected flat runs', () => { + setup([]); + expect(screen.queryByText('Actions')).not.toBeInTheDocument(); + }); + + it('should be appeard with selected flat runs', async () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + + setup(flatRuns); + expect(await screen.findByText('Actions')).toBeInTheDocument(); + }); + }); +}); From 3fe92dbbc2d3a6190f85d7f8c75c0c24978c845e Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 30 May 2024 09:59:52 -0700 Subject: [PATCH 079/161] fix: fix run `archived` logic in postgres --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 39b5bda15d1..ead375b705b 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,7 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived"). + ColumnExpr("r.archived OR e.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). From fe4454d9001dc4759d8a673628920375707cdb06 Mon Sep 17 00:00:00 2001 From: Ashton G Date: Mon, 3 Jun 2024 10:16:09 -0400 Subject: [PATCH 080/161] chore: run bulk action interstitial component (#9390) Co-authored-by: Keita Fish --- .../components/InterstitialModalComponent.tsx | 2 +- ...nFilterInterstitialModalComponent.test.tsx | 216 ++++++++++++++++++ .../RunFilterInterstitialModalComponent.tsx | 168 ++++++++++++++ .../RunMoveWarningModalComponent.test.tsx | 93 ++++++++ .../RunMoveWarningModalComponent.tsx | 54 +++++ webui/react/src/hooks/useTypedParams.test.tsx | 4 +- .../pages/TrialDetails/TrialDetailsLogs.tsx | 15 +- webui/react/src/setupTests.ts | 19 +- .../src/utils/mergeAbortControllers.test.ts | 87 +++++++ .../react/src/utils/mergeAbortControllers.ts | 20 ++ 10 files changed, 653 insertions(+), 25 deletions(-) create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.test.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.tsx create mode 100644 webui/react/src/utils/mergeAbortControllers.test.ts create mode 100644 webui/react/src/utils/mergeAbortControllers.ts diff --git a/webui/react/src/components/InterstitialModalComponent.tsx b/webui/react/src/components/InterstitialModalComponent.tsx index 0789b4a6b38..7eaff4c822e 100644 --- a/webui/react/src/components/InterstitialModalComponent.tsx +++ b/webui/react/src/components/InterstitialModalComponent.tsx @@ -6,7 +6,7 @@ import { useCallback, useEffect } from 'react'; export type onInterstitialCloseActionType = (reason: 'ok' | 'close' | 'failed') => void; interface Props { - onCloseAction: (reason: 'ok' | 'close' | 'failed') => void; + onCloseAction: onInterstitialCloseActionType; loadableData: Loadable; } diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx new file mode 100644 index 00000000000..3284273cdaf --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx @@ -0,0 +1,216 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { FilterFormSetWithoutId, FormField } from 'components/FilterForm/components/type'; +import RunFilterInterstitialModalComponent, { + CloseReason, + ControlledModalRef, + Props, +} from 'components/RunFilterInterstitialModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +vi.mock('services/api', async () => ({ + ...(await vi.importActual('services/api')), + searchRuns: vi.fn(() => + Promise.resolve({ + pagination: { + total: 0, + }, + }), + ), +})); + +const { searchRuns } = await import('services/api'); +const searchRunsMock = vi.mocked(searchRuns); + +const emptyFilterFormSetWithoutId: FilterFormSetWithoutId = { + filterGroup: { + children: [], + conjunction: 'or', + kind: 'group', + }, + showArchived: false, +}; + +const setupTest = (props: Partial = {}) => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunFilterInterstitialModalComponent', () => { + beforeEach(() => { + searchRunsMock.mockRestore(); + }); + + it('does not call server until opened', () => { + const { ref } = setupTest(); + + expect(searchRunsMock).not.toBeCalled(); + act(() => { + ref.current?.open(); + }); + expect(searchRunsMock).toBeCalled(); + }); + + it('calls server with filter describing filter selection', () => { + const expectedFilterGroup: FilterFormSetWithoutId['filterGroup'] = { + children: [ + { + columnName: 'experimentName', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator: 'contains', + type: 'COLUMN_TYPE_TEXT', + value: 'foo', + }, + ], + conjunction: 'and', + kind: 'group', + }; + const expectedExclusions = [1, 2, 3]; + const { ref } = setupTest({ + filterFormSet: { + filterGroup: expectedFilterGroup, + showArchived: true, + }, + selection: { + exclusions: expectedExclusions, + type: 'ALL_EXCEPT', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + // TODO: is there a better way to test this expectation? + expect(filterFormSet.showArchived).toBeTruthy(); + const [filterGroup, idFilterGroup] = filterFormSet.filterGroup.children?.[0].children || []; + expect(filterGroup).toEqual(expectedFilterGroup); + + const idFilters = idFilterGroup.children; + expect(idFilters.every((f: FormField) => f.operator === '!=')).toBeTruthy(); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedExclusions); + }); + + it('calls server with filter describing visual selection', () => { + const expectedSelection = [1, 2, 3]; + const { ref } = setupTest({ + selection: { + selections: expectedSelection, + type: 'ONLY_IN', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + expect(filterFormSet.showArchived).toBe(false); + const idFilters = filterFormSet.filterGroup.children?.[0].children || []; + expect(idFilters.every((f: FormField) => f.operator === '=')).toBe(true); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedSelection); + }); + + it('cancels request when modal is closed via close button', async () => { + searchRunsMock.mockImplementation((_params, options) => { + return new Promise((_resolve, reject) => { + options?.signal?.addEventListener('abort', () => { + reject(); + }); + }); + }); + const { ref } = setupTest(); + // explicit type here because typescript can't infer that the act function + // runs imperatively. + let lifecycle: Promise | undefined; + // we don't await the act because we need the render pipeline to flush + // before we get the close reason back + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('close'); + }); + + it('closes modal with has_search_runs when it has runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 1, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('has_search_runs'); + }); + + it('closes modal with no_search_runs when it lacks runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 0, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('no_search_runs'); + }); + + it('closes modal with failed when request errors outside of aborts', async () => { + searchRunsMock.mockImplementation(() => Promise.reject(new Error('uh oh!'))); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('failed'); + }); +}); diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx new file mode 100644 index 00000000000..a117b74202e --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx @@ -0,0 +1,168 @@ +import { useModal } from 'hew/Modal'; +import { Failed, NotLoaded } from 'hew/utils/loadable'; +import { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react'; + +import { FilterFormSetWithoutId, Operator } from 'components/FilterForm/components/type'; +import InterstitialModalComponent, { + onInterstitialCloseActionType, +} from 'components/InterstitialModalComponent'; +import { SelectionType } from 'components/Searches/Searches.settings'; +import { useAsync } from 'hooks/useAsync'; +import { searchRuns } from 'services/api'; +import { DetError } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; +import { observable } from 'utils/observable'; + +export type CloseReason = 'has_search_runs' | 'no_search_runs' | 'failed' | 'close' | 'manual'; + +export interface Props { + projectId?: number; + selection: SelectionType; + filterFormSet: FilterFormSetWithoutId; +} + +export interface ControlledModalRef { + open: () => Promise; + close: (reason?: CloseReason) => void; +} + +/** + * Modal component for checking selections for runs that are part of a search. + * is essentially a single purpose interstitial modal component. Because it + * wraps a modal and the intended use is within a user flow, this component does + * not use the `useModal` hook. instead, it exposes control via ref. the `open` + * method of the ref returns a promise that resolves when the modal is closed + * with the reason why the modal closed. + * + */ +export const RunFilterInterstitialModalComponent = forwardRef( + ({ projectId, selection, filterFormSet }: Props, ref): JSX.Element => { + const InterstitialModal = useModal(InterstitialModalComponent); + const [isOpen, setIsOpen] = useState(false); + const closeController = useRef(new AbortController()); + const lifecycleObservable = useRef(observable(null)); + + const { close: internalClose, open: internalOpen } = InterstitialModal; + + const open = async () => { + internalOpen(); + setIsOpen(true); + const closeReason = await lifecycleObservable.current.toPromise(); + if (closeReason === null) { + // this promise should never reject -- toPromise only resolves when the + // value changes, and no code sets the observavble to null + return Promise.reject(); + } + return closeReason; + }; + + const close = useCallback( + (reason: CloseReason = 'manual') => { + setIsOpen(false); + // encourage render with isOpen to false before closing to prevent + // firing onCloseAction twice + setTimeout(() => internalClose('close'), 0); + closeController.current.abort(); + closeController.current = new AbortController(); + lifecycleObservable.current.set(reason); + lifecycleObservable.current = observable(null); + }, + [internalClose], + ); + + useImperativeHandle(ref, () => ({ close, open })); + + const selectionHasSearchRuns = useAsync( + async (canceler) => { + if (!isOpen) return NotLoaded; + const mergedCanceler = mergeAbortControllers(canceler, closeController.current); + const idToFilter = (operator: Operator, id: number) => + ({ + columnName: 'id', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator, + type: 'COLUMN_TYPE_NUMBER', + value: id, + }) as const; + const filterGroup: FilterFormSetWithoutId['filterGroup'] = + selection.type === 'ALL_EXCEPT' + ? { + children: [ + filterFormSet.filterGroup, + { + children: selection.exclusions.map(idToFilter.bind(this, '!=')), + conjunction: 'and', + kind: 'group', + }, + ], + conjunction: 'and', + kind: 'group', + } + : { + children: selection.selections.map(idToFilter.bind(this, '=')), + conjunction: 'or', + kind: 'group', + }; + const filter: FilterFormSetWithoutId = { + ...filterFormSet, + filterGroup: { + children: [ + filterGroup, + { + columnName: 'numTrials', + kind: 'field', + location: 'LOCATION_TYPE_EXPERIMENT', + operator: '>', + type: 'COLUMN_TYPE_NUMBER', + value: 1, + } as const, + ], + conjunction: 'and', + kind: 'group', + }, + }; + try { + const results = await searchRuns( + { + filter: JSON.stringify(filter), + limit: 0, + projectId, + }, + { signal: mergedCanceler.signal }, + ); + + return (results.pagination.total || 0) > 0; + } catch (e) { + if (!mergedCanceler.signal.aborted) { + return Failed(e instanceof Error ? e : new DetError(e)); + } + return NotLoaded; + } + }, + [selection, filterFormSet, projectId, isOpen], + ); + + const interstitialClose: onInterstitialCloseActionType = useCallback( + (reason) => { + if (reason === 'ok') { + return selectionHasSearchRuns.forEach((bool) => { + const fixedReason = bool ? 'has_search_runs' : 'no_search_runs'; + close(fixedReason); + }); + } + close(reason); + }, + [close, selectionHasSearchRuns], + ); + + return ( + + ); + }, +); + +export default RunFilterInterstitialModalComponent; diff --git a/webui/react/src/components/RunMoveWarningModalComponent.test.tsx b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx new file mode 100644 index 00000000000..8847538b527 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx @@ -0,0 +1,93 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { + CloseReason, + RunMoveWarningFlowRef, + RunMoveWarningModalComponent, +} from 'components/RunMoveWarningModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +const setupTest = () => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunMoveWarningModalComponent', () => { + it('is not shown until opened', () => { + const { ref } = setupTest(); + + expect(screen.queryByText('Move Run Dependency Alert')).toBeNull(); + act(() => { + ref.current?.open(); + }); + expect(screen.queryByText('Move Run Dependency Alert')).not.toBeNull(); + }); + + it('closes modal with cancel when closed with the x button', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with cancel when cancel button is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const cancelButton = await screen.findByText('Cancel'); + await userEvent.click(cancelButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with ok when submit is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const okayButton = await screen.findByText('Move independent runs'); + await userEvent.click(okayButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('ok'); + }); + + it('closes modal with manual when manually closed with no arg', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + act(() => { + ref.current?.close(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('manual'); + }); +}); diff --git a/webui/react/src/components/RunMoveWarningModalComponent.tsx b/webui/react/src/components/RunMoveWarningModalComponent.tsx new file mode 100644 index 00000000000..3a2d0086e20 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.tsx @@ -0,0 +1,54 @@ +import { Modal, useModal } from 'hew/Modal'; +import { observable, WritableObservable } from 'micro-observables'; +import { forwardRef, useImperativeHandle, useRef } from 'react'; + +export type CloseReason = 'ok' | 'cancel' | 'manual'; + +import handleError from 'utils/error'; + +type RunMoveWarningProps = { + onClose: (reason: 'ok' | 'cancel') => void; +}; +const RunMoveWarningCopy = ({ onClose }: RunMoveWarningProps) => ( + onClose('ok'), text: 'Move independent runs' }} + title="Move Run Dependency Alert" + onClose={() => onClose('cancel')}> + Some runs you are trying to move belong to a Hyperparameter Search and cannot be moved + independently to maintain their contextual relationships. These runs will be skipped. + +); + +export type RunMoveWarningFlowRef = { + open: () => Promise; + close: () => void; +}; + +export const RunMoveWarningModalComponent = forwardRef((_, ref) => { + const RunMoveWarning = useModal(RunMoveWarningCopy); + const closeReason = useRef>(observable(null)); + + const { close: internalClose, open: internalOpen } = RunMoveWarning; + + const open = async () => { + internalOpen(); + const reason = await closeReason.current.toPromise(); + if (reason === null) { + return Promise.reject(); + } + return reason; + }; + + const close = (reason: CloseReason = 'manual') => { + internalClose(reason); + closeReason.current.set(reason); + closeReason.current = observable(null); + }; + + useImperativeHandle(ref, () => ({ close, open })); + + return ; +}); + +export default RunMoveWarningModalComponent; diff --git a/webui/react/src/hooks/useTypedParams.test.tsx b/webui/react/src/hooks/useTypedParams.test.tsx index 054c5aecdb9..dadaf631d7e 100644 --- a/webui/react/src/hooks/useTypedParams.test.tsx +++ b/webui/react/src/hooks/useTypedParams.test.tsx @@ -174,8 +174,8 @@ describe('useTypedParams', () => { .afterEach(() => navSpy.mockClear()), ); }); - it('does not update if params are not changed', () => { - fc.assert( + it('does not update if params are not changed', async () => { + await fc.assert( fc .asyncProperty(sameArbPartial, async ([params, partial]) => { const { hookRef } = setupTest(params); diff --git a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx index e75b75c99c7..8f93518fb7c 100644 --- a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx +++ b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx @@ -16,6 +16,7 @@ import { readStream } from 'services/utils'; import { ExperimentBase, TrialDetails } from 'types'; import { downloadTrialLogs } from 'utils/browser'; import handleError, { ErrorType } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; import css from './TrialDetailsLogs.module.scss'; @@ -26,20 +27,6 @@ export interface Props { type OrderBy = 'ORDER_BY_UNSPECIFIED' | 'ORDER_BY_ASC' | 'ORDER_BY_DESC'; -const mergeAbortControllers = (...controllers: AbortController[]) => { - const mergedController = new AbortController(); - - controllers.forEach((c) => { - const abort = () => { - mergedController.abort(); - c.signal.removeEventListener('abort', abort); - }; - c.signal.addEventListener('abort', abort); - }); - - return mergedController; -}; - const TrialDetailsLogs: React.FC = ({ experiment, trial }: Props) => { const { ui } = useUI(); const [filterOptions, setFilterOptions] = useState({}); diff --git a/webui/react/src/setupTests.ts b/webui/react/src/setupTests.ts index fe8c871c9f7..b8b22e32f0b 100644 --- a/webui/react/src/setupTests.ts +++ b/webui/react/src/setupTests.ts @@ -6,20 +6,23 @@ */ import '@testing-library/jest-dom/extend-expect'; import 'micro-observables/batchingForReactDom'; -import 'utils/prototypes'; import 'whatwg-fetch'; import Schema from 'async-validator'; -import { noOp } from 'utils/service'; +// this code doesn't work in node environments +if (globalThis.window) { + await import('utils/prototypes'); + const { noOp } = await import('utils/service'); -/** - * To clean up the async-validator console warning that get generated during testing. - * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning - */ -Schema.warning = noOp; + /** + * To clean up the async-validator console warning that get generated during testing. + * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning + */ + Schema.warning = noOp; +} -Object.defineProperty(window, 'matchMedia', { +Object.defineProperty(globalThis, 'matchMedia', { value: () => ({ addEventListener: vi.fn(), addListener: vi.fn(), // deprecated diff --git a/webui/react/src/utils/mergeAbortControllers.test.ts b/webui/react/src/utils/mergeAbortControllers.test.ts new file mode 100644 index 00000000000..51308bac61f --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.test.ts @@ -0,0 +1,87 @@ +// @vitest-environment node +// we're using node because the jsdom version of the abortcontroller doesn't have reasons on abortsignals +import fc from 'fast-check'; +import { zip } from 'lodash'; + +import { mergeAbortControllers } from 'utils/mergeAbortControllers'; + +// arbitrary to generate a list of abort controllers to pass to mergeAbortControllers +const argArb = fc.uniqueArray( + fc.constant(() => new AbortController()).map((f) => f()), + { minLength: 1 }, +); + +// return a subset of the above to control +const argArbWithSelection = (n?: number) => + argArb.chain((arr) => + fc.tuple(fc.constant(arr), fc.shuffledSubarray(arr, { maxLength: n, minLength: 1 })), + ); + +// the above, but the subset from the above returns with unique reason values to +// verify which abortController was the first to abort +const argArbWithSelectionAndReasons = (n?: number) => + argArbWithSelection(n).chain(([args, selection]) => { + const reasonsArb = fc.uniqueArray(fc.anything(), { + maxLength: selection.length, + minLength: selection.length, + }); + const selectionAndReasonArb = reasonsArb + .map((reasons) => zip(selection, reasons)) + .filter((tups): tups is [AbortController, unknown][] => + tups.every((tup) => tup.every((c) => c !== undefined)), + ); + + return fc.tuple(fc.constant(args), selectionAndReasonArb); + }); + +describe('mergeAbortControllers', () => { + it('merged abort controller aborts if any constituent aborts', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(); + expect(result.signal.aborted).toBe(true); + }), + ); + }); + it('merged abort controller aborts with constituent reason', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(1), ([args, abortControllers]) => { + const [[abortController, reason]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(reason); + expect(abortController.signal.reason).toBe(reason); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); + it('merged abort controller only reflects the first abort', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(), ([args, abortControllers]) => { + const [[firstAbortController]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortControllers.forEach(([abortController, reason]) => { + abortController.abort(reason); + }); + expect(result.signal.reason).toBe(firstAbortController.signal.reason); + }), + ); + }); + + it('merging an aborted controller results in an aborted controller', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + abortController.abort(); + const result = mergeAbortControllers(...args); + + expect(result.signal.aborted).toBe(true); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); +}); diff --git a/webui/react/src/utils/mergeAbortControllers.ts b/webui/react/src/utils/mergeAbortControllers.ts new file mode 100644 index 00000000000..98004fe3100 --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.ts @@ -0,0 +1,20 @@ +export const mergeAbortControllers = (...controllers: AbortController[]): AbortController => { + const mergedController = new AbortController(); + + controllers.forEach((c) => { + // resulting controller is aborted, just ignore the rest + if (mergedController.signal.aborted) return; + // preemptively abort if the signal's already aborted + if (c.signal.aborted) return mergedController.abort(c.signal.reason); + + const abort = () => { + mergedController.abort(c.signal.reason); + c.signal.removeEventListener('abort', abort); + }; + c.signal.addEventListener('abort', abort); + }); + + return mergedController; +}; + +export default mergeAbortControllers; From 9d428db1669298bae0eb1dcfbe156d8d4f8f97a5 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 11:02:29 -0700 Subject: [PATCH 081/161] chore: feedback --- .../pages/FlatRuns/FlatRunActionButton.test.tsx | 15 ++------------- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 10 +++++----- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 9a9b1ba7aeb..166fcd77d1b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -3,25 +3,14 @@ import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; -import { FlatRun, Project, RunState, WorkspaceState } from 'types'; +import { FlatRun, RunState } from 'types'; const setup = (selectedFlatRuns: ReadonlyArray>) => { - const project: Readonly = { - archived: false, - id: 1, - immutable: false, - name: 'proj', - notes: [], - state: WorkspaceState.Unspecified, - userId: 1, - workspaceId: 1, - }; - render( diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index a1a650b836a..e78658dcefa 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -8,7 +8,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; -import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; @@ -40,7 +40,7 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; - project: Readonly; + projectId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -48,7 +48,7 @@ interface Props { const FlatRunActionButton = ({ isMobile, selectedRuns, - project, + projectId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { @@ -63,7 +63,7 @@ const FlatRunActionButton = ({ .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { - projectId: project.id, + projectId, runIds: validRunIds, }; switch (action) { @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [project.id, selectedRuns], + [projectId, selectedRuns], ); const submitBatchAction = useCallback( diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 8425c37b528..460bc0b5ad2 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -947,7 +947,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { /> From 745089effd779f36e561394be3dff5f370ca3207 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 16:11:38 -0700 Subject: [PATCH 082/161] feat: basic move action --- .../FlatRuns/FlatRunActionButton.test.tsx | 1 + .../pages/FlatRuns/FlatRunActionButton.tsx | 19 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 194 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 4 +- webui/react/src/pages/ProjectDetails.tsx | 2 +- webui/react/src/pages/SearchDetails.tsx | 6 +- webui/react/src/services/api.ts | 8 +- webui/react/src/services/apiConfig.ts | 8 +- 8 files changed, 227 insertions(+), 15 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 166fcd77d1b..25beefaa41e 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -12,6 +12,7 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { isMobile={false} projectId={1} selectedRuns={selectedFlatRuns} + workspaceId={1} onActionComplete={vi.fn()} /> , diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index e78658dcefa..b3929b0ae00 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -7,6 +7,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; +import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; @@ -14,24 +15,20 @@ import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; const BATCH_ACTIONS = [ - // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; type BatchAction = (typeof BATCH_ACTIONS)[number]; const ACTION_ICONS: Record = { - // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', [ExperimentAction.Kill]: 'cancelled', - // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -41,6 +38,7 @@ interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; projectId: number; + workspaceId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -49,12 +47,15 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + workspaceId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); const permissions = usePermissions(); const { openToast } = useToast(); + const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = + useModal(FlatRunMoveModalComponent); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( @@ -68,8 +69,7 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - break; + return flatRunMoveModalOpen(); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [projectId, selectedRuns], + [flatRunMoveModalOpen, projectId, selectedRuns], ); const submitBatchAction = useCallback( @@ -194,6 +194,11 @@ const FlatRunActionButton = ({ onConfirm={() => submitBatchAction(batchAction)} /> )} + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx new file mode 100644 index 00000000000..87d449e6bb8 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -0,0 +1,194 @@ +import Form from 'hew/Form'; +import Icon from 'hew/Icon'; +import { Modal } from 'hew/Modal'; +import Select, { Option } from 'hew/Select'; +import Spinner from 'hew/Spinner'; +import { useToast } from 'hew/Toast'; +import { Label } from 'hew/Typography'; +import { Loadable } from 'hew/utils/loadable'; +import { List } from 'immutable'; +import { useObservable } from 'micro-observables'; +import React, { useEffect, useId } from 'react'; + +import Link from 'components/Link'; +import usePermissions from 'hooks/usePermissions'; +import { paths } from 'routes/utils'; +import { moveRuns } from 'services/api'; +import projectStore from 'stores/projects'; +import workspaceStore from 'stores/workspaces'; +import { FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { pluralizer } from 'utils/string'; + +const FORM_ID = 'move-flat-run-form'; + +type FormInputs = { + projectId?: number; + workspaceId?: number; +}; + +interface Props { + flatRuns: Readonly[]; + onSubmit?: (successfulIds?: number[]) => void; + sourceProjectId: number; + sourceWorkspaceId?: number; +} + +const FlatRunMoveModalComponent: React.FC = ({ + flatRuns, + onSubmit, + sourceProjectId, + sourceWorkspaceId, +}: Props) => { + const idPrefix = useId(); + const { openToast } = useToast(); + const [form] = Form.useForm(); + const workspaceId = Form.useWatch('workspaceId', form); + const projectId = Form.useWatch('projectId', form); + + const { canMoveExperimentsTo } = usePermissions(); + const workspaces = Loadable.getOrElse([], useObservable(workspaceStore.unarchived)).filter((w) => + canMoveExperimentsTo({ destination: { id: w.id } }), + ); + const loadableProjects: Loadable> = useObservable( + projectStore.getProjectsByWorkspace(workspaceId), + ); + + useEffect(() => { + if (workspaceId !== undefined) { + projectStore.fetch(workspaceId, undefined, true); + } + }, [workspaceId]); + + const handleSubmit = async () => { + if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { + openToast({ title: 'No changes to save.' }); + return; + } + const values = await form.validateFields(); + const projId = values.projectId ?? 1; + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); + + onSubmit?.(results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + }; + + return ( + +
+ + + + {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} +
+
+ ); +}; + +export default FlatRunMoveModalComponent; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 460bc0b5ad2..ec09bb43108 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -100,6 +100,7 @@ const formStore = new FilterFormStore(); interface Props { projectId: number; + workspaceId: number; searchId?: number; } @@ -118,7 +119,7 @@ const parseSortString = (sortString: string): Sort[] => { }); }; -const FlatRuns: React.FC = ({ projectId, searchId }) => { +const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const dataGridRef = useRef(null); const contentRef = useRef(null); const [searchParams, setSearchParams] = useSearchParams(); @@ -949,6 +950,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} projectId={projectId} selectedRuns={selectedRuns} + workspaceId={workspaceId} onActionComplete={onActionComplete} /> diff --git a/webui/react/src/pages/ProjectDetails.tsx b/webui/react/src/pages/ProjectDetails.tsx index 3274b4f5d7f..de9e15815f1 100644 --- a/webui/react/src/pages/ProjectDetails.tsx +++ b/webui/react/src/pages/ProjectDetails.tsx @@ -94,7 +94,7 @@ const ProjectDetails: React.FC = () => { children: (
- +
), diff --git a/webui/react/src/pages/SearchDetails.tsx b/webui/react/src/pages/SearchDetails.tsx index 369003a4c2e..f9a66783f1e 100644 --- a/webui/react/src/pages/SearchDetails.tsx +++ b/webui/react/src/pages/SearchDetails.tsx @@ -138,7 +138,11 @@ const SearchDetails: React.FC = () => { const tabItems: PivotProps['items'] = [ { children: experiment?.projectId && ( - + ), key: TabType.Trials, label: 'Trials', diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 39acbb16325..561101669bf 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -771,9 +771,11 @@ export const killRuns = generateDetApi( - Config.moveRuns, -); +export const moveRuns = generateDetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +>(Config.moveRuns); export const unarchiveRuns = generateDetApi< Api.V1UnarchiveRunsRequest, diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index b782ac8f284..fd92b846f39 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1170,9 +1170,13 @@ export const killRuns: DetApi detApi.Internal.killRuns(params, options), }; -export const moveRuns: DetApi = { +export const moveRuns: DetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +> = { name: 'moveRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.moveRuns(params, options), }; From eb917e1ce84d62e26683a1b440e3ba346f1d9b59 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 17:13:24 -0700 Subject: [PATCH 083/161] feat: move warning modal --- .../FilterForm/components/FilterFormStore.ts | 21 ++ .../FlatRuns/FlatRunActionButton.test.tsx | 5 + .../pages/FlatRuns/FlatRunActionButton.tsx | 8 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 286 +++++++++++------- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 + 5 files changed, 206 insertions(+), 116 deletions(-) diff --git a/webui/react/src/components/FilterForm/components/FilterFormStore.ts b/webui/react/src/components/FilterForm/components/FilterFormStore.ts index b04658d53f0..e27c7c457b4 100644 --- a/webui/react/src/components/FilterForm/components/FilterFormStore.ts +++ b/webui/react/src/components/FilterForm/components/FilterFormStore.ts @@ -74,6 +74,27 @@ export class FilterFormStore { ); } + public get filterFormSetWithoutId(): Observable { + const replacer = (key: string, value: unknown): unknown => { + return key === 'id' ? undefined : value; + }; + return this.#formset.select((loadableFormset) => + Loadable.match(loadableFormset, { + _: () => ({ + filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, + showArchived: true, + }), + Loaded: (formset) => { + const sweepedForm = this.#sweepInvalid(structuredClone(formset.filterGroup)); + const newFormSet: FilterFormSetWithoutId = JSON.parse( + JSON.stringify({ ...formset, filterGroup: sweepedForm }, replacer), + ); + return newFormSet; + }, + }), + ); + } + public get fieldCount(): Observable { return this.getFieldCount(); } diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 25beefaa41e..b02bfaf216d 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Conjunction, FormKind } from 'components/FilterForm/components/type'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; @@ -9,6 +10,10 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { render( >; projectId: number; workspaceId: number; + filterFormSetWithoutId: FilterFormSetWithoutId; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -47,6 +49,7 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + filterFormSetWithoutId, workspaceId, onActionSuccess, onActionComplete, @@ -69,7 +72,8 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - return flatRunMoveModalOpen(); + flatRunMoveModalOpen(); + break; case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -195,9 +199,11 @@ const FlatRunActionButton = ({ /> )} ); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 87d449e6bb8..1c6c5ebc3de 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -8,9 +8,16 @@ import { Label } from 'hew/Typography'; import { Loadable } from 'hew/utils/loadable'; import { List } from 'immutable'; import { useObservable } from 'micro-observables'; -import React, { useEffect, useId } from 'react'; +import React, { Ref, useCallback, useEffect, useId, useRef } from 'react'; +import { FilterFormSetWithoutId } from 'components/FilterForm/components/type'; import Link from 'components/Link'; +import RunFilterInterstitialModalComponent, { + ControlledModalRef, +} from 'components/RunFilterInterstitialModalComponent'; +import RunMoveWarningModalComponent, { + RunMoveWarningFlowRef, +} from 'components/RunMoveWarningModalComponent'; import usePermissions from 'hooks/usePermissions'; import { paths } from 'routes/utils'; import { moveRuns } from 'services/api'; @@ -29,17 +36,23 @@ type FormInputs = { interface Props { flatRuns: Readonly[]; - onSubmit?: (successfulIds?: number[]) => void; sourceProjectId: number; sourceWorkspaceId?: number; + filterFormSetWithoutId: FilterFormSetWithoutId; + onSubmit?: (successfulIds?: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunMoveModalComponent: React.FC = ({ flatRuns, - onSubmit, + filterFormSetWithoutId, sourceProjectId, sourceWorkspaceId, + onSubmit, + onActionComplete, }: Props) => { + const controlledModalRef: Ref = useRef(null); + const runMoveWarningFlowRef: Ref = useRef(null); const idPrefix = useId(); const { openToast } = useToast(); const [form] = Form.useForm(); @@ -60,7 +73,7 @@ const FlatRunMoveModalComponent: React.FC = ({ } }, [workspaceId]); - const handleSubmit = async () => { + const handleSubmit = useCallback(async () => { if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { openToast({ title: 'No changes to save.' }); return; @@ -68,126 +81,169 @@ const FlatRunMoveModalComponent: React.FC = ({ const values = await form.validateFields(); const projId = values.projectId ?? 1; - const results = await moveRuns({ - destinationProjectId: projId, - runIds: flatRuns.map((flatRun) => flatRun.id), - sourceProjectId, - }); + try { + const closeReason = (await controlledModalRef.current?.open()) ?? 'failed'; + switch (closeReason) { + case 'has_search_runs': { + const closeWarningReason = await runMoveWarningFlowRef.current?.open(); + if (closeWarningReason === 'cancel') { + openToast({ title: 'Cancelled Move Action' }); + return; + } + break; + } + case 'no_search_runs': + break; + case 'manual': + case 'failed': + case 'close': + openToast({ title: 'Cancelled Move Action' }); + return; + } + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); - onSubmit?.(results.successful); + onSubmit?.(results.successful); - const numSuccesses = results.successful.length; - const numFailures = results.failed.length; + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; - const destinationProjectName = - Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? - ''; + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; - if (numSuccesses === 0 && numFailures === 0) { - openToast({ - description: 'No selected runs were eligible for moving', - title: 'No eligible runs', - }); - } else if (numFailures === 0) { - openToast({ - closeable: true, - description: `${results.successful.length} runs moved to project ${destinationProjectName}`, - link: View Project, - title: 'Move Success', - }); - } else if (numSuccesses === 0) { - openToast({ - description: `Unable to move ${numFailures} runs`, - severity: 'Warning', - title: 'Move Failure', - }); - } else { - openToast({ - closeable: true, - description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, - link: View Project, - severity: 'Warning', - title: 'Partial Move Failure', - }); + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + await onActionComplete?.(); + } catch (e) { + handleError(e, { publicSubject: 'Unable to move runs' }); } - form.resetFields(); - }; + }, [ + flatRuns, + form, + loadableProjects, + onActionComplete, + onSubmit, + openToast, + projectId, + sourceProjectId, + sourceWorkspaceId, + workspaceId, + ]); return ( - -
- - - - {workspaceId && workspaceId !== 1 && ( + <> + + - {Loadable.match(loadableProjects, { - Failed: () =>
Failed to load
, - Loaded: (loadableProjects) => ( - - ), - NotLoaded: () => , - })} + initialValue={sourceWorkspaceId ?? 1} + label="Workspace" + name="workspaceId" + rules={[{ message: 'Workspace is required', required: true }]}> +
- )} - -
+ {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} + +
+ + flatRun.id), type: 'ONLY_IN' }} + /> + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ec09bb43108..75f2c381925 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -162,6 +162,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const sortString = useMemo(() => makeSortString(sorts.filter(validSort.is)), [sorts]); const loadableFormset = useObservable(formStore.formset); const filtersString = useObservable(formStore.asJsonString); + const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [total, setTotal] = useState>(NotLoaded); const isMobile = useMobile(); const [isLoading, setIsLoading] = useState(true); @@ -947,6 +948,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { onRowHeightChange={onRowHeightChange} /> Date: Wed, 5 Jun 2024 15:39:12 -0700 Subject: [PATCH 084/161] fix: feedback --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 1c6c5ebc3de..5acbd0f3b68 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -40,7 +40,7 @@ interface Props { sourceWorkspaceId?: number; filterFormSetWithoutId: FilterFormSetWithoutId; onSubmit?: (successfulIds?: number[]) => void; - onActionComplete?: () => Promise; + onActionComplete?: () => void; } const FlatRunMoveModalComponent: React.FC = ({ From e01184a9c7adb604ecb645c9b2a87495ee65c776 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 5 Jun 2024 15:42:35 -0700 Subject: [PATCH 085/161] fix: unarchive behavior --- master/internal/api_runs.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index ead375b705b..767fcaf2791 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -33,6 +33,7 @@ import ( type runCandidateResult struct { Archived bool + ExpArchived bool ID int32 ExpID *int32 IsMultitrial bool @@ -139,7 +140,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived OR e.archived AS archived"). + ColumnExpr("r.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). @@ -692,6 +693,7 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, Model(&runCandidates). Column("r.id"). Column("r.archived"). + ColumnExpr("e.archived AS exp_archived"). ColumnExpr("r.experiment_id as exp_id"). ColumnExpr("false as is_multitrial"). ColumnExpr("r.state IN (?) AS is_terminal", bun.In(model.StatesToStrings(model.TerminalStates))). @@ -727,6 +729,11 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, for _, cand := range runCandidates { visibleIDs.Insert(cand.ID) switch { + case cand.ExpArchived: + results = append(results, &apiv1.RunActionResult{ + Error: "Parent is archived.", + Id: cand.ID, + }) case cand.Archived && archive: results = append(results, &apiv1.RunActionResult{ Error: "", From 786301b3f0466f239933adc5707cdecbbe10f906 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 5 Jun 2024 16:01:54 -0700 Subject: [PATCH 086/161] fix: minor fixes --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 5acbd0f3b68..b7715a5452b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -205,7 +205,6 @@ const FlatRunMoveModalComponent: React.FC = ({ {workspaceId && workspaceId !== 1 && ( From 1e529fa3d8e252370d26662105df7a6ab3f9eb43 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 6 Jun 2024 22:53:33 -0700 Subject: [PATCH 087/161] fix: archive/unarchive error text fix --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 767fcaf2791..21439127136 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -731,7 +731,7 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, switch { case cand.ExpArchived: results = append(results, &apiv1.RunActionResult{ - Error: "Parent is archived.", + Error: "Run is part of archived Search.", Id: cand.ID, }) case cand.Archived && archive: From fa0c8e1f8f8cb643105410ba9b0bffa7d8b2aaa7 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 01:03:31 -0700 Subject: [PATCH 088/161] test: `FlatRunMoveModal` --- .../FlatRuns/FlatRunActionButton.test.tsx | 51 +++++++--- .../pages/FlatRuns/FlatRunMoveModal.test.tsx | 98 +++++++++++++++++++ 2 files changed, 133 insertions(+), 16 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index b02bfaf216d..bf62f069710 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -1,4 +1,5 @@ import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; @@ -7,6 +8,8 @@ import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; const setup = (selectedFlatRuns: ReadonlyArray>) => { + const user = userEvent.setup(); + render( >) => { /> , ); + + return { + user, + }; }; describe('canActionFlatRun function', () => { describe('Flat Run Action Button Visibility', () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + it('should not be appeard without selected flat runs', () => { setup([]); expect(screen.queryByText('Actions')).not.toBeInTheDocument(); }); it('should be appeard with selected flat runs', async () => { - const flatRuns: ReadonlyArray> = [ - { - archived: false, - checkpointCount: 0, - checkpointSize: 0, - id: 1, - parentArchived: false, - projectId: 1, - projectName: 'test', - startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), - state: RunState.Active, - workspaceId: 10, - workspaceName: 'test', - }, - ]; - setup(flatRuns); expect(await screen.findByText('Actions')).toBeInTheDocument(); }); + + it('should show action list', async () => { + const { user } = setup(flatRuns); + + const actionButton = await screen.findByText('Actions'); + await user.click(actionButton); + expect(await screen.findByText('Move')).toBeInTheDocument(); + expect(await screen.findByText('Archive')).toBeInTheDocument(); + expect(await screen.findByText('Unarchive')).toBeInTheDocument(); + expect(await screen.findByText('Delete')).toBeInTheDocument(); + expect(await screen.findByText('Kill')).toBeInTheDocument(); + }); }); }); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx new file mode 100644 index 00000000000..d9b48dee593 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx @@ -0,0 +1,98 @@ +import { render, screen } from '@testing-library/react'; +import userEvent, { UserEvent } from '@testing-library/user-event'; +import dayjs from 'dayjs'; +import Button from 'hew/Button'; +import { useModal } from 'hew/Modal'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { useMemo } from 'react'; + +import { + Conjunction, + FilterFormSetWithoutId, + FormKind, +} from 'components/FilterForm/components/type'; +import { V1MoveRunsRequest } from 'services/api-ts-sdk'; +import { FlatRun, RunState } from 'types'; + +import FlatRunMoveModalComponent from './FlatRunMoveModal'; + +const OPEN_MODAL_TEXT = 'Open Modal'; + +vi.mock('services/api', () => ({ + createGroup: vi.fn(), + getWorkspaceProjects: vi.fn(() => + Promise.resolve({ projects: [{ id: 1, name: 'project_1', workspaceId: 1 }] }), + ), + moveRuns: (params: V1MoveRunsRequest) => { + return Promise.resolve({ + failed: [], + successful: params.runIds, + }); + }, +})); + +const Container = (): JSX.Element => { + const BASE_FLAT_RUNS: FlatRun[] = useMemo(() => { + return [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + }, []); + + const filterFormSetWithoutId: FilterFormSetWithoutId = useMemo(() => { + return { + filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, + showArchived: false, + }; + }, []); + + const flatRunMoveModal = useModal(FlatRunMoveModalComponent); + + return ( +
+ + +
+ ); +}; + +const setup = (): { user: UserEvent } => { + const user = userEvent.setup(); + + render( + + + , + ); + + return { + user, + }; +}; + +describe('FlatRunMoveModalComponent', () => { + it('should open modal', async () => { + const { user } = setup(); + + await user.click(screen.getByRole('button', { name: OPEN_MODAL_TEXT })); + expect((await screen.findAllByText('Move Runs')).length).toBe(2); + expect(await screen.findByText('Workspace')).toBeInTheDocument(); + expect(await screen.findByRole('button', { name: 'Cancel' })).toBeInTheDocument(); + expect(await screen.findByRole('button', { name: 'Move Runs' })).toBeInTheDocument(); + }); +}); From 6f1b9a0ad063268877876a9e4954638cca39c3db Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 11:37:40 -0700 Subject: [PATCH 089/161] test: ignore `bindings.py` for codecov --- codecov.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/codecov.yml b/codecov.yml index d1fd2e00b0e..5d293f5f733 100644 --- a/codecov.yml +++ b/codecov.yml @@ -12,16 +12,16 @@ coverage: backend: target: 42% threshold: 3% - flags: + flags: - backend informational: false - patch: + patch: default: informational: true - backend: + backend: target: 80% threshold: 5% - flags: + flags: - backend informational: false only_pulls: true @@ -29,14 +29,17 @@ coverage: flags: backend: carryforward: true - + github_checks: annotations: false -comment: +comment: layout: "diff, flags, files" behavior: default parsers: go: partials_as_hits: true + +ignore: + - "harness/determined/common/api/bindings.py" From 75d317a06b30495ae938f79f00700d7f092bf652 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 12:48:12 -0700 Subject: [PATCH 090/161] test: backend test --- master/internal/api_runs_intg_test.go | 74 +++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/master/internal/api_runs_intg_test.go b/master/internal/api_runs_intg_test.go index 15b7745e4ee..3fcd9ca359b 100644 --- a/master/internal/api_runs_intg_test.go +++ b/master/internal/api_runs_intg_test.go @@ -18,6 +18,7 @@ import ( "github.com/determined-ai/determined/master/pkg/model" "github.com/determined-ai/determined/master/pkg/ptrs" "github.com/determined-ai/determined/master/pkg/schemas" + "github.com/determined-ai/determined/master/pkg/schemas/expconf" "github.com/determined-ai/determined/proto/pkg/apiv1" "github.com/determined-ai/determined/proto/pkg/taskv1" ) @@ -1099,3 +1100,76 @@ func TestArchiveUnarchiveNoInput(t *testing.T) { require.NoError(t, err) require.Empty(t, unarchRes.Results) } + +func TestArchiveUnarchiveWithArchivedParent(t *testing.T) { + api, curUser, ctx := setupAPITest(t, nil) + _, projectID := createProjectAndWorkspace(ctx, t, api) + + activeConfig := schemas.WithDefaults(schemas.Merge(minExpConfig, expconf.ExperimentConfig{ + RawDescription: ptrs.Ptr("desc"), + RawName: expconf.Name{RawString: ptrs.Ptr("name")}, + })) + + exp := &model.Experiment{ + JobID: model.JobID(uuid.New().String()), + State: model.CompletedState, + OwnerID: &curUser.ID, + ProjectID: projectID, + StartTime: time.Now(), + Config: activeConfig.AsLegacy(), + } + require.NoError(t, api.m.db.AddExperiment(exp, []byte{10, 11, 12}, activeConfig)) + + task1 := &model.Task{TaskType: model.TaskTypeTrial, TaskID: model.NewTaskID()} + require.NoError(t, db.AddTask(ctx, task1)) + require.NoError(t, db.AddTrial(ctx, &model.Trial{ + State: model.CompletedState, + ExperimentID: exp.ID, + StartTime: time.Now(), + }, task1.TaskID)) + + task2 := &model.Task{TaskType: model.TaskTypeTrial, TaskID: model.NewTaskID()} + require.NoError(t, db.AddTask(ctx, task2)) + require.NoError(t, db.AddTrial(ctx, &model.Trial{ + State: model.CompletedState, + ExperimentID: exp.ID, + StartTime: time.Now(), + }, task2.TaskID)) + + sourceprojectID := int32(projectID) + req := &apiv1.SearchRunsRequest{ + ProjectId: &sourceprojectID, + Sort: ptrs.Ptr("id=asc"), + } + + resp, err := api.SearchRuns(ctx, req) + require.NoError(t, err) + require.Len(t, resp.Runs, 2) + + runID1, runID2 := resp.Runs[0].Id, resp.Runs[1].Id + + // Set the parent experiment as archived + _, err = api.ArchiveExperiment(ctx, &apiv1.ArchiveExperimentRequest{Id: int32(exp.ID)}) + require.NoError(t, err) + + runIDs := []int32{runID1, runID2} + unarchRes, err := api.ArchiveRuns(ctx, &apiv1.ArchiveRunsRequest{ + RunIds: runIDs, + ProjectId: sourceprojectID, + }) + + errMsg := "Run is part of archived Search." + require.NoError(t, err) + require.Len(t, unarchRes.Results, 2) + require.Equal(t, errMsg, unarchRes.Results[0].Error) + require.Equal(t, errMsg, unarchRes.Results[1].Error) + + _, err = api.UnarchiveRuns(ctx, &apiv1.UnarchiveRunsRequest{ + RunIds: runIDs, + ProjectId: sourceprojectID, + }) + require.NoError(t, err) + require.Len(t, unarchRes.Results, 2) + require.Equal(t, errMsg, unarchRes.Results[0].Error) + require.Equal(t, errMsg, unarchRes.Results[1].Error) +} From 494463aac796a45f14d38959f4325920006b0360 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 10 Jun 2024 11:44:52 -0700 Subject: [PATCH 091/161] chore: backend feedback --- proto/src/determined/run/v1/run.proto | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proto/src/determined/run/v1/run.proto b/proto/src/determined/run/v1/run.proto index 6ea1b43e226..5bf3ac6f433 100644 --- a/proto/src/determined/run/v1/run.proto +++ b/proto/src/determined/run/v1/run.proto @@ -111,6 +111,8 @@ message FlatRun { bool parent_archived = 18; // Data related the the experiment associated with this run. optional FlatRunExperiment experiment = 19; - // The archived status of this run + // The archived status of this run. + // This is only looking at the archived status at the run level and not taking + // into account whether the experiment is archived or not. bool archived = 20; } From 1c0e897830bfdd143787d832a37caeae8a9e1b31 Mon Sep 17 00:00:00 2001 From: John Kim Date: Mon, 10 Jun 2024 16:10:24 -0400 Subject: [PATCH 092/161] update bindings after merge --- harness/determined/common/api/bindings.py | 69 +++++++++++++ proto/pkg/runv1/run.pb.go | 4 +- webui/react/src/services/api-ts-sdk/api.ts | 110 ++++++++++++++++++++- 3 files changed, 181 insertions(+), 2 deletions(-) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index ee09100bb36..dcc085d560f 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -5803,6 +5803,29 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: } return out +class v1GetProjectByKeyResponse(Printable): + """Response to GetProjectByKeyRequest.""" + + def __init__( + self, + *, + project: "v1Project", + ): + self.project = project + + @classmethod + def from_json(cls, obj: Json) -> "v1GetProjectByKeyResponse": + kwargs: "typing.Dict[str, typing.Any]" = { + "project": v1Project.from_json(obj["project"]), + } + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + "project": self.project.to_json(omit_unset), + } + return out + class v1GetProjectColumnsResponse(Printable): def __init__( @@ -9788,16 +9811,20 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: class v1PatchProject(Printable): """PatchProject is a partial update to a project with all optional fields.""" description: "typing.Optional[str]" = None + key: "typing.Optional[str]" = None name: "typing.Optional[str]" = None def __init__( self, *, description: "typing.Union[str, None, Unset]" = _unset, + key: "typing.Union[str, None, Unset]" = _unset, name: "typing.Union[str, None, Unset]" = _unset, ): if not isinstance(description, Unset): self.description = description + if not isinstance(key, Unset): + self.key = key if not isinstance(name, Unset): self.name = name @@ -9807,6 +9834,8 @@ def from_json(cls, obj: Json) -> "v1PatchProject": } if "description" in obj: kwargs["description"] = obj["description"] + if "key" in obj: + kwargs["key"] = obj["key"] if "name" in obj: kwargs["name"] = obj["name"] return cls(**kwargs) @@ -9816,6 +9845,8 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: } if not omit_unset or "description" in vars(self): out["description"] = self.description + if not omit_unset or "key" in vars(self): + out["key"] = self.key if not omit_unset or "name" in vars(self): out["name"] = self.name return out @@ -10842,6 +10873,7 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: class v1PostProjectRequest(Printable): """Request for creating a project.""" description: "typing.Optional[str]" = None + key: "typing.Optional[str]" = None def __init__( self, @@ -10849,11 +10881,14 @@ def __init__( name: str, workspaceId: int, description: "typing.Union[str, None, Unset]" = _unset, + key: "typing.Union[str, None, Unset]" = _unset, ): self.name = name self.workspaceId = workspaceId if not isinstance(description, Unset): self.description = description + if not isinstance(key, Unset): + self.key = key @classmethod def from_json(cls, obj: Json) -> "v1PostProjectRequest": @@ -10863,6 +10898,8 @@ def from_json(cls, obj: Json) -> "v1PostProjectRequest": } if "description" in obj: kwargs["description"] = obj["description"] + if "key" in obj: + kwargs["key"] = obj["key"] return cls(**kwargs) def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: @@ -10872,6 +10909,8 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: } if not omit_unset or "description" in vars(self): out["description"] = self.description + if not omit_unset or "key" in vars(self): + out["key"] = self.key return out class v1PostProjectResponse(Printable): @@ -11313,6 +11352,7 @@ def __init__( errorMessage: str, id: int, immutable: bool, + key: str, name: str, notes: "typing.Sequence[v1Note]", numActiveExperiments: int, @@ -11329,6 +11369,7 @@ def __init__( self.errorMessage = errorMessage self.id = id self.immutable = immutable + self.key = key self.name = name self.notes = notes self.numActiveExperiments = numActiveExperiments @@ -11351,6 +11392,7 @@ def from_json(cls, obj: Json) -> "v1Project": "errorMessage": obj["errorMessage"], "id": obj["id"], "immutable": obj["immutable"], + "key": obj["key"], "name": obj["name"], "notes": [v1Note.from_json(x) for x in obj["notes"]], "numActiveExperiments": obj["numActiveExperiments"], @@ -11374,6 +11416,7 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: "errorMessage": self.errorMessage, "id": self.id, "immutable": self.immutable, + "key": self.key, "name": self.name, "notes": [x.to_json(omit_unset) for x in self.notes], "numActiveExperiments": self.numActiveExperiments, @@ -19086,6 +19129,32 @@ def get_GetProject( return v1GetProjectResponse.from_json(_resp.json()) raise APIHttpError("get_GetProject", _resp) +def get_GetProjectByKey( + session: "api.BaseSession", + *, + key: str, +) -> "v1GetProjectByKeyResponse": + """Get the request project by key. + + - key: The key of the project. + """ + _params = None + if type(key) == str: + key = parse.quote(key) + _resp = session._do_request( + method="GET", + path=f"/api/v1/projects/key/{key}", + params=_params, + json=None, + data=None, + headers=None, + timeout=None, + stream=False, + ) + if _resp.status_code == 200: + return v1GetProjectByKeyResponse.from_json(_resp.json()) + raise APIHttpError("get_GetProjectByKey", _resp) + def get_GetProjectColumns( session: "api.BaseSession", *, diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 9816a359c85..998a1e8d711 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,7 +216,9 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` - // The archived status of this run + // The archived status of this run. + // This is only looking at the archived status at the run level and not taking + // into account whether the experiment is archived or not. Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` } diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index e213bc5c6db..bb4f95c5201 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3495,7 +3495,7 @@ export interface V1FlatRun { */ experiment?: V1FlatRunExperiment; /** - * The archived status of this run + * The archived status of this run. This is only looking at the archived status at the run level and not taking into account whether the experiment is archived or not. * @type {boolean} * @memberof V1FlatRun */ @@ -4452,6 +4452,19 @@ export interface V1GetPermissionsSummaryResponse { */ assignments: Array; } +/** + * Response to GetProjectByKeyRequest. + * @export + * @interface V1GetProjectByKeyResponse + */ +export interface V1GetProjectByKeyResponse { + /** + * The project requested. + * @type {V1Project} + * @memberof V1GetProjectByKeyResponse + */ + project: V1Project; +} /** * * @export @@ -7236,6 +7249,12 @@ export interface V1PatchProject { * @memberof V1PatchProject */ description?: string; + /** + * The new key for the project. + * @type {string} + * @memberof V1PatchProject + */ + key?: string; } /** * Response to PatchProjectRequest. @@ -7929,6 +7948,12 @@ export interface V1PostProjectRequest { * @memberof V1PostProjectRequest */ workspaceId: number; + /** + * Key for the project. + * @type {string} + * @memberof V1PostProjectRequest + */ + key?: string; } /** * Response to PostProjectRequest. @@ -8316,6 +8341,12 @@ export interface V1Project { * @memberof V1Project */ errorMessage: string; + /** + * The key of the project. + * @type {string} + * @memberof V1Project + */ + key: string; } /** * Project Column is a description of a column used on experiments in the project. @@ -27894,6 +27925,42 @@ export const ProjectsApiFetchParamCreator = function (configuration?: Configurat options: localVarRequestOptions, }; }, + /** + * + * @summary Get the request project by key. + * @param {string} key The key of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectByKey(key: string, options: any = {}): FetchArgs { + // verify required parameter 'key' is not null or undefined + if (key === null || key === undefined) { + throw new RequiredError('key','Required parameter key was null or undefined when calling getProjectByKey.'); + } + const localVarPath = `/api/v1/projects/key/{key}` + .replace(`{${"key"}}`, encodeURIComponent(String(key))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, /** * * @summary Get a list of columns for experiment list table. @@ -28304,6 +28371,25 @@ export const ProjectsApiFp = function (configuration?: Configuration) { }); }; }, + /** + * + * @summary Get the request project by key. + * @param {string} key The key of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectByKey(key: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).getProjectByKey(key, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * * @summary Get a list of columns for experiment list table. @@ -28511,6 +28597,16 @@ export const ProjectsApiFactory = function (configuration?: Configuration, fetch getProject(id: number, options?: any) { return ProjectsApiFp(configuration).getProject(id, options)(fetch, basePath); }, + /** + * + * @summary Get the request project by key. + * @param {string} key The key of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectByKey(key: string, options?: any) { + return ProjectsApiFp(configuration).getProjectByKey(key, options)(fetch, basePath); + }, /** * * @summary Get a list of columns for experiment list table. @@ -28655,6 +28751,18 @@ export class ProjectsApi extends BaseAPI { return ProjectsApiFp(this.configuration).getProject(id, options)(this.fetch, this.basePath) } + /** + * + * @summary Get the request project by key. + * @param {string} key The key of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ProjectsApi + */ + public getProjectByKey(key: string, options?: any) { + return ProjectsApiFp(this.configuration).getProjectByKey(key, options)(this.fetch, this.basePath) + } + /** * * @summary Get a list of columns for experiment list table. From 7cf82f002cc822dba0ec667667cb353d540e7e8e Mon Sep 17 00:00:00 2001 From: John Kim Date: Mon, 10 Jun 2024 16:14:33 -0400 Subject: [PATCH 093/161] merge error --- proto/pkg/runv1/run.pb.go | 4 +--- webui/react/src/services/api-ts-sdk/api.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 998a1e8d711..9816a359c85 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,9 +216,7 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` - // The archived status of this run. - // This is only looking at the archived status at the run level and not taking - // into account whether the experiment is archived or not. + // The archived status of this run Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` } diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index bb4f95c5201..ff4613b3b9e 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3495,7 +3495,7 @@ export interface V1FlatRun { */ experiment?: V1FlatRunExperiment; /** - * The archived status of this run. This is only looking at the archived status at the run level and not taking into account whether the experiment is archived or not. + * The archived status of this run * @type {boolean} * @memberof V1FlatRun */ From 87cd592f52ed26220deccb852dcd82ec49107286 Mon Sep 17 00:00:00 2001 From: John Kim Date: Mon, 10 Jun 2024 16:29:37 -0400 Subject: [PATCH 094/161] fmt --- .../pages/FlatRuns/FlatRunActionButton.tsx | 10 ++- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 88 +++++++++---------- 2 files changed, 50 insertions(+), 48 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index c5c4aadec12..716253a8f2f 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -108,8 +108,9 @@ const FlatRunActionButton = ({ } else if (numFailures === 0) { openToast({ closeable: true, - description: `${action} succeeded for ${results.successful.length - } ${LABEL_PLURAL.toLowerCase()}`, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, title: `${action} Success`, }); } else if (numSuccesses === 0) { @@ -121,8 +122,9 @@ const FlatRunActionButton = ({ } else { openToast({ closeable: true, - description: `${action} succeeded for ${numSuccesses} out of ${numFailures + numSuccesses - } eligible + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible ${LABEL_PLURAL.toLowerCase()}`, severity: 'Warning', title: `Partial ${action} Failure`, diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 57f30bcf5db..5f11ca1cbee 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -332,8 +332,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, { max: heatmap.max, @@ -345,8 +345,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -357,8 +357,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); break; @@ -369,8 +369,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -383,9 +383,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { settings.columnWidths[currentColumn.column], heatmap && settings.heatmapOn && !settings.heatmapSkipped.includes(currentColumn.column) ? { - max: heatmap.max, - min: heatmap.min, - } + max: heatmap.max, + min: heatmap.min, + } : undefined, ); } @@ -766,12 +766,12 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const items: MenuItem[] = [ settings.selection.type === 'ALL_EXCEPT' || settings.selection.selections.length > 0 ? { - key: 'select-none', - label: 'Clear selected', - onClick: () => { - handleSelectionChange?.('remove-all'); - }, - } + key: 'select-none', + label: 'Clear selected', + onClick: () => { + handleSelectionChange?.('remove-all'); + }, + } : null, ...[5, 10, 25].map((n) => ({ key: `select-${n}`, @@ -800,32 +800,32 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { ? null : !isPinned ? { - icon: , - key: 'pin', - label: 'Pin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), - ); - }, - } + icon: , + key: 'pin', + label: 'Pin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), + ); + }, + } : { - disabled: settings.pinnedColumnsCount <= 1, - icon: , - key: 'unpin', - label: 'Unpin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.max(settings.pinnedColumnsCount - 1, 0), - ); + disabled: settings.pinnedColumnsCount <= 1, + icon: , + key: 'unpin', + label: 'Unpin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.max(settings.pinnedColumnsCount - 1, 0), + ); + }, }, - }, { icon: , key: 'hide', @@ -882,9 +882,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { sortCount === 0 ? [] : [ - { type: 'divider' as const }, - ...sortMenuItemsForColumn(column, sorts, handleSortChange), - ]; + { type: 'divider' as const }, + ...sortMenuItemsForColumn(column, sorts, handleSortChange), + ]; items.push( ...sortMenuItems, From 4193a1ae336d4b283ed756887d49d8a6099b885f Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 10 Jun 2024 15:16:19 -0700 Subject: [PATCH 095/161] test: test --- webui/react/src/pages/SearchDetails.test.tsx | 41 ++++++++++ webui/react/src/services/decoder.test.ts | 78 ++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 webui/react/src/pages/SearchDetails.test.tsx diff --git a/webui/react/src/pages/SearchDetails.test.tsx b/webui/react/src/pages/SearchDetails.test.tsx new file mode 100644 index 00000000000..3332d414ce1 --- /dev/null +++ b/webui/react/src/pages/SearchDetails.test.tsx @@ -0,0 +1,41 @@ +import { render, screen } from '@testing-library/react'; +import userEvent, { UserEvent } from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { HelmetProvider } from 'react-helmet-async'; +import { BrowserRouter } from 'react-router-dom'; + +import { ThemeProvider } from 'components/ThemeProvider'; +import SearchDetails from 'pages/SearchDetails'; + +vi.mock('services/api', () => ({ + getExperimentDetails: vi.fn(), + patchExperiment: vi.fn(), +})); + +const setup = (): { user: UserEvent } => { + const user = userEvent.setup(); + + render( + + + + + + + + + , + ); + + return { user }; +}; + +describe('SearchDetails', () => { + it('should have tabs', () => { + setup(); + + expect(screen.getByText('Uncategorized Experiments')).toBeInTheDocument(); + expect(screen.getByText('Trials')).toBeInTheDocument(); + expect(screen.getByText('Notes')).toBeInTheDocument(); + }); +}); diff --git a/webui/react/src/services/decoder.test.ts b/webui/react/src/services/decoder.test.ts index 7d706e794d9..66a854d2332 100644 --- a/webui/react/src/services/decoder.test.ts +++ b/webui/react/src/services/decoder.test.ts @@ -1,6 +1,8 @@ import hparams from 'fixtures/hyperparameter-configs.json'; import experimentResps from 'fixtures/responses/experiment-details/set-a.json'; import * as ioTypes from 'ioTypes'; +import { V1ExperimentActionResult, V1RunActionResult } from 'services/api-ts-sdk'; +import * as decoder from 'services/decoder'; type FailReport = { error: Error; sample: T }; @@ -40,4 +42,80 @@ describe('Decoder', () => { ); expect(fails).toHaveLength(0); }); + + describe('mapV1ActionResults', () => { + it('should work with Sdk.V1ExperimentActionResult[] input', () => { + const result: V1ExperimentActionResult[] = [ + { error: '', id: 1 }, + { error: '', id: 2 }, + { error: 'error', id: 3 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [{ error: 'error', id: 3 }], + successful: [1, 2], + }); + }); + + it('should work with Sdk.V1RunActionResult[] input', () => { + const result: V1RunActionResult[] = [ + { error: '', id: 1 }, + { error: '', id: 2 }, + { error: 'error', id: 3 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [{ error: 'error', id: 3 }], + successful: [1, 2], + }); + }); + + it('should work with empty input', () => { + const expected = decoder.mapV1ActionResults([]); + expect(expected).toStrictEqual({ + failed: [], + successful: [], + }); + }); + + it('should work with all successful input', () => { + const result: V1RunActionResult[] = [ + { error: '', id: 1 }, + { error: '', id: 2 }, + { error: '', id: 3 }, + { error: '', id: 4 }, + { error: '', id: 5 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [], + successful: [1, 2, 3, 4, 5], + }); + }); + + it('should work with all failed input', () => { + const result: V1RunActionResult[] = [ + { error: 'oh no', id: 1 }, + { error: 'yare yare', id: 2 }, + { error: 'error', id: 3 }, + { error: 'a', id: 4 }, + { error: 'エラー', id: 5 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [ + { error: 'oh no', id: 1 }, + { error: 'yare yare', id: 2 }, + { error: 'error', id: 3 }, + { error: 'a', id: 4 }, + { error: 'エラー', id: 5 }, + ], + successful: [], + }); + }); + }); }); From 0cdae7cd72fd0106e6593bd7a915a53e6b130222 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 10 Jun 2024 15:45:13 -0700 Subject: [PATCH 096/161] fix: minor fixes --- proto/pkg/runv1/run.pb.go | 4 +++- webui/react/src/hooks/usePermissions.ts | 22 ++++++++++++++++++++++ webui/react/src/services/api-ts-sdk/api.ts | 2 +- webui/react/src/services/api.ts | 16 ++++++++++------ webui/react/src/services/apiConfig.ts | 16 ++++++++++++---- webui/react/src/utils/flatRun.ts | 12 ++++-------- 6 files changed, 52 insertions(+), 20 deletions(-) diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 9816a359c85..998a1e8d711 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,7 +216,9 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` - // The archived status of this run + // The archived status of this run. + // This is only looking at the archived status at the run level and not taking + // into account whether the experiment is archived or not. Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` } diff --git a/webui/react/src/hooks/usePermissions.ts b/webui/react/src/hooks/usePermissions.ts index ae909e64756..4e8d2130c09 100644 --- a/webui/react/src/hooks/usePermissions.ts +++ b/webui/react/src/hooks/usePermissions.ts @@ -59,6 +59,7 @@ export interface PermissionsHook { canAdministrateUsers: boolean; canAssignRoles: (arg0: WorkspacePermissionsArgs) => boolean; canCreateExperiment: (arg0: WorkspacePermissionsArgs) => boolean; + canCreateFlatRun: (arg0: WorkspacePermissionsArgs) => boolean; canCreateModelVersion: (arg0: ModelPermissionsArgs) => boolean; canCreateModelWorkspace: (arg0: ModelWorkspacePermissionsArgs) => boolean; canCreateModels: boolean; @@ -79,6 +80,7 @@ export interface PermissionsHook { canEditWebhooks: boolean; canManageResourcePoolBindings: boolean; canModifyExperiment: (arg0: WorkspacePermissionsArgs) => boolean; + canModifyFlatRun: (arg0: WorkspacePermissionsArgs) => boolean; canModifyExperimentMetadata: (arg0: WorkspacePermissionsArgs) => boolean; canModifyGroups: boolean; canModifyModel: (arg0: ModelPermissionsArgs) => boolean; @@ -132,6 +134,8 @@ const usePermissions = (): PermissionsHook => { canAssignRoles: (args: WorkspacePermissionsArgs) => canAssignRoles(rbacOpts, args.workspace), canCreateExperiment: (args: WorkspacePermissionsArgs) => canCreateExperiment(rbacOpts, args.workspace), + canCreateFlatRun: (args: WorkspacePermissionsArgs) => + canCreateFlatRun(rbacOpts, args.workspace), canCreateModels: canCreateModels(rbacOpts), canCreateModelVersion: (args: ModelPermissionsArgs) => canCreateModelVersion(rbacOpts, args.model), @@ -164,6 +168,8 @@ const usePermissions = (): PermissionsHook => { canModifyExperiment(rbacOpts, args.workspace), canModifyExperimentMetadata: (args: WorkspacePermissionsArgs) => canModifyExperimentMetadata(rbacOpts, args.workspace), + canModifyFlatRun: (args: WorkspacePermissionsArgs) => + canModifyFlatRun(rbacOpts, args.workspace), canModifyGroups: canModifyGroups(rbacOpts), canModifyModel: (args: ModelPermissionsArgs) => canModifyModel(rbacOpts, args.model), canModifyModelVersion: (args: ModelVersionPermissionsArgs) => @@ -687,6 +693,22 @@ const canManageResourcePoolBindings = ({ // Flat Runs +// alias of canCreateExperiment +const canCreateFlatRun = ( + { rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + workspace?: PermissionWorkspace, +): boolean => { + return canCreateExperiment({ rbacEnabled, userAssignments, userRoles }, workspace); +}; + +// alias of canModifyExperiment +const canModifyFlatRun = ( + { rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + workspace?: PermissionWorkspace, +): boolean => { + return canModifyExperiment({ rbacEnabled, userAssignments, userRoles }, workspace); +}; + const canDeleteFlatRun = ( { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, run: FlatRun, diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index ff4613b3b9e..bb4f95c5201 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3495,7 +3495,7 @@ export interface V1FlatRun { */ experiment?: V1FlatRunExperiment; /** - * The archived status of this run + * The archived status of this run. This is only looking at the archived status at the run level and not taking into account whether the experiment is archived or not. * @type {boolean} * @memberof V1FlatRun */ diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 561101669bf..7c43779114d 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -763,13 +763,17 @@ export const archiveRuns = generateDetApi< Type.BulkActionResult >(Config.archiveRuns); -export const deleteRuns = generateDetApi( - Config.deleteRuns, -); +export const deleteRuns = generateDetApi< + Api.V1DeleteRunsRequest, + Api.V1DeleteRunsResponse, + Type.BulkActionResult +>(Config.deleteRuns); -export const killRuns = generateDetApi( - Config.killRuns, -); +export const killRuns = generateDetApi< + Api.V1KillRunsRequest, + Api.V1KillRunsResponse, + Type.BulkActionResult +>(Config.killRuns); export const moveRuns = generateDetApi< Api.V1MoveRunsRequest, diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index fd92b846f39..c683cd6373e 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1158,15 +1158,23 @@ export const archiveRuns: DetApi< request: (params, options) => detApi.Internal.archiveRuns(params, options), }; -export const deleteRuns: DetApi = { +export const deleteRuns: DetApi< + Api.V1DeleteRunsRequest, + Api.V1DeleteRunsResponse, + Type.BulkActionResult +> = { name: 'deleteRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.deleteRuns(params, options), }; -export const killRuns: DetApi = { +export const killRuns: DetApi< + Api.V1KillRunsRequest, + Api.V1KillRunsResponse, + Type.BulkActionResult +> = { name: 'killRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.killRuns(params, options), }; diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 8b52c9cb22c..3d33f3893c8 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -6,7 +6,7 @@ type FlatRunChecker = (flatRun: Readonly) => boolean; type FlatRunPermissionSet = Pick< PermissionsHook, - 'canCreateExperiment' | 'canDeleteFlatRun' | 'canModifyExperiment' | 'canMoveFlatRun' + 'canCreateFlatRun' | 'canDeleteFlatRun' | 'canModifyFlatRun' | 'canMoveFlatRun' >; const flatRunCheckers: Record = { @@ -28,7 +28,7 @@ export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly, targets: ReadonlyArray, permissions: Readonly, @@ -41,17 +41,13 @@ const getActionsForFlatRun = ( switch (action) { case FlatRunAction.Delete: return permissions.canDeleteFlatRun({ flatRun }); - case FlatRunAction.Move: return permissions.canMoveFlatRun({ flatRun }); - case FlatRunAction.Archive: case FlatRunAction.Unarchive: - return permissions.canModifyExperiment({ workspace }); - + return permissions.canModifyFlatRun({ workspace }); case FlatRunAction.Kill: - return permissions.canModifyExperiment({ workspace }) && !flatRun.experiment?.unmanaged; - + return permissions.canModifyFlatRun({ workspace }) && !flatRun.experiment?.unmanaged; default: return true; } From 922f14955c0daa1b22af43dc9b5d8e49b106b12c Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 14 May 2024 16:38:12 -0700 Subject: [PATCH 097/161] feat: initial implementation of flat run actions --- .../pages/FlatRuns/FlatRunActionButton.tsx | 258 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 25 +- webui/react/src/services/api.ts | 24 ++ webui/react/src/services/apiConfig.ts | 53 +++- webui/react/src/services/decoder.ts | 8 +- 5 files changed, 350 insertions(+), 18 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx new file mode 100644 index 00000000000..2f8ebbd42f4 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -0,0 +1,258 @@ +import Button from 'hew/Button'; +import Dropdown, { MenuItem } from 'hew/Dropdown'; +import Icon, { IconName } from 'hew/Icon'; +import { useModal } from 'hew/Modal'; +import { useToast } from 'hew/Toast'; +import { useCallback, useMemo, useState } from 'react'; + +import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; +import { BatchAction } from 'components/TableActionBar'; +// import usePermissions from 'hooks/usePermissions'; +import { + archiveRuns, + deleteRuns, + killRuns, + openOrCreateTensorBoard, + unarchiveRuns, +} from 'services/api'; +import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { capitalizeWord } from 'utils/string'; +import { openCommandResponse } from 'utils/wait'; + +// export const getActionsForRunsUnion = ( +// experiments: FlatRun[], +// targets: ExperimentAction[], +// permissions: ExperimentPermissionSet, +// ): ExperimentAction[] => { +// if (!experiments.length) return []; // redundant, for clarity +// const actionsForExperiments = experiments.map((e) => +// getActionsForExperiment(e, targets, permissions), +// ); +// return targets.filter((action) => +// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), +// ); +// }; + +const BATCH_ACTIONS = [ + ExperimentAction.OpenTensorBoard, + ExperimentAction.Move, + ExperimentAction.RetainLogs, + ExperimentAction.Archive, + ExperimentAction.Unarchive, + ExperimentAction.Delete, + ExperimentAction.Activate, + ExperimentAction.Pause, + ExperimentAction.Cancel, + ExperimentAction.Kill, +] as const; + +const ACTION_ICONS: Record = { + [ExperimentAction.Activate]: 'play', + [ExperimentAction.Pause]: 'pause', + [ExperimentAction.Cancel]: 'stop', + [ExperimentAction.Archive]: 'archive', + [ExperimentAction.Unarchive]: 'document', + [ExperimentAction.Move]: 'workspaces', + [ExperimentAction.RetainLogs]: 'logs', + [ExperimentAction.OpenTensorBoard]: 'tensor-board', + [ExperimentAction.Kill]: 'cancelled', + [ExperimentAction.Delete]: 'error', +} as const; + +const LABEL_PLURAL = 'runs'; + +interface Props { + isMobile: boolean; + selectedRuns: FlatRun[]; + project: Project; + onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; +} + +const FlatRunActionButton = ({ + isMobile, + selectedRuns, + project, + onActionSuccess, +}: Props): JSX.Element => { + const [batchAction, setBatchAction] = useState(undefined); + // const permissions = usePermissions(); + const { openToast } = useToast(); + const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); + + const sendBatchActions = useCallback( + // TODO: remove this + // eslint-disable-next-line require-await + async (action: BatchAction): Promise => { + const validRunIds = selectedRuns + // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .map((run) => run.id); + const params = { + projectId: project.id, + runIds: validRunIds, + }; + switch (action) { + case ExperimentAction.OpenTensorBoard: { + if (validRunIds.length !== selectedRuns.length) { + // if unmanaged experiments are selected, open experimentTensorBoardModal + // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs + } else { + openCommandResponse( + await openOrCreateTensorBoard({ + experimentIds: params.runIds, + workspaceId: project.workspaceId, + }), + ); + } + return; + } + case ExperimentAction.Move: + // return ExperimentMoveModal.open(); + case ExperimentAction.RetainLogs: + // return ExperimentRetainLogsModal.open(); + case ExperimentAction.Activate: + // return await archiveRuns(params); + case ExperimentAction.Archive: + return await archiveRuns(params); + case ExperimentAction.Cancel: + // return await cancelExperiments(params); + case ExperimentAction.Kill: + return await killRuns(params); + case ExperimentAction.Pause: + // return await pauseExperiments(params); + case ExperimentAction.Unarchive: + return await unarchiveRuns(params); + case ExperimentAction.Delete: + return await deleteRuns(params); + } + }, + [project.id, project.workspaceId, selectedRuns], + ); + + const submitBatchAction = useCallback( + async (action: BatchAction) => { + try { + const results = await sendBatchActions(action); + if (results === undefined) return; + + onActionSuccess?.(action, results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: `No selected ${LABEL_PLURAL.toLowerCase()} were eligible for ${action.toLowerCase()}`, + title: `No eligible ${LABEL_PLURAL.toLowerCase()}`, + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, + title: `${action} Success`, + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to ${action.toLowerCase()} ${numFailures} ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `${action} Failure`, + }); + } else { + openToast({ + closeable: true, + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible + ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `Partial ${action} Failure`, + }); + } + } catch (e) { + const publicSubject = + action === ExperimentAction.OpenTensorBoard + ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` + : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + handleError(e, { + isUserTriggered: true, + publicMessage: 'Please try again later.', + publicSubject, + silent: false, + }); + } finally { + // onActionComplete?.(); + } + }, + [sendBatchActions, onActionSuccess, openToast], + ); + + const handleBatchAction = useCallback( + (action: string) => { + switch (action) { + case ExperimentAction.OpenTensorBoard: + submitBatchAction(action); + break; + case ExperimentAction.Move: + case ExperimentAction.RetainLogs: + sendBatchActions(action); + break; + default: + setBatchAction(action as BatchAction); + BatchActionConfirmModal.open(); + break; + } + }, + [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + ); + + // const availableBatchActions = useMemo(() => { + // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. + // }, [selectedExperimentIds, experimentMap, permissions]); + + const editMenuItems = useMemo(() => { + const groupedBatchActions = [ + BATCH_ACTIONS.slice(0, 1), // View in TensorBoard + BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete + BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill + ]; + const groupSize = groupedBatchActions.length; + return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { + const isLastGroup = index === groupSize - 1; + group.forEach((action) => + acc.push({ + danger: action === ExperimentAction.Delete, + // disabled: !availableBatchActions.includes(action), // TODO uncomment later + icon: , + key: action, + label: action, + }), + ); + if (!isLastGroup) acc.push({ type: 'divider' }); + return acc; + }, []); + }, []); + + return ( + <> + {selectedRuns.length > 0 && ( + + + + )} + {batchAction && ( + exp.unmanaged)} // TODO: is it needed for Runs? + onConfirm={() => submitBatchAction(batchAction)} + /> + )} + + ); +}; + +export default FlatRunActionButton; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ac8528b4606..96f5c2c1bca 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -63,6 +63,7 @@ import { DEFAULT_SELECTION, SelectionType as SelectionState, } from 'pages/F_ExpList/F_ExperimentList.settings'; +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { paths } from 'routes/utils'; import { getProjectColumns, getProjectNumericMetricsRange, searchRuns } from 'services/api'; import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; @@ -196,6 +197,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { } }, [projectId]); + const selectedRunIdSet = useMemo(() => { + return new Set(settings.selection.type === 'ONLY_IN' ? settings.selection.selections : []); + }, [settings.selection]); + const columnsIfLoaded = useMemo( () => (isLoadingSettings ? [] : settings.columns), [isLoadingSettings, settings.columns], @@ -214,18 +219,16 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { if (isLoadingSettings) { return selectedMap; } - const selectedIdSet = new Set( - settings.selection.type === 'ONLY_IN' ? settings.selection.selections : [], - ); + runs.forEach((r, index) => { Loadable.forEach(r, (run) => { - if (selectedIdSet.has(run.id)) { + if (selectedRunIdSet.has(run.id)) { selectedMap.set(run.id, { index, run }); } }); }); return selectedMap; - }, [isLoadingSettings, settings.selection, runs]); + }, [isLoadingSettings, runs, selectedRunIdSet]); const selection = useMemo(() => { let rows = CompactSelection.empty(); @@ -238,6 +241,13 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { }; }, [loadedSelectedRunIds]); + const selectedRuns: FlatRun[] = useMemo(() => { + const selected = runs.flatMap((run) => { + return run.isLoaded && selectedRunIdSet.has(run.data.id) ? [run.data] : []; + }); + return selected; + }, [runs, selectedRunIdSet]); + const handleIsOpenFilterChange = useCallback((newOpen: boolean) => { setIsOpenFilter(newOpen); if (!newOpen) { @@ -930,6 +940,11 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { rowHeight={globalSettings.rowHeight} onRowHeightChange={onRowHeightChange} /> + diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 0a6c975e646..39acbb16325 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -757,6 +757,30 @@ export const searchRuns = generateDetApi< Type.SearchFlatRunPagination >(Config.searchRuns); +export const archiveRuns = generateDetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +>(Config.archiveRuns); + +export const deleteRuns = generateDetApi( + Config.deleteRuns, +); + +export const killRuns = generateDetApi( + Config.killRuns, +); + +export const moveRuns = generateDetApi( + Config.moveRuns, +); + +export const unarchiveRuns = generateDetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + void +>(Config.unarchiveRuns); + /* Tasks */ export const getCommands = generateDetApi< diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index f9d34fd7a9b..7c8c01d55f3 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -717,7 +717,7 @@ export const archiveExperiments: DetApi< Type.BulkActionResult > = { name: 'archiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.archiveExperiments(params.projectId, params, options); }, @@ -741,7 +741,7 @@ export const deleteExperiments: DetApi< Type.BulkActionResult > = { name: 'deleteExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.deleteExperiments(params.projectId, params, options); }, @@ -765,7 +765,7 @@ export const unarchiveExperiments: DetApi< Type.BulkActionResult > = { name: 'unarchiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.unarchiveExperiments(params.projectId, params, options); }, @@ -789,7 +789,7 @@ export const activateExperiments: DetApi< Type.BulkActionResult > = { name: 'activateExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.activateExperiments(params.projectId, params, options); }, @@ -813,7 +813,7 @@ export const pauseExperiments: DetApi< Type.BulkActionResult > = { name: 'pauseExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.pauseExperiments(params.projectId, params, options); }, @@ -837,7 +837,7 @@ export const cancelExperiments: DetApi< Type.BulkActionResult > = { name: 'cancelExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.cancelExperiments(params.projectId, params, options); }, @@ -861,7 +861,7 @@ export const killExperiments: DetApi< Type.BulkActionResult > = { name: 'killExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.killExperiments(params.projectId, params, options); }, @@ -1014,7 +1014,7 @@ export const moveExperiments: DetApi< Type.BulkActionResult > = { name: 'moveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.moveExperiments(params.projectId, params, options), }; @@ -1025,7 +1025,7 @@ export const changeExperimentLogRetention: DetApi< Type.BulkActionResult > = { name: 'changeExperimentLogRetention', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.putExperimentsRetainLogs(params.projectId, params, options), }; @@ -1148,6 +1148,41 @@ export const searchRuns: DetApi< ), }; +export const archiveRuns: DetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'archiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.archiveRuns(params, options), +}; + +export const deleteRuns: DetApi = { + name: 'deleteRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.deleteRuns(params, options), +}; + +export const killRuns: DetApi = { + name: 'killRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.killRuns(params, options), +}; + +export const moveRuns: DetApi = { + name: 'moveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.moveRuns(params, options), +}; + +export const unarchiveRuns: DetApi = + { + name: 'unarchiveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), + }; + /* Tasks */ export const getTask: DetApi< diff --git a/webui/react/src/services/decoder.ts b/webui/react/src/services/decoder.ts index 6f15eb56447..23f4820e5b7 100644 --- a/webui/react/src/services/decoder.ts +++ b/webui/react/src/services/decoder.ts @@ -875,11 +875,11 @@ export const decodeJobStates = ( >; }; -export const mapV1ExperimentActionResults = ( - results: Sdk.V1ExperimentActionResult[], +export const mapV1ActionResults = ( + results: Sdk.V1ExperimentActionResult[] | Sdk.V1RunActionResult[], ): types.BulkActionResult => { return results.reduce( - (acc, cur) => { + (acc: types.BulkActionResult, cur) => { if (cur.error.length > 0) { acc.failed.push(cur); } else { @@ -887,7 +887,7 @@ export const mapV1ExperimentActionResults = ( } return acc; }, - { failed: [], successful: [] } as types.BulkActionResult, + { failed: [], successful: [] }, ); }; From a0c410dcece0eaf207afcacd841d5026e733d59f Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 22 May 2024 11:34:30 -0700 Subject: [PATCH 098/161] fix: minor changes --- .../react/src/pages/FlatRuns/FlatRunActionButton.tsx | 4 +--- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2f8ebbd42f4..2fbd2d13cd6 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -81,8 +81,6 @@ const FlatRunActionButton = ({ const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( - // TODO: remove this - // eslint-disable-next-line require-await async (action: BatchAction): Promise => { const validRunIds = selectedRuns // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission @@ -111,7 +109,7 @@ const FlatRunActionButton = ({ case ExperimentAction.RetainLogs: // return ExperimentRetainLogsModal.open(); case ExperimentAction.Activate: - // return await archiveRuns(params); + // return await activate(params); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Cancel: diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 96f5c2c1bca..d76315d33e9 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,6 +53,7 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; +import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -656,6 +657,15 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); + const onActionSuccess = useCallback( + // TODO: update this function + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (_action: BatchAction, _successfulIds: number[]) => { + handleSelectionChange('remove-all'); + }, + [handleSelectionChange], + ); + const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -944,6 +954,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} + onActionSuccess={onActionSuccess} /> From 8f700fba3d651b979ae2ab329bdf0ff949f09431 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 16:31:46 -0700 Subject: [PATCH 099/161] feat: add RBAC permissions for flatRuns --- webui/react/src/hooks/usePermissions.ts | 36 +++++- .../pages/FlatRuns/FlatRunActionButton.tsx | 112 +++++------------- webui/react/src/types.ts | 15 +++ webui/react/src/utils/flatRun.ts | 72 +++++++++++ 4 files changed, 151 insertions(+), 84 deletions(-) create mode 100644 webui/react/src/utils/flatRun.ts diff --git a/webui/react/src/hooks/usePermissions.ts b/webui/react/src/hooks/usePermissions.ts index e25ac702b98..ae909e64756 100644 --- a/webui/react/src/hooks/usePermissions.ts +++ b/webui/react/src/hooks/usePermissions.ts @@ -9,6 +9,8 @@ import userStore from 'stores/users'; import { DetailedUser, ExperimentPermissionsArgs, + FlatRun, + FlatRunPermissionsArgs, ModelItem, ModelVersion, Permission, @@ -53,7 +55,7 @@ interface MovePermissionsArgs { destination?: PermissionWorkspace; } -interface PermissionsHook { +export interface PermissionsHook { canAdministrateUsers: boolean; canAssignRoles: (arg0: WorkspacePermissionsArgs) => boolean; canCreateExperiment: (arg0: WorkspacePermissionsArgs) => boolean; @@ -67,6 +69,7 @@ interface PermissionsHook { canCreateWorkspace: boolean; canCreateWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canDeleteExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canDeleteFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canDeleteModel: (arg0: ModelPermissionsArgs) => boolean; canDeleteModelVersion: (arg0: ModelVersionPermissionsArgs) => boolean; canDeleteProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -88,6 +91,7 @@ interface PermissionsHook { canModifyWorkspaceCheckpointStorage: (arg0: WorkspacePermissionsArgs) => boolean; canModifyWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canMoveExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canMoveFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canMoveExperimentsTo: (arg0: MovePermissionsArgs) => boolean; canMoveModel: (arg0: MovePermissionsArgs) => boolean; canMoveProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -144,6 +148,7 @@ const usePermissions = (): PermissionsHook => { canCreateWorkspaceNSC(rbacOpts, args.workspace), canDeleteExperiment: (args: ExperimentPermissionsArgs) => canDeleteExperiment(rbacOpts, args.experiment), + canDeleteFlatRun: (args: FlatRunPermissionsArgs) => canDeleteFlatRun(rbacOpts, args.flatRun), canDeleteModel: (args: ModelPermissionsArgs) => canDeleteModel(rbacOpts, args.model), canDeleteModelVersion: (args: ModelVersionPermissionsArgs) => canDeleteModelVersion(rbacOpts, args.modelVersion), @@ -181,6 +186,7 @@ const usePermissions = (): PermissionsHook => { canMoveExperiment(rbacOpts, args.experiment), canMoveExperimentsTo: (args: MovePermissionsArgs) => canMoveExperimentsTo(rbacOpts, args.destination), + canMoveFlatRun: (args: FlatRunPermissionsArgs) => canMoveFlatRun(rbacOpts, args.flatRun), canMoveModel: (args: MovePermissionsArgs) => canMoveModel(rbacOpts, args.destination), canMoveProjects: (args: ProjectPermissionsArgs) => canMoveWorkspaceProjects(rbacOpts, args.project), @@ -679,4 +685,32 @@ const canManageResourcePoolBindings = ({ : !!currentUser && currentUser.isAdmin; }; +// Flat Runs + +const canDeleteFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const permitted = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? permitted.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + +const canMoveFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const srcPermit = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? srcPermit.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + export default usePermissions; diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2fbd2d13cd6..ee7130b4ddb 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -6,57 +6,32 @@ import { useToast } from 'hew/Toast'; import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; -import { BatchAction } from 'components/TableActionBar'; -// import usePermissions from 'hooks/usePermissions'; -import { - archiveRuns, - deleteRuns, - killRuns, - openOrCreateTensorBoard, - unarchiveRuns, -} from 'services/api'; +import usePermissions from 'hooks/usePermissions'; +import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; import handleError from 'utils/error'; +import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; -import { openCommandResponse } from 'utils/wait'; - -// export const getActionsForRunsUnion = ( -// experiments: FlatRun[], -// targets: ExperimentAction[], -// permissions: ExperimentPermissionSet, -// ): ExperimentAction[] => { -// if (!experiments.length) return []; // redundant, for clarity -// const actionsForExperiments = experiments.map((e) => -// getActionsForExperiment(e, targets, permissions), -// ); -// return targets.filter((action) => -// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), -// ); -// }; const BATCH_ACTIONS = [ - ExperimentAction.OpenTensorBoard, + // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, - ExperimentAction.RetainLogs, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - ExperimentAction.Activate, - ExperimentAction.Pause, - ExperimentAction.Cancel, + // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; +type BatchAction = (typeof BATCH_ACTIONS)[number]; + const ACTION_ICONS: Record = { - [ExperimentAction.Activate]: 'play', - [ExperimentAction.Pause]: 'pause', - [ExperimentAction.Cancel]: 'stop', + // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', - [ExperimentAction.RetainLogs]: 'logs', - [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Kill]: 'cancelled', + // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -67,6 +42,7 @@ interface Props { selectedRuns: FlatRun[]; project: Project; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunActionButton = ({ @@ -74,57 +50,39 @@ const FlatRunActionButton = ({ selectedRuns, project, onActionSuccess, + onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); - // const permissions = usePermissions(); + const permissions = usePermissions(); const { openToast } = useToast(); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( async (action: BatchAction): Promise => { const validRunIds = selectedRuns - // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { projectId: project.id, runIds: validRunIds, }; switch (action) { - case ExperimentAction.OpenTensorBoard: { - if (validRunIds.length !== selectedRuns.length) { - // if unmanaged experiments are selected, open experimentTensorBoardModal - // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs - } else { - openCommandResponse( - await openOrCreateTensorBoard({ - experimentIds: params.runIds, - workspaceId: project.workspaceId, - }), - ); - } - return; - } case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - case ExperimentAction.RetainLogs: - // return ExperimentRetainLogsModal.open(); - case ExperimentAction.Activate: - // return await activate(params); + // return ExperimentMoveModal.open(); + break; case ExperimentAction.Archive: return await archiveRuns(params); - case ExperimentAction.Cancel: - // return await cancelExperiments(params); case ExperimentAction.Kill: return await killRuns(params); - case ExperimentAction.Pause: - // return await pauseExperiments(params); case ExperimentAction.Unarchive: return await unarchiveRuns(params); case ExperimentAction.Delete: return await deleteRuns(params); + default: + break; } }, - [project.id, project.workspaceId, selectedRuns], + [project.id, selectedRuns], ); const submitBatchAction = useCallback( @@ -169,10 +127,7 @@ const FlatRunActionButton = ({ }); } } catch (e) { - const publicSubject = - action === ExperimentAction.OpenTensorBoard - ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` - : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { isUserTriggered: true, publicMessage: 'Please try again later.', @@ -180,20 +135,16 @@ const FlatRunActionButton = ({ silent: false, }); } finally { - // onActionComplete?.(); + onActionComplete?.(); } }, - [sendBatchActions, onActionSuccess, openToast], + [sendBatchActions, onActionSuccess, openToast, onActionComplete], ); const handleBatchAction = useCallback( (action: string) => { switch (action) { - case ExperimentAction.OpenTensorBoard: - submitBatchAction(action); - break; case ExperimentAction.Move: - case ExperimentAction.RetainLogs: sendBatchActions(action); break; default: @@ -202,27 +153,22 @@ const FlatRunActionButton = ({ break; } }, - [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + [BatchActionConfirmModal, sendBatchActions], ); - // const availableBatchActions = useMemo(() => { - // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); - // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. - // }, [selectedExperimentIds, experimentMap, permissions]); + const availableBatchActions = useMemo(() => { + return getActionsForFlatRunsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + }, [selectedRuns, permissions]); const editMenuItems = useMemo(() => { - const groupedBatchActions = [ - BATCH_ACTIONS.slice(0, 1), // View in TensorBoard - BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete - BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill - ]; + const groupedBatchActions = [BATCH_ACTIONS]; const groupSize = groupedBatchActions.length; return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { const isLastGroup = index === groupSize - 1; group.forEach((action) => acc.push({ danger: action === ExperimentAction.Delete, - // disabled: !availableBatchActions.includes(action), // TODO uncomment later + disabled: !availableBatchActions.includes(action), icon: , key: action, label: action, @@ -231,7 +177,7 @@ const FlatRunActionButton = ({ if (!isLastGroup) acc.push({ type: 'divider' }); return acc; }, []); - }, []); + }, [availableBatchActions]); return ( <> @@ -245,7 +191,7 @@ const FlatRunActionButton = ({ {batchAction && ( exp.unmanaged)} // TODO: is it needed for Runs? + isUnmanagedIncluded={selectedRuns.some((run) => run.experiment?.unmanaged ?? false)} onConfirm={() => submitBatchAction(batchAction)} /> )} diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 84463695548..22ab2ab6380 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1146,6 +1146,10 @@ export interface ExperimentPermissionsArgs { experiment: ProjectExperiment; } +export interface FlatRunPermissionsArgs { + flatRun: FlatRun; +} + export interface PermissionWorkspace { id: number; userId?: number; @@ -1253,3 +1257,14 @@ export interface FlatRunExperiment { export interface SearchFlatRunPagination extends WithPagination { runs: FlatRun[]; } + +export const FlatRunAction = { + Archive: 'Archive', + Delete: 'Delete', + Kill: 'Kill', + Move: 'Move', + // Pause: 'Pause', + Unarchive: 'Unarchive', +} as const; + +export type FlatRunAction = ValueOf; diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts new file mode 100644 index 00000000000..6375851fd24 --- /dev/null +++ b/webui/react/src/utils/flatRun.ts @@ -0,0 +1,72 @@ +import { deletableRunStates, killableRunStates, terminalRunStates } from 'constants/states'; +import { PermissionsHook } from 'hooks/usePermissions'; +import { FlatRun, FlatRunAction } from 'types'; + +type FlatRunChecker = (flatRun: FlatRun) => boolean; + +type FlatRunPermissionSet = Pick< + PermissionsHook, + 'canCreateExperiment' | 'canDeleteFlatRun' | 'canModifyExperiment' | 'canMoveFlatRun' +>; + +const flatRunCheckers: Record = { + [FlatRunAction.Archive]: (flatRun) => + !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + + [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), + + [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), + + [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + + // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), + + [FlatRunAction.Unarchive]: (flatRun) => + terminalRunStates.has(flatRun.state) && flatRun.parentArchived, +}; + +export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { + return flatRunCheckers[action](flatRun); +}; + +const getActionsForFlatRun = ( + flatRun: FlatRun, + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun) return []; // redundant, for clarity + const workspace = { id: flatRun.workspaceId }; + return targets + .filter((action) => canActionFlatRun(action, flatRun)) + .filter((action) => { + switch (action) { + case FlatRunAction.Delete: + return permissions.canDeleteFlatRun({ flatRun }); + + case FlatRunAction.Move: + return permissions.canMoveFlatRun({ flatRun }); + + case FlatRunAction.Archive: + case FlatRunAction.Unarchive: + return permissions.canModifyExperiment({ workspace }); + + case FlatRunAction.Kill: + return permissions.canModifyExperiment({ workspace }) && !flatRun.experiment?.unmanaged; + + default: + return true; + } + }); +}; + +export const getActionsForFlatRunsUnion = ( + flatRun: FlatRun[], + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun.length) return []; + const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); + return targets.filter((action) => + actionsForRuns.some((runActions) => runActions.includes(action)), + ); +}; From 73c65eb3aace9d90da3faecf2e66aff1f9850c93 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 17:28:07 -0700 Subject: [PATCH 100/161] feat: return `archived` for FlatRun --- harness/determined/common/api/bindings.py | 4 ++ master/internal/api_runs.go | 1 + proto/pkg/runv1/run.pb.go | 60 +++++++++++++--------- proto/src/determined/run/v1/run.proto | 5 +- webui/react/src/services/api-ts-sdk/api.ts | 6 +++ webui/react/src/services/apiConfig.ts | 15 +++--- webui/react/src/types.ts | 1 + webui/react/src/utils/flatRun.ts | 7 ++- 8 files changed, 64 insertions(+), 35 deletions(-) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index 52e3eb1edf6..dcc085d560f 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -4275,6 +4275,7 @@ class v1FlatRun(Printable): def __init__( self, *, + archived: bool, checkpointCount: int, checkpointSize: str, id: int, @@ -4295,6 +4296,7 @@ def __init__( summaryMetrics: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, userId: "typing.Union[int, None, Unset]" = _unset, ): + self.archived = archived self.checkpointCount = checkpointCount self.checkpointSize = checkpointSize self.id = id @@ -4327,6 +4329,7 @@ def __init__( @classmethod def from_json(cls, obj: Json) -> "v1FlatRun": kwargs: "typing.Dict[str, typing.Any]" = { + "archived": obj["archived"], "checkpointCount": obj["checkpointCount"], "checkpointSize": obj["checkpointSize"], "id": obj["id"], @@ -4360,6 +4363,7 @@ def from_json(cls, obj: Json) -> "v1FlatRun": def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out: "typing.Dict[str, typing.Any]" = { + "archived": self.archived, "checkpointCount": self.checkpointCount, "checkpointSize": self.checkpointSize, "id": self.id, diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 5e86620dcc7..de4592eb2a5 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,6 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). + ColumnExpr("r.archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 7406eca7199..9816a359c85 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,6 +216,8 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` + // The archived status of this run + Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` } func (x *FlatRun) Reset() { @@ -383,6 +385,13 @@ func (x *FlatRun) GetExperiment() *FlatRunExperiment { return nil } +func (x *FlatRun) GetArchived() bool { + if x != nil { + return x.Archived + } + return false +} + var File_determined_run_v1_run_proto protoreflect.FileDescriptor var file_determined_run_v1_run_proto_rawDesc = []byte{ @@ -440,7 +449,7 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x70, 0x61, 0x63, 0x68, 0x79, 0x64, 0x65, 0x72, 0x6d, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xf9, 0x08, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0xa0, 0x09, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, @@ -493,29 +502,32 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x6e, 0x74, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x06, - 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x3a, - 0x9b, 0x01, 0x92, 0x41, 0x97, 0x01, 0x0a, 0x94, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, - 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0xd2, 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, - 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, - 0x01, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, - 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, - 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, - 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, - 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, - 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, - 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, - 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, - 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, - 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, - 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1a, 0x0a, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x3a, 0xa6, 0x01, 0x92, 0x41, + 0xa2, 0x01, 0x0a, 0x9f, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, 0x0a, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0xd2, + 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0a, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, + 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0xd2, 0x01, 0x08, 0x61, 0x72, 0x63, 0x68, + 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, + 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, + 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, + 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, + 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, + 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, + 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/proto/src/determined/run/v1/run.proto b/proto/src/determined/run/v1/run.proto index 62f4a54502f..6ea1b43e226 100644 --- a/proto/src/determined/run/v1/run.proto +++ b/proto/src/determined/run/v1/run.proto @@ -66,7 +66,8 @@ message FlatRun { "project_name", "workspace_id", "workspace_name", - "parent_archived" + "parent_archived", + "archived" ] } }; @@ -110,4 +111,6 @@ message FlatRun { bool parent_archived = 18; // Data related the the experiment associated with this run. optional FlatRunExperiment experiment = 19; + // The archived status of this run + bool archived = 20; } diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index a5f12afc19c..ff4613b3b9e 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3494,6 +3494,12 @@ export interface V1FlatRun { * @memberof V1FlatRun */ experiment?: V1FlatRunExperiment; + /** + * The archived status of this run + * @type {boolean} + * @memberof V1FlatRun + */ + archived: boolean; } /** * diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index 7c8c01d55f3..b782ac8f284 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1176,12 +1176,15 @@ export const moveRuns: DetApi detApi.Internal.moveRuns(params, options), }; -export const unarchiveRuns: DetApi = - { - name: 'unarchiveRuns', - postProcess: noOp, - request: (params, options) => detApi.Internal.unarchiveRuns(params, options), - }; +export const unarchiveRuns: DetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'unarchiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), +}; /* Tasks */ diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 22ab2ab6380..6f633247b19 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1237,6 +1237,7 @@ export interface FlatRun { projectName: string; workspaceId: number; workspaceName: string; + archived: boolean; parentArchived: boolean; experiment?: FlatRunExperiment; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6375851fd24..6c2aef34d5e 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,18 +11,17 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), - [FlatRunAction.Unarchive]: (flatRun) => - terminalRunStates.has(flatRun.state) && flatRun.parentArchived, + [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { From 9aaca82b35f3b6c13474158499f9fdb11fd8715d Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 11:09:46 -0700 Subject: [PATCH 101/161] chore: minor changes --- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 3 +-- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 15 +++++---------- webui/react/src/utils/flatRun.ts | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index ee7130b4ddb..0413a0a35b3 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -126,6 +126,7 @@ const FlatRunActionButton = ({ title: `Partial ${action} Failure`, }); } + await onActionComplete?.(); } catch (e) { const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { @@ -134,8 +135,6 @@ const FlatRunActionButton = ({ publicSubject, silent: false, }); - } finally { - onActionComplete?.(); } }, [sendBatchActions, onActionSuccess, openToast, onActionComplete], diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index d76315d33e9..8425c37b528 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -53,7 +53,6 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; -import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -657,14 +656,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); - const onActionSuccess = useCallback( - // TODO: update this function - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (_action: BatchAction, _successfulIds: number[]) => { - handleSelectionChange('remove-all'); - }, - [handleSelectionChange], - ); + const onActionComplete = useCallback(async () => { + handleSelectionChange('remove-all'); + await fetchRuns(); + }, [fetchRuns, handleSelectionChange]); const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -954,7 +949,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} - onActionSuccess={onActionSuccess} + onActionComplete={onActionComplete} /> diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6c2aef34d5e..fb266d5c797 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,13 +11,13 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), + !flatRun.parentArchived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, + [FlatRunAction.Move]: (flatRun) => !flatRun.parentArchived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), From 7ce852ed8ca4b4f1865ff51b91fee4f0e160d647 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 15:15:43 -0700 Subject: [PATCH 102/161] test: `canActionFlatRun` test cases --- webui/react/src/constants/states.ts | 2 +- webui/react/src/utils/flatRun.test.ts | 218 ++++++++++++++++++++++++++ 2 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 webui/react/src/utils/flatRun.test.ts diff --git a/webui/react/src/constants/states.ts b/webui/react/src/constants/states.ts index c0cb4ab57e1..677c4477e99 100644 --- a/webui/react/src/constants/states.ts +++ b/webui/react/src/constants/states.ts @@ -65,7 +65,7 @@ export const terminalCommandStates: Set = new Set([ CommandState.Terminating, ]); -const runStateList = [ +export const runStateList = [ RunState.Canceled, RunState.Completed, RunState.Error, diff --git a/webui/react/src/utils/flatRun.test.ts b/webui/react/src/utils/flatRun.test.ts new file mode 100644 index 00000000000..3b7d97c29f7 --- /dev/null +++ b/webui/react/src/utils/flatRun.test.ts @@ -0,0 +1,218 @@ +import dayjs from 'dayjs'; + +import { + deletableRunStates, + killableRunStates, + runStateList, + terminalRunStates, +} from 'constants/states'; +import { FlatRun, FlatRunAction, RunState } from 'types'; +import { canActionFlatRun } from 'utils/flatRun'; + +describe('Flat Run Utilities', () => { + const BASE_FLAT_RUN: Readonly = { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }; + + describe('canActionFlatRun function', () => { + const terminatedRunStates: Set = new Set( + Object.values(RunState).filter((v) => terminalRunStates.has(v)), + ); + + describe('Archive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be archivable (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, flatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be archivable (%s)', + (terminatedRunState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, archivedFlatRun)).toBeFalsy(); + + // parentArchived and archived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, bothArchivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Unarchive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be unarchivable (%s)', + (terminatedRunState) => { + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeTruthy(); + + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, bothArchivedFlatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be unarchivable with Terminated Run State (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, parentArchivedFlatRun)).toBeFalsy(); + }, + ); + + it.each(Array.from(Object.values(RunState).filter((v) => !terminatedRunStates.has(v))))( + 'should not be unarchivable with non Terminated Run States (%s)', + (nonTerminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Delete Action', () => { + it.each(runStateList)('should be deletable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((state) => !deletableRunStates.has(state)))( + 'should not be deletable', + (nonDeletableRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonDeletableRunState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Kill Action', () => { + const killRunStates: Set = new Set( + Object.values(RunState).filter((v) => killableRunStates.includes(v)), + ); + + it.each(Array.from(killRunStates))('should be killable (%s)', (killRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: killRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((v) => !killRunStates.has(v)))( + 'should not be killable (%s)', + (nonKillRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonKillRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Move Action', () => { + it.each(Object.values(RunState))('should be movable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState))('should not be movable (%s)', (runState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, archivedFlatRun)).toBeFalsy(); + + // both archived and parentArchived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, bothArchivedFlatRun)).toBeFalsy(); + }); + }); + }); +}); From d1d2a3263bcfc0a442715048474906b7a5aceca8 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 11:49:57 -0700 Subject: [PATCH 103/161] chore: better type --- .../pages/FlatRuns/FlatRunActionButton.tsx | 4 ++-- webui/react/src/utils/flatRun.ts | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 0413a0a35b3..a1a650b836a 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -39,8 +39,8 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; - selectedRuns: FlatRun[]; - project: Project; + selectedRuns: ReadonlyArray>; + project: Readonly; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index fb266d5c797..8b52c9cb22c 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -2,7 +2,7 @@ import { deletableRunStates, killableRunStates, terminalRunStates } from 'consta import { PermissionsHook } from 'hooks/usePermissions'; import { FlatRun, FlatRunAction } from 'types'; -type FlatRunChecker = (flatRun: FlatRun) => boolean; +type FlatRunChecker = (flatRun: Readonly) => boolean; type FlatRunPermissionSet = Pick< PermissionsHook, @@ -24,15 +24,15 @@ const flatRunCheckers: Record = { [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; -export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { +export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly): boolean => { return flatRunCheckers[action](flatRun); }; const getActionsForFlatRun = ( - flatRun: FlatRun, - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: Readonly, + targets: ReadonlyArray, + permissions: Readonly, +): ReadonlyArray => { if (!flatRun) return []; // redundant, for clarity const workspace = { id: flatRun.workspaceId }; return targets @@ -59,10 +59,10 @@ const getActionsForFlatRun = ( }; export const getActionsForFlatRunsUnion = ( - flatRun: FlatRun[], - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: ReadonlyArray>, + targets: ReadonlyArray, + permissions: Readonly, +): Readonly => { if (!flatRun.length) return []; const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); return targets.filter((action) => From a60ef4d45d3e6e2d61d288a03a14c63830698ca3 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 12:18:04 -0700 Subject: [PATCH 104/161] test: `FlatRunActionButton` test --- .../FlatRuns/FlatRunActionButton.test.tsx | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx new file mode 100644 index 00000000000..9a9b1ba7aeb --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -0,0 +1,60 @@ +import { render, screen } from '@testing-library/react'; +import dayjs from 'dayjs'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; + +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; +import { FlatRun, Project, RunState, WorkspaceState } from 'types'; + +const setup = (selectedFlatRuns: ReadonlyArray>) => { + const project: Readonly = { + archived: false, + id: 1, + immutable: false, + name: 'proj', + notes: [], + state: WorkspaceState.Unspecified, + userId: 1, + workspaceId: 1, + }; + + render( + + + , + ); +}; + +describe('canActionFlatRun function', () => { + describe('Flat Run Action Button Visibility', () => { + it('should not be appeard without selected flat runs', () => { + setup([]); + expect(screen.queryByText('Actions')).not.toBeInTheDocument(); + }); + + it('should be appeard with selected flat runs', async () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + + setup(flatRuns); + expect(await screen.findByText('Actions')).toBeInTheDocument(); + }); + }); +}); From b2cf2e5109f7e1abc5ee50e83926b99995a09024 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 30 May 2024 09:59:52 -0700 Subject: [PATCH 105/161] fix: fix run `archived` logic in postgres --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index de4592eb2a5..e01aa9fd507 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -139,7 +139,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived"). + ColumnExpr("r.archived OR e.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). From ad47ffc2f4f9be8af7410709aeb19450d34f1ecb Mon Sep 17 00:00:00 2001 From: Ashton G Date: Mon, 3 Jun 2024 10:16:09 -0400 Subject: [PATCH 106/161] chore: run bulk action interstitial component (#9390) Co-authored-by: Keita Fish --- .../components/InterstitialModalComponent.tsx | 2 +- ...nFilterInterstitialModalComponent.test.tsx | 216 ++++++++++++++++++ .../RunFilterInterstitialModalComponent.tsx | 168 ++++++++++++++ .../RunMoveWarningModalComponent.test.tsx | 93 ++++++++ .../RunMoveWarningModalComponent.tsx | 54 +++++ webui/react/src/hooks/useTypedParams.test.tsx | 4 +- .../pages/TrialDetails/TrialDetailsLogs.tsx | 15 +- webui/react/src/setupTests.ts | 19 +- .../src/utils/mergeAbortControllers.test.ts | 87 +++++++ .../react/src/utils/mergeAbortControllers.ts | 20 ++ 10 files changed, 653 insertions(+), 25 deletions(-) create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.test.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.tsx create mode 100644 webui/react/src/utils/mergeAbortControllers.test.ts create mode 100644 webui/react/src/utils/mergeAbortControllers.ts diff --git a/webui/react/src/components/InterstitialModalComponent.tsx b/webui/react/src/components/InterstitialModalComponent.tsx index 0789b4a6b38..7eaff4c822e 100644 --- a/webui/react/src/components/InterstitialModalComponent.tsx +++ b/webui/react/src/components/InterstitialModalComponent.tsx @@ -6,7 +6,7 @@ import { useCallback, useEffect } from 'react'; export type onInterstitialCloseActionType = (reason: 'ok' | 'close' | 'failed') => void; interface Props { - onCloseAction: (reason: 'ok' | 'close' | 'failed') => void; + onCloseAction: onInterstitialCloseActionType; loadableData: Loadable; } diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx new file mode 100644 index 00000000000..3284273cdaf --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx @@ -0,0 +1,216 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { FilterFormSetWithoutId, FormField } from 'components/FilterForm/components/type'; +import RunFilterInterstitialModalComponent, { + CloseReason, + ControlledModalRef, + Props, +} from 'components/RunFilterInterstitialModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +vi.mock('services/api', async () => ({ + ...(await vi.importActual('services/api')), + searchRuns: vi.fn(() => + Promise.resolve({ + pagination: { + total: 0, + }, + }), + ), +})); + +const { searchRuns } = await import('services/api'); +const searchRunsMock = vi.mocked(searchRuns); + +const emptyFilterFormSetWithoutId: FilterFormSetWithoutId = { + filterGroup: { + children: [], + conjunction: 'or', + kind: 'group', + }, + showArchived: false, +}; + +const setupTest = (props: Partial = {}) => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunFilterInterstitialModalComponent', () => { + beforeEach(() => { + searchRunsMock.mockRestore(); + }); + + it('does not call server until opened', () => { + const { ref } = setupTest(); + + expect(searchRunsMock).not.toBeCalled(); + act(() => { + ref.current?.open(); + }); + expect(searchRunsMock).toBeCalled(); + }); + + it('calls server with filter describing filter selection', () => { + const expectedFilterGroup: FilterFormSetWithoutId['filterGroup'] = { + children: [ + { + columnName: 'experimentName', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator: 'contains', + type: 'COLUMN_TYPE_TEXT', + value: 'foo', + }, + ], + conjunction: 'and', + kind: 'group', + }; + const expectedExclusions = [1, 2, 3]; + const { ref } = setupTest({ + filterFormSet: { + filterGroup: expectedFilterGroup, + showArchived: true, + }, + selection: { + exclusions: expectedExclusions, + type: 'ALL_EXCEPT', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + // TODO: is there a better way to test this expectation? + expect(filterFormSet.showArchived).toBeTruthy(); + const [filterGroup, idFilterGroup] = filterFormSet.filterGroup.children?.[0].children || []; + expect(filterGroup).toEqual(expectedFilterGroup); + + const idFilters = idFilterGroup.children; + expect(idFilters.every((f: FormField) => f.operator === '!=')).toBeTruthy(); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedExclusions); + }); + + it('calls server with filter describing visual selection', () => { + const expectedSelection = [1, 2, 3]; + const { ref } = setupTest({ + selection: { + selections: expectedSelection, + type: 'ONLY_IN', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + expect(filterFormSet.showArchived).toBe(false); + const idFilters = filterFormSet.filterGroup.children?.[0].children || []; + expect(idFilters.every((f: FormField) => f.operator === '=')).toBe(true); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedSelection); + }); + + it('cancels request when modal is closed via close button', async () => { + searchRunsMock.mockImplementation((_params, options) => { + return new Promise((_resolve, reject) => { + options?.signal?.addEventListener('abort', () => { + reject(); + }); + }); + }); + const { ref } = setupTest(); + // explicit type here because typescript can't infer that the act function + // runs imperatively. + let lifecycle: Promise | undefined; + // we don't await the act because we need the render pipeline to flush + // before we get the close reason back + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('close'); + }); + + it('closes modal with has_search_runs when it has runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 1, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('has_search_runs'); + }); + + it('closes modal with no_search_runs when it lacks runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 0, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('no_search_runs'); + }); + + it('closes modal with failed when request errors outside of aborts', async () => { + searchRunsMock.mockImplementation(() => Promise.reject(new Error('uh oh!'))); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('failed'); + }); +}); diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx new file mode 100644 index 00000000000..a117b74202e --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx @@ -0,0 +1,168 @@ +import { useModal } from 'hew/Modal'; +import { Failed, NotLoaded } from 'hew/utils/loadable'; +import { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react'; + +import { FilterFormSetWithoutId, Operator } from 'components/FilterForm/components/type'; +import InterstitialModalComponent, { + onInterstitialCloseActionType, +} from 'components/InterstitialModalComponent'; +import { SelectionType } from 'components/Searches/Searches.settings'; +import { useAsync } from 'hooks/useAsync'; +import { searchRuns } from 'services/api'; +import { DetError } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; +import { observable } from 'utils/observable'; + +export type CloseReason = 'has_search_runs' | 'no_search_runs' | 'failed' | 'close' | 'manual'; + +export interface Props { + projectId?: number; + selection: SelectionType; + filterFormSet: FilterFormSetWithoutId; +} + +export interface ControlledModalRef { + open: () => Promise; + close: (reason?: CloseReason) => void; +} + +/** + * Modal component for checking selections for runs that are part of a search. + * is essentially a single purpose interstitial modal component. Because it + * wraps a modal and the intended use is within a user flow, this component does + * not use the `useModal` hook. instead, it exposes control via ref. the `open` + * method of the ref returns a promise that resolves when the modal is closed + * with the reason why the modal closed. + * + */ +export const RunFilterInterstitialModalComponent = forwardRef( + ({ projectId, selection, filterFormSet }: Props, ref): JSX.Element => { + const InterstitialModal = useModal(InterstitialModalComponent); + const [isOpen, setIsOpen] = useState(false); + const closeController = useRef(new AbortController()); + const lifecycleObservable = useRef(observable(null)); + + const { close: internalClose, open: internalOpen } = InterstitialModal; + + const open = async () => { + internalOpen(); + setIsOpen(true); + const closeReason = await lifecycleObservable.current.toPromise(); + if (closeReason === null) { + // this promise should never reject -- toPromise only resolves when the + // value changes, and no code sets the observavble to null + return Promise.reject(); + } + return closeReason; + }; + + const close = useCallback( + (reason: CloseReason = 'manual') => { + setIsOpen(false); + // encourage render with isOpen to false before closing to prevent + // firing onCloseAction twice + setTimeout(() => internalClose('close'), 0); + closeController.current.abort(); + closeController.current = new AbortController(); + lifecycleObservable.current.set(reason); + lifecycleObservable.current = observable(null); + }, + [internalClose], + ); + + useImperativeHandle(ref, () => ({ close, open })); + + const selectionHasSearchRuns = useAsync( + async (canceler) => { + if (!isOpen) return NotLoaded; + const mergedCanceler = mergeAbortControllers(canceler, closeController.current); + const idToFilter = (operator: Operator, id: number) => + ({ + columnName: 'id', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator, + type: 'COLUMN_TYPE_NUMBER', + value: id, + }) as const; + const filterGroup: FilterFormSetWithoutId['filterGroup'] = + selection.type === 'ALL_EXCEPT' + ? { + children: [ + filterFormSet.filterGroup, + { + children: selection.exclusions.map(idToFilter.bind(this, '!=')), + conjunction: 'and', + kind: 'group', + }, + ], + conjunction: 'and', + kind: 'group', + } + : { + children: selection.selections.map(idToFilter.bind(this, '=')), + conjunction: 'or', + kind: 'group', + }; + const filter: FilterFormSetWithoutId = { + ...filterFormSet, + filterGroup: { + children: [ + filterGroup, + { + columnName: 'numTrials', + kind: 'field', + location: 'LOCATION_TYPE_EXPERIMENT', + operator: '>', + type: 'COLUMN_TYPE_NUMBER', + value: 1, + } as const, + ], + conjunction: 'and', + kind: 'group', + }, + }; + try { + const results = await searchRuns( + { + filter: JSON.stringify(filter), + limit: 0, + projectId, + }, + { signal: mergedCanceler.signal }, + ); + + return (results.pagination.total || 0) > 0; + } catch (e) { + if (!mergedCanceler.signal.aborted) { + return Failed(e instanceof Error ? e : new DetError(e)); + } + return NotLoaded; + } + }, + [selection, filterFormSet, projectId, isOpen], + ); + + const interstitialClose: onInterstitialCloseActionType = useCallback( + (reason) => { + if (reason === 'ok') { + return selectionHasSearchRuns.forEach((bool) => { + const fixedReason = bool ? 'has_search_runs' : 'no_search_runs'; + close(fixedReason); + }); + } + close(reason); + }, + [close, selectionHasSearchRuns], + ); + + return ( + + ); + }, +); + +export default RunFilterInterstitialModalComponent; diff --git a/webui/react/src/components/RunMoveWarningModalComponent.test.tsx b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx new file mode 100644 index 00000000000..8847538b527 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx @@ -0,0 +1,93 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { + CloseReason, + RunMoveWarningFlowRef, + RunMoveWarningModalComponent, +} from 'components/RunMoveWarningModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +const setupTest = () => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunMoveWarningModalComponent', () => { + it('is not shown until opened', () => { + const { ref } = setupTest(); + + expect(screen.queryByText('Move Run Dependency Alert')).toBeNull(); + act(() => { + ref.current?.open(); + }); + expect(screen.queryByText('Move Run Dependency Alert')).not.toBeNull(); + }); + + it('closes modal with cancel when closed with the x button', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with cancel when cancel button is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const cancelButton = await screen.findByText('Cancel'); + await userEvent.click(cancelButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with ok when submit is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const okayButton = await screen.findByText('Move independent runs'); + await userEvent.click(okayButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('ok'); + }); + + it('closes modal with manual when manually closed with no arg', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + act(() => { + ref.current?.close(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('manual'); + }); +}); diff --git a/webui/react/src/components/RunMoveWarningModalComponent.tsx b/webui/react/src/components/RunMoveWarningModalComponent.tsx new file mode 100644 index 00000000000..3a2d0086e20 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.tsx @@ -0,0 +1,54 @@ +import { Modal, useModal } from 'hew/Modal'; +import { observable, WritableObservable } from 'micro-observables'; +import { forwardRef, useImperativeHandle, useRef } from 'react'; + +export type CloseReason = 'ok' | 'cancel' | 'manual'; + +import handleError from 'utils/error'; + +type RunMoveWarningProps = { + onClose: (reason: 'ok' | 'cancel') => void; +}; +const RunMoveWarningCopy = ({ onClose }: RunMoveWarningProps) => ( + onClose('ok'), text: 'Move independent runs' }} + title="Move Run Dependency Alert" + onClose={() => onClose('cancel')}> + Some runs you are trying to move belong to a Hyperparameter Search and cannot be moved + independently to maintain their contextual relationships. These runs will be skipped. + +); + +export type RunMoveWarningFlowRef = { + open: () => Promise; + close: () => void; +}; + +export const RunMoveWarningModalComponent = forwardRef((_, ref) => { + const RunMoveWarning = useModal(RunMoveWarningCopy); + const closeReason = useRef>(observable(null)); + + const { close: internalClose, open: internalOpen } = RunMoveWarning; + + const open = async () => { + internalOpen(); + const reason = await closeReason.current.toPromise(); + if (reason === null) { + return Promise.reject(); + } + return reason; + }; + + const close = (reason: CloseReason = 'manual') => { + internalClose(reason); + closeReason.current.set(reason); + closeReason.current = observable(null); + }; + + useImperativeHandle(ref, () => ({ close, open })); + + return ; +}); + +export default RunMoveWarningModalComponent; diff --git a/webui/react/src/hooks/useTypedParams.test.tsx b/webui/react/src/hooks/useTypedParams.test.tsx index 054c5aecdb9..dadaf631d7e 100644 --- a/webui/react/src/hooks/useTypedParams.test.tsx +++ b/webui/react/src/hooks/useTypedParams.test.tsx @@ -174,8 +174,8 @@ describe('useTypedParams', () => { .afterEach(() => navSpy.mockClear()), ); }); - it('does not update if params are not changed', () => { - fc.assert( + it('does not update if params are not changed', async () => { + await fc.assert( fc .asyncProperty(sameArbPartial, async ([params, partial]) => { const { hookRef } = setupTest(params); diff --git a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx index e75b75c99c7..8f93518fb7c 100644 --- a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx +++ b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx @@ -16,6 +16,7 @@ import { readStream } from 'services/utils'; import { ExperimentBase, TrialDetails } from 'types'; import { downloadTrialLogs } from 'utils/browser'; import handleError, { ErrorType } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; import css from './TrialDetailsLogs.module.scss'; @@ -26,20 +27,6 @@ export interface Props { type OrderBy = 'ORDER_BY_UNSPECIFIED' | 'ORDER_BY_ASC' | 'ORDER_BY_DESC'; -const mergeAbortControllers = (...controllers: AbortController[]) => { - const mergedController = new AbortController(); - - controllers.forEach((c) => { - const abort = () => { - mergedController.abort(); - c.signal.removeEventListener('abort', abort); - }; - c.signal.addEventListener('abort', abort); - }); - - return mergedController; -}; - const TrialDetailsLogs: React.FC = ({ experiment, trial }: Props) => { const { ui } = useUI(); const [filterOptions, setFilterOptions] = useState({}); diff --git a/webui/react/src/setupTests.ts b/webui/react/src/setupTests.ts index fe8c871c9f7..b8b22e32f0b 100644 --- a/webui/react/src/setupTests.ts +++ b/webui/react/src/setupTests.ts @@ -6,20 +6,23 @@ */ import '@testing-library/jest-dom/extend-expect'; import 'micro-observables/batchingForReactDom'; -import 'utils/prototypes'; import 'whatwg-fetch'; import Schema from 'async-validator'; -import { noOp } from 'utils/service'; +// this code doesn't work in node environments +if (globalThis.window) { + await import('utils/prototypes'); + const { noOp } = await import('utils/service'); -/** - * To clean up the async-validator console warning that get generated during testing. - * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning - */ -Schema.warning = noOp; + /** + * To clean up the async-validator console warning that get generated during testing. + * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning + */ + Schema.warning = noOp; +} -Object.defineProperty(window, 'matchMedia', { +Object.defineProperty(globalThis, 'matchMedia', { value: () => ({ addEventListener: vi.fn(), addListener: vi.fn(), // deprecated diff --git a/webui/react/src/utils/mergeAbortControllers.test.ts b/webui/react/src/utils/mergeAbortControllers.test.ts new file mode 100644 index 00000000000..51308bac61f --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.test.ts @@ -0,0 +1,87 @@ +// @vitest-environment node +// we're using node because the jsdom version of the abortcontroller doesn't have reasons on abortsignals +import fc from 'fast-check'; +import { zip } from 'lodash'; + +import { mergeAbortControllers } from 'utils/mergeAbortControllers'; + +// arbitrary to generate a list of abort controllers to pass to mergeAbortControllers +const argArb = fc.uniqueArray( + fc.constant(() => new AbortController()).map((f) => f()), + { minLength: 1 }, +); + +// return a subset of the above to control +const argArbWithSelection = (n?: number) => + argArb.chain((arr) => + fc.tuple(fc.constant(arr), fc.shuffledSubarray(arr, { maxLength: n, minLength: 1 })), + ); + +// the above, but the subset from the above returns with unique reason values to +// verify which abortController was the first to abort +const argArbWithSelectionAndReasons = (n?: number) => + argArbWithSelection(n).chain(([args, selection]) => { + const reasonsArb = fc.uniqueArray(fc.anything(), { + maxLength: selection.length, + minLength: selection.length, + }); + const selectionAndReasonArb = reasonsArb + .map((reasons) => zip(selection, reasons)) + .filter((tups): tups is [AbortController, unknown][] => + tups.every((tup) => tup.every((c) => c !== undefined)), + ); + + return fc.tuple(fc.constant(args), selectionAndReasonArb); + }); + +describe('mergeAbortControllers', () => { + it('merged abort controller aborts if any constituent aborts', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(); + expect(result.signal.aborted).toBe(true); + }), + ); + }); + it('merged abort controller aborts with constituent reason', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(1), ([args, abortControllers]) => { + const [[abortController, reason]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(reason); + expect(abortController.signal.reason).toBe(reason); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); + it('merged abort controller only reflects the first abort', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(), ([args, abortControllers]) => { + const [[firstAbortController]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortControllers.forEach(([abortController, reason]) => { + abortController.abort(reason); + }); + expect(result.signal.reason).toBe(firstAbortController.signal.reason); + }), + ); + }); + + it('merging an aborted controller results in an aborted controller', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + abortController.abort(); + const result = mergeAbortControllers(...args); + + expect(result.signal.aborted).toBe(true); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); +}); diff --git a/webui/react/src/utils/mergeAbortControllers.ts b/webui/react/src/utils/mergeAbortControllers.ts new file mode 100644 index 00000000000..98004fe3100 --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.ts @@ -0,0 +1,20 @@ +export const mergeAbortControllers = (...controllers: AbortController[]): AbortController => { + const mergedController = new AbortController(); + + controllers.forEach((c) => { + // resulting controller is aborted, just ignore the rest + if (mergedController.signal.aborted) return; + // preemptively abort if the signal's already aborted + if (c.signal.aborted) return mergedController.abort(c.signal.reason); + + const abort = () => { + mergedController.abort(c.signal.reason); + c.signal.removeEventListener('abort', abort); + }; + c.signal.addEventListener('abort', abort); + }); + + return mergedController; +}; + +export default mergeAbortControllers; From 85b0d50116195716771ec02321035d8d2ee6f704 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 11:02:29 -0700 Subject: [PATCH 107/161] chore: feedback --- .../pages/FlatRuns/FlatRunActionButton.test.tsx | 15 ++------------- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 10 +++++----- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 9a9b1ba7aeb..166fcd77d1b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -3,25 +3,14 @@ import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; -import { FlatRun, Project, RunState, WorkspaceState } from 'types'; +import { FlatRun, RunState } from 'types'; const setup = (selectedFlatRuns: ReadonlyArray>) => { - const project: Readonly = { - archived: false, - id: 1, - immutable: false, - name: 'proj', - notes: [], - state: WorkspaceState.Unspecified, - userId: 1, - workspaceId: 1, - }; - render( diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index a1a650b836a..e78658dcefa 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -8,7 +8,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; -import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; @@ -40,7 +40,7 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; - project: Readonly; + projectId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -48,7 +48,7 @@ interface Props { const FlatRunActionButton = ({ isMobile, selectedRuns, - project, + projectId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { @@ -63,7 +63,7 @@ const FlatRunActionButton = ({ .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { - projectId: project.id, + projectId, runIds: validRunIds, }; switch (action) { @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [project.id, selectedRuns], + [projectId, selectedRuns], ); const submitBatchAction = useCallback( diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 8425c37b528..460bc0b5ad2 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -947,7 +947,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { /> From 4d9e9b7af380674412fd78f11f1195fee44948f1 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 16:11:38 -0700 Subject: [PATCH 108/161] feat: basic move action --- .../FlatRuns/FlatRunActionButton.test.tsx | 1 + .../pages/FlatRuns/FlatRunActionButton.tsx | 19 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 194 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 4 +- webui/react/src/pages/ProjectDetails.tsx | 2 +- webui/react/src/pages/SearchDetails.tsx | 6 +- webui/react/src/services/api.ts | 8 +- webui/react/src/services/apiConfig.ts | 8 +- 8 files changed, 227 insertions(+), 15 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 166fcd77d1b..25beefaa41e 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -12,6 +12,7 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { isMobile={false} projectId={1} selectedRuns={selectedFlatRuns} + workspaceId={1} onActionComplete={vi.fn()} /> , diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index e78658dcefa..b3929b0ae00 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -7,6 +7,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; +import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; @@ -14,24 +15,20 @@ import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; const BATCH_ACTIONS = [ - // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; type BatchAction = (typeof BATCH_ACTIONS)[number]; const ACTION_ICONS: Record = { - // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', [ExperimentAction.Kill]: 'cancelled', - // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -41,6 +38,7 @@ interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; projectId: number; + workspaceId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -49,12 +47,15 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + workspaceId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); const permissions = usePermissions(); const { openToast } = useToast(); + const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = + useModal(FlatRunMoveModalComponent); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( @@ -68,8 +69,7 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - break; + return flatRunMoveModalOpen(); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [projectId, selectedRuns], + [flatRunMoveModalOpen, projectId, selectedRuns], ); const submitBatchAction = useCallback( @@ -194,6 +194,11 @@ const FlatRunActionButton = ({ onConfirm={() => submitBatchAction(batchAction)} /> )} + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx new file mode 100644 index 00000000000..87d449e6bb8 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -0,0 +1,194 @@ +import Form from 'hew/Form'; +import Icon from 'hew/Icon'; +import { Modal } from 'hew/Modal'; +import Select, { Option } from 'hew/Select'; +import Spinner from 'hew/Spinner'; +import { useToast } from 'hew/Toast'; +import { Label } from 'hew/Typography'; +import { Loadable } from 'hew/utils/loadable'; +import { List } from 'immutable'; +import { useObservable } from 'micro-observables'; +import React, { useEffect, useId } from 'react'; + +import Link from 'components/Link'; +import usePermissions from 'hooks/usePermissions'; +import { paths } from 'routes/utils'; +import { moveRuns } from 'services/api'; +import projectStore from 'stores/projects'; +import workspaceStore from 'stores/workspaces'; +import { FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { pluralizer } from 'utils/string'; + +const FORM_ID = 'move-flat-run-form'; + +type FormInputs = { + projectId?: number; + workspaceId?: number; +}; + +interface Props { + flatRuns: Readonly[]; + onSubmit?: (successfulIds?: number[]) => void; + sourceProjectId: number; + sourceWorkspaceId?: number; +} + +const FlatRunMoveModalComponent: React.FC = ({ + flatRuns, + onSubmit, + sourceProjectId, + sourceWorkspaceId, +}: Props) => { + const idPrefix = useId(); + const { openToast } = useToast(); + const [form] = Form.useForm(); + const workspaceId = Form.useWatch('workspaceId', form); + const projectId = Form.useWatch('projectId', form); + + const { canMoveExperimentsTo } = usePermissions(); + const workspaces = Loadable.getOrElse([], useObservable(workspaceStore.unarchived)).filter((w) => + canMoveExperimentsTo({ destination: { id: w.id } }), + ); + const loadableProjects: Loadable> = useObservable( + projectStore.getProjectsByWorkspace(workspaceId), + ); + + useEffect(() => { + if (workspaceId !== undefined) { + projectStore.fetch(workspaceId, undefined, true); + } + }, [workspaceId]); + + const handleSubmit = async () => { + if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { + openToast({ title: 'No changes to save.' }); + return; + } + const values = await form.validateFields(); + const projId = values.projectId ?? 1; + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); + + onSubmit?.(results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + }; + + return ( + +
+ + + + {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} +
+
+ ); +}; + +export default FlatRunMoveModalComponent; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 460bc0b5ad2..ec09bb43108 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -100,6 +100,7 @@ const formStore = new FilterFormStore(); interface Props { projectId: number; + workspaceId: number; searchId?: number; } @@ -118,7 +119,7 @@ const parseSortString = (sortString: string): Sort[] => { }); }; -const FlatRuns: React.FC = ({ projectId, searchId }) => { +const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const dataGridRef = useRef(null); const contentRef = useRef(null); const [searchParams, setSearchParams] = useSearchParams(); @@ -949,6 +950,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} projectId={projectId} selectedRuns={selectedRuns} + workspaceId={workspaceId} onActionComplete={onActionComplete} /> diff --git a/webui/react/src/pages/ProjectDetails.tsx b/webui/react/src/pages/ProjectDetails.tsx index 3274b4f5d7f..de9e15815f1 100644 --- a/webui/react/src/pages/ProjectDetails.tsx +++ b/webui/react/src/pages/ProjectDetails.tsx @@ -94,7 +94,7 @@ const ProjectDetails: React.FC = () => { children: (
- +
), diff --git a/webui/react/src/pages/SearchDetails.tsx b/webui/react/src/pages/SearchDetails.tsx index 369003a4c2e..f9a66783f1e 100644 --- a/webui/react/src/pages/SearchDetails.tsx +++ b/webui/react/src/pages/SearchDetails.tsx @@ -138,7 +138,11 @@ const SearchDetails: React.FC = () => { const tabItems: PivotProps['items'] = [ { children: experiment?.projectId && ( - + ), key: TabType.Trials, label: 'Trials', diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 39acbb16325..561101669bf 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -771,9 +771,11 @@ export const killRuns = generateDetApi( - Config.moveRuns, -); +export const moveRuns = generateDetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +>(Config.moveRuns); export const unarchiveRuns = generateDetApi< Api.V1UnarchiveRunsRequest, diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index b782ac8f284..fd92b846f39 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1170,9 +1170,13 @@ export const killRuns: DetApi detApi.Internal.killRuns(params, options), }; -export const moveRuns: DetApi = { +export const moveRuns: DetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +> = { name: 'moveRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.moveRuns(params, options), }; From 1f7ab64434fa01be7d199737920bf8392389d68f Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 17:13:24 -0700 Subject: [PATCH 109/161] feat: move warning modal --- .../FilterForm/components/FilterFormStore.ts | 21 ++ .../FlatRuns/FlatRunActionButton.test.tsx | 5 + .../pages/FlatRuns/FlatRunActionButton.tsx | 8 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 286 +++++++++++------- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 + 5 files changed, 206 insertions(+), 116 deletions(-) diff --git a/webui/react/src/components/FilterForm/components/FilterFormStore.ts b/webui/react/src/components/FilterForm/components/FilterFormStore.ts index b04658d53f0..e27c7c457b4 100644 --- a/webui/react/src/components/FilterForm/components/FilterFormStore.ts +++ b/webui/react/src/components/FilterForm/components/FilterFormStore.ts @@ -74,6 +74,27 @@ export class FilterFormStore { ); } + public get filterFormSetWithoutId(): Observable { + const replacer = (key: string, value: unknown): unknown => { + return key === 'id' ? undefined : value; + }; + return this.#formset.select((loadableFormset) => + Loadable.match(loadableFormset, { + _: () => ({ + filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, + showArchived: true, + }), + Loaded: (formset) => { + const sweepedForm = this.#sweepInvalid(structuredClone(formset.filterGroup)); + const newFormSet: FilterFormSetWithoutId = JSON.parse( + JSON.stringify({ ...formset, filterGroup: sweepedForm }, replacer), + ); + return newFormSet; + }, + }), + ); + } + public get fieldCount(): Observable { return this.getFieldCount(); } diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 25beefaa41e..b02bfaf216d 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Conjunction, FormKind } from 'components/FilterForm/components/type'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; @@ -9,6 +10,10 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { render( >; projectId: number; workspaceId: number; + filterFormSetWithoutId: FilterFormSetWithoutId; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -47,6 +49,7 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + filterFormSetWithoutId, workspaceId, onActionSuccess, onActionComplete, @@ -69,7 +72,8 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - return flatRunMoveModalOpen(); + flatRunMoveModalOpen(); + break; case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -195,9 +199,11 @@ const FlatRunActionButton = ({ /> )} ); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 87d449e6bb8..1c6c5ebc3de 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -8,9 +8,16 @@ import { Label } from 'hew/Typography'; import { Loadable } from 'hew/utils/loadable'; import { List } from 'immutable'; import { useObservable } from 'micro-observables'; -import React, { useEffect, useId } from 'react'; +import React, { Ref, useCallback, useEffect, useId, useRef } from 'react'; +import { FilterFormSetWithoutId } from 'components/FilterForm/components/type'; import Link from 'components/Link'; +import RunFilterInterstitialModalComponent, { + ControlledModalRef, +} from 'components/RunFilterInterstitialModalComponent'; +import RunMoveWarningModalComponent, { + RunMoveWarningFlowRef, +} from 'components/RunMoveWarningModalComponent'; import usePermissions from 'hooks/usePermissions'; import { paths } from 'routes/utils'; import { moveRuns } from 'services/api'; @@ -29,17 +36,23 @@ type FormInputs = { interface Props { flatRuns: Readonly[]; - onSubmit?: (successfulIds?: number[]) => void; sourceProjectId: number; sourceWorkspaceId?: number; + filterFormSetWithoutId: FilterFormSetWithoutId; + onSubmit?: (successfulIds?: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunMoveModalComponent: React.FC = ({ flatRuns, - onSubmit, + filterFormSetWithoutId, sourceProjectId, sourceWorkspaceId, + onSubmit, + onActionComplete, }: Props) => { + const controlledModalRef: Ref = useRef(null); + const runMoveWarningFlowRef: Ref = useRef(null); const idPrefix = useId(); const { openToast } = useToast(); const [form] = Form.useForm(); @@ -60,7 +73,7 @@ const FlatRunMoveModalComponent: React.FC = ({ } }, [workspaceId]); - const handleSubmit = async () => { + const handleSubmit = useCallback(async () => { if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { openToast({ title: 'No changes to save.' }); return; @@ -68,126 +81,169 @@ const FlatRunMoveModalComponent: React.FC = ({ const values = await form.validateFields(); const projId = values.projectId ?? 1; - const results = await moveRuns({ - destinationProjectId: projId, - runIds: flatRuns.map((flatRun) => flatRun.id), - sourceProjectId, - }); + try { + const closeReason = (await controlledModalRef.current?.open()) ?? 'failed'; + switch (closeReason) { + case 'has_search_runs': { + const closeWarningReason = await runMoveWarningFlowRef.current?.open(); + if (closeWarningReason === 'cancel') { + openToast({ title: 'Cancelled Move Action' }); + return; + } + break; + } + case 'no_search_runs': + break; + case 'manual': + case 'failed': + case 'close': + openToast({ title: 'Cancelled Move Action' }); + return; + } + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); - onSubmit?.(results.successful); + onSubmit?.(results.successful); - const numSuccesses = results.successful.length; - const numFailures = results.failed.length; + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; - const destinationProjectName = - Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? - ''; + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; - if (numSuccesses === 0 && numFailures === 0) { - openToast({ - description: 'No selected runs were eligible for moving', - title: 'No eligible runs', - }); - } else if (numFailures === 0) { - openToast({ - closeable: true, - description: `${results.successful.length} runs moved to project ${destinationProjectName}`, - link: View Project, - title: 'Move Success', - }); - } else if (numSuccesses === 0) { - openToast({ - description: `Unable to move ${numFailures} runs`, - severity: 'Warning', - title: 'Move Failure', - }); - } else { - openToast({ - closeable: true, - description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, - link: View Project, - severity: 'Warning', - title: 'Partial Move Failure', - }); + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + await onActionComplete?.(); + } catch (e) { + handleError(e, { publicSubject: 'Unable to move runs' }); } - form.resetFields(); - }; + }, [ + flatRuns, + form, + loadableProjects, + onActionComplete, + onSubmit, + openToast, + projectId, + sourceProjectId, + sourceWorkspaceId, + workspaceId, + ]); return ( - -
- - - - {workspaceId && workspaceId !== 1 && ( + <> + + - {Loadable.match(loadableProjects, { - Failed: () =>
Failed to load
, - Loaded: (loadableProjects) => ( - - ), - NotLoaded: () => , - })} + initialValue={sourceWorkspaceId ?? 1} + label="Workspace" + name="workspaceId" + rules={[{ message: 'Workspace is required', required: true }]}> +
- )} - -
+ {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} + +
+ + flatRun.id), type: 'ONLY_IN' }} + /> + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index ec09bb43108..75f2c381925 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -162,6 +162,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const sortString = useMemo(() => makeSortString(sorts.filter(validSort.is)), [sorts]); const loadableFormset = useObservable(formStore.formset); const filtersString = useObservable(formStore.asJsonString); + const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [total, setTotal] = useState>(NotLoaded); const isMobile = useMobile(); const [isLoading, setIsLoading] = useState(true); @@ -947,6 +948,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { onRowHeightChange={onRowHeightChange} /> Date: Wed, 5 Jun 2024 15:39:12 -0700 Subject: [PATCH 110/161] fix: feedback --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 1c6c5ebc3de..5acbd0f3b68 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -40,7 +40,7 @@ interface Props { sourceWorkspaceId?: number; filterFormSetWithoutId: FilterFormSetWithoutId; onSubmit?: (successfulIds?: number[]) => void; - onActionComplete?: () => Promise; + onActionComplete?: () => void; } const FlatRunMoveModalComponent: React.FC = ({ From 778edf11ae78be247bcae5549febf9d2592d7add Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 5 Jun 2024 15:42:35 -0700 Subject: [PATCH 111/161] fix: unarchive behavior --- master/internal/api_runs.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index e01aa9fd507..1eb7335ed56 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -33,6 +33,7 @@ import ( type runCandidateResult struct { Archived bool + ExpArchived bool ID int32 ExpID *int32 IsMultitrial bool @@ -139,7 +140,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived OR e.archived AS archived"). + ColumnExpr("r.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). @@ -692,6 +693,7 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, Model(&runCandidates). Column("r.id"). Column("r.archived"). + ColumnExpr("e.archived AS exp_archived"). ColumnExpr("r.experiment_id as exp_id"). ColumnExpr("false as is_multitrial"). ColumnExpr("r.state IN (?) AS is_terminal", bun.In(model.StatesToStrings(model.TerminalStates))). @@ -727,6 +729,11 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, for _, cand := range runCandidates { visibleIDs.Insert(cand.ID) switch { + case cand.ExpArchived: + results = append(results, &apiv1.RunActionResult{ + Error: "Parent is archived.", + Id: cand.ID, + }) case cand.Archived && archive: results = append(results, &apiv1.RunActionResult{ Error: "", From 647f255c82793f2cce55700c711f3152cc3938ba Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 5 Jun 2024 16:01:54 -0700 Subject: [PATCH 112/161] fix: minor fixes --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 5acbd0f3b68..b7715a5452b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -205,7 +205,6 @@ const FlatRunMoveModalComponent: React.FC = ({
{workspaceId && workspaceId !== 1 && ( From 2f3cf74565121a4ebf54380e3b80b233b9c1daf9 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 6 Jun 2024 22:53:33 -0700 Subject: [PATCH 113/161] fix: archive/unarchive error text fix --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 1eb7335ed56..07c2b178071 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -731,7 +731,7 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, switch { case cand.ExpArchived: results = append(results, &apiv1.RunActionResult{ - Error: "Parent is archived.", + Error: "Run is part of archived Search.", Id: cand.ID, }) case cand.Archived && archive: From 971fdca6c0c3e0776ad24698b8fb498fa04da059 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 01:03:31 -0700 Subject: [PATCH 114/161] test: `FlatRunMoveModal` --- .../FlatRuns/FlatRunActionButton.test.tsx | 51 +++++++--- .../pages/FlatRuns/FlatRunMoveModal.test.tsx | 98 +++++++++++++++++++ 2 files changed, 133 insertions(+), 16 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index b02bfaf216d..bf62f069710 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -1,4 +1,5 @@ import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; @@ -7,6 +8,8 @@ import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; const setup = (selectedFlatRuns: ReadonlyArray>) => { + const user = userEvent.setup(); + render( >) => { /> , ); + + return { + user, + }; }; describe('canActionFlatRun function', () => { describe('Flat Run Action Button Visibility', () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + it('should not be appeard without selected flat runs', () => { setup([]); expect(screen.queryByText('Actions')).not.toBeInTheDocument(); }); it('should be appeard with selected flat runs', async () => { - const flatRuns: ReadonlyArray> = [ - { - archived: false, - checkpointCount: 0, - checkpointSize: 0, - id: 1, - parentArchived: false, - projectId: 1, - projectName: 'test', - startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), - state: RunState.Active, - workspaceId: 10, - workspaceName: 'test', - }, - ]; - setup(flatRuns); expect(await screen.findByText('Actions')).toBeInTheDocument(); }); + + it('should show action list', async () => { + const { user } = setup(flatRuns); + + const actionButton = await screen.findByText('Actions'); + await user.click(actionButton); + expect(await screen.findByText('Move')).toBeInTheDocument(); + expect(await screen.findByText('Archive')).toBeInTheDocument(); + expect(await screen.findByText('Unarchive')).toBeInTheDocument(); + expect(await screen.findByText('Delete')).toBeInTheDocument(); + expect(await screen.findByText('Kill')).toBeInTheDocument(); + }); }); }); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx new file mode 100644 index 00000000000..d9b48dee593 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx @@ -0,0 +1,98 @@ +import { render, screen } from '@testing-library/react'; +import userEvent, { UserEvent } from '@testing-library/user-event'; +import dayjs from 'dayjs'; +import Button from 'hew/Button'; +import { useModal } from 'hew/Modal'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { useMemo } from 'react'; + +import { + Conjunction, + FilterFormSetWithoutId, + FormKind, +} from 'components/FilterForm/components/type'; +import { V1MoveRunsRequest } from 'services/api-ts-sdk'; +import { FlatRun, RunState } from 'types'; + +import FlatRunMoveModalComponent from './FlatRunMoveModal'; + +const OPEN_MODAL_TEXT = 'Open Modal'; + +vi.mock('services/api', () => ({ + createGroup: vi.fn(), + getWorkspaceProjects: vi.fn(() => + Promise.resolve({ projects: [{ id: 1, name: 'project_1', workspaceId: 1 }] }), + ), + moveRuns: (params: V1MoveRunsRequest) => { + return Promise.resolve({ + failed: [], + successful: params.runIds, + }); + }, +})); + +const Container = (): JSX.Element => { + const BASE_FLAT_RUNS: FlatRun[] = useMemo(() => { + return [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + }, []); + + const filterFormSetWithoutId: FilterFormSetWithoutId = useMemo(() => { + return { + filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, + showArchived: false, + }; + }, []); + + const flatRunMoveModal = useModal(FlatRunMoveModalComponent); + + return ( +
+ + +
+ ); +}; + +const setup = (): { user: UserEvent } => { + const user = userEvent.setup(); + + render( + + + , + ); + + return { + user, + }; +}; + +describe('FlatRunMoveModalComponent', () => { + it('should open modal', async () => { + const { user } = setup(); + + await user.click(screen.getByRole('button', { name: OPEN_MODAL_TEXT })); + expect((await screen.findAllByText('Move Runs')).length).toBe(2); + expect(await screen.findByText('Workspace')).toBeInTheDocument(); + expect(await screen.findByRole('button', { name: 'Cancel' })).toBeInTheDocument(); + expect(await screen.findByRole('button', { name: 'Move Runs' })).toBeInTheDocument(); + }); +}); From 8af94365318ab0c6478484811cb7e368ba67ba5f Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 11:37:40 -0700 Subject: [PATCH 115/161] test: ignore `bindings.py` for codecov --- codecov.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/codecov.yml b/codecov.yml index d1fd2e00b0e..5d293f5f733 100644 --- a/codecov.yml +++ b/codecov.yml @@ -12,16 +12,16 @@ coverage: backend: target: 42% threshold: 3% - flags: + flags: - backend informational: false - patch: + patch: default: informational: true - backend: + backend: target: 80% threshold: 5% - flags: + flags: - backend informational: false only_pulls: true @@ -29,14 +29,17 @@ coverage: flags: backend: carryforward: true - + github_checks: annotations: false -comment: +comment: layout: "diff, flags, files" behavior: default parsers: go: partials_as_hits: true + +ignore: + - "harness/determined/common/api/bindings.py" From fe06de14af54728fa6603287f8e8ad3b89102db8 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 12:48:12 -0700 Subject: [PATCH 116/161] test: backend test --- master/internal/api_runs_intg_test.go | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/master/internal/api_runs_intg_test.go b/master/internal/api_runs_intg_test.go index 7b4d541ae05..2cea0e703a6 100644 --- a/master/internal/api_runs_intg_test.go +++ b/master/internal/api_runs_intg_test.go @@ -1204,3 +1204,76 @@ func TestArchiveUnarchiveNoInput(t *testing.T) { require.NoError(t, err) require.Empty(t, unarchRes.Results) } + +func TestArchiveUnarchiveWithArchivedParent(t *testing.T) { + api, curUser, ctx := setupAPITest(t, nil) + _, projectID := createProjectAndWorkspace(ctx, t, api) + + activeConfig := schemas.WithDefaults(schemas.Merge(minExpConfig, expconf.ExperimentConfig{ + RawDescription: ptrs.Ptr("desc"), + RawName: expconf.Name{RawString: ptrs.Ptr("name")}, + })) + + exp := &model.Experiment{ + JobID: model.JobID(uuid.New().String()), + State: model.CompletedState, + OwnerID: &curUser.ID, + ProjectID: projectID, + StartTime: time.Now(), + Config: activeConfig.AsLegacy(), + } + require.NoError(t, api.m.db.AddExperiment(exp, []byte{10, 11, 12}, activeConfig)) + + task1 := &model.Task{TaskType: model.TaskTypeTrial, TaskID: model.NewTaskID()} + require.NoError(t, db.AddTask(ctx, task1)) + require.NoError(t, db.AddTrial(ctx, &model.Trial{ + State: model.CompletedState, + ExperimentID: exp.ID, + StartTime: time.Now(), + }, task1.TaskID)) + + task2 := &model.Task{TaskType: model.TaskTypeTrial, TaskID: model.NewTaskID()} + require.NoError(t, db.AddTask(ctx, task2)) + require.NoError(t, db.AddTrial(ctx, &model.Trial{ + State: model.CompletedState, + ExperimentID: exp.ID, + StartTime: time.Now(), + }, task2.TaskID)) + + sourceprojectID := int32(projectID) + req := &apiv1.SearchRunsRequest{ + ProjectId: &sourceprojectID, + Sort: ptrs.Ptr("id=asc"), + } + + resp, err := api.SearchRuns(ctx, req) + require.NoError(t, err) + require.Len(t, resp.Runs, 2) + + runID1, runID2 := resp.Runs[0].Id, resp.Runs[1].Id + + // Set the parent experiment as archived + _, err = api.ArchiveExperiment(ctx, &apiv1.ArchiveExperimentRequest{Id: int32(exp.ID)}) + require.NoError(t, err) + + runIDs := []int32{runID1, runID2} + unarchRes, err := api.ArchiveRuns(ctx, &apiv1.ArchiveRunsRequest{ + RunIds: runIDs, + ProjectId: sourceprojectID, + }) + + errMsg := "Run is part of archived Search." + require.NoError(t, err) + require.Len(t, unarchRes.Results, 2) + require.Equal(t, errMsg, unarchRes.Results[0].Error) + require.Equal(t, errMsg, unarchRes.Results[1].Error) + + _, err = api.UnarchiveRuns(ctx, &apiv1.UnarchiveRunsRequest{ + RunIds: runIDs, + ProjectId: sourceprojectID, + }) + require.NoError(t, err) + require.Len(t, unarchRes.Results, 2) + require.Equal(t, errMsg, unarchRes.Results[0].Error) + require.Equal(t, errMsg, unarchRes.Results[1].Error) +} From 3847cb133b610da32a362aaae4a81d668e8046e5 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 10 Jun 2024 11:44:52 -0700 Subject: [PATCH 117/161] chore: backend feedback --- proto/src/determined/run/v1/run.proto | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proto/src/determined/run/v1/run.proto b/proto/src/determined/run/v1/run.proto index 6ea1b43e226..5bf3ac6f433 100644 --- a/proto/src/determined/run/v1/run.proto +++ b/proto/src/determined/run/v1/run.proto @@ -111,6 +111,8 @@ message FlatRun { bool parent_archived = 18; // Data related the the experiment associated with this run. optional FlatRunExperiment experiment = 19; - // The archived status of this run + // The archived status of this run. + // This is only looking at the archived status at the run level and not taking + // into account whether the experiment is archived or not. bool archived = 20; } From bc949cd8b1c69941731b4e9798628dfccfdff995 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 10 Jun 2024 15:16:19 -0700 Subject: [PATCH 118/161] test: test --- webui/react/src/pages/SearchDetails.test.tsx | 41 ++++++++++ webui/react/src/services/decoder.test.ts | 78 ++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 webui/react/src/pages/SearchDetails.test.tsx diff --git a/webui/react/src/pages/SearchDetails.test.tsx b/webui/react/src/pages/SearchDetails.test.tsx new file mode 100644 index 00000000000..3332d414ce1 --- /dev/null +++ b/webui/react/src/pages/SearchDetails.test.tsx @@ -0,0 +1,41 @@ +import { render, screen } from '@testing-library/react'; +import userEvent, { UserEvent } from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { HelmetProvider } from 'react-helmet-async'; +import { BrowserRouter } from 'react-router-dom'; + +import { ThemeProvider } from 'components/ThemeProvider'; +import SearchDetails from 'pages/SearchDetails'; + +vi.mock('services/api', () => ({ + getExperimentDetails: vi.fn(), + patchExperiment: vi.fn(), +})); + +const setup = (): { user: UserEvent } => { + const user = userEvent.setup(); + + render( + + + + + + + + + , + ); + + return { user }; +}; + +describe('SearchDetails', () => { + it('should have tabs', () => { + setup(); + + expect(screen.getByText('Uncategorized Experiments')).toBeInTheDocument(); + expect(screen.getByText('Trials')).toBeInTheDocument(); + expect(screen.getByText('Notes')).toBeInTheDocument(); + }); +}); diff --git a/webui/react/src/services/decoder.test.ts b/webui/react/src/services/decoder.test.ts index 7d706e794d9..66a854d2332 100644 --- a/webui/react/src/services/decoder.test.ts +++ b/webui/react/src/services/decoder.test.ts @@ -1,6 +1,8 @@ import hparams from 'fixtures/hyperparameter-configs.json'; import experimentResps from 'fixtures/responses/experiment-details/set-a.json'; import * as ioTypes from 'ioTypes'; +import { V1ExperimentActionResult, V1RunActionResult } from 'services/api-ts-sdk'; +import * as decoder from 'services/decoder'; type FailReport = { error: Error; sample: T }; @@ -40,4 +42,80 @@ describe('Decoder', () => { ); expect(fails).toHaveLength(0); }); + + describe('mapV1ActionResults', () => { + it('should work with Sdk.V1ExperimentActionResult[] input', () => { + const result: V1ExperimentActionResult[] = [ + { error: '', id: 1 }, + { error: '', id: 2 }, + { error: 'error', id: 3 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [{ error: 'error', id: 3 }], + successful: [1, 2], + }); + }); + + it('should work with Sdk.V1RunActionResult[] input', () => { + const result: V1RunActionResult[] = [ + { error: '', id: 1 }, + { error: '', id: 2 }, + { error: 'error', id: 3 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [{ error: 'error', id: 3 }], + successful: [1, 2], + }); + }); + + it('should work with empty input', () => { + const expected = decoder.mapV1ActionResults([]); + expect(expected).toStrictEqual({ + failed: [], + successful: [], + }); + }); + + it('should work with all successful input', () => { + const result: V1RunActionResult[] = [ + { error: '', id: 1 }, + { error: '', id: 2 }, + { error: '', id: 3 }, + { error: '', id: 4 }, + { error: '', id: 5 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [], + successful: [1, 2, 3, 4, 5], + }); + }); + + it('should work with all failed input', () => { + const result: V1RunActionResult[] = [ + { error: 'oh no', id: 1 }, + { error: 'yare yare', id: 2 }, + { error: 'error', id: 3 }, + { error: 'a', id: 4 }, + { error: 'エラー', id: 5 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [ + { error: 'oh no', id: 1 }, + { error: 'yare yare', id: 2 }, + { error: 'error', id: 3 }, + { error: 'a', id: 4 }, + { error: 'エラー', id: 5 }, + ], + successful: [], + }); + }); + }); }); From 37e3ca9b18d6c266f95802cbfde9d20b1b108f3a Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 10 Jun 2024 15:45:13 -0700 Subject: [PATCH 119/161] fix: minor fixes --- proto/pkg/runv1/run.pb.go | 4 +++- webui/react/src/hooks/usePermissions.ts | 22 ++++++++++++++++++++++ webui/react/src/services/api-ts-sdk/api.ts | 2 +- webui/react/src/services/api.ts | 16 ++++++++++------ webui/react/src/services/apiConfig.ts | 16 ++++++++++++---- webui/react/src/utils/flatRun.ts | 12 ++++-------- 6 files changed, 52 insertions(+), 20 deletions(-) diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 9816a359c85..998a1e8d711 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,7 +216,9 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` - // The archived status of this run + // The archived status of this run. + // This is only looking at the archived status at the run level and not taking + // into account whether the experiment is archived or not. Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` } diff --git a/webui/react/src/hooks/usePermissions.ts b/webui/react/src/hooks/usePermissions.ts index ae909e64756..4e8d2130c09 100644 --- a/webui/react/src/hooks/usePermissions.ts +++ b/webui/react/src/hooks/usePermissions.ts @@ -59,6 +59,7 @@ export interface PermissionsHook { canAdministrateUsers: boolean; canAssignRoles: (arg0: WorkspacePermissionsArgs) => boolean; canCreateExperiment: (arg0: WorkspacePermissionsArgs) => boolean; + canCreateFlatRun: (arg0: WorkspacePermissionsArgs) => boolean; canCreateModelVersion: (arg0: ModelPermissionsArgs) => boolean; canCreateModelWorkspace: (arg0: ModelWorkspacePermissionsArgs) => boolean; canCreateModels: boolean; @@ -79,6 +80,7 @@ export interface PermissionsHook { canEditWebhooks: boolean; canManageResourcePoolBindings: boolean; canModifyExperiment: (arg0: WorkspacePermissionsArgs) => boolean; + canModifyFlatRun: (arg0: WorkspacePermissionsArgs) => boolean; canModifyExperimentMetadata: (arg0: WorkspacePermissionsArgs) => boolean; canModifyGroups: boolean; canModifyModel: (arg0: ModelPermissionsArgs) => boolean; @@ -132,6 +134,8 @@ const usePermissions = (): PermissionsHook => { canAssignRoles: (args: WorkspacePermissionsArgs) => canAssignRoles(rbacOpts, args.workspace), canCreateExperiment: (args: WorkspacePermissionsArgs) => canCreateExperiment(rbacOpts, args.workspace), + canCreateFlatRun: (args: WorkspacePermissionsArgs) => + canCreateFlatRun(rbacOpts, args.workspace), canCreateModels: canCreateModels(rbacOpts), canCreateModelVersion: (args: ModelPermissionsArgs) => canCreateModelVersion(rbacOpts, args.model), @@ -164,6 +168,8 @@ const usePermissions = (): PermissionsHook => { canModifyExperiment(rbacOpts, args.workspace), canModifyExperimentMetadata: (args: WorkspacePermissionsArgs) => canModifyExperimentMetadata(rbacOpts, args.workspace), + canModifyFlatRun: (args: WorkspacePermissionsArgs) => + canModifyFlatRun(rbacOpts, args.workspace), canModifyGroups: canModifyGroups(rbacOpts), canModifyModel: (args: ModelPermissionsArgs) => canModifyModel(rbacOpts, args.model), canModifyModelVersion: (args: ModelVersionPermissionsArgs) => @@ -687,6 +693,22 @@ const canManageResourcePoolBindings = ({ // Flat Runs +// alias of canCreateExperiment +const canCreateFlatRun = ( + { rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + workspace?: PermissionWorkspace, +): boolean => { + return canCreateExperiment({ rbacEnabled, userAssignments, userRoles }, workspace); +}; + +// alias of canModifyExperiment +const canModifyFlatRun = ( + { rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + workspace?: PermissionWorkspace, +): boolean => { + return canModifyExperiment({ rbacEnabled, userAssignments, userRoles }, workspace); +}; + const canDeleteFlatRun = ( { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, run: FlatRun, diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index ff4613b3b9e..bb4f95c5201 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3495,7 +3495,7 @@ export interface V1FlatRun { */ experiment?: V1FlatRunExperiment; /** - * The archived status of this run + * The archived status of this run. This is only looking at the archived status at the run level and not taking into account whether the experiment is archived or not. * @type {boolean} * @memberof V1FlatRun */ diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 561101669bf..7c43779114d 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -763,13 +763,17 @@ export const archiveRuns = generateDetApi< Type.BulkActionResult >(Config.archiveRuns); -export const deleteRuns = generateDetApi( - Config.deleteRuns, -); +export const deleteRuns = generateDetApi< + Api.V1DeleteRunsRequest, + Api.V1DeleteRunsResponse, + Type.BulkActionResult +>(Config.deleteRuns); -export const killRuns = generateDetApi( - Config.killRuns, -); +export const killRuns = generateDetApi< + Api.V1KillRunsRequest, + Api.V1KillRunsResponse, + Type.BulkActionResult +>(Config.killRuns); export const moveRuns = generateDetApi< Api.V1MoveRunsRequest, diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index fd92b846f39..c683cd6373e 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1158,15 +1158,23 @@ export const archiveRuns: DetApi< request: (params, options) => detApi.Internal.archiveRuns(params, options), }; -export const deleteRuns: DetApi = { +export const deleteRuns: DetApi< + Api.V1DeleteRunsRequest, + Api.V1DeleteRunsResponse, + Type.BulkActionResult +> = { name: 'deleteRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.deleteRuns(params, options), }; -export const killRuns: DetApi = { +export const killRuns: DetApi< + Api.V1KillRunsRequest, + Api.V1KillRunsResponse, + Type.BulkActionResult +> = { name: 'killRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.killRuns(params, options), }; diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 8b52c9cb22c..3d33f3893c8 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -6,7 +6,7 @@ type FlatRunChecker = (flatRun: Readonly) => boolean; type FlatRunPermissionSet = Pick< PermissionsHook, - 'canCreateExperiment' | 'canDeleteFlatRun' | 'canModifyExperiment' | 'canMoveFlatRun' + 'canCreateFlatRun' | 'canDeleteFlatRun' | 'canModifyFlatRun' | 'canMoveFlatRun' >; const flatRunCheckers: Record = { @@ -28,7 +28,7 @@ export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly, targets: ReadonlyArray, permissions: Readonly, @@ -41,17 +41,13 @@ const getActionsForFlatRun = ( switch (action) { case FlatRunAction.Delete: return permissions.canDeleteFlatRun({ flatRun }); - case FlatRunAction.Move: return permissions.canMoveFlatRun({ flatRun }); - case FlatRunAction.Archive: case FlatRunAction.Unarchive: - return permissions.canModifyExperiment({ workspace }); - + return permissions.canModifyFlatRun({ workspace }); case FlatRunAction.Kill: - return permissions.canModifyExperiment({ workspace }) && !flatRun.experiment?.unmanaged; - + return permissions.canModifyFlatRun({ workspace }) && !flatRun.experiment?.unmanaged; default: return true; } From 5fcd926ce0c1c5f293f9419100b1115c24190f6a Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 11 Jun 2024 15:26:47 -0700 Subject: [PATCH 120/161] fix: feedback --- .../FlatRuns/FlatRunActionButton.test.tsx | 5 ----- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 6 +----- .../pages/FlatRuns/FlatRunMoveModal.test.tsx | 18 +----------------- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 7 +++---- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 4 +--- 5 files changed, 6 insertions(+), 34 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index bf62f069710..17ce427da29 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -3,7 +3,6 @@ import userEvent from '@testing-library/user-event'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; -import { Conjunction, FormKind } from 'components/FilterForm/components/type'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; @@ -13,10 +12,6 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { render( >; projectId: number; workspaceId: number; - filterFormSetWithoutId: FilterFormSetWithoutId; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; - onActionComplete?: () => Promise; + onActionComplete?: () => void | Promise; } const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, - filterFormSetWithoutId, workspaceId, onActionSuccess, onActionComplete, @@ -199,7 +196,6 @@ const FlatRunActionButton = ({ /> )} { ]; }, []); - const filterFormSetWithoutId: FilterFormSetWithoutId = useMemo(() => { - return { - filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, - showArchived: false, - }; - }, []); - const flatRunMoveModal = useModal(FlatRunMoveModalComponent); return (
- +
); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index b7715a5452b..b25c4d7bde5 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -10,7 +10,6 @@ import { List } from 'immutable'; import { useObservable } from 'micro-observables'; import React, { Ref, useCallback, useEffect, useId, useRef } from 'react'; -import { FilterFormSetWithoutId } from 'components/FilterForm/components/type'; import Link from 'components/Link'; import RunFilterInterstitialModalComponent, { ControlledModalRef, @@ -19,6 +18,7 @@ import RunMoveWarningModalComponent, { RunMoveWarningFlowRef, } from 'components/RunMoveWarningModalComponent'; import usePermissions from 'hooks/usePermissions'; +import { formStore } from 'pages/FlatRuns/FlatRuns'; import { paths } from 'routes/utils'; import { moveRuns } from 'services/api'; import projectStore from 'stores/projects'; @@ -38,14 +38,12 @@ interface Props { flatRuns: Readonly[]; sourceProjectId: number; sourceWorkspaceId?: number; - filterFormSetWithoutId: FilterFormSetWithoutId; onSubmit?: (successfulIds?: number[]) => void; - onActionComplete?: () => void; + onActionComplete?: () => void | Promise; } const FlatRunMoveModalComponent: React.FC = ({ flatRuns, - filterFormSetWithoutId, sourceProjectId, sourceWorkspaceId, onSubmit, @@ -55,6 +53,7 @@ const FlatRunMoveModalComponent: React.FC = ({ const runMoveWarningFlowRef: Ref = useRef(null); const idPrefix = useId(); const { openToast } = useToast(); + const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [form] = Form.useForm(); const workspaceId = Form.useWatch('workspaceId', form); const projectId = Form.useWatch('projectId', form); diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 75f2c381925..686b76b16bc 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -96,7 +96,7 @@ const STATIC_COLUMNS = [MULTISELECT]; const BANNED_FILTER_COLUMNS = new Set(['searcherMetricsVal']); -const formStore = new FilterFormStore(); +export const formStore = new FilterFormStore(); interface Props { projectId: number; @@ -162,7 +162,6 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const sortString = useMemo(() => makeSortString(sorts.filter(validSort.is)), [sorts]); const loadableFormset = useObservable(formStore.formset); const filtersString = useObservable(formStore.asJsonString); - const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [total, setTotal] = useState>(NotLoaded); const isMobile = useMobile(); const [isLoading, setIsLoading] = useState(true); @@ -948,7 +947,6 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { onRowHeightChange={onRowHeightChange} /> Date: Wed, 12 Jun 2024 11:22:11 -0400 Subject: [PATCH 121/161] cleanup --- .../src/components/RunActionDropdown.test.tsx | 3 +- .../src/components/RunActionDropdown.tsx | 5 -- .../pages/FlatRuns/FlatRunActionButton.tsx | 10 ++- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 90 +++++++++---------- 4 files changed, 51 insertions(+), 57 deletions(-) diff --git a/webui/react/src/components/RunActionDropdown.test.tsx b/webui/react/src/components/RunActionDropdown.test.tsx index 0dd65bd6ec8..8985cd7036e 100644 --- a/webui/react/src/components/RunActionDropdown.test.tsx +++ b/webui/react/src/components/RunActionDropdown.test.tsx @@ -8,7 +8,7 @@ import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { RunState } from 'types'; import RunActionDropdown from './RunActionDropdown'; -import { cell, filterFormSetWithoutId, run } from './RunActionDropdown.test.mock'; +import { cell, run } from './RunActionDropdown.test.mock'; const mockNavigatorClipboard = () => { Object.defineProperty(navigator, 'clipboard', { @@ -61,7 +61,6 @@ const setup = (link?: string, state?: RunState, archived?: boolean) => { void; onVisibleChange?: (visible: boolean) => void; projectId: number; - filterFormSetWithoutId: FilterFormSetWithoutId; } const Action = { @@ -51,7 +48,6 @@ const RunActionDropdown: React.FC = ({ onComplete, onLink, onVisibleChange, - filterFormSetWithoutId, projectId, }: Props) => { const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = @@ -176,7 +172,6 @@ const RunActionDropdown: React.FC = ({ const shared = ( = ({ projectId, workspaceId, searchId }) => { const sortString = useMemo(() => makeSortString(sorts.filter(validSort.is)), [sorts]); const loadableFormset = useObservable(formStore.formset); const filtersString = useObservable(formStore.asJsonString); - const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [total, setTotal] = useState>(NotLoaded); const isMobile = useMobile(); const [isLoading, setIsLoading] = useState(true); @@ -332,8 +331,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, { max: heatmap.max, @@ -345,8 +344,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -357,8 +356,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); break; @@ -369,8 +368,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -383,9 +382,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { settings.columnWidths[currentColumn.column], heatmap && settings.heatmapOn && !settings.heatmapSkipped.includes(currentColumn.column) ? { - max: heatmap.max, - min: heatmap.min, - } + max: heatmap.max, + min: heatmap.min, + } : undefined, ); } @@ -766,12 +765,12 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const items: MenuItem[] = [ settings.selection.type === 'ALL_EXCEPT' || settings.selection.selections.length > 0 ? { - key: 'select-none', - label: 'Clear selected', - onClick: () => { - handleSelectionChange?.('remove-all'); - }, - } + key: 'select-none', + label: 'Clear selected', + onClick: () => { + handleSelectionChange?.('remove-all'); + }, + } : null, ...[5, 10, 25].map((n) => ({ key: `select-${n}`, @@ -800,32 +799,32 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { ? null : !isPinned ? { - icon: , - key: 'pin', - label: 'Pin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), - ); - }, - } + icon: , + key: 'pin', + label: 'Pin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), + ); + }, + } : { - disabled: settings.pinnedColumnsCount <= 1, - icon: , - key: 'unpin', - label: 'Unpin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.max(settings.pinnedColumnsCount - 1, 0), - ); + disabled: settings.pinnedColumnsCount <= 1, + icon: , + key: 'unpin', + label: 'Unpin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.max(settings.pinnedColumnsCount - 1, 0), + ); + }, }, - }, { icon: , key: 'hide', @@ -882,9 +881,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { sortCount === 0 ? [] : [ - { type: 'divider' as const }, - ...sortMenuItemsForColumn(column, sorts, handleSortChange), - ]; + { type: 'divider' as const }, + ...sortMenuItemsForColumn(column, sorts, handleSortChange), + ]; items.push( ...sortMenuItems, @@ -1062,7 +1061,6 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { return ( Date: Tue, 14 May 2024 16:38:12 -0700 Subject: [PATCH 122/161] feat: initial implementation of flat run actions --- .../pages/FlatRuns/FlatRunActionButton.tsx | 258 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 25 +- webui/react/src/services/api.ts | 24 ++ webui/react/src/services/apiConfig.ts | 53 +++- webui/react/src/services/decoder.ts | 8 +- 5 files changed, 350 insertions(+), 18 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx new file mode 100644 index 00000000000..2f8ebbd42f4 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -0,0 +1,258 @@ +import Button from 'hew/Button'; +import Dropdown, { MenuItem } from 'hew/Dropdown'; +import Icon, { IconName } from 'hew/Icon'; +import { useModal } from 'hew/Modal'; +import { useToast } from 'hew/Toast'; +import { useCallback, useMemo, useState } from 'react'; + +import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; +import { BatchAction } from 'components/TableActionBar'; +// import usePermissions from 'hooks/usePermissions'; +import { + archiveRuns, + deleteRuns, + killRuns, + openOrCreateTensorBoard, + unarchiveRuns, +} from 'services/api'; +import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { capitalizeWord } from 'utils/string'; +import { openCommandResponse } from 'utils/wait'; + +// export const getActionsForRunsUnion = ( +// experiments: FlatRun[], +// targets: ExperimentAction[], +// permissions: ExperimentPermissionSet, +// ): ExperimentAction[] => { +// if (!experiments.length) return []; // redundant, for clarity +// const actionsForExperiments = experiments.map((e) => +// getActionsForExperiment(e, targets, permissions), +// ); +// return targets.filter((action) => +// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), +// ); +// }; + +const BATCH_ACTIONS = [ + ExperimentAction.OpenTensorBoard, + ExperimentAction.Move, + ExperimentAction.RetainLogs, + ExperimentAction.Archive, + ExperimentAction.Unarchive, + ExperimentAction.Delete, + ExperimentAction.Activate, + ExperimentAction.Pause, + ExperimentAction.Cancel, + ExperimentAction.Kill, +] as const; + +const ACTION_ICONS: Record = { + [ExperimentAction.Activate]: 'play', + [ExperimentAction.Pause]: 'pause', + [ExperimentAction.Cancel]: 'stop', + [ExperimentAction.Archive]: 'archive', + [ExperimentAction.Unarchive]: 'document', + [ExperimentAction.Move]: 'workspaces', + [ExperimentAction.RetainLogs]: 'logs', + [ExperimentAction.OpenTensorBoard]: 'tensor-board', + [ExperimentAction.Kill]: 'cancelled', + [ExperimentAction.Delete]: 'error', +} as const; + +const LABEL_PLURAL = 'runs'; + +interface Props { + isMobile: boolean; + selectedRuns: FlatRun[]; + project: Project; + onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; +} + +const FlatRunActionButton = ({ + isMobile, + selectedRuns, + project, + onActionSuccess, +}: Props): JSX.Element => { + const [batchAction, setBatchAction] = useState(undefined); + // const permissions = usePermissions(); + const { openToast } = useToast(); + const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); + + const sendBatchActions = useCallback( + // TODO: remove this + // eslint-disable-next-line require-await + async (action: BatchAction): Promise => { + const validRunIds = selectedRuns + // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .map((run) => run.id); + const params = { + projectId: project.id, + runIds: validRunIds, + }; + switch (action) { + case ExperimentAction.OpenTensorBoard: { + if (validRunIds.length !== selectedRuns.length) { + // if unmanaged experiments are selected, open experimentTensorBoardModal + // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs + } else { + openCommandResponse( + await openOrCreateTensorBoard({ + experimentIds: params.runIds, + workspaceId: project.workspaceId, + }), + ); + } + return; + } + case ExperimentAction.Move: + // return ExperimentMoveModal.open(); + case ExperimentAction.RetainLogs: + // return ExperimentRetainLogsModal.open(); + case ExperimentAction.Activate: + // return await archiveRuns(params); + case ExperimentAction.Archive: + return await archiveRuns(params); + case ExperimentAction.Cancel: + // return await cancelExperiments(params); + case ExperimentAction.Kill: + return await killRuns(params); + case ExperimentAction.Pause: + // return await pauseExperiments(params); + case ExperimentAction.Unarchive: + return await unarchiveRuns(params); + case ExperimentAction.Delete: + return await deleteRuns(params); + } + }, + [project.id, project.workspaceId, selectedRuns], + ); + + const submitBatchAction = useCallback( + async (action: BatchAction) => { + try { + const results = await sendBatchActions(action); + if (results === undefined) return; + + onActionSuccess?.(action, results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: `No selected ${LABEL_PLURAL.toLowerCase()} were eligible for ${action.toLowerCase()}`, + title: `No eligible ${LABEL_PLURAL.toLowerCase()}`, + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, + title: `${action} Success`, + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to ${action.toLowerCase()} ${numFailures} ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `${action} Failure`, + }); + } else { + openToast({ + closeable: true, + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible + ${LABEL_PLURAL.toLowerCase()}`, + severity: 'Warning', + title: `Partial ${action} Failure`, + }); + } + } catch (e) { + const publicSubject = + action === ExperimentAction.OpenTensorBoard + ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` + : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + handleError(e, { + isUserTriggered: true, + publicMessage: 'Please try again later.', + publicSubject, + silent: false, + }); + } finally { + // onActionComplete?.(); + } + }, + [sendBatchActions, onActionSuccess, openToast], + ); + + const handleBatchAction = useCallback( + (action: string) => { + switch (action) { + case ExperimentAction.OpenTensorBoard: + submitBatchAction(action); + break; + case ExperimentAction.Move: + case ExperimentAction.RetainLogs: + sendBatchActions(action); + break; + default: + setBatchAction(action as BatchAction); + BatchActionConfirmModal.open(); + break; + } + }, + [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + ); + + // const availableBatchActions = useMemo(() => { + // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. + // }, [selectedExperimentIds, experimentMap, permissions]); + + const editMenuItems = useMemo(() => { + const groupedBatchActions = [ + BATCH_ACTIONS.slice(0, 1), // View in TensorBoard + BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete + BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill + ]; + const groupSize = groupedBatchActions.length; + return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { + const isLastGroup = index === groupSize - 1; + group.forEach((action) => + acc.push({ + danger: action === ExperimentAction.Delete, + // disabled: !availableBatchActions.includes(action), // TODO uncomment later + icon: , + key: action, + label: action, + }), + ); + if (!isLastGroup) acc.push({ type: 'divider' }); + return acc; + }, []); + }, []); + + return ( + <> + {selectedRuns.length > 0 && ( + + + + )} + {batchAction && ( + exp.unmanaged)} // TODO: is it needed for Runs? + onConfirm={() => submitBatchAction(batchAction)} + /> + )} + + ); +}; + +export default FlatRunActionButton; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 18f109cea2d..4aa17b15258 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -65,6 +65,7 @@ import { DEFAULT_SELECTION, SelectionType as SelectionState, } from 'pages/F_ExpList/F_ExperimentList.settings'; +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { paths } from 'routes/utils'; import { getProjectColumns, getProjectNumericMetricsRange, searchRuns } from 'services/api'; import { V1ColumnType, V1LocationType } from 'services/api-ts-sdk'; @@ -209,6 +210,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { } }, [projectId]); + const selectedRunIdSet = useMemo(() => { + return new Set(settings.selection.type === 'ONLY_IN' ? settings.selection.selections : []); + }, [settings.selection]); + const columnsIfLoaded = useMemo( () => (isLoadingSettings ? [] : settings.columns), [isLoadingSettings, settings.columns], @@ -228,19 +233,17 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { if (isLoadingSettings) { return [selectedArray, selectedMap]; } - const selectedIdSet = new Set( - settings.selection.type === 'ONLY_IN' ? settings.selection.selections : [], - ); + runs.forEach((r, index) => { Loadable.forEach(r, (run) => { - if (selectedIdSet.has(run.id)) { + if (selectedRunIdSet.has(run.id)) { selectedMap.set(run.id, { index, run }); selectedArray.push(run); } }); }); return [selectedArray, selectedMap]; - }, [isLoadingSettings, settings.selection, runs]); + }, [isLoadingSettings, runs, selectedRunIdSet]); const selection = useMemo(() => { let rows = CompactSelection.empty(); @@ -253,6 +256,13 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { }; }, [loadedSelectedRunIds]); + const selectedRuns: FlatRun[] = useMemo(() => { + const selected = runs.flatMap((run) => { + return run.isLoaded && selectedRunIdSet.has(run.data.id) ? [run.data] : []; + }); + return selected; + }, [runs, selectedRunIdSet]); + const handleIsOpenFilterChange = useCallback((newOpen: boolean) => { setIsOpenFilter(newOpen); if (!newOpen) { @@ -976,6 +986,11 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { rowHeight={globalSettings.rowHeight} onRowHeightChange={onRowHeightChange} /> + diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 0a6c975e646..39acbb16325 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -757,6 +757,30 @@ export const searchRuns = generateDetApi< Type.SearchFlatRunPagination >(Config.searchRuns); +export const archiveRuns = generateDetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +>(Config.archiveRuns); + +export const deleteRuns = generateDetApi( + Config.deleteRuns, +); + +export const killRuns = generateDetApi( + Config.killRuns, +); + +export const moveRuns = generateDetApi( + Config.moveRuns, +); + +export const unarchiveRuns = generateDetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + void +>(Config.unarchiveRuns); + /* Tasks */ export const getCommands = generateDetApi< diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index f9d34fd7a9b..7c8c01d55f3 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -717,7 +717,7 @@ export const archiveExperiments: DetApi< Type.BulkActionResult > = { name: 'archiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.archiveExperiments(params.projectId, params, options); }, @@ -741,7 +741,7 @@ export const deleteExperiments: DetApi< Type.BulkActionResult > = { name: 'deleteExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.deleteExperiments(params.projectId, params, options); }, @@ -765,7 +765,7 @@ export const unarchiveExperiments: DetApi< Type.BulkActionResult > = { name: 'unarchiveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.unarchiveExperiments(params.projectId, params, options); }, @@ -789,7 +789,7 @@ export const activateExperiments: DetApi< Type.BulkActionResult > = { name: 'activateExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.activateExperiments(params.projectId, params, options); }, @@ -813,7 +813,7 @@ export const pauseExperiments: DetApi< Type.BulkActionResult > = { name: 'pauseExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.pauseExperiments(params.projectId, params, options); }, @@ -837,7 +837,7 @@ export const cancelExperiments: DetApi< Type.BulkActionResult > = { name: 'cancelExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.cancelExperiments(params.projectId, params, options); }, @@ -861,7 +861,7 @@ export const killExperiments: DetApi< Type.BulkActionResult > = { name: 'killExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params: Service.BulkActionParams, options) => { return detApi.Experiments.killExperiments(params.projectId, params, options); }, @@ -1014,7 +1014,7 @@ export const moveExperiments: DetApi< Type.BulkActionResult > = { name: 'moveExperiments', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.moveExperiments(params.projectId, params, options), }; @@ -1025,7 +1025,7 @@ export const changeExperimentLogRetention: DetApi< Type.BulkActionResult > = { name: 'changeExperimentLogRetention', - postProcess: (response) => decoder.mapV1ExperimentActionResults(response.results), + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Experiments.putExperimentsRetainLogs(params.projectId, params, options), }; @@ -1148,6 +1148,41 @@ export const searchRuns: DetApi< ), }; +export const archiveRuns: DetApi< + Api.V1ArchiveRunsRequest, + Api.V1ArchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'archiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.archiveRuns(params, options), +}; + +export const deleteRuns: DetApi = { + name: 'deleteRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.deleteRuns(params, options), +}; + +export const killRuns: DetApi = { + name: 'killRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.killRuns(params, options), +}; + +export const moveRuns: DetApi = { + name: 'moveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.moveRuns(params, options), +}; + +export const unarchiveRuns: DetApi = + { + name: 'unarchiveRuns', + postProcess: noOp, + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), + }; + /* Tasks */ export const getTask: DetApi< diff --git a/webui/react/src/services/decoder.ts b/webui/react/src/services/decoder.ts index 8a1e34c6d0a..58df024bad4 100644 --- a/webui/react/src/services/decoder.ts +++ b/webui/react/src/services/decoder.ts @@ -889,11 +889,11 @@ export const decodeJobStates = ( >; }; -export const mapV1ExperimentActionResults = ( - results: Sdk.V1ExperimentActionResult[], +export const mapV1ActionResults = ( + results: Sdk.V1ExperimentActionResult[] | Sdk.V1RunActionResult[], ): types.BulkActionResult => { return results.reduce( - (acc, cur) => { + (acc: types.BulkActionResult, cur) => { if (cur.error.length > 0) { acc.failed.push(cur); } else { @@ -901,7 +901,7 @@ export const mapV1ExperimentActionResults = ( } return acc; }, - { failed: [], successful: [] } as types.BulkActionResult, + { failed: [], successful: [] }, ); }; From f00cdce9f0ac02c3b06ad8ce16def8befa2738b4 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 22 May 2024 11:34:30 -0700 Subject: [PATCH 123/161] fix: minor changes --- .../react/src/pages/FlatRuns/FlatRunActionButton.tsx | 4 +--- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 11 +++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2f8ebbd42f4..2fbd2d13cd6 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -81,8 +81,6 @@ const FlatRunActionButton = ({ const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( - // TODO: remove this - // eslint-disable-next-line require-await async (action: BatchAction): Promise => { const validRunIds = selectedRuns // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission @@ -111,7 +109,7 @@ const FlatRunActionButton = ({ case ExperimentAction.RetainLogs: // return ExperimentRetainLogsModal.open(); case ExperimentAction.Activate: - // return await archiveRuns(params); + // return await activate(params); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Cancel: diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 4aa17b15258..b9d058c9a51 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -52,6 +52,7 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; +import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -702,6 +703,15 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); + const onActionSuccess = useCallback( + // TODO: update this function + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (_action: BatchAction, _successfulIds: number[]) => { + handleSelectionChange('remove-all'); + }, + [handleSelectionChange], + ); + const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -990,6 +1000,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} + onActionSuccess={onActionSuccess} /> From 614161fbc39987bf93eba384137509ce31c88c57 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 16:31:46 -0700 Subject: [PATCH 124/161] feat: add RBAC permissions for flatRuns --- webui/react/src/hooks/usePermissions.ts | 36 +++++- .../pages/FlatRuns/FlatRunActionButton.tsx | 112 +++++------------- webui/react/src/types.ts | 15 +++ webui/react/src/utils/flatRun.ts | 72 +++++++++++ 4 files changed, 151 insertions(+), 84 deletions(-) create mode 100644 webui/react/src/utils/flatRun.ts diff --git a/webui/react/src/hooks/usePermissions.ts b/webui/react/src/hooks/usePermissions.ts index e25ac702b98..ae909e64756 100644 --- a/webui/react/src/hooks/usePermissions.ts +++ b/webui/react/src/hooks/usePermissions.ts @@ -9,6 +9,8 @@ import userStore from 'stores/users'; import { DetailedUser, ExperimentPermissionsArgs, + FlatRun, + FlatRunPermissionsArgs, ModelItem, ModelVersion, Permission, @@ -53,7 +55,7 @@ interface MovePermissionsArgs { destination?: PermissionWorkspace; } -interface PermissionsHook { +export interface PermissionsHook { canAdministrateUsers: boolean; canAssignRoles: (arg0: WorkspacePermissionsArgs) => boolean; canCreateExperiment: (arg0: WorkspacePermissionsArgs) => boolean; @@ -67,6 +69,7 @@ interface PermissionsHook { canCreateWorkspace: boolean; canCreateWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canDeleteExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canDeleteFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canDeleteModel: (arg0: ModelPermissionsArgs) => boolean; canDeleteModelVersion: (arg0: ModelVersionPermissionsArgs) => boolean; canDeleteProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -88,6 +91,7 @@ interface PermissionsHook { canModifyWorkspaceCheckpointStorage: (arg0: WorkspacePermissionsArgs) => boolean; canModifyWorkspaceNSC(arg0: WorkspacePermissionsArgs): boolean; canMoveExperiment: (arg0: ExperimentPermissionsArgs) => boolean; + canMoveFlatRun: (arg0: FlatRunPermissionsArgs) => boolean; canMoveExperimentsTo: (arg0: MovePermissionsArgs) => boolean; canMoveModel: (arg0: MovePermissionsArgs) => boolean; canMoveProjects: (arg0: ProjectPermissionsArgs) => boolean; @@ -144,6 +148,7 @@ const usePermissions = (): PermissionsHook => { canCreateWorkspaceNSC(rbacOpts, args.workspace), canDeleteExperiment: (args: ExperimentPermissionsArgs) => canDeleteExperiment(rbacOpts, args.experiment), + canDeleteFlatRun: (args: FlatRunPermissionsArgs) => canDeleteFlatRun(rbacOpts, args.flatRun), canDeleteModel: (args: ModelPermissionsArgs) => canDeleteModel(rbacOpts, args.model), canDeleteModelVersion: (args: ModelVersionPermissionsArgs) => canDeleteModelVersion(rbacOpts, args.modelVersion), @@ -181,6 +186,7 @@ const usePermissions = (): PermissionsHook => { canMoveExperiment(rbacOpts, args.experiment), canMoveExperimentsTo: (args: MovePermissionsArgs) => canMoveExperimentsTo(rbacOpts, args.destination), + canMoveFlatRun: (args: FlatRunPermissionsArgs) => canMoveFlatRun(rbacOpts, args.flatRun), canMoveModel: (args: MovePermissionsArgs) => canMoveModel(rbacOpts, args.destination), canMoveProjects: (args: ProjectPermissionsArgs) => canMoveWorkspaceProjects(rbacOpts, args.project), @@ -679,4 +685,32 @@ const canManageResourcePoolBindings = ({ : !!currentUser && currentUser.isAdmin; }; +// Flat Runs + +const canDeleteFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const permitted = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? permitted.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + +const canMoveFlatRun = ( + { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + run: FlatRun, +): boolean => { + const srcPermit = relevantPermissions(userAssignments, userRoles, run.workspaceId); + return ( + !!currentUser && + (rbacEnabled + ? srcPermit.has(V1PermissionType.DELETEEXPERIMENT) + : currentUser.isAdmin || currentUser.id === run.userId) + ); +}; + export default usePermissions; diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 2fbd2d13cd6..ee7130b4ddb 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -6,57 +6,32 @@ import { useToast } from 'hew/Toast'; import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; -import { BatchAction } from 'components/TableActionBar'; -// import usePermissions from 'hooks/usePermissions'; -import { - archiveRuns, - deleteRuns, - killRuns, - openOrCreateTensorBoard, - unarchiveRuns, -} from 'services/api'; +import usePermissions from 'hooks/usePermissions'; +import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; import handleError from 'utils/error'; +import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; -import { openCommandResponse } from 'utils/wait'; - -// export const getActionsForRunsUnion = ( -// experiments: FlatRun[], -// targets: ExperimentAction[], -// permissions: ExperimentPermissionSet, -// ): ExperimentAction[] => { -// if (!experiments.length) return []; // redundant, for clarity -// const actionsForExperiments = experiments.map((e) => -// getActionsForExperiment(e, targets, permissions), -// ); -// return targets.filter((action) => -// actionsForExperiments.some((experimentActions) => experimentActions.includes(action)), -// ); -// }; const BATCH_ACTIONS = [ - ExperimentAction.OpenTensorBoard, + // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, - ExperimentAction.RetainLogs, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - ExperimentAction.Activate, - ExperimentAction.Pause, - ExperimentAction.Cancel, + // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; +type BatchAction = (typeof BATCH_ACTIONS)[number]; + const ACTION_ICONS: Record = { - [ExperimentAction.Activate]: 'play', - [ExperimentAction.Pause]: 'pause', - [ExperimentAction.Cancel]: 'stop', + // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', - [ExperimentAction.RetainLogs]: 'logs', - [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Kill]: 'cancelled', + // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -67,6 +42,7 @@ interface Props { selectedRuns: FlatRun[]; project: Project; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunActionButton = ({ @@ -74,57 +50,39 @@ const FlatRunActionButton = ({ selectedRuns, project, onActionSuccess, + onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); - // const permissions = usePermissions(); + const permissions = usePermissions(); const { openToast } = useToast(); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( async (action: BatchAction): Promise => { const validRunIds = selectedRuns - // .filter((exp) => canActionExperiment(action, exp)) TODO: Runs permission + .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { projectId: project.id, runIds: validRunIds, }; switch (action) { - case ExperimentAction.OpenTensorBoard: { - if (validRunIds.length !== selectedRuns.length) { - // if unmanaged experiments are selected, open experimentTensorBoardModal - // openExperimentTensorBoardModal(); // TODO Tensorboard for Runs - } else { - openCommandResponse( - await openOrCreateTensorBoard({ - experimentIds: params.runIds, - workspaceId: project.workspaceId, - }), - ); - } - return; - } case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - case ExperimentAction.RetainLogs: - // return ExperimentRetainLogsModal.open(); - case ExperimentAction.Activate: - // return await activate(params); + // return ExperimentMoveModal.open(); + break; case ExperimentAction.Archive: return await archiveRuns(params); - case ExperimentAction.Cancel: - // return await cancelExperiments(params); case ExperimentAction.Kill: return await killRuns(params); - case ExperimentAction.Pause: - // return await pauseExperiments(params); case ExperimentAction.Unarchive: return await unarchiveRuns(params); case ExperimentAction.Delete: return await deleteRuns(params); + default: + break; } }, - [project.id, project.workspaceId, selectedRuns], + [project.id, selectedRuns], ); const submitBatchAction = useCallback( @@ -169,10 +127,7 @@ const FlatRunActionButton = ({ }); } } catch (e) { - const publicSubject = - action === ExperimentAction.OpenTensorBoard - ? `Unable to View TensorBoard for Selected ${capitalizeWord(LABEL_PLURAL)}` - : `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; + const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { isUserTriggered: true, publicMessage: 'Please try again later.', @@ -180,20 +135,16 @@ const FlatRunActionButton = ({ silent: false, }); } finally { - // onActionComplete?.(); + onActionComplete?.(); } }, - [sendBatchActions, onActionSuccess, openToast], + [sendBatchActions, onActionSuccess, openToast, onActionComplete], ); const handleBatchAction = useCallback( (action: string) => { switch (action) { - case ExperimentAction.OpenTensorBoard: - submitBatchAction(action); - break; case ExperimentAction.Move: - case ExperimentAction.RetainLogs: sendBatchActions(action); break; default: @@ -202,27 +153,22 @@ const FlatRunActionButton = ({ break; } }, - [BatchActionConfirmModal, sendBatchActions, submitBatchAction], + [BatchActionConfirmModal, sendBatchActions], ); - // const availableBatchActions = useMemo(() => { - // return getActionsForExperimentsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); - // // Spreading batchActions is so TypeScript doesn't complain that it's readonly. - // }, [selectedExperimentIds, experimentMap, permissions]); + const availableBatchActions = useMemo(() => { + return getActionsForFlatRunsUnion(selectedRuns, [...BATCH_ACTIONS], permissions); + }, [selectedRuns, permissions]); const editMenuItems = useMemo(() => { - const groupedBatchActions = [ - BATCH_ACTIONS.slice(0, 1), // View in TensorBoard - BATCH_ACTIONS.slice(1, 5), // Move, Archive, Unarchive, Delete - BATCH_ACTIONS.slice(5), // Resume, Pause, Cancel, Kill - ]; + const groupedBatchActions = [BATCH_ACTIONS]; const groupSize = groupedBatchActions.length; return groupedBatchActions.reduce((acc: MenuItem[], group, index) => { const isLastGroup = index === groupSize - 1; group.forEach((action) => acc.push({ danger: action === ExperimentAction.Delete, - // disabled: !availableBatchActions.includes(action), // TODO uncomment later + disabled: !availableBatchActions.includes(action), icon: , key: action, label: action, @@ -231,7 +177,7 @@ const FlatRunActionButton = ({ if (!isLastGroup) acc.push({ type: 'divider' }); return acc; }, []); - }, []); + }, [availableBatchActions]); return ( <> @@ -245,7 +191,7 @@ const FlatRunActionButton = ({ {batchAction && ( exp.unmanaged)} // TODO: is it needed for Runs? + isUnmanagedIncluded={selectedRuns.some((run) => run.experiment?.unmanaged ?? false)} onConfirm={() => submitBatchAction(batchAction)} /> )} diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 84463695548..22ab2ab6380 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1146,6 +1146,10 @@ export interface ExperimentPermissionsArgs { experiment: ProjectExperiment; } +export interface FlatRunPermissionsArgs { + flatRun: FlatRun; +} + export interface PermissionWorkspace { id: number; userId?: number; @@ -1253,3 +1257,14 @@ export interface FlatRunExperiment { export interface SearchFlatRunPagination extends WithPagination { runs: FlatRun[]; } + +export const FlatRunAction = { + Archive: 'Archive', + Delete: 'Delete', + Kill: 'Kill', + Move: 'Move', + // Pause: 'Pause', + Unarchive: 'Unarchive', +} as const; + +export type FlatRunAction = ValueOf; diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts new file mode 100644 index 00000000000..6375851fd24 --- /dev/null +++ b/webui/react/src/utils/flatRun.ts @@ -0,0 +1,72 @@ +import { deletableRunStates, killableRunStates, terminalRunStates } from 'constants/states'; +import { PermissionsHook } from 'hooks/usePermissions'; +import { FlatRun, FlatRunAction } from 'types'; + +type FlatRunChecker = (flatRun: FlatRun) => boolean; + +type FlatRunPermissionSet = Pick< + PermissionsHook, + 'canCreateExperiment' | 'canDeleteFlatRun' | 'canModifyExperiment' | 'canMoveFlatRun' +>; + +const flatRunCheckers: Record = { + [FlatRunAction.Archive]: (flatRun) => + !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + + [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), + + [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), + + [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + + // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), + + [FlatRunAction.Unarchive]: (flatRun) => + terminalRunStates.has(flatRun.state) && flatRun.parentArchived, +}; + +export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { + return flatRunCheckers[action](flatRun); +}; + +const getActionsForFlatRun = ( + flatRun: FlatRun, + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun) return []; // redundant, for clarity + const workspace = { id: flatRun.workspaceId }; + return targets + .filter((action) => canActionFlatRun(action, flatRun)) + .filter((action) => { + switch (action) { + case FlatRunAction.Delete: + return permissions.canDeleteFlatRun({ flatRun }); + + case FlatRunAction.Move: + return permissions.canMoveFlatRun({ flatRun }); + + case FlatRunAction.Archive: + case FlatRunAction.Unarchive: + return permissions.canModifyExperiment({ workspace }); + + case FlatRunAction.Kill: + return permissions.canModifyExperiment({ workspace }) && !flatRun.experiment?.unmanaged; + + default: + return true; + } + }); +}; + +export const getActionsForFlatRunsUnion = ( + flatRun: FlatRun[], + targets: FlatRunAction[], + permissions: FlatRunPermissionSet, +): FlatRunAction[] => { + if (!flatRun.length) return []; + const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); + return targets.filter((action) => + actionsForRuns.some((runActions) => runActions.includes(action)), + ); +}; From 54abde4cf2354e35eed2f2f34693872e1eb8040a Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 23 May 2024 17:28:07 -0700 Subject: [PATCH 125/161] feat: return `archived` for FlatRun --- harness/determined/common/api/bindings.py | 4 ++ master/internal/api_runs.go | 1 + proto/pkg/runv1/run.pb.go | 63 +++++++++++++--------- proto/src/determined/run/v1/run.proto | 7 ++- webui/react/src/services/api-ts-sdk/api.ts | 6 +++ webui/react/src/services/apiConfig.ts | 15 +++--- webui/react/src/types.ts | 1 + webui/react/src/utils/flatRun.ts | 7 ++- 8 files changed, 68 insertions(+), 36 deletions(-) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index 29f523ce2bf..5e29e637b15 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -4327,6 +4327,7 @@ class v1FlatRun(Printable): def __init__( self, *, + archived: bool, checkpointCount: int, checkpointSize: str, id: int, @@ -4348,6 +4349,7 @@ def __init__( summaryMetrics: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, userId: "typing.Union[int, None, Unset]" = _unset, ): + self.archived = archived self.checkpointCount = checkpointCount self.checkpointSize = checkpointSize self.id = id @@ -4382,6 +4384,7 @@ def __init__( @classmethod def from_json(cls, obj: Json) -> "v1FlatRun": kwargs: "typing.Dict[str, typing.Any]" = { + "archived": obj["archived"], "checkpointCount": obj["checkpointCount"], "checkpointSize": obj["checkpointSize"], "id": obj["id"], @@ -4417,6 +4420,7 @@ def from_json(cls, obj: Json) -> "v1FlatRun": def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out: "typing.Dict[str, typing.Any]" = { + "archived": self.archived, "checkpointCount": self.checkpointCount, "checkpointSize": self.checkpointSize, "id": self.id, diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index 6db30e581cc..b921e3643eb 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -140,6 +140,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). + ColumnExpr("r.archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index ee2cb2edfbd..2c9308e2650 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -218,6 +218,10 @@ type FlatRun struct { Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` // The arbitrary metadata of the run. Metadata *_struct.Struct `protobuf:"bytes,20,opt,name=metadata,proto3,oneof" json:"metadata,omitempty"` + // The archived status of this run. + // This is only looking at the archived status at the run level and not taking + // into account whether the experiment is archived or not. + Archived bool `protobuf:"varint,21,opt,name=archived,proto3" json:"archived,omitempty"` } func (x *FlatRun) Reset() { @@ -392,6 +396,13 @@ func (x *FlatRun) GetMetadata() *_struct.Struct { return nil } +func (x *FlatRun) GetArchived() bool { + if x != nil { + return x.Archived + } + return false +} + var File_determined_run_v1_run_proto protoreflect.FileDescriptor var file_determined_run_v1_run_proto_rawDesc = []byte{ @@ -449,7 +460,7 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x70, 0x61, 0x63, 0x68, 0x79, 0x64, 0x65, 0x72, 0x6d, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xc0, 0x09, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0xe7, 0x09, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, @@ -506,30 +517,32 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x38, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x07, 0x52, 0x08, 0x6d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x3a, 0x9b, 0x01, 0x92, 0x41, 0x97, 0x01, - 0x0a, 0x94, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0xd2, 0x01, 0x04, - 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, - 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, - 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0a, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, - 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, - 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, - 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, - 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, - 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, - 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, - 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x72, 0x63, + 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x72, 0x63, + 0x68, 0x69, 0x76, 0x65, 0x64, 0x3a, 0xa6, 0x01, 0x92, 0x41, 0xa2, 0x01, 0x0a, 0x9f, 0x01, 0xd2, + 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0xd2, 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, + 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, + 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, + 0x76, 0x65, 0x64, 0xd2, 0x01, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, + 0x0a, 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, + 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, + 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, + 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x0b, 0x0a, 0x09, + 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, + 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, 0x76, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/src/determined/run/v1/run.proto b/proto/src/determined/run/v1/run.proto index 556b4c278c5..e15c57b7ff6 100644 --- a/proto/src/determined/run/v1/run.proto +++ b/proto/src/determined/run/v1/run.proto @@ -66,7 +66,8 @@ message FlatRun { "project_name", "workspace_id", "workspace_name", - "parent_archived" + "parent_archived", + "archived" ] } }; @@ -112,4 +113,8 @@ message FlatRun { optional FlatRunExperiment experiment = 19; // The arbitrary metadata of the run. optional google.protobuf.Struct metadata = 20; + // The archived status of this run. + // This is only looking at the archived status at the run level and not taking + // into account whether the experiment is archived or not. + bool archived = 21; } diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index f724be74d6b..33ed1ae25fe 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -3544,6 +3544,12 @@ export interface V1FlatRun { * @memberof V1FlatRun */ metadata?: any; + /** + * The archived status of this run. This is only looking at the archived status at the run level and not taking into account whether the experiment is archived or not. + * @type {boolean} + * @memberof V1FlatRun + */ + archived: boolean; } /** * diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index 7c8c01d55f3..b782ac8f284 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1176,12 +1176,15 @@ export const moveRuns: DetApi detApi.Internal.moveRuns(params, options), }; -export const unarchiveRuns: DetApi = - { - name: 'unarchiveRuns', - postProcess: noOp, - request: (params, options) => detApi.Internal.unarchiveRuns(params, options), - }; +export const unarchiveRuns: DetApi< + Api.V1UnarchiveRunsRequest, + Api.V1UnarchiveRunsResponse, + Type.BulkActionResult +> = { + name: 'unarchiveRuns', + postProcess: (response) => decoder.mapV1ActionResults(response.results), + request: (params, options) => detApi.Internal.unarchiveRuns(params, options), +}; /* Tasks */ diff --git a/webui/react/src/types.ts b/webui/react/src/types.ts index 22ab2ab6380..6f633247b19 100644 --- a/webui/react/src/types.ts +++ b/webui/react/src/types.ts @@ -1237,6 +1237,7 @@ export interface FlatRun { projectName: string; workspaceId: number; workspaceName: string; + archived: boolean; parentArchived: boolean; experiment?: FlatRunExperiment; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6375851fd24..6c2aef34d5e 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,18 +11,17 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.parentArchived && !flatRun.parentArchived && terminalRunStates.has(flatRun.state), + !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun?.parentArchived && !flatRun.parentArchived, + [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), - [FlatRunAction.Unarchive]: (flatRun) => - terminalRunStates.has(flatRun.state) && flatRun.parentArchived, + [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { From 6ad02d5733dd5ea9441ddaac7bb536eba9891124 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 11:09:46 -0700 Subject: [PATCH 126/161] chore: minor changes --- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 3 +-- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 15 +++++---------- webui/react/src/utils/flatRun.ts | 4 ++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index ee7130b4ddb..0413a0a35b3 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -126,6 +126,7 @@ const FlatRunActionButton = ({ title: `Partial ${action} Failure`, }); } + await onActionComplete?.(); } catch (e) { const publicSubject = `Unable to ${action} Selected ${capitalizeWord(LABEL_PLURAL)}`; handleError(e, { @@ -134,8 +135,6 @@ const FlatRunActionButton = ({ publicSubject, silent: false, }); - } finally { - onActionComplete?.(); } }, [sendBatchActions, onActionSuccess, openToast, onActionComplete], diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index b9d058c9a51..45738af298d 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -52,7 +52,6 @@ import { rowHeightMap, settingsConfigGlobal, } from 'components/OptionsMenu.settings'; -import { BatchAction } from 'components/TableActionBar'; import useUI from 'components/ThemeProvider'; import { useAsync } from 'hooks/useAsync'; import { useGlasbey } from 'hooks/useGlasbey'; @@ -703,14 +702,10 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { [rowRangeToIds, settings.selection, updateSettings], ); - const onActionSuccess = useCallback( - // TODO: update this function - // eslint-disable-next-line @typescript-eslint/no-unused-vars - (_action: BatchAction, _successfulIds: number[]) => { - handleSelectionChange('remove-all'); - }, - [handleSelectionChange], - ); + const onActionComplete = useCallback(async () => { + handleSelectionChange('remove-all'); + await fetchRuns(); + }, [fetchRuns, handleSelectionChange]); const handleContextMenuComplete: ContextMenuCompleteHandlerProps = useCallback(() => {}, []); @@ -1000,7 +995,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} project={project} selectedRuns={selectedRuns} - onActionSuccess={onActionSuccess} + onActionComplete={onActionComplete} /> diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 6c2aef34d5e..fb266d5c797 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -11,13 +11,13 @@ type FlatRunPermissionSet = Pick< const flatRunCheckers: Record = { [FlatRunAction.Archive]: (flatRun) => - !flatRun.archived && !flatRun.archived && terminalRunStates.has(flatRun.state), + !flatRun.parentArchived && !flatRun.archived && terminalRunStates.has(flatRun.state), [FlatRunAction.Delete]: (flatRun) => deletableRunStates.has(flatRun.state), [FlatRunAction.Kill]: (flatRun) => killableRunStates.includes(flatRun.state), - [FlatRunAction.Move]: (flatRun) => !flatRun.archived && !flatRun.archived, + [FlatRunAction.Move]: (flatRun) => !flatRun.parentArchived && !flatRun.archived, // [FlatRunAction.Pause]: (run) => pausableRunStates.has(run.state), From c6b503cbcea48ca66b68ecc9a1728bf82ab6adae Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 24 May 2024 15:15:43 -0700 Subject: [PATCH 127/161] test: `canActionFlatRun` test cases --- webui/react/src/constants/states.ts | 2 +- webui/react/src/utils/flatRun.test.ts | 218 ++++++++++++++++++++++++++ 2 files changed, 219 insertions(+), 1 deletion(-) create mode 100644 webui/react/src/utils/flatRun.test.ts diff --git a/webui/react/src/constants/states.ts b/webui/react/src/constants/states.ts index c0cb4ab57e1..677c4477e99 100644 --- a/webui/react/src/constants/states.ts +++ b/webui/react/src/constants/states.ts @@ -65,7 +65,7 @@ export const terminalCommandStates: Set = new Set([ CommandState.Terminating, ]); -const runStateList = [ +export const runStateList = [ RunState.Canceled, RunState.Completed, RunState.Error, diff --git a/webui/react/src/utils/flatRun.test.ts b/webui/react/src/utils/flatRun.test.ts new file mode 100644 index 00000000000..3b7d97c29f7 --- /dev/null +++ b/webui/react/src/utils/flatRun.test.ts @@ -0,0 +1,218 @@ +import dayjs from 'dayjs'; + +import { + deletableRunStates, + killableRunStates, + runStateList, + terminalRunStates, +} from 'constants/states'; +import { FlatRun, FlatRunAction, RunState } from 'types'; +import { canActionFlatRun } from 'utils/flatRun'; + +describe('Flat Run Utilities', () => { + const BASE_FLAT_RUN: Readonly = { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }; + + describe('canActionFlatRun function', () => { + const terminatedRunStates: Set = new Set( + Object.values(RunState).filter((v) => terminalRunStates.has(v)), + ); + + describe('Archive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be archivable (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, flatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be archivable (%s)', + (terminatedRunState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, archivedFlatRun)).toBeFalsy(); + + // parentArchived and archived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Archive, bothArchivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Unarchive Action', () => { + it.each(Array.from(terminatedRunStates))( + 'should be unarchivable (%s)', + (terminatedRunState) => { + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeTruthy(); + + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, bothArchivedFlatRun)).toBeTruthy(); + }, + ); + + it.each(Array.from(terminatedRunStates))( + 'should not be unarchivable with Terminated Run State (%s)', + (terminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: false, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: terminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, parentArchivedFlatRun)).toBeFalsy(); + }, + ); + + it.each(Array.from(Object.values(RunState).filter((v) => !terminatedRunStates.has(v))))( + 'should not be unarchivable with non Terminated Run States (%s)', + (nonTerminatedRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, flatRun)).toBeFalsy(); + + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: nonTerminatedRunState, + }; + expect(canActionFlatRun(FlatRunAction.Unarchive, archivedFlatRun)).toBeFalsy(); + }, + ); + }); + + describe('Delete Action', () => { + it.each(runStateList)('should be deletable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((state) => !deletableRunStates.has(state)))( + 'should not be deletable', + (nonDeletableRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonDeletableRunState, + }; + expect(canActionFlatRun(FlatRunAction.Delete, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Kill Action', () => { + const killRunStates: Set = new Set( + Object.values(RunState).filter((v) => killableRunStates.includes(v)), + ); + + it.each(Array.from(killRunStates))('should be killable (%s)', (killRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: killRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState).filter((v) => !killRunStates.has(v)))( + 'should not be killable (%s)', + (nonKillRunState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: nonKillRunState, + }; + expect(canActionFlatRun(FlatRunAction.Kill, flatRun)).toBeFalsy(); + }, + ); + }); + + describe('Move Action', () => { + it.each(Object.values(RunState))('should be movable (%s)', (runState) => { + const flatRun: FlatRun = { + ...BASE_FLAT_RUN, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, flatRun)).toBeTruthy(); + }); + + it.each(Object.values(RunState))('should not be movable (%s)', (runState) => { + // just parentArchived is true + const parentArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, parentArchivedFlatRun)).toBeFalsy(); + + // just archived is true + const archivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, archivedFlatRun)).toBeFalsy(); + + // both archived and parentArchived are true + const bothArchivedFlatRun: FlatRun = { + ...BASE_FLAT_RUN, + archived: true, + parentArchived: true, + state: runState, + }; + expect(canActionFlatRun(FlatRunAction.Move, bothArchivedFlatRun)).toBeFalsy(); + }); + }); + }); +}); From 9518246a9bb952e0b2effaff37817377a2534087 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 11:49:57 -0700 Subject: [PATCH 128/161] chore: better type --- .../pages/FlatRuns/FlatRunActionButton.tsx | 4 ++-- webui/react/src/utils/flatRun.ts | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 0413a0a35b3..a1a650b836a 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -39,8 +39,8 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; - selectedRuns: FlatRun[]; - project: Project; + selectedRuns: ReadonlyArray>; + project: Readonly; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index fb266d5c797..8b52c9cb22c 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -2,7 +2,7 @@ import { deletableRunStates, killableRunStates, terminalRunStates } from 'consta import { PermissionsHook } from 'hooks/usePermissions'; import { FlatRun, FlatRunAction } from 'types'; -type FlatRunChecker = (flatRun: FlatRun) => boolean; +type FlatRunChecker = (flatRun: Readonly) => boolean; type FlatRunPermissionSet = Pick< PermissionsHook, @@ -24,15 +24,15 @@ const flatRunCheckers: Record = { [FlatRunAction.Unarchive]: (flatRun) => terminalRunStates.has(flatRun.state) && flatRun.archived, }; -export const canActionFlatRun = (action: FlatRunAction, flatRun: FlatRun): boolean => { +export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly): boolean => { return flatRunCheckers[action](flatRun); }; const getActionsForFlatRun = ( - flatRun: FlatRun, - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: Readonly, + targets: ReadonlyArray, + permissions: Readonly, +): ReadonlyArray => { if (!flatRun) return []; // redundant, for clarity const workspace = { id: flatRun.workspaceId }; return targets @@ -59,10 +59,10 @@ const getActionsForFlatRun = ( }; export const getActionsForFlatRunsUnion = ( - flatRun: FlatRun[], - targets: FlatRunAction[], - permissions: FlatRunPermissionSet, -): FlatRunAction[] => { + flatRun: ReadonlyArray>, + targets: ReadonlyArray, + permissions: Readonly, +): Readonly => { if (!flatRun.length) return []; const actionsForRuns = flatRun.map((run) => getActionsForFlatRun(run, targets, permissions)); return targets.filter((action) => From e282d37c620eccfba13f6ab08f11235f4329025b Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 28 May 2024 12:18:04 -0700 Subject: [PATCH 129/161] test: `FlatRunActionButton` test --- .../FlatRuns/FlatRunActionButton.test.tsx | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx new file mode 100644 index 00000000000..9a9b1ba7aeb --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -0,0 +1,60 @@ +import { render, screen } from '@testing-library/react'; +import dayjs from 'dayjs'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; + +import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; +import { FlatRun, Project, RunState, WorkspaceState } from 'types'; + +const setup = (selectedFlatRuns: ReadonlyArray>) => { + const project: Readonly = { + archived: false, + id: 1, + immutable: false, + name: 'proj', + notes: [], + state: WorkspaceState.Unspecified, + userId: 1, + workspaceId: 1, + }; + + render( + + + , + ); +}; + +describe('canActionFlatRun function', () => { + describe('Flat Run Action Button Visibility', () => { + it('should not be appeard without selected flat runs', () => { + setup([]); + expect(screen.queryByText('Actions')).not.toBeInTheDocument(); + }); + + it('should be appeard with selected flat runs', async () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + + setup(flatRuns); + expect(await screen.findByText('Actions')).toBeInTheDocument(); + }); + }); +}); From dbd8cbd52e33bdd9b3d9f689b5a257a357c14141 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 30 May 2024 09:59:52 -0700 Subject: [PATCH 130/161] fix: fix run `archived` logic in postgres --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index b921e3643eb..e23f05afe0d 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -140,7 +140,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived"). + ColumnExpr("r.archived OR e.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). From e3362cfeecd98b35456bd529aea48dddcb8fe6c0 Mon Sep 17 00:00:00 2001 From: Ashton G Date: Mon, 3 Jun 2024 10:16:09 -0400 Subject: [PATCH 131/161] chore: run bulk action interstitial component (#9390) Co-authored-by: Keita Fish --- .../components/InterstitialModalComponent.tsx | 2 +- ...nFilterInterstitialModalComponent.test.tsx | 216 ++++++++++++++++++ .../RunFilterInterstitialModalComponent.tsx | 168 ++++++++++++++ .../RunMoveWarningModalComponent.test.tsx | 93 ++++++++ .../RunMoveWarningModalComponent.tsx | 54 +++++ webui/react/src/hooks/useTypedParams.test.tsx | 4 +- .../pages/TrialDetails/TrialDetailsLogs.tsx | 15 +- webui/react/src/setupTests.ts | 19 +- .../src/utils/mergeAbortControllers.test.ts | 87 +++++++ .../react/src/utils/mergeAbortControllers.ts | 20 ++ 10 files changed, 653 insertions(+), 25 deletions(-) create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx create mode 100644 webui/react/src/components/RunFilterInterstitialModalComponent.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.test.tsx create mode 100644 webui/react/src/components/RunMoveWarningModalComponent.tsx create mode 100644 webui/react/src/utils/mergeAbortControllers.test.ts create mode 100644 webui/react/src/utils/mergeAbortControllers.ts diff --git a/webui/react/src/components/InterstitialModalComponent.tsx b/webui/react/src/components/InterstitialModalComponent.tsx index 0789b4a6b38..7eaff4c822e 100644 --- a/webui/react/src/components/InterstitialModalComponent.tsx +++ b/webui/react/src/components/InterstitialModalComponent.tsx @@ -6,7 +6,7 @@ import { useCallback, useEffect } from 'react'; export type onInterstitialCloseActionType = (reason: 'ok' | 'close' | 'failed') => void; interface Props { - onCloseAction: (reason: 'ok' | 'close' | 'failed') => void; + onCloseAction: onInterstitialCloseActionType; loadableData: Loadable; } diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx new file mode 100644 index 00000000000..3284273cdaf --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.test.tsx @@ -0,0 +1,216 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { FilterFormSetWithoutId, FormField } from 'components/FilterForm/components/type'; +import RunFilterInterstitialModalComponent, { + CloseReason, + ControlledModalRef, + Props, +} from 'components/RunFilterInterstitialModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +vi.mock('services/api', async () => ({ + ...(await vi.importActual('services/api')), + searchRuns: vi.fn(() => + Promise.resolve({ + pagination: { + total: 0, + }, + }), + ), +})); + +const { searchRuns } = await import('services/api'); +const searchRunsMock = vi.mocked(searchRuns); + +const emptyFilterFormSetWithoutId: FilterFormSetWithoutId = { + filterGroup: { + children: [], + conjunction: 'or', + kind: 'group', + }, + showArchived: false, +}; + +const setupTest = (props: Partial = {}) => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunFilterInterstitialModalComponent', () => { + beforeEach(() => { + searchRunsMock.mockRestore(); + }); + + it('does not call server until opened', () => { + const { ref } = setupTest(); + + expect(searchRunsMock).not.toBeCalled(); + act(() => { + ref.current?.open(); + }); + expect(searchRunsMock).toBeCalled(); + }); + + it('calls server with filter describing filter selection', () => { + const expectedFilterGroup: FilterFormSetWithoutId['filterGroup'] = { + children: [ + { + columnName: 'experimentName', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator: 'contains', + type: 'COLUMN_TYPE_TEXT', + value: 'foo', + }, + ], + conjunction: 'and', + kind: 'group', + }; + const expectedExclusions = [1, 2, 3]; + const { ref } = setupTest({ + filterFormSet: { + filterGroup: expectedFilterGroup, + showArchived: true, + }, + selection: { + exclusions: expectedExclusions, + type: 'ALL_EXCEPT', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + // TODO: is there a better way to test this expectation? + expect(filterFormSet.showArchived).toBeTruthy(); + const [filterGroup, idFilterGroup] = filterFormSet.filterGroup.children?.[0].children || []; + expect(filterGroup).toEqual(expectedFilterGroup); + + const idFilters = idFilterGroup.children; + expect(idFilters.every((f: FormField) => f.operator === '!=')).toBeTruthy(); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedExclusions); + }); + + it('calls server with filter describing visual selection', () => { + const expectedSelection = [1, 2, 3]; + const { ref } = setupTest({ + selection: { + selections: expectedSelection, + type: 'ONLY_IN', + }, + }); + act(() => { + ref.current?.open(); + }); + + expect(searchRunsMock).toBeCalled(); + + const { lastCall } = vi.mocked(searchRuns).mock; + const filterFormSetString = lastCall?.[0].filter; + expect(filterFormSetString).toBeDefined(); + const filterFormSet = JSON.parse(filterFormSetString || ''); + + expect(filterFormSet.showArchived).toBe(false); + const idFilters = filterFormSet.filterGroup.children?.[0].children || []; + expect(idFilters.every((f: FormField) => f.operator === '=')).toBe(true); + expect(idFilters.map((f: FormField) => f.value)).toEqual(expectedSelection); + }); + + it('cancels request when modal is closed via close button', async () => { + searchRunsMock.mockImplementation((_params, options) => { + return new Promise((_resolve, reject) => { + options?.signal?.addEventListener('abort', () => { + reject(); + }); + }); + }); + const { ref } = setupTest(); + // explicit type here because typescript can't infer that the act function + // runs imperatively. + let lifecycle: Promise | undefined; + // we don't await the act because we need the render pipeline to flush + // before we get the close reason back + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('close'); + }); + + it('closes modal with has_search_runs when it has runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 1, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('has_search_runs'); + }); + + it('closes modal with no_search_runs when it lacks runs', async () => { + searchRunsMock.mockImplementation(() => + Promise.resolve({ + pagination: { + total: 0, + }, + runs: [], + }), + ); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('no_search_runs'); + }); + + it('closes modal with failed when request errors outside of aborts', async () => { + searchRunsMock.mockImplementation(() => Promise.reject(new Error('uh oh!'))); + const { ref } = setupTest(); + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('failed'); + }); +}); diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx new file mode 100644 index 00000000000..a117b74202e --- /dev/null +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx @@ -0,0 +1,168 @@ +import { useModal } from 'hew/Modal'; +import { Failed, NotLoaded } from 'hew/utils/loadable'; +import { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react'; + +import { FilterFormSetWithoutId, Operator } from 'components/FilterForm/components/type'; +import InterstitialModalComponent, { + onInterstitialCloseActionType, +} from 'components/InterstitialModalComponent'; +import { SelectionType } from 'components/Searches/Searches.settings'; +import { useAsync } from 'hooks/useAsync'; +import { searchRuns } from 'services/api'; +import { DetError } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; +import { observable } from 'utils/observable'; + +export type CloseReason = 'has_search_runs' | 'no_search_runs' | 'failed' | 'close' | 'manual'; + +export interface Props { + projectId?: number; + selection: SelectionType; + filterFormSet: FilterFormSetWithoutId; +} + +export interface ControlledModalRef { + open: () => Promise; + close: (reason?: CloseReason) => void; +} + +/** + * Modal component for checking selections for runs that are part of a search. + * is essentially a single purpose interstitial modal component. Because it + * wraps a modal and the intended use is within a user flow, this component does + * not use the `useModal` hook. instead, it exposes control via ref. the `open` + * method of the ref returns a promise that resolves when the modal is closed + * with the reason why the modal closed. + * + */ +export const RunFilterInterstitialModalComponent = forwardRef( + ({ projectId, selection, filterFormSet }: Props, ref): JSX.Element => { + const InterstitialModal = useModal(InterstitialModalComponent); + const [isOpen, setIsOpen] = useState(false); + const closeController = useRef(new AbortController()); + const lifecycleObservable = useRef(observable(null)); + + const { close: internalClose, open: internalOpen } = InterstitialModal; + + const open = async () => { + internalOpen(); + setIsOpen(true); + const closeReason = await lifecycleObservable.current.toPromise(); + if (closeReason === null) { + // this promise should never reject -- toPromise only resolves when the + // value changes, and no code sets the observavble to null + return Promise.reject(); + } + return closeReason; + }; + + const close = useCallback( + (reason: CloseReason = 'manual') => { + setIsOpen(false); + // encourage render with isOpen to false before closing to prevent + // firing onCloseAction twice + setTimeout(() => internalClose('close'), 0); + closeController.current.abort(); + closeController.current = new AbortController(); + lifecycleObservable.current.set(reason); + lifecycleObservable.current = observable(null); + }, + [internalClose], + ); + + useImperativeHandle(ref, () => ({ close, open })); + + const selectionHasSearchRuns = useAsync( + async (canceler) => { + if (!isOpen) return NotLoaded; + const mergedCanceler = mergeAbortControllers(canceler, closeController.current); + const idToFilter = (operator: Operator, id: number) => + ({ + columnName: 'id', + kind: 'field', + location: 'LOCATION_TYPE_RUN', + operator, + type: 'COLUMN_TYPE_NUMBER', + value: id, + }) as const; + const filterGroup: FilterFormSetWithoutId['filterGroup'] = + selection.type === 'ALL_EXCEPT' + ? { + children: [ + filterFormSet.filterGroup, + { + children: selection.exclusions.map(idToFilter.bind(this, '!=')), + conjunction: 'and', + kind: 'group', + }, + ], + conjunction: 'and', + kind: 'group', + } + : { + children: selection.selections.map(idToFilter.bind(this, '=')), + conjunction: 'or', + kind: 'group', + }; + const filter: FilterFormSetWithoutId = { + ...filterFormSet, + filterGroup: { + children: [ + filterGroup, + { + columnName: 'numTrials', + kind: 'field', + location: 'LOCATION_TYPE_EXPERIMENT', + operator: '>', + type: 'COLUMN_TYPE_NUMBER', + value: 1, + } as const, + ], + conjunction: 'and', + kind: 'group', + }, + }; + try { + const results = await searchRuns( + { + filter: JSON.stringify(filter), + limit: 0, + projectId, + }, + { signal: mergedCanceler.signal }, + ); + + return (results.pagination.total || 0) > 0; + } catch (e) { + if (!mergedCanceler.signal.aborted) { + return Failed(e instanceof Error ? e : new DetError(e)); + } + return NotLoaded; + } + }, + [selection, filterFormSet, projectId, isOpen], + ); + + const interstitialClose: onInterstitialCloseActionType = useCallback( + (reason) => { + if (reason === 'ok') { + return selectionHasSearchRuns.forEach((bool) => { + const fixedReason = bool ? 'has_search_runs' : 'no_search_runs'; + close(fixedReason); + }); + } + close(reason); + }, + [close, selectionHasSearchRuns], + ); + + return ( + + ); + }, +); + +export default RunFilterInterstitialModalComponent; diff --git a/webui/react/src/components/RunMoveWarningModalComponent.test.tsx b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx new file mode 100644 index 00000000000..8847538b527 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.test.tsx @@ -0,0 +1,93 @@ +import { act, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Ref } from 'react'; + +import { + CloseReason, + RunMoveWarningFlowRef, + RunMoveWarningModalComponent, +} from 'components/RunMoveWarningModalComponent'; +import { ThemeProvider } from 'components/ThemeProvider'; + +const setupTest = () => { + const ref: Ref = { current: null }; + userEvent.setup(); + + render( + + + + + , + ); + + return { + ref, + }; +}; + +describe('RunMoveWarningModalComponent', () => { + it('is not shown until opened', () => { + const { ref } = setupTest(); + + expect(screen.queryByText('Move Run Dependency Alert')).toBeNull(); + act(() => { + ref.current?.open(); + }); + expect(screen.queryByText('Move Run Dependency Alert')).not.toBeNull(); + }); + + it('closes modal with cancel when closed with the x button', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const closeButton = await screen.findByLabelText('Close'); + await userEvent.click(closeButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with cancel when cancel button is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const cancelButton = await screen.findByText('Cancel'); + await userEvent.click(cancelButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('cancel'); + }); + + it('closes modal with ok when submit is pressed', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + const okayButton = await screen.findByText('Move independent runs'); + await userEvent.click(okayButton); + const closeReason = await lifecycle; + expect(closeReason).toBe('ok'); + }); + + it('closes modal with manual when manually closed with no arg', async () => { + const { ref } = setupTest(); + + let lifecycle: Promise | undefined; + act(() => { + lifecycle = ref.current?.open(); + }); + act(() => { + ref.current?.close(); + }); + const closeReason = await lifecycle; + expect(closeReason).toBe('manual'); + }); +}); diff --git a/webui/react/src/components/RunMoveWarningModalComponent.tsx b/webui/react/src/components/RunMoveWarningModalComponent.tsx new file mode 100644 index 00000000000..3a2d0086e20 --- /dev/null +++ b/webui/react/src/components/RunMoveWarningModalComponent.tsx @@ -0,0 +1,54 @@ +import { Modal, useModal } from 'hew/Modal'; +import { observable, WritableObservable } from 'micro-observables'; +import { forwardRef, useImperativeHandle, useRef } from 'react'; + +export type CloseReason = 'ok' | 'cancel' | 'manual'; + +import handleError from 'utils/error'; + +type RunMoveWarningProps = { + onClose: (reason: 'ok' | 'cancel') => void; +}; +const RunMoveWarningCopy = ({ onClose }: RunMoveWarningProps) => ( + onClose('ok'), text: 'Move independent runs' }} + title="Move Run Dependency Alert" + onClose={() => onClose('cancel')}> + Some runs you are trying to move belong to a Hyperparameter Search and cannot be moved + independently to maintain their contextual relationships. These runs will be skipped. + +); + +export type RunMoveWarningFlowRef = { + open: () => Promise; + close: () => void; +}; + +export const RunMoveWarningModalComponent = forwardRef((_, ref) => { + const RunMoveWarning = useModal(RunMoveWarningCopy); + const closeReason = useRef>(observable(null)); + + const { close: internalClose, open: internalOpen } = RunMoveWarning; + + const open = async () => { + internalOpen(); + const reason = await closeReason.current.toPromise(); + if (reason === null) { + return Promise.reject(); + } + return reason; + }; + + const close = (reason: CloseReason = 'manual') => { + internalClose(reason); + closeReason.current.set(reason); + closeReason.current = observable(null); + }; + + useImperativeHandle(ref, () => ({ close, open })); + + return ; +}); + +export default RunMoveWarningModalComponent; diff --git a/webui/react/src/hooks/useTypedParams.test.tsx b/webui/react/src/hooks/useTypedParams.test.tsx index 054c5aecdb9..dadaf631d7e 100644 --- a/webui/react/src/hooks/useTypedParams.test.tsx +++ b/webui/react/src/hooks/useTypedParams.test.tsx @@ -174,8 +174,8 @@ describe('useTypedParams', () => { .afterEach(() => navSpy.mockClear()), ); }); - it('does not update if params are not changed', () => { - fc.assert( + it('does not update if params are not changed', async () => { + await fc.assert( fc .asyncProperty(sameArbPartial, async ([params, partial]) => { const { hookRef } = setupTest(params); diff --git a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx index e75b75c99c7..8f93518fb7c 100644 --- a/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx +++ b/webui/react/src/pages/TrialDetails/TrialDetailsLogs.tsx @@ -16,6 +16,7 @@ import { readStream } from 'services/utils'; import { ExperimentBase, TrialDetails } from 'types'; import { downloadTrialLogs } from 'utils/browser'; import handleError, { ErrorType } from 'utils/error'; +import mergeAbortControllers from 'utils/mergeAbortControllers'; import css from './TrialDetailsLogs.module.scss'; @@ -26,20 +27,6 @@ export interface Props { type OrderBy = 'ORDER_BY_UNSPECIFIED' | 'ORDER_BY_ASC' | 'ORDER_BY_DESC'; -const mergeAbortControllers = (...controllers: AbortController[]) => { - const mergedController = new AbortController(); - - controllers.forEach((c) => { - const abort = () => { - mergedController.abort(); - c.signal.removeEventListener('abort', abort); - }; - c.signal.addEventListener('abort', abort); - }); - - return mergedController; -}; - const TrialDetailsLogs: React.FC = ({ experiment, trial }: Props) => { const { ui } = useUI(); const [filterOptions, setFilterOptions] = useState({}); diff --git a/webui/react/src/setupTests.ts b/webui/react/src/setupTests.ts index fe8c871c9f7..b8b22e32f0b 100644 --- a/webui/react/src/setupTests.ts +++ b/webui/react/src/setupTests.ts @@ -6,20 +6,23 @@ */ import '@testing-library/jest-dom/extend-expect'; import 'micro-observables/batchingForReactDom'; -import 'utils/prototypes'; import 'whatwg-fetch'; import Schema from 'async-validator'; -import { noOp } from 'utils/service'; +// this code doesn't work in node environments +if (globalThis.window) { + await import('utils/prototypes'); + const { noOp } = await import('utils/service'); -/** - * To clean up the async-validator console warning that get generated during testing. - * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning - */ -Schema.warning = noOp; + /** + * To clean up the async-validator console warning that get generated during testing. + * https://github.com/yiminghe/async-validator#how-to-avoid-global-warning + */ + Schema.warning = noOp; +} -Object.defineProperty(window, 'matchMedia', { +Object.defineProperty(globalThis, 'matchMedia', { value: () => ({ addEventListener: vi.fn(), addListener: vi.fn(), // deprecated diff --git a/webui/react/src/utils/mergeAbortControllers.test.ts b/webui/react/src/utils/mergeAbortControllers.test.ts new file mode 100644 index 00000000000..51308bac61f --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.test.ts @@ -0,0 +1,87 @@ +// @vitest-environment node +// we're using node because the jsdom version of the abortcontroller doesn't have reasons on abortsignals +import fc from 'fast-check'; +import { zip } from 'lodash'; + +import { mergeAbortControllers } from 'utils/mergeAbortControllers'; + +// arbitrary to generate a list of abort controllers to pass to mergeAbortControllers +const argArb = fc.uniqueArray( + fc.constant(() => new AbortController()).map((f) => f()), + { minLength: 1 }, +); + +// return a subset of the above to control +const argArbWithSelection = (n?: number) => + argArb.chain((arr) => + fc.tuple(fc.constant(arr), fc.shuffledSubarray(arr, { maxLength: n, minLength: 1 })), + ); + +// the above, but the subset from the above returns with unique reason values to +// verify which abortController was the first to abort +const argArbWithSelectionAndReasons = (n?: number) => + argArbWithSelection(n).chain(([args, selection]) => { + const reasonsArb = fc.uniqueArray(fc.anything(), { + maxLength: selection.length, + minLength: selection.length, + }); + const selectionAndReasonArb = reasonsArb + .map((reasons) => zip(selection, reasons)) + .filter((tups): tups is [AbortController, unknown][] => + tups.every((tup) => tup.every((c) => c !== undefined)), + ); + + return fc.tuple(fc.constant(args), selectionAndReasonArb); + }); + +describe('mergeAbortControllers', () => { + it('merged abort controller aborts if any constituent aborts', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(); + expect(result.signal.aborted).toBe(true); + }), + ); + }); + it('merged abort controller aborts with constituent reason', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(1), ([args, abortControllers]) => { + const [[abortController, reason]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortController.abort(reason); + expect(abortController.signal.reason).toBe(reason); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); + it('merged abort controller only reflects the first abort', () => { + fc.assert( + fc.property(argArbWithSelectionAndReasons(), ([args, abortControllers]) => { + const [[firstAbortController]] = abortControllers; + const result = mergeAbortControllers(...args); + + abortControllers.forEach(([abortController, reason]) => { + abortController.abort(reason); + }); + expect(result.signal.reason).toBe(firstAbortController.signal.reason); + }), + ); + }); + + it('merging an aborted controller results in an aborted controller', () => { + fc.assert( + fc.property(argArbWithSelection(1), ([args, abortControllers]) => { + const [abortController] = abortControllers; + abortController.abort(); + const result = mergeAbortControllers(...args); + + expect(result.signal.aborted).toBe(true); + expect(result.signal.reason).toBe(abortController.signal.reason); + }), + ); + }); +}); diff --git a/webui/react/src/utils/mergeAbortControllers.ts b/webui/react/src/utils/mergeAbortControllers.ts new file mode 100644 index 00000000000..98004fe3100 --- /dev/null +++ b/webui/react/src/utils/mergeAbortControllers.ts @@ -0,0 +1,20 @@ +export const mergeAbortControllers = (...controllers: AbortController[]): AbortController => { + const mergedController = new AbortController(); + + controllers.forEach((c) => { + // resulting controller is aborted, just ignore the rest + if (mergedController.signal.aborted) return; + // preemptively abort if the signal's already aborted + if (c.signal.aborted) return mergedController.abort(c.signal.reason); + + const abort = () => { + mergedController.abort(c.signal.reason); + c.signal.removeEventListener('abort', abort); + }; + c.signal.addEventListener('abort', abort); + }); + + return mergedController; +}; + +export default mergeAbortControllers; From 400548bde9a8a5d88672ed8543675c7b05550482 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 11:02:29 -0700 Subject: [PATCH 132/161] chore: feedback --- .../pages/FlatRuns/FlatRunActionButton.test.tsx | 15 ++------------- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 10 +++++----- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 9a9b1ba7aeb..166fcd77d1b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -3,25 +3,14 @@ import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; -import { FlatRun, Project, RunState, WorkspaceState } from 'types'; +import { FlatRun, RunState } from 'types'; const setup = (selectedFlatRuns: ReadonlyArray>) => { - const project: Readonly = { - archived: false, - id: 1, - immutable: false, - name: 'proj', - notes: [], - state: WorkspaceState.Unspecified, - userId: 1, - workspaceId: 1, - }; - render( diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index a1a650b836a..e78658dcefa 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -8,7 +8,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; -import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; +import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; @@ -40,7 +40,7 @@ const LABEL_PLURAL = 'runs'; interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; - project: Readonly; + projectId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -48,7 +48,7 @@ interface Props { const FlatRunActionButton = ({ isMobile, selectedRuns, - project, + projectId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { @@ -63,7 +63,7 @@ const FlatRunActionButton = ({ .filter((exp) => canActionFlatRun(action, exp)) .map((run) => run.id); const params = { - projectId: project.id, + projectId, runIds: validRunIds, }; switch (action) { @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [project.id, selectedRuns], + [projectId, selectedRuns], ); const submitBatchAction = useCallback( diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 45738af298d..c274dffa072 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -993,7 +993,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { /> From b4439e479b8a11bb4ecbf04c0fc52034c7b2823b Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 16:11:38 -0700 Subject: [PATCH 133/161] feat: basic move action --- .../FlatRuns/FlatRunActionButton.test.tsx | 1 + .../pages/FlatRuns/FlatRunActionButton.tsx | 19 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 194 ++++++++++++++++++ webui/react/src/pages/FlatRuns/FlatRuns.tsx | 4 +- webui/react/src/pages/ProjectDetails.tsx | 2 +- webui/react/src/pages/SearchDetails.tsx | 6 +- webui/react/src/services/api.ts | 8 +- webui/react/src/services/apiConfig.ts | 8 +- 8 files changed, 227 insertions(+), 15 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 166fcd77d1b..25beefaa41e 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -12,6 +12,7 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { isMobile={false} projectId={1} selectedRuns={selectedFlatRuns} + workspaceId={1} onActionComplete={vi.fn()} /> , diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index e78658dcefa..b3929b0ae00 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -7,6 +7,7 @@ import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; import usePermissions from 'hooks/usePermissions'; +import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; import handleError from 'utils/error'; @@ -14,24 +15,20 @@ import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; const BATCH_ACTIONS = [ - // ExperimentAction.OpenTensorBoard, ExperimentAction.Move, ExperimentAction.Archive, ExperimentAction.Unarchive, ExperimentAction.Delete, - // ExperimentAction.Pause, ExperimentAction.Kill, ] as const; type BatchAction = (typeof BATCH_ACTIONS)[number]; const ACTION_ICONS: Record = { - // [ExperimentAction.Pause]: 'pause', [ExperimentAction.Archive]: 'archive', [ExperimentAction.Unarchive]: 'document', [ExperimentAction.Move]: 'workspaces', [ExperimentAction.Kill]: 'cancelled', - // [ExperimentAction.OpenTensorBoard]: 'tensor-board', [ExperimentAction.Delete]: 'error', } as const; @@ -41,6 +38,7 @@ interface Props { isMobile: boolean; selectedRuns: ReadonlyArray>; projectId: number; + workspaceId: number; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -49,12 +47,15 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + workspaceId, onActionSuccess, onActionComplete, }: Props): JSX.Element => { const [batchAction, setBatchAction] = useState(undefined); const permissions = usePermissions(); const { openToast } = useToast(); + const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = + useModal(FlatRunMoveModalComponent); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); const sendBatchActions = useCallback( @@ -68,8 +69,7 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - // return ExperimentMoveModal.open(); - break; + return flatRunMoveModalOpen(); case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -82,7 +82,7 @@ const FlatRunActionButton = ({ break; } }, - [projectId, selectedRuns], + [flatRunMoveModalOpen, projectId, selectedRuns], ); const submitBatchAction = useCallback( @@ -194,6 +194,11 @@ const FlatRunActionButton = ({ onConfirm={() => submitBatchAction(batchAction)} /> )} + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx new file mode 100644 index 00000000000..87d449e6bb8 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -0,0 +1,194 @@ +import Form from 'hew/Form'; +import Icon from 'hew/Icon'; +import { Modal } from 'hew/Modal'; +import Select, { Option } from 'hew/Select'; +import Spinner from 'hew/Spinner'; +import { useToast } from 'hew/Toast'; +import { Label } from 'hew/Typography'; +import { Loadable } from 'hew/utils/loadable'; +import { List } from 'immutable'; +import { useObservable } from 'micro-observables'; +import React, { useEffect, useId } from 'react'; + +import Link from 'components/Link'; +import usePermissions from 'hooks/usePermissions'; +import { paths } from 'routes/utils'; +import { moveRuns } from 'services/api'; +import projectStore from 'stores/projects'; +import workspaceStore from 'stores/workspaces'; +import { FlatRun, Project } from 'types'; +import handleError from 'utils/error'; +import { pluralizer } from 'utils/string'; + +const FORM_ID = 'move-flat-run-form'; + +type FormInputs = { + projectId?: number; + workspaceId?: number; +}; + +interface Props { + flatRuns: Readonly[]; + onSubmit?: (successfulIds?: number[]) => void; + sourceProjectId: number; + sourceWorkspaceId?: number; +} + +const FlatRunMoveModalComponent: React.FC = ({ + flatRuns, + onSubmit, + sourceProjectId, + sourceWorkspaceId, +}: Props) => { + const idPrefix = useId(); + const { openToast } = useToast(); + const [form] = Form.useForm(); + const workspaceId = Form.useWatch('workspaceId', form); + const projectId = Form.useWatch('projectId', form); + + const { canMoveExperimentsTo } = usePermissions(); + const workspaces = Loadable.getOrElse([], useObservable(workspaceStore.unarchived)).filter((w) => + canMoveExperimentsTo({ destination: { id: w.id } }), + ); + const loadableProjects: Loadable> = useObservable( + projectStore.getProjectsByWorkspace(workspaceId), + ); + + useEffect(() => { + if (workspaceId !== undefined) { + projectStore.fetch(workspaceId, undefined, true); + } + }, [workspaceId]); + + const handleSubmit = async () => { + if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { + openToast({ title: 'No changes to save.' }); + return; + } + const values = await form.validateFields(); + const projId = values.projectId ?? 1; + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); + + onSubmit?.(results.successful); + + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; + + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + }; + + return ( + +
+ + + + {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} +
+
+ ); +}; + +export default FlatRunMoveModalComponent; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index c274dffa072..2e6a4156e73 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -106,6 +106,7 @@ const formStore = new FilterFormStore(); interface Props { projectId: number; + workspaceId: number; searchId?: number; } @@ -124,7 +125,7 @@ const parseSortString = (sortString: string): Sort[] => { }); }; -const FlatRuns: React.FC = ({ projectId, searchId }) => { +const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const dataGridRef = useRef(null); const contentRef = useRef(null); const { params, updateParams } = useTypedParams(ProjectUrlSettings, {}); @@ -995,6 +996,7 @@ const FlatRuns: React.FC = ({ projectId, searchId }) => { isMobile={isMobile} projectId={projectId} selectedRuns={selectedRuns} + workspaceId={workspaceId} onActionComplete={onActionComplete} /> diff --git a/webui/react/src/pages/ProjectDetails.tsx b/webui/react/src/pages/ProjectDetails.tsx index 3274b4f5d7f..de9e15815f1 100644 --- a/webui/react/src/pages/ProjectDetails.tsx +++ b/webui/react/src/pages/ProjectDetails.tsx @@ -94,7 +94,7 @@ const ProjectDetails: React.FC = () => { children: (
- +
), diff --git a/webui/react/src/pages/SearchDetails.tsx b/webui/react/src/pages/SearchDetails.tsx index 5388c4422d6..baaa4df907c 100644 --- a/webui/react/src/pages/SearchDetails.tsx +++ b/webui/react/src/pages/SearchDetails.tsx @@ -141,7 +141,11 @@ const SearchDetails: React.FC = () => { const tabItems: PivotProps['items'] = [ { children: experiment?.projectId && ( - + ), key: TabType.Runs, label: 'Runs', diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 39acbb16325..561101669bf 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -771,9 +771,11 @@ export const killRuns = generateDetApi( - Config.moveRuns, -); +export const moveRuns = generateDetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +>(Config.moveRuns); export const unarchiveRuns = generateDetApi< Api.V1UnarchiveRunsRequest, diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index b782ac8f284..fd92b846f39 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1170,9 +1170,13 @@ export const killRuns: DetApi detApi.Internal.killRuns(params, options), }; -export const moveRuns: DetApi = { +export const moveRuns: DetApi< + Api.V1MoveRunsRequest, + Api.V1MoveRunsResponse, + Type.BulkActionResult +> = { name: 'moveRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.moveRuns(params, options), }; From cf184af835313a02b9d969cf838c756fed4894b8 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 3 Jun 2024 17:13:24 -0700 Subject: [PATCH 134/161] feat: move warning modal --- .../FilterForm/components/FilterFormStore.ts | 21 ++ .../FlatRuns/FlatRunActionButton.test.tsx | 5 + .../pages/FlatRuns/FlatRunActionButton.tsx | 8 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 286 +++++++++++------- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 2 + 5 files changed, 206 insertions(+), 116 deletions(-) diff --git a/webui/react/src/components/FilterForm/components/FilterFormStore.ts b/webui/react/src/components/FilterForm/components/FilterFormStore.ts index b04658d53f0..e27c7c457b4 100644 --- a/webui/react/src/components/FilterForm/components/FilterFormStore.ts +++ b/webui/react/src/components/FilterForm/components/FilterFormStore.ts @@ -74,6 +74,27 @@ export class FilterFormStore { ); } + public get filterFormSetWithoutId(): Observable { + const replacer = (key: string, value: unknown): unknown => { + return key === 'id' ? undefined : value; + }; + return this.#formset.select((loadableFormset) => + Loadable.match(loadableFormset, { + _: () => ({ + filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, + showArchived: true, + }), + Loaded: (formset) => { + const sweepedForm = this.#sweepInvalid(structuredClone(formset.filterGroup)); + const newFormSet: FilterFormSetWithoutId = JSON.parse( + JSON.stringify({ ...formset, filterGroup: sweepedForm }, replacer), + ); + return newFormSet; + }, + }), + ); + } + public get fieldCount(): Observable { return this.getFieldCount(); } diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 25beefaa41e..b02bfaf216d 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { Conjunction, FormKind } from 'components/FilterForm/components/type'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; @@ -9,6 +10,10 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { render( >; projectId: number; workspaceId: number; + filterFormSetWithoutId: FilterFormSetWithoutId; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; onActionComplete?: () => Promise; } @@ -47,6 +49,7 @@ const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, + filterFormSetWithoutId, workspaceId, onActionSuccess, onActionComplete, @@ -69,7 +72,8 @@ const FlatRunActionButton = ({ }; switch (action) { case ExperimentAction.Move: - return flatRunMoveModalOpen(); + flatRunMoveModalOpen(); + break; case ExperimentAction.Archive: return await archiveRuns(params); case ExperimentAction.Kill: @@ -195,9 +199,11 @@ const FlatRunActionButton = ({ /> )} ); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 87d449e6bb8..1c6c5ebc3de 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -8,9 +8,16 @@ import { Label } from 'hew/Typography'; import { Loadable } from 'hew/utils/loadable'; import { List } from 'immutable'; import { useObservable } from 'micro-observables'; -import React, { useEffect, useId } from 'react'; +import React, { Ref, useCallback, useEffect, useId, useRef } from 'react'; +import { FilterFormSetWithoutId } from 'components/FilterForm/components/type'; import Link from 'components/Link'; +import RunFilterInterstitialModalComponent, { + ControlledModalRef, +} from 'components/RunFilterInterstitialModalComponent'; +import RunMoveWarningModalComponent, { + RunMoveWarningFlowRef, +} from 'components/RunMoveWarningModalComponent'; import usePermissions from 'hooks/usePermissions'; import { paths } from 'routes/utils'; import { moveRuns } from 'services/api'; @@ -29,17 +36,23 @@ type FormInputs = { interface Props { flatRuns: Readonly[]; - onSubmit?: (successfulIds?: number[]) => void; sourceProjectId: number; sourceWorkspaceId?: number; + filterFormSetWithoutId: FilterFormSetWithoutId; + onSubmit?: (successfulIds?: number[]) => void; + onActionComplete?: () => Promise; } const FlatRunMoveModalComponent: React.FC = ({ flatRuns, - onSubmit, + filterFormSetWithoutId, sourceProjectId, sourceWorkspaceId, + onSubmit, + onActionComplete, }: Props) => { + const controlledModalRef: Ref = useRef(null); + const runMoveWarningFlowRef: Ref = useRef(null); const idPrefix = useId(); const { openToast } = useToast(); const [form] = Form.useForm(); @@ -60,7 +73,7 @@ const FlatRunMoveModalComponent: React.FC = ({ } }, [workspaceId]); - const handleSubmit = async () => { + const handleSubmit = useCallback(async () => { if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { openToast({ title: 'No changes to save.' }); return; @@ -68,126 +81,169 @@ const FlatRunMoveModalComponent: React.FC = ({ const values = await form.validateFields(); const projId = values.projectId ?? 1; - const results = await moveRuns({ - destinationProjectId: projId, - runIds: flatRuns.map((flatRun) => flatRun.id), - sourceProjectId, - }); + try { + const closeReason = (await controlledModalRef.current?.open()) ?? 'failed'; + switch (closeReason) { + case 'has_search_runs': { + const closeWarningReason = await runMoveWarningFlowRef.current?.open(); + if (closeWarningReason === 'cancel') { + openToast({ title: 'Cancelled Move Action' }); + return; + } + break; + } + case 'no_search_runs': + break; + case 'manual': + case 'failed': + case 'close': + openToast({ title: 'Cancelled Move Action' }); + return; + } + + const results = await moveRuns({ + destinationProjectId: projId, + runIds: flatRuns.map((flatRun) => flatRun.id), + sourceProjectId, + }); - onSubmit?.(results.successful); + onSubmit?.(results.successful); - const numSuccesses = results.successful.length; - const numFailures = results.failed.length; + const numSuccesses = results.successful.length; + const numFailures = results.failed.length; - const destinationProjectName = - Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? - ''; + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? + ''; - if (numSuccesses === 0 && numFailures === 0) { - openToast({ - description: 'No selected runs were eligible for moving', - title: 'No eligible runs', - }); - } else if (numFailures === 0) { - openToast({ - closeable: true, - description: `${results.successful.length} runs moved to project ${destinationProjectName}`, - link: View Project, - title: 'Move Success', - }); - } else if (numSuccesses === 0) { - openToast({ - description: `Unable to move ${numFailures} runs`, - severity: 'Warning', - title: 'Move Failure', - }); - } else { - openToast({ - closeable: true, - description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, - link: View Project, - severity: 'Warning', - title: 'Partial Move Failure', - }); + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + form.resetFields(); + await onActionComplete?.(); + } catch (e) { + handleError(e, { publicSubject: 'Unable to move runs' }); } - form.resetFields(); - }; + }, [ + flatRuns, + form, + loadableProjects, + onActionComplete, + onSubmit, + openToast, + projectId, + sourceProjectId, + sourceWorkspaceId, + workspaceId, + ]); return ( - -
- - - - {workspaceId && workspaceId !== 1 && ( + <> + + - {Loadable.match(loadableProjects, { - Failed: () =>
Failed to load
, - Loaded: (loadableProjects) => ( - - ), - NotLoaded: () => , - })} + initialValue={sourceWorkspaceId ?? 1} + label="Workspace" + name="workspaceId" + rules={[{ message: 'Workspace is required', required: true }]}> +
- )} - -
+ {workspaceId && workspaceId !== 1 && ( + + {Loadable.match(loadableProjects, { + Failed: () =>
Failed to load
, + Loaded: (loadableProjects) => ( + + ), + NotLoaded: () => , + })} +
+ )} + +
+ + flatRun.id), type: 'ONLY_IN' }} + /> + ); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 2e6a4156e73..56014d4dea4 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -173,6 +173,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const sortString = useMemo(() => makeSortString(sorts.filter(validSort.is)), [sorts]); const loadableFormset = useObservable(formStore.formset); const filtersString = useObservable(formStore.asJsonString); + const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [total, setTotal] = useState>(NotLoaded); const isMobile = useMobile(); const [isLoading, setIsLoading] = useState(true); @@ -993,6 +994,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { onRowHeightChange={onRowHeightChange} /> Date: Wed, 5 Jun 2024 15:39:12 -0700 Subject: [PATCH 135/161] fix: feedback --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 1c6c5ebc3de..5acbd0f3b68 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -40,7 +40,7 @@ interface Props { sourceWorkspaceId?: number; filterFormSetWithoutId: FilterFormSetWithoutId; onSubmit?: (successfulIds?: number[]) => void; - onActionComplete?: () => Promise; + onActionComplete?: () => void; } const FlatRunMoveModalComponent: React.FC = ({ From e4b5037c75fa23c0a257938cb6b8b3a8dd1a2672 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 5 Jun 2024 15:42:35 -0700 Subject: [PATCH 136/161] fix: unarchive behavior --- master/internal/api_runs.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index e23f05afe0d..e1bab21de21 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -34,6 +34,7 @@ import ( type runCandidateResult struct { Archived bool + ExpArchived bool ID int32 ExpID *int32 IsMultitrial bool @@ -140,7 +141,7 @@ func getRunsColumns(q *bun.SelectQuery) *bun.SelectQuery { Column("r.external_run_id"). Column("r.project_id"). Column("r.searcher_metric_value"). - ColumnExpr("r.archived OR e.archived AS archived"). + ColumnExpr("r.archived AS archived"). ColumnExpr("extract(epoch FROM coalesce(r.end_time, now()) - r.start_time)::int AS duration"). ColumnExpr("CASE WHEN r.hparams='null' THEN NULL ELSE r.hparams END AS hyperparameters"). ColumnExpr("r.summary_metrics AS summary_metrics"). @@ -695,6 +696,7 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, Model(&runCandidates). Column("r.id"). Column("r.archived"). + ColumnExpr("e.archived AS exp_archived"). ColumnExpr("r.experiment_id as exp_id"). ColumnExpr("false as is_multitrial"). ColumnExpr("r.state IN (?) AS is_terminal", bun.In(model.StatesToStrings(model.TerminalStates))). @@ -730,6 +732,11 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, for _, cand := range runCandidates { visibleIDs.Insert(cand.ID) switch { + case cand.ExpArchived: + results = append(results, &apiv1.RunActionResult{ + Error: "Parent is archived.", + Id: cand.ID, + }) case cand.Archived && archive: results = append(results, &apiv1.RunActionResult{ Error: "", From 41d7ccc9e4527e22ec720466412089aaf0255ee8 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 5 Jun 2024 16:01:54 -0700 Subject: [PATCH 137/161] fix: minor fixes --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 5acbd0f3b68..b7715a5452b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -205,7 +205,6 @@ const FlatRunMoveModalComponent: React.FC = ({
{workspaceId && workspaceId !== 1 && ( From 8c484de380068e907c7e2669aa6e92eff4fbcf1d Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 6 Jun 2024 22:53:33 -0700 Subject: [PATCH 138/161] fix: archive/unarchive error text fix --- master/internal/api_runs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/master/internal/api_runs.go b/master/internal/api_runs.go index e1bab21de21..298dc9154aa 100644 --- a/master/internal/api_runs.go +++ b/master/internal/api_runs.go @@ -734,7 +734,7 @@ func archiveUnarchiveAction(ctx context.Context, archive bool, runIDs []int32, switch { case cand.ExpArchived: results = append(results, &apiv1.RunActionResult{ - Error: "Parent is archived.", + Error: "Run is part of archived Search.", Id: cand.ID, }) case cand.Archived && archive: From dcd70a51d8d989b7fb8a7d94198a41a1fb4892a5 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 01:03:31 -0700 Subject: [PATCH 139/161] test: `FlatRunMoveModal` --- .../FlatRuns/FlatRunActionButton.test.tsx | 51 +++++++--- .../pages/FlatRuns/FlatRunMoveModal.test.tsx | 98 +++++++++++++++++++ 2 files changed, 133 insertions(+), 16 deletions(-) create mode 100644 webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index b02bfaf216d..bf62f069710 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -1,4 +1,5 @@ import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; @@ -7,6 +8,8 @@ import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; const setup = (selectedFlatRuns: ReadonlyArray>) => { + const user = userEvent.setup(); + render( >) => { /> , ); + + return { + user, + }; }; describe('canActionFlatRun function', () => { describe('Flat Run Action Button Visibility', () => { + const flatRuns: ReadonlyArray> = [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + it('should not be appeard without selected flat runs', () => { setup([]); expect(screen.queryByText('Actions')).not.toBeInTheDocument(); }); it('should be appeard with selected flat runs', async () => { - const flatRuns: ReadonlyArray> = [ - { - archived: false, - checkpointCount: 0, - checkpointSize: 0, - id: 1, - parentArchived: false, - projectId: 1, - projectName: 'test', - startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), - state: RunState.Active, - workspaceId: 10, - workspaceName: 'test', - }, - ]; - setup(flatRuns); expect(await screen.findByText('Actions')).toBeInTheDocument(); }); + + it('should show action list', async () => { + const { user } = setup(flatRuns); + + const actionButton = await screen.findByText('Actions'); + await user.click(actionButton); + expect(await screen.findByText('Move')).toBeInTheDocument(); + expect(await screen.findByText('Archive')).toBeInTheDocument(); + expect(await screen.findByText('Unarchive')).toBeInTheDocument(); + expect(await screen.findByText('Delete')).toBeInTheDocument(); + expect(await screen.findByText('Kill')).toBeInTheDocument(); + }); }); }); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx new file mode 100644 index 00000000000..d9b48dee593 --- /dev/null +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx @@ -0,0 +1,98 @@ +import { render, screen } from '@testing-library/react'; +import userEvent, { UserEvent } from '@testing-library/user-event'; +import dayjs from 'dayjs'; +import Button from 'hew/Button'; +import { useModal } from 'hew/Modal'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { useMemo } from 'react'; + +import { + Conjunction, + FilterFormSetWithoutId, + FormKind, +} from 'components/FilterForm/components/type'; +import { V1MoveRunsRequest } from 'services/api-ts-sdk'; +import { FlatRun, RunState } from 'types'; + +import FlatRunMoveModalComponent from './FlatRunMoveModal'; + +const OPEN_MODAL_TEXT = 'Open Modal'; + +vi.mock('services/api', () => ({ + createGroup: vi.fn(), + getWorkspaceProjects: vi.fn(() => + Promise.resolve({ projects: [{ id: 1, name: 'project_1', workspaceId: 1 }] }), + ), + moveRuns: (params: V1MoveRunsRequest) => { + return Promise.resolve({ + failed: [], + successful: params.runIds, + }); + }, +})); + +const Container = (): JSX.Element => { + const BASE_FLAT_RUNS: FlatRun[] = useMemo(() => { + return [ + { + archived: false, + checkpointCount: 0, + checkpointSize: 0, + id: 1, + parentArchived: false, + projectId: 1, + projectName: 'test', + startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), + state: RunState.Active, + workspaceId: 10, + workspaceName: 'test', + }, + ]; + }, []); + + const filterFormSetWithoutId: FilterFormSetWithoutId = useMemo(() => { + return { + filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, + showArchived: false, + }; + }, []); + + const flatRunMoveModal = useModal(FlatRunMoveModalComponent); + + return ( +
+ + +
+ ); +}; + +const setup = (): { user: UserEvent } => { + const user = userEvent.setup(); + + render( + + + , + ); + + return { + user, + }; +}; + +describe('FlatRunMoveModalComponent', () => { + it('should open modal', async () => { + const { user } = setup(); + + await user.click(screen.getByRole('button', { name: OPEN_MODAL_TEXT })); + expect((await screen.findAllByText('Move Runs')).length).toBe(2); + expect(await screen.findByText('Workspace')).toBeInTheDocument(); + expect(await screen.findByRole('button', { name: 'Cancel' })).toBeInTheDocument(); + expect(await screen.findByRole('button', { name: 'Move Runs' })).toBeInTheDocument(); + }); +}); From b2108890ca95c1683baf74740c664bb8ea14da98 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 11:37:40 -0700 Subject: [PATCH 140/161] test: ignore `bindings.py` for codecov --- codecov.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/codecov.yml b/codecov.yml index d1fd2e00b0e..5d293f5f733 100644 --- a/codecov.yml +++ b/codecov.yml @@ -12,16 +12,16 @@ coverage: backend: target: 42% threshold: 3% - flags: + flags: - backend informational: false - patch: + patch: default: informational: true - backend: + backend: target: 80% threshold: 5% - flags: + flags: - backend informational: false only_pulls: true @@ -29,14 +29,17 @@ coverage: flags: backend: carryforward: true - + github_checks: annotations: false -comment: +comment: layout: "diff, flags, files" behavior: default parsers: go: partials_as_hits: true + +ignore: + - "harness/determined/common/api/bindings.py" From bfd65c0ce1dea4e206f6fad3d3492e7ed26cff11 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Fri, 7 Jun 2024 12:48:12 -0700 Subject: [PATCH 141/161] test: backend test --- master/internal/api_runs_intg_test.go | 75 ++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/master/internal/api_runs_intg_test.go b/master/internal/api_runs_intg_test.go index 958e93b6a3c..27e58db233c 100644 --- a/master/internal/api_runs_intg_test.go +++ b/master/internal/api_runs_intg_test.go @@ -1476,7 +1476,7 @@ func TestSearchRunsWithArbitraryMetadata(t *testing.T) { searchReq := &apiv1.SearchRunsRequest{ Filter: ptrs.Ptr( ` - {"filterGroup": { + {"filterGroup": { "children":[{ "columnName":"id", "kind":"field", @@ -1493,3 +1493,76 @@ func TestSearchRunsWithArbitraryMetadata(t *testing.T) { require.Equal(t, r.Id, searchResp.Runs[0].Id) require.Equal(t, rawMetadata, searchResp.Runs[0].Metadata.AsMap()) } + +func TestArchiveUnarchiveWithArchivedParent(t *testing.T) { + api, curUser, ctx := setupAPITest(t, nil) + _, projectID := createProjectAndWorkspace(ctx, t, api) + + activeConfig := schemas.WithDefaults(schemas.Merge(minExpConfig, expconf.ExperimentConfig{ + RawDescription: ptrs.Ptr("desc"), + RawName: expconf.Name{RawString: ptrs.Ptr("name")}, + })) + + exp := &model.Experiment{ + JobID: model.JobID(uuid.New().String()), + State: model.CompletedState, + OwnerID: &curUser.ID, + ProjectID: projectID, + StartTime: time.Now(), + Config: activeConfig.AsLegacy(), + } + require.NoError(t, api.m.db.AddExperiment(exp, []byte{10, 11, 12}, activeConfig)) + + task1 := &model.Task{TaskType: model.TaskTypeTrial, TaskID: model.NewTaskID()} + require.NoError(t, db.AddTask(ctx, task1)) + require.NoError(t, db.AddTrial(ctx, &model.Trial{ + State: model.CompletedState, + ExperimentID: exp.ID, + StartTime: time.Now(), + }, task1.TaskID)) + + task2 := &model.Task{TaskType: model.TaskTypeTrial, TaskID: model.NewTaskID()} + require.NoError(t, db.AddTask(ctx, task2)) + require.NoError(t, db.AddTrial(ctx, &model.Trial{ + State: model.CompletedState, + ExperimentID: exp.ID, + StartTime: time.Now(), + }, task2.TaskID)) + + sourceprojectID := int32(projectID) + req := &apiv1.SearchRunsRequest{ + ProjectId: &sourceprojectID, + Sort: ptrs.Ptr("id=asc"), + } + + resp, err := api.SearchRuns(ctx, req) + require.NoError(t, err) + require.Len(t, resp.Runs, 2) + + runID1, runID2 := resp.Runs[0].Id, resp.Runs[1].Id + + // Set the parent experiment as archived + _, err = api.ArchiveExperiment(ctx, &apiv1.ArchiveExperimentRequest{Id: int32(exp.ID)}) + require.NoError(t, err) + + runIDs := []int32{runID1, runID2} + unarchRes, err := api.ArchiveRuns(ctx, &apiv1.ArchiveRunsRequest{ + RunIds: runIDs, + ProjectId: sourceprojectID, + }) + + errMsg := "Run is part of archived Search." + require.NoError(t, err) + require.Len(t, unarchRes.Results, 2) + require.Equal(t, errMsg, unarchRes.Results[0].Error) + require.Equal(t, errMsg, unarchRes.Results[1].Error) + + _, err = api.UnarchiveRuns(ctx, &apiv1.UnarchiveRunsRequest{ + RunIds: runIDs, + ProjectId: sourceprojectID, + }) + require.NoError(t, err) + require.Len(t, unarchRes.Results, 2) + require.Equal(t, errMsg, unarchRes.Results[0].Error) + require.Equal(t, errMsg, unarchRes.Results[1].Error) +} From 8b95fc62b399c8b77eea374a2ba4309287ac08ff Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 10 Jun 2024 15:16:19 -0700 Subject: [PATCH 142/161] test: test --- webui/react/src/pages/SearchDetails.test.tsx | 41 ++++++++++ webui/react/src/services/decoder.test.ts | 78 ++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 webui/react/src/pages/SearchDetails.test.tsx diff --git a/webui/react/src/pages/SearchDetails.test.tsx b/webui/react/src/pages/SearchDetails.test.tsx new file mode 100644 index 00000000000..3332d414ce1 --- /dev/null +++ b/webui/react/src/pages/SearchDetails.test.tsx @@ -0,0 +1,41 @@ +import { render, screen } from '@testing-library/react'; +import userEvent, { UserEvent } from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { HelmetProvider } from 'react-helmet-async'; +import { BrowserRouter } from 'react-router-dom'; + +import { ThemeProvider } from 'components/ThemeProvider'; +import SearchDetails from 'pages/SearchDetails'; + +vi.mock('services/api', () => ({ + getExperimentDetails: vi.fn(), + patchExperiment: vi.fn(), +})); + +const setup = (): { user: UserEvent } => { + const user = userEvent.setup(); + + render( + + + + + + + + + , + ); + + return { user }; +}; + +describe('SearchDetails', () => { + it('should have tabs', () => { + setup(); + + expect(screen.getByText('Uncategorized Experiments')).toBeInTheDocument(); + expect(screen.getByText('Trials')).toBeInTheDocument(); + expect(screen.getByText('Notes')).toBeInTheDocument(); + }); +}); diff --git a/webui/react/src/services/decoder.test.ts b/webui/react/src/services/decoder.test.ts index 7d706e794d9..66a854d2332 100644 --- a/webui/react/src/services/decoder.test.ts +++ b/webui/react/src/services/decoder.test.ts @@ -1,6 +1,8 @@ import hparams from 'fixtures/hyperparameter-configs.json'; import experimentResps from 'fixtures/responses/experiment-details/set-a.json'; import * as ioTypes from 'ioTypes'; +import { V1ExperimentActionResult, V1RunActionResult } from 'services/api-ts-sdk'; +import * as decoder from 'services/decoder'; type FailReport = { error: Error; sample: T }; @@ -40,4 +42,80 @@ describe('Decoder', () => { ); expect(fails).toHaveLength(0); }); + + describe('mapV1ActionResults', () => { + it('should work with Sdk.V1ExperimentActionResult[] input', () => { + const result: V1ExperimentActionResult[] = [ + { error: '', id: 1 }, + { error: '', id: 2 }, + { error: 'error', id: 3 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [{ error: 'error', id: 3 }], + successful: [1, 2], + }); + }); + + it('should work with Sdk.V1RunActionResult[] input', () => { + const result: V1RunActionResult[] = [ + { error: '', id: 1 }, + { error: '', id: 2 }, + { error: 'error', id: 3 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [{ error: 'error', id: 3 }], + successful: [1, 2], + }); + }); + + it('should work with empty input', () => { + const expected = decoder.mapV1ActionResults([]); + expect(expected).toStrictEqual({ + failed: [], + successful: [], + }); + }); + + it('should work with all successful input', () => { + const result: V1RunActionResult[] = [ + { error: '', id: 1 }, + { error: '', id: 2 }, + { error: '', id: 3 }, + { error: '', id: 4 }, + { error: '', id: 5 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [], + successful: [1, 2, 3, 4, 5], + }); + }); + + it('should work with all failed input', () => { + const result: V1RunActionResult[] = [ + { error: 'oh no', id: 1 }, + { error: 'yare yare', id: 2 }, + { error: 'error', id: 3 }, + { error: 'a', id: 4 }, + { error: 'エラー', id: 5 }, + ]; + + const expected = decoder.mapV1ActionResults(result); + expect(expected).toStrictEqual({ + failed: [ + { error: 'oh no', id: 1 }, + { error: 'yare yare', id: 2 }, + { error: 'error', id: 3 }, + { error: 'a', id: 4 }, + { error: 'エラー', id: 5 }, + ], + successful: [], + }); + }); + }); }); From 5a81aec7f808558d6cdef949442139a8cc9833e8 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Mon, 10 Jun 2024 15:45:13 -0700 Subject: [PATCH 143/161] fix: minor fixes --- webui/react/src/hooks/usePermissions.ts | 22 ++++++++++++++++++++++ webui/react/src/services/api.ts | 16 ++++++++++------ webui/react/src/services/apiConfig.ts | 16 ++++++++++++---- webui/react/src/utils/flatRun.ts | 12 ++++-------- 4 files changed, 48 insertions(+), 18 deletions(-) diff --git a/webui/react/src/hooks/usePermissions.ts b/webui/react/src/hooks/usePermissions.ts index ae909e64756..4e8d2130c09 100644 --- a/webui/react/src/hooks/usePermissions.ts +++ b/webui/react/src/hooks/usePermissions.ts @@ -59,6 +59,7 @@ export interface PermissionsHook { canAdministrateUsers: boolean; canAssignRoles: (arg0: WorkspacePermissionsArgs) => boolean; canCreateExperiment: (arg0: WorkspacePermissionsArgs) => boolean; + canCreateFlatRun: (arg0: WorkspacePermissionsArgs) => boolean; canCreateModelVersion: (arg0: ModelPermissionsArgs) => boolean; canCreateModelWorkspace: (arg0: ModelWorkspacePermissionsArgs) => boolean; canCreateModels: boolean; @@ -79,6 +80,7 @@ export interface PermissionsHook { canEditWebhooks: boolean; canManageResourcePoolBindings: boolean; canModifyExperiment: (arg0: WorkspacePermissionsArgs) => boolean; + canModifyFlatRun: (arg0: WorkspacePermissionsArgs) => boolean; canModifyExperimentMetadata: (arg0: WorkspacePermissionsArgs) => boolean; canModifyGroups: boolean; canModifyModel: (arg0: ModelPermissionsArgs) => boolean; @@ -132,6 +134,8 @@ const usePermissions = (): PermissionsHook => { canAssignRoles: (args: WorkspacePermissionsArgs) => canAssignRoles(rbacOpts, args.workspace), canCreateExperiment: (args: WorkspacePermissionsArgs) => canCreateExperiment(rbacOpts, args.workspace), + canCreateFlatRun: (args: WorkspacePermissionsArgs) => + canCreateFlatRun(rbacOpts, args.workspace), canCreateModels: canCreateModels(rbacOpts), canCreateModelVersion: (args: ModelPermissionsArgs) => canCreateModelVersion(rbacOpts, args.model), @@ -164,6 +168,8 @@ const usePermissions = (): PermissionsHook => { canModifyExperiment(rbacOpts, args.workspace), canModifyExperimentMetadata: (args: WorkspacePermissionsArgs) => canModifyExperimentMetadata(rbacOpts, args.workspace), + canModifyFlatRun: (args: WorkspacePermissionsArgs) => + canModifyFlatRun(rbacOpts, args.workspace), canModifyGroups: canModifyGroups(rbacOpts), canModifyModel: (args: ModelPermissionsArgs) => canModifyModel(rbacOpts, args.model), canModifyModelVersion: (args: ModelVersionPermissionsArgs) => @@ -687,6 +693,22 @@ const canManageResourcePoolBindings = ({ // Flat Runs +// alias of canCreateExperiment +const canCreateFlatRun = ( + { rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + workspace?: PermissionWorkspace, +): boolean => { + return canCreateExperiment({ rbacEnabled, userAssignments, userRoles }, workspace); +}; + +// alias of canModifyExperiment +const canModifyFlatRun = ( + { rbacEnabled, userAssignments, userRoles }: RbacOptsProps, + workspace?: PermissionWorkspace, +): boolean => { + return canModifyExperiment({ rbacEnabled, userAssignments, userRoles }, workspace); +}; + const canDeleteFlatRun = ( { currentUser, rbacEnabled, userAssignments, userRoles }: RbacOptsProps, run: FlatRun, diff --git a/webui/react/src/services/api.ts b/webui/react/src/services/api.ts index 561101669bf..7c43779114d 100644 --- a/webui/react/src/services/api.ts +++ b/webui/react/src/services/api.ts @@ -763,13 +763,17 @@ export const archiveRuns = generateDetApi< Type.BulkActionResult >(Config.archiveRuns); -export const deleteRuns = generateDetApi( - Config.deleteRuns, -); +export const deleteRuns = generateDetApi< + Api.V1DeleteRunsRequest, + Api.V1DeleteRunsResponse, + Type.BulkActionResult +>(Config.deleteRuns); -export const killRuns = generateDetApi( - Config.killRuns, -); +export const killRuns = generateDetApi< + Api.V1KillRunsRequest, + Api.V1KillRunsResponse, + Type.BulkActionResult +>(Config.killRuns); export const moveRuns = generateDetApi< Api.V1MoveRunsRequest, diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index fd92b846f39..c683cd6373e 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1158,15 +1158,23 @@ export const archiveRuns: DetApi< request: (params, options) => detApi.Internal.archiveRuns(params, options), }; -export const deleteRuns: DetApi = { +export const deleteRuns: DetApi< + Api.V1DeleteRunsRequest, + Api.V1DeleteRunsResponse, + Type.BulkActionResult +> = { name: 'deleteRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.deleteRuns(params, options), }; -export const killRuns: DetApi = { +export const killRuns: DetApi< + Api.V1KillRunsRequest, + Api.V1KillRunsResponse, + Type.BulkActionResult +> = { name: 'killRuns', - postProcess: noOp, + postProcess: (response) => decoder.mapV1ActionResults(response.results), request: (params, options) => detApi.Internal.killRuns(params, options), }; diff --git a/webui/react/src/utils/flatRun.ts b/webui/react/src/utils/flatRun.ts index 8b52c9cb22c..3d33f3893c8 100644 --- a/webui/react/src/utils/flatRun.ts +++ b/webui/react/src/utils/flatRun.ts @@ -6,7 +6,7 @@ type FlatRunChecker = (flatRun: Readonly) => boolean; type FlatRunPermissionSet = Pick< PermissionsHook, - 'canCreateExperiment' | 'canDeleteFlatRun' | 'canModifyExperiment' | 'canMoveFlatRun' + 'canCreateFlatRun' | 'canDeleteFlatRun' | 'canModifyFlatRun' | 'canMoveFlatRun' >; const flatRunCheckers: Record = { @@ -28,7 +28,7 @@ export const canActionFlatRun = (action: FlatRunAction, flatRun: Readonly, targets: ReadonlyArray, permissions: Readonly, @@ -41,17 +41,13 @@ const getActionsForFlatRun = ( switch (action) { case FlatRunAction.Delete: return permissions.canDeleteFlatRun({ flatRun }); - case FlatRunAction.Move: return permissions.canMoveFlatRun({ flatRun }); - case FlatRunAction.Archive: case FlatRunAction.Unarchive: - return permissions.canModifyExperiment({ workspace }); - + return permissions.canModifyFlatRun({ workspace }); case FlatRunAction.Kill: - return permissions.canModifyExperiment({ workspace }) && !flatRun.experiment?.unmanaged; - + return permissions.canModifyFlatRun({ workspace }) && !flatRun.experiment?.unmanaged; default: return true; } From 99c83d737387c2a0e4923fa4d08b4c43d97b5b61 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Tue, 11 Jun 2024 15:26:47 -0700 Subject: [PATCH 144/161] fix: feedback --- .../FlatRuns/FlatRunActionButton.test.tsx | 5 ----- .../src/pages/FlatRuns/FlatRunActionButton.tsx | 6 +----- .../pages/FlatRuns/FlatRunMoveModal.test.tsx | 18 +----------------- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 7 +++---- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 4 +--- 5 files changed, 6 insertions(+), 34 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index bf62f069710..17ce427da29 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -3,7 +3,6 @@ import userEvent from '@testing-library/user-event'; import dayjs from 'dayjs'; import UIProvider, { DefaultTheme } from 'hew/Theme'; -import { Conjunction, FormKind } from 'components/FilterForm/components/type'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; @@ -13,10 +12,6 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { render( >; projectId: number; workspaceId: number; - filterFormSetWithoutId: FilterFormSetWithoutId; onActionSuccess?: (action: BatchAction, successfulIds: number[]) => void; - onActionComplete?: () => Promise; + onActionComplete?: () => void | Promise; } const FlatRunActionButton = ({ isMobile, selectedRuns, projectId, - filterFormSetWithoutId, workspaceId, onActionSuccess, onActionComplete, @@ -199,7 +196,6 @@ const FlatRunActionButton = ({ /> )} { ]; }, []); - const filterFormSetWithoutId: FilterFormSetWithoutId = useMemo(() => { - return { - filterGroup: { children: [], conjunction: Conjunction.Or, kind: FormKind.Group }, - showArchived: false, - }; - }, []); - const flatRunMoveModal = useModal(FlatRunMoveModalComponent); return (
- +
); }; diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index b7715a5452b..b25c4d7bde5 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -10,7 +10,6 @@ import { List } from 'immutable'; import { useObservable } from 'micro-observables'; import React, { Ref, useCallback, useEffect, useId, useRef } from 'react'; -import { FilterFormSetWithoutId } from 'components/FilterForm/components/type'; import Link from 'components/Link'; import RunFilterInterstitialModalComponent, { ControlledModalRef, @@ -19,6 +18,7 @@ import RunMoveWarningModalComponent, { RunMoveWarningFlowRef, } from 'components/RunMoveWarningModalComponent'; import usePermissions from 'hooks/usePermissions'; +import { formStore } from 'pages/FlatRuns/FlatRuns'; import { paths } from 'routes/utils'; import { moveRuns } from 'services/api'; import projectStore from 'stores/projects'; @@ -38,14 +38,12 @@ interface Props { flatRuns: Readonly[]; sourceProjectId: number; sourceWorkspaceId?: number; - filterFormSetWithoutId: FilterFormSetWithoutId; onSubmit?: (successfulIds?: number[]) => void; - onActionComplete?: () => void; + onActionComplete?: () => void | Promise; } const FlatRunMoveModalComponent: React.FC = ({ flatRuns, - filterFormSetWithoutId, sourceProjectId, sourceWorkspaceId, onSubmit, @@ -55,6 +53,7 @@ const FlatRunMoveModalComponent: React.FC = ({ const runMoveWarningFlowRef: Ref = useRef(null); const idPrefix = useId(); const { openToast } = useToast(); + const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [form] = Form.useForm(); const workspaceId = Form.useWatch('workspaceId', form); const projectId = Form.useWatch('projectId', form); diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 56014d4dea4..d304ef9ed9b 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -102,7 +102,7 @@ const BANNED_FILTER_COLUMNS = new Set(['searcherMetricsVal']); const NO_PINS_WIDTH = 200; -const formStore = new FilterFormStore(); +export const formStore = new FilterFormStore(); interface Props { projectId: number; @@ -173,7 +173,6 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const sortString = useMemo(() => makeSortString(sorts.filter(validSort.is)), [sorts]); const loadableFormset = useObservable(formStore.formset); const filtersString = useObservable(formStore.asJsonString); - const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [total, setTotal] = useState>(NotLoaded); const isMobile = useMobile(); const [isLoading, setIsLoading] = useState(true); @@ -994,7 +993,6 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { onRowHeightChange={onRowHeightChange} /> Date: Wed, 12 Jun 2024 12:38:31 -0700 Subject: [PATCH 145/161] fix: minor fixes --- webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx | 4 ++-- webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 17ce427da29..9853d07d07d 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -44,12 +44,12 @@ describe('canActionFlatRun function', () => { }, ]; - it('should not be appeard without selected flat runs', () => { + it('should not appear without selected flat runs', () => { setup([]); expect(screen.queryByText('Actions')).not.toBeInTheDocument(); }); - it('should be appeard with selected flat runs', async () => { + it('should appear with selected flat runs', async () => { setup(flatRuns); expect(await screen.findByText('Actions')).toBeInTheDocument(); }); diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index b881396eef1..0e1f9b42d9d 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -192,6 +192,7 @@ const FlatRunActionButton = ({ run.experiment?.unmanaged ?? false)} + itemName="run" onConfirm={() => submitBatchAction(batchAction)} /> )} From fa36e22441e8be434b83cbca5e7e3ab7154f37a9 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 12 Jun 2024 15:41:16 -0700 Subject: [PATCH 146/161] test: more test --- .../FlatRuns/FlatRunActionButton.test.tsx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 9853d07d07d..92abedfdee3 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -6,8 +6,19 @@ import UIProvider, { DefaultTheme } from 'hew/Theme'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; +vi.mock('services/api', () => ({ + getWorkspaceProjects: vi.fn(() => + Promise.resolve({ projects: [{ id: 1, name: 'project_1', workspaceId: 1 }] }), + ), + killRuns: vi.fn((params: { projectId: number; runIds: number[] }) => { + return Promise.resolve(params.runIds.map((id) => ({ error: '', id }))); + }), +})); + const setup = (selectedFlatRuns: ReadonlyArray>) => { const user = userEvent.setup(); + const onActionSuccess = vi.fn(); + const onActionComplete = vi.fn(); render( @@ -16,12 +27,14 @@ const setup = (selectedFlatRuns: ReadonlyArray>) => { projectId={1} selectedRuns={selectedFlatRuns} workspaceId={1} - onActionComplete={vi.fn()} + onActionComplete={onActionComplete} + onActionSuccess={onActionSuccess} /> , ); return { + handler: { onActionSuccess }, user, }; }; @@ -65,5 +78,13 @@ describe('canActionFlatRun function', () => { expect(await screen.findByText('Delete')).toBeInTheDocument(); expect(await screen.findByText('Kill')).toBeInTheDocument(); }); + + it('should kill runs', async () => { + const { user } = setup(flatRuns); + const actionButton = await screen.findByText('Actions'); + await user.click(actionButton); + await user.click(await screen.findByText('Kill')); + expect(await screen.findByText('Confirm Batch Kill')).toBeInTheDocument(); + }); }); }); From ef322d8f5b1847951c066a87a231ff019fae0293 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 13 Jun 2024 11:12:26 -0700 Subject: [PATCH 147/161] fix: minor fixes --- webui/react/src/pages/SearchDetails.test.tsx | 1 - webui/react/src/utils/tests/generateTestData.ts | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/webui/react/src/pages/SearchDetails.test.tsx b/webui/react/src/pages/SearchDetails.test.tsx index 3332d414ce1..7b9fc94bd63 100644 --- a/webui/react/src/pages/SearchDetails.test.tsx +++ b/webui/react/src/pages/SearchDetails.test.tsx @@ -35,7 +35,6 @@ describe('SearchDetails', () => { setup(); expect(screen.getByText('Uncategorized Experiments')).toBeInTheDocument(); - expect(screen.getByText('Trials')).toBeInTheDocument(); expect(screen.getByText('Notes')).toBeInTheDocument(); }); }); diff --git a/webui/react/src/utils/tests/generateTestData.ts b/webui/react/src/utils/tests/generateTestData.ts index 71ed811fd3c..1f2bd18a21e 100644 --- a/webui/react/src/utils/tests/generateTestData.ts +++ b/webui/react/src/utils/tests/generateTestData.ts @@ -267,6 +267,7 @@ export const generateTestExperimentData = (): { export const generateTestRunData = (): FlatRun => { return { + archived: false, checkpointCount: 0, checkpointSize: 0, hyperparameters: { 1: 1 }, From da72616ad2828b9d6744b79710a10a06f53ed99e Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Thu, 13 Jun 2024 17:06:49 -0700 Subject: [PATCH 148/161] test: more tests --- .../FlatRuns/FlatRunActionButton.test.tsx | 10 ++- .../pages/FlatRuns/FlatRunActionButton.tsx | 55 +++++++++++- .../pages/FlatRuns/FlatRunMoveModal.test.tsx | 44 +++++++--- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 83 +++++-------------- 4 files changed, 113 insertions(+), 79 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx index 92abedfdee3..f6f9bd4dced 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.test.tsx @@ -6,12 +6,14 @@ import UIProvider, { DefaultTheme } from 'hew/Theme'; import FlatRunActionButton from 'pages/FlatRuns/FlatRunActionButton'; import { FlatRun, RunState } from 'types'; -vi.mock('services/api', () => ({ +vi.mock('services/api', async (importOriginal) => ({ + __esModule: true, + ...(await importOriginal()), getWorkspaceProjects: vi.fn(() => Promise.resolve({ projects: [{ id: 1, name: 'project_1', workspaceId: 1 }] }), ), killRuns: vi.fn((params: { projectId: number; runIds: number[] }) => { - return Promise.resolve(params.runIds.map((id) => ({ error: '', id }))); + return Promise.resolve({ failed: [], successful: params.runIds }); }), })); @@ -80,11 +82,13 @@ describe('canActionFlatRun function', () => { }); it('should kill runs', async () => { - const { user } = setup(flatRuns); + const { user, handler } = setup(flatRuns); const actionButton = await screen.findByText('Actions'); await user.click(actionButton); await user.click(await screen.findByText('Kill')); expect(await screen.findByText('Confirm Batch Kill')).toBeInTheDocument(); + await user.click(await screen.findByRole('button', { name: 'Kill' })); + expect(handler.onActionSuccess).toBeCalled(); }); }); }); diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 0e1f9b42d9d..3751d11b5b8 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -3,13 +3,19 @@ import Dropdown, { MenuItem } from 'hew/Dropdown'; import Icon, { IconName } from 'hew/Icon'; import { useModal } from 'hew/Modal'; import { useToast } from 'hew/Toast'; +import { Loadable } from 'hew/utils/loadable'; +import { List } from 'immutable'; +import { useObservable } from 'micro-observables'; import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; +import Link from 'components/Link'; import usePermissions from 'hooks/usePermissions'; import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; +import { paths } from 'routes/utils'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; -import { BulkActionResult, ExperimentAction, FlatRun } from 'types'; +import projectStore from 'stores/projects'; +import { BulkActionResult, ExperimentAction, FlatRun, Project } from 'types'; import handleError from 'utils/error'; import { canActionFlatRun, getActionsForFlatRunsUnion } from 'utils/flatRun'; import { capitalizeWord } from 'utils/string'; @@ -57,6 +63,9 @@ const FlatRunActionButton = ({ const { Component: FlatRunMoveComponentModal, open: flatRunMoveModalOpen } = useModal(FlatRunMoveModalComponent); const BatchActionConfirmModal = useModal(BatchActionConfirmModalComponent); + const loadableProjects: Loadable> = useObservable( + projectStore.getProjectsByWorkspace(workspaceId), + ); const sendBatchActions = useCallback( async (action: BatchAction): Promise => { @@ -179,6 +188,48 @@ const FlatRunActionButton = ({ }, []); }, [availableBatchActions]); + const onSubmit = useCallback( + async (results: BulkActionResult, destinationProjectId: number) => { + const numSuccesses = results?.successful.length ?? 0; + const numFailures = results?.failed.length ?? 0; + + const destinationProjectName = + Loadable.getOrElse(List(), loadableProjects).find( + (p) => p.id === destinationProjectId, + )?.name ?? ''; + + if (numSuccesses === 0 && numFailures === 0) { + openToast({ + description: 'No selected runs were eligible for moving', + title: 'No eligible runs', + }); + } else if (numFailures === 0) { + openToast({ + closeable: true, + description: `${results.successful.length} runs moved to project ${destinationProjectName}`, + link: View Project, + title: 'Move Success', + }); + } else if (numSuccesses === 0) { + openToast({ + description: `Unable to move ${numFailures} runs`, + severity: 'Warning', + title: 'Move Failure', + }); + } else { + openToast({ + closeable: true, + description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, + link: View Project, + severity: 'Warning', + title: 'Partial Move Failure', + }); + } + await onActionComplete?.(); + }, + [loadableProjects, onActionComplete, openToast], + ); + return ( <> {selectedRuns.length > 0 && ( @@ -200,7 +251,7 @@ const FlatRunActionButton = ({ flatRuns={[...selectedRuns]} sourceProjectId={projectId} sourceWorkspaceId={workspaceId} - onActionComplete={onActionComplete} + onSubmit={onSubmit} /> ); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx index 16624474ba2..54a1d2f0a67 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx @@ -1,15 +1,14 @@ import { render, screen } from '@testing-library/react'; -import userEvent, { UserEvent } from '@testing-library/user-event'; +import userEvent from '@testing-library/user-event'; import dayjs from 'dayjs'; import Button from 'hew/Button'; import { useModal } from 'hew/Modal'; import UIProvider, { DefaultTheme } from 'hew/Theme'; import { useMemo } from 'react'; +import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; import { V1MoveRunsRequest } from 'services/api-ts-sdk'; -import { FlatRun, RunState } from 'types'; - -import FlatRunMoveModalComponent from './FlatRunMoveModal'; +import { BulkActionResult, FlatRun, RunState } from 'types'; const OPEN_MODAL_TEXT = 'Open Modal'; @@ -18,15 +17,21 @@ vi.mock('services/api', () => ({ getWorkspaceProjects: vi.fn(() => Promise.resolve({ projects: [{ id: 1, name: 'project_1', workspaceId: 1 }] }), ), - moveRuns: (params: V1MoveRunsRequest) => { + getWorkspaces: vi.fn(() => Promise.resolve({ workspaces: [] })), + moveRuns: vi.fn((params: V1MoveRunsRequest) => { return Promise.resolve({ failed: [], successful: params.runIds, }); - }, + }), + searchRuns: vi.fn(() => Promise.resolve({ pagination: { total: 0 } })), })); -const Container = (): JSX.Element => { +const Container = ({ + onSubmit, +}: { + onSubmit?: (results: BulkActionResult, destinationProjectId: number) => void; +}): JSX.Element => { const BASE_FLAT_RUNS: FlatRun[] = useMemo(() => { return [ { @@ -39,7 +44,7 @@ const Container = (): JSX.Element => { projectName: 'test', startTime: dayjs('2024-05-24T23:03:45.415603Z').toDate(), state: RunState.Active, - workspaceId: 10, + workspaceId: 1, workspaceName: 'test', }, ]; @@ -50,21 +55,27 @@ const Container = (): JSX.Element => { return (
- +
); }; -const setup = (): { user: UserEvent } => { +const setup = () => { + const onSubmit = vi.fn(); const user = userEvent.setup(); render( - + , ); return { + handlers: { onSubmit }, user, }; }; @@ -79,4 +90,15 @@ describe('FlatRunMoveModalComponent', () => { expect(await screen.findByRole('button', { name: 'Cancel' })).toBeInTheDocument(); expect(await screen.findByRole('button', { name: 'Move Runs' })).toBeInTheDocument(); }); + + it('should submit modal', async () => { + const { user, handlers } = setup(); + + await user.click(screen.getByRole('button', { name: OPEN_MODAL_TEXT })); + expect((await screen.findAllByText('Move Runs')).length).toBe(2); + expect(await screen.findByText('Workspace')).toBeInTheDocument(); + expect(await screen.findByRole('button', { name: 'Move Runs' })).not.toBeDisabled(); + await user.click(await screen.findByRole('button', { name: 'Move Runs' })); + expect(handlers.onSubmit).toBeCalled(); + }); }); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index b25c4d7bde5..58d031b2bfd 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -10,7 +10,6 @@ import { List } from 'immutable'; import { useObservable } from 'micro-observables'; import React, { Ref, useCallback, useEffect, useId, useRef } from 'react'; -import Link from 'components/Link'; import RunFilterInterstitialModalComponent, { ControlledModalRef, } from 'components/RunFilterInterstitialModalComponent'; @@ -19,27 +18,25 @@ import RunMoveWarningModalComponent, { } from 'components/RunMoveWarningModalComponent'; import usePermissions from 'hooks/usePermissions'; import { formStore } from 'pages/FlatRuns/FlatRuns'; -import { paths } from 'routes/utils'; import { moveRuns } from 'services/api'; import projectStore from 'stores/projects'; import workspaceStore from 'stores/workspaces'; -import { FlatRun, Project } from 'types'; +import { BulkActionResult, FlatRun, Project } from 'types'; import handleError from 'utils/error'; import { pluralizer } from 'utils/string'; const FORM_ID = 'move-flat-run-form'; type FormInputs = { - projectId?: number; - workspaceId?: number; + destinationProjectId?: number; + destinationWorkspaceId?: number; }; interface Props { flatRuns: Readonly[]; sourceProjectId: number; sourceWorkspaceId?: number; - onSubmit?: (successfulIds?: number[]) => void; - onActionComplete?: () => void | Promise; + onSubmit?: (results: BulkActionResult, destinationProjectId: number) => void | Promise; } const FlatRunMoveModalComponent: React.FC = ({ @@ -47,7 +44,6 @@ const FlatRunMoveModalComponent: React.FC = ({ sourceProjectId, sourceWorkspaceId, onSubmit, - onActionComplete, }: Props) => { const controlledModalRef: Ref = useRef(null); const runMoveWarningFlowRef: Ref = useRef(null); @@ -55,30 +51,31 @@ const FlatRunMoveModalComponent: React.FC = ({ const { openToast } = useToast(); const filterFormSetWithoutId = useObservable(formStore.filterFormSetWithoutId); const [form] = Form.useForm(); - const workspaceId = Form.useWatch('workspaceId', form); - const projectId = Form.useWatch('projectId', form); + const destinationWorkspaceId = Form.useWatch('destinationWorkspaceId', form); + const destinationProjectId = Form.useWatch('destinationProjectId', form); const { canMoveExperimentsTo } = usePermissions(); const workspaces = Loadable.getOrElse([], useObservable(workspaceStore.unarchived)).filter((w) => canMoveExperimentsTo({ destination: { id: w.id } }), ); const loadableProjects: Loadable> = useObservable( - projectStore.getProjectsByWorkspace(workspaceId), + projectStore.getProjectsByWorkspace(destinationWorkspaceId), ); useEffect(() => { - if (workspaceId !== undefined) { - projectStore.fetch(workspaceId, undefined, true); + if (destinationWorkspaceId !== undefined) { + projectStore.fetch(destinationWorkspaceId, undefined, true); } - }, [workspaceId]); + }, [destinationWorkspaceId]); const handleSubmit = useCallback(async () => { - if (workspaceId === sourceWorkspaceId && projectId === sourceProjectId) { + const values = await form.validateFields(); + const projId = values.destinationProjectId ?? 1; + + if (destinationWorkspaceId === sourceWorkspaceId && projId === sourceProjectId) { openToast({ title: 'No changes to save.' }); return; } - const values = await form.validateFields(); - const projId = values.projectId ?? 1; try { const closeReason = (await controlledModalRef.current?.open()) ?? 'failed'; @@ -105,59 +102,19 @@ const FlatRunMoveModalComponent: React.FC = ({ runIds: flatRuns.map((flatRun) => flatRun.id), sourceProjectId, }); - - onSubmit?.(results.successful); - - const numSuccesses = results.successful.length; - const numFailures = results.failed.length; - - const destinationProjectName = - Loadable.getOrElse(List(), loadableProjects).find((p) => p.id === projId)?.name ?? - ''; - - if (numSuccesses === 0 && numFailures === 0) { - openToast({ - description: 'No selected runs were eligible for moving', - title: 'No eligible runs', - }); - } else if (numFailures === 0) { - openToast({ - closeable: true, - description: `${results.successful.length} runs moved to project ${destinationProjectName}`, - link: View Project, - title: 'Move Success', - }); - } else if (numSuccesses === 0) { - openToast({ - description: `Unable to move ${numFailures} runs`, - severity: 'Warning', - title: 'Move Failure', - }); - } else { - openToast({ - closeable: true, - description: `${numFailures} out of ${numFailures + numSuccesses} eligible runs failed to move to project ${destinationProjectName}`, - link: View Project, - severity: 'Warning', - title: 'Partial Move Failure', - }); - } + await onSubmit?.(results, projId); form.resetFields(); - await onActionComplete?.(); } catch (e) { handleError(e, { publicSubject: 'Unable to move runs' }); } }, [ flatRuns, form, - loadableProjects, - onActionComplete, onSubmit, openToast, - projectId, sourceProjectId, sourceWorkspaceId, - workspaceId, + destinationWorkspaceId, ]); return ( @@ -166,7 +123,7 @@ const FlatRunMoveModalComponent: React.FC = ({ cancel size="small" submit={{ - disabled: workspaceId !== 1 && !projectId, + disabled: destinationWorkspaceId !== 1 && !destinationProjectId, form: idPrefix + FORM_ID, handleError, handler: handleSubmit, @@ -177,7 +134,7 @@ const FlatRunMoveModalComponent: React.FC = ({ - {workspaceId && workspaceId !== 1 && ( + {destinationWorkspaceId !== undefined && destinationWorkspaceId !== 1 && ( {Loadable.match(loadableProjects, { Failed: () =>
Failed to load
, From 0eb768bcbcafce57d91298b768064e4e2c163098 Mon Sep 17 00:00:00 2001 From: John Kim Date: Fri, 14 Jun 2024 16:32:27 -0400 Subject: [PATCH 149/161] fix typos --- webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx | 4 ++-- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index b25c4d7bde5..b858ddbd1de 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -170,9 +170,9 @@ const FlatRunMoveModalComponent: React.FC = ({ form: idPrefix + FORM_ID, handleError, handler: handleSubmit, - text: `Move ${pluralizer(flatRuns.length, 'Runs')}`, + text: `Move ${pluralizer(flatRuns.length, 'Run')}`, }} - title={`Move ${pluralizer(flatRuns.length, 'Runs')}`}> + title={`Move ${pluralizer(flatRuns.length, 'Run')}`}>
= ({ projectId, workspaceId, searchId }) => { default: break; } - openToast({ severity: 'Confirm', title: `Run ${action.toLowerCase()}d successfully` }); + openToast({ + severity: 'Confirm', + title: `Run ${action.split('')[action.length - 1] === 'e' ? action.toLowerCase() : `${action.toLowerCase()}e`}d successfully`, + }); }, [openToast], ); From 172f40b798f7615c8759f64651f1555d59878ced Mon Sep 17 00:00:00 2001 From: John Kim Date: Mon, 17 Jun 2024 11:18:58 -0400 Subject: [PATCH 150/161] merge fix and fmt --- .../pages/FlatRuns/FlatRunActionButton.tsx | 10 +- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 112 +++++++++++------- 2 files changed, 73 insertions(+), 49 deletions(-) diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index 0366bfc98df..3751d11b5b8 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -114,8 +114,9 @@ const FlatRunActionButton = ({ } else if (numFailures === 0) { openToast({ closeable: true, - description: `${action} succeeded for ${results.successful.length - } ${LABEL_PLURAL.toLowerCase()}`, + description: `${action} succeeded for ${ + results.successful.length + } ${LABEL_PLURAL.toLowerCase()}`, title: `${action} Success`, }); } else if (numSuccesses === 0) { @@ -127,8 +128,9 @@ const FlatRunActionButton = ({ } else { openToast({ closeable: true, - description: `${action} succeeded for ${numSuccesses} out of ${numFailures + numSuccesses - } eligible + description: `${action} succeeded for ${numSuccesses} out of ${ + numFailures + numSuccesses + } eligible ${LABEL_PLURAL.toLowerCase()}`, severity: 'Warning', title: `Partial ${action} Failure`, diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index 07f405416dd..c315f688629 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -353,8 +353,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, { max: heatmap.max, @@ -366,8 +366,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -378,8 +378,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); break; @@ -390,8 +390,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -404,9 +404,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { settings.columnWidths[currentColumn.column], heatmap && settings.heatmapOn && !settings.heatmapSkipped.includes(currentColumn.column) ? { - max: heatmap.max, - min: heatmap.min, - } + max: heatmap.max, + min: heatmap.min, + } : undefined, ); } @@ -813,12 +813,12 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const items: MenuItem[] = [ settings.selection.type === 'ALL_EXCEPT' || settings.selection.selections.length > 0 ? { - key: 'select-none', - label: 'Clear selected', - onClick: () => { - handleSelectionChange?.('remove-all'); - }, - } + key: 'select-none', + label: 'Clear selected', + onClick: () => { + handleSelectionChange?.('remove-all'); + }, + } : null, ...[5, 10, 25].map((n) => ({ key: `select-${n}`, @@ -847,32 +847,32 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { ? null : !isPinned ? { - icon: , - key: 'pin', - label: 'Pin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), - ); - }, - } + icon: , + key: 'pin', + label: 'Pin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), + ); + }, + } : { - disabled: settings.pinnedColumnsCount <= 1, - icon: , - key: 'unpin', - label: 'Unpin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.max(settings.pinnedColumnsCount - 1, 0), - ); + disabled: settings.pinnedColumnsCount <= 1, + icon: , + key: 'unpin', + label: 'Unpin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.max(settings.pinnedColumnsCount - 1, 0), + ); + }, }, - }, { icon: , key: 'hide', @@ -929,9 +929,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { sortCount === 0 ? [] : [ - { type: 'divider' as const }, - ...sortMenuItemsForColumn(column, sorts, handleSortChange), - ]; + { type: 'divider' as const }, + ...sortMenuItemsForColumn(column, sorts, handleSortChange), + ]; items.push( ...sortMenuItems, @@ -1100,7 +1100,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { projectId={projectId} selectedRuns={loadedSelectedRuns} onWidthChange={handleCompareWidthChange}> - columns={columns} data={runs} getHeaderMenuItems={getHeaderMenuItems} @@ -1110,6 +1110,28 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { page={page} pageSize={PAGE_SIZE} pinnedColumnsCount={isLoadingSettings ? 0 : settings.pinnedColumnsCount} + renderContextMenuComponent={({ + cell, + rowData, + link, + open, + onComplete, + onClose, + onVisibleChange, + }) => { + return ( + + ); + }} rowHeight={rowHeightMap[globalSettings.rowHeight as RowHeight]} selection={selection} sorts={sorts} From 41343fc4b4f4c61b3eb27866b51e96b4408fed5d Mon Sep 17 00:00:00 2001 From: John Kim Date: Mon, 17 Jun 2024 12:42:16 -0400 Subject: [PATCH 151/161] merge fixes --- harness/determined/common/api/bindings.py | 334 +++++++++++ proto/pkg/runv1/run.pb.go | 78 +-- .../src/components/RunActionDropdown.tsx | 2 +- .../pages/FlatRuns/FlatRunMoveModal.test.tsx | 10 +- .../src/pages/FlatRuns/FlatRunMoveModal.tsx | 4 +- webui/react/src/services/api-ts-sdk/api.ts | 532 ++++++++++++++++++ 6 files changed, 920 insertions(+), 40 deletions(-) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index dcc085d560f..5e29e637b15 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -727,6 +727,7 @@ class trialv1Trial(Printable): endTime: "typing.Optional[str]" = None latestValidation: "typing.Optional[v1MetricsWorkload]" = None logRetentionDays: "typing.Optional[int]" = None + metadata: "typing.Optional[typing.Dict[str, typing.Any]]" = None runnerState: "typing.Optional[str]" = None searcherMetricValue: "typing.Optional[float]" = None summaryMetrics: "typing.Optional[typing.Dict[str, typing.Any]]" = None @@ -752,6 +753,7 @@ def __init__( endTime: "typing.Union[str, None, Unset]" = _unset, latestValidation: "typing.Union[v1MetricsWorkload, None, Unset]" = _unset, logRetentionDays: "typing.Union[int, None, Unset]" = _unset, + metadata: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, runnerState: "typing.Union[str, None, Unset]" = _unset, searcherMetricValue: "typing.Union[float, None, Unset]" = _unset, summaryMetrics: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, @@ -780,6 +782,8 @@ def __init__( self.latestValidation = latestValidation if not isinstance(logRetentionDays, Unset): self.logRetentionDays = logRetentionDays + if not isinstance(metadata, Unset): + self.metadata = metadata if not isinstance(runnerState, Unset): self.runnerState = runnerState if not isinstance(searcherMetricValue, Unset): @@ -820,6 +824,8 @@ def from_json(cls, obj: Json) -> "trialv1Trial": kwargs["latestValidation"] = v1MetricsWorkload.from_json(obj["latestValidation"]) if obj["latestValidation"] is not None else None if "logRetentionDays" in obj: kwargs["logRetentionDays"] = obj["logRetentionDays"] + if "metadata" in obj: + kwargs["metadata"] = obj["metadata"] if "runnerState" in obj: kwargs["runnerState"] = obj["runnerState"] if "searcherMetricValue" in obj: @@ -860,6 +866,8 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out["latestValidation"] = None if self.latestValidation is None else self.latestValidation.to_json(omit_unset) if not omit_unset or "logRetentionDays" in vars(self): out["logRetentionDays"] = self.logRetentionDays + if not omit_unset or "metadata" in vars(self): + out["metadata"] = self.metadata if not omit_unset or "runnerState" in vars(self): out["runnerState"] = self.runnerState if not omit_unset or "searcherMetricValue" in vars(self): @@ -2321,6 +2329,49 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out["requestId"] = self.requestId return out +class v1ClusterMessage(Printable): + """Active notice from the server admin.""" + createdTime: "typing.Optional[str]" = None + endTime: "typing.Optional[str]" = None + + def __init__( + self, + *, + message: str, + startTime: str, + createdTime: "typing.Union[str, None, Unset]" = _unset, + endTime: "typing.Union[str, None, Unset]" = _unset, + ): + self.message = message + self.startTime = startTime + if not isinstance(createdTime, Unset): + self.createdTime = createdTime + if not isinstance(endTime, Unset): + self.endTime = endTime + + @classmethod + def from_json(cls, obj: Json) -> "v1ClusterMessage": + kwargs: "typing.Dict[str, typing.Any]" = { + "message": obj["message"], + "startTime": obj["startTime"], + } + if "createdTime" in obj: + kwargs["createdTime"] = obj["createdTime"] + if "endTime" in obj: + kwargs["endTime"] = obj["endTime"] + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + "message": self.message, + "startTime": self.startTime, + } + if not omit_unset or "createdTime" in vars(self): + out["createdTime"] = self.createdTime + if not omit_unset or "endTime" in vars(self): + out["endTime"] = self.endTime + return out + class v1ColumnType(DetEnum): """ColumnType indicates the type of data under the column - COLUMN_TYPE_UNSPECIFIED: data type is unknown/mixed @@ -4268,6 +4319,7 @@ class v1FlatRun(Printable): externalRunId: "typing.Optional[int]" = None hyperparameters: "typing.Optional[typing.Dict[str, typing.Any]]" = None labels: "typing.Optional[typing.Sequence[str]]" = None + metadata: "typing.Optional[typing.Dict[str, typing.Any]]" = None searcherMetricValue: "typing.Optional[float]" = None summaryMetrics: "typing.Optional[typing.Dict[str, typing.Any]]" = None userId: "typing.Optional[int]" = None @@ -4292,6 +4344,7 @@ def __init__( externalRunId: "typing.Union[int, None, Unset]" = _unset, hyperparameters: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, labels: "typing.Union[typing.Sequence[str], None, Unset]" = _unset, + metadata: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, searcherMetricValue: "typing.Union[float, None, Unset]" = _unset, summaryMetrics: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, userId: "typing.Union[int, None, Unset]" = _unset, @@ -4319,6 +4372,8 @@ def __init__( self.hyperparameters = hyperparameters if not isinstance(labels, Unset): self.labels = labels + if not isinstance(metadata, Unset): + self.metadata = metadata if not isinstance(searcherMetricValue, Unset): self.searcherMetricValue = searcherMetricValue if not isinstance(summaryMetrics, Unset): @@ -4353,6 +4408,8 @@ def from_json(cls, obj: Json) -> "v1FlatRun": kwargs["hyperparameters"] = obj["hyperparameters"] if "labels" in obj: kwargs["labels"] = obj["labels"] + if "metadata" in obj: + kwargs["metadata"] = obj["metadata"] if "searcherMetricValue" in obj: kwargs["searcherMetricValue"] = float(obj["searcherMetricValue"]) if obj["searcherMetricValue"] is not None else None if "summaryMetrics" in obj: @@ -4387,6 +4444,8 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out["hyperparameters"] = self.hyperparameters if not omit_unset or "labels" in vars(self): out["labels"] = self.labels + if not omit_unset or "metadata" in vars(self): + out["metadata"] = self.metadata if not omit_unset or "searcherMetricValue" in vars(self): out["searcherMetricValue"] = None if self.searcherMetricValue is None else dump_float(self.searcherMetricValue) if not omit_unset or "summaryMetrics" in vars(self): @@ -4668,6 +4727,35 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: } return out +class v1GetClusterMessageResponse(Printable): + """GetClusterMessageResponse is the response that contains the current cluster + message. + """ + clusterMessage: "typing.Optional[v1ClusterMessage]" = None + + def __init__( + self, + *, + clusterMessage: "typing.Union[v1ClusterMessage, None, Unset]" = _unset, + ): + if not isinstance(clusterMessage, Unset): + self.clusterMessage = clusterMessage + + @classmethod + def from_json(cls, obj: Json) -> "v1GetClusterMessageResponse": + kwargs: "typing.Dict[str, typing.Any]" = { + } + if "clusterMessage" in obj: + kwargs["clusterMessage"] = v1ClusterMessage.from_json(obj["clusterMessage"]) if obj["clusterMessage"] is not None else None + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + } + if not omit_unset or "clusterMessage" in vars(self): + out["clusterMessage"] = None if self.clusterMessage is None else self.clusterMessage.to_json(omit_unset) + return out + class v1GetCommandResponse(Printable): """Response to GetCommandRequest.""" @@ -5283,6 +5371,7 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: class v1GetMasterResponse(Printable): """Response to GetMasterRequest.""" branding: "typing.Optional[str]" = None + clusterMessage: "typing.Optional[v1ClusterMessage]" = None externalLoginUri: "typing.Optional[str]" = None externalLogoutUri: "typing.Optional[str]" = None featureSwitches: "typing.Optional[typing.Sequence[str]]" = None @@ -5301,6 +5390,7 @@ def __init__( strictJobQueueControl: bool, version: str, branding: "typing.Union[str, None, Unset]" = _unset, + clusterMessage: "typing.Union[v1ClusterMessage, None, Unset]" = _unset, externalLoginUri: "typing.Union[str, None, Unset]" = _unset, externalLogoutUri: "typing.Union[str, None, Unset]" = _unset, featureSwitches: "typing.Union[typing.Sequence[str], None, Unset]" = _unset, @@ -5317,6 +5407,8 @@ def __init__( self.version = version if not isinstance(branding, Unset): self.branding = branding + if not isinstance(clusterMessage, Unset): + self.clusterMessage = clusterMessage if not isinstance(externalLoginUri, Unset): self.externalLoginUri = externalLoginUri if not isinstance(externalLogoutUri, Unset): @@ -5345,6 +5437,8 @@ def from_json(cls, obj: Json) -> "v1GetMasterResponse": } if "branding" in obj: kwargs["branding"] = obj["branding"] + if "clusterMessage" in obj: + kwargs["clusterMessage"] = v1ClusterMessage.from_json(obj["clusterMessage"]) if obj["clusterMessage"] is not None else None if "externalLoginUri" in obj: kwargs["externalLoginUri"] = obj["externalLoginUri"] if "externalLogoutUri" in obj: @@ -5373,6 +5467,8 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: } if not omit_unset or "branding" in vars(self): out["branding"] = self.branding + if not omit_unset or "clusterMessage" in vars(self): + out["clusterMessage"] = None if self.clusterMessage is None else self.clusterMessage.to_json(omit_unset) if not omit_unset or "externalLoginUri" in vars(self): out["externalLoginUri"] = self.externalLoginUri if not omit_unset or "externalLogoutUri" in vars(self): @@ -6059,6 +6155,33 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out["roles"] = None if self.roles is None else [x.to_json(omit_unset) for x in self.roles] return out +class v1GetRunMetadataResponse(Printable): + """Response to get the metadata of a run.""" + metadata: "typing.Optional[typing.Dict[str, typing.Any]]" = None + + def __init__( + self, + *, + metadata: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, + ): + if not isinstance(metadata, Unset): + self.metadata = metadata + + @classmethod + def from_json(cls, obj: Json) -> "v1GetRunMetadataResponse": + kwargs: "typing.Dict[str, typing.Any]" = { + } + if "metadata" in obj: + kwargs["metadata"] = obj["metadata"] + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + } + if not omit_unset or "metadata" in vars(self): + out["metadata"] = self.metadata + return out + class v1GetSearcherEventsResponse(Printable): """Response to GetSearcherEventsRequest.""" searcherEvents: "typing.Optional[typing.Sequence[v1SearcherEvent]]" = None @@ -10936,6 +11059,64 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: } return out +class v1PostRunMetadataRequest(Printable): + """Request to post metadata for a run.""" + runId: "typing.Optional[int]" = None + + def __init__( + self, + *, + metadata: "typing.Dict[str, typing.Any]", + runId: "typing.Union[int, None, Unset]" = _unset, + ): + self.metadata = metadata + if not isinstance(runId, Unset): + self.runId = runId + + @classmethod + def from_json(cls, obj: Json) -> "v1PostRunMetadataRequest": + kwargs: "typing.Dict[str, typing.Any]" = { + "metadata": obj["metadata"], + } + if "runId" in obj: + kwargs["runId"] = obj["runId"] + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + "metadata": self.metadata, + } + if not omit_unset or "runId" in vars(self): + out["runId"] = self.runId + return out + +class v1PostRunMetadataResponse(Printable): + """Response to post metadata for a run.""" + metadata: "typing.Optional[typing.Dict[str, typing.Any]]" = None + + def __init__( + self, + *, + metadata: "typing.Union[typing.Dict[str, typing.Any], None, Unset]" = _unset, + ): + if not isinstance(metadata, Unset): + self.metadata = metadata + + @classmethod + def from_json(cls, obj: Json) -> "v1PostRunMetadataResponse": + kwargs: "typing.Dict[str, typing.Any]" = { + } + if "metadata" in obj: + kwargs["metadata"] = obj["metadata"] + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + } + if not omit_unset or "metadata" in vars(self): + out["metadata"] = self.metadata + return out + class v1PostSearcherOperationsRequest(Printable): """Request for sending operations from a custom search method.""" experimentId: "typing.Optional[int]" = None @@ -13741,6 +13922,49 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out["trialOperation"] = None if self.trialOperation is None else self.trialOperation.to_json(omit_unset) return out +class v1SetClusterMessageRequest(Printable): + """Set the cluster-wide message.""" + duration: "typing.Optional[str]" = None + endTime: "typing.Optional[str]" = None + + def __init__( + self, + *, + message: str, + startTime: str, + duration: "typing.Union[str, None, Unset]" = _unset, + endTime: "typing.Union[str, None, Unset]" = _unset, + ): + self.message = message + self.startTime = startTime + if not isinstance(duration, Unset): + self.duration = duration + if not isinstance(endTime, Unset): + self.endTime = endTime + + @classmethod + def from_json(cls, obj: Json) -> "v1SetClusterMessageRequest": + kwargs: "typing.Dict[str, typing.Any]" = { + "message": obj["message"], + "startTime": obj["startTime"], + } + if "duration" in obj: + kwargs["duration"] = obj["duration"] + if "endTime" in obj: + kwargs["endTime"] = obj["endTime"] + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + "message": self.message, + "startTime": self.startTime, + } + if not omit_unset or "duration" in vars(self): + out["duration"] = self.duration + if not omit_unset or "endTime" in vars(self): + out["endTime"] = self.endTime + return out + class v1SetCommandPriorityRequest(Printable): """Set the priority of the requested command.""" commandId: "typing.Optional[str]" = None @@ -17320,6 +17544,25 @@ def delete_DeleteCheckpoints( return raise APIHttpError("delete_DeleteCheckpoints", _resp) +def delete_DeleteClusterMessage( + session: "api.BaseSession", +) -> None: + """Clear the cluster-wide message shown to all users.""" + _params = None + _resp = session._do_request( + method="DELETE", + path="/api/v1/master/cluster_message", + params=_params, + json=None, + data=None, + headers=None, + timeout=None, + stream=False, + ) + if _resp.status_code == 200: + return + raise APIHttpError("delete_DeleteClusterMessage", _resp) + def delete_DeleteExperiment( session: "api.BaseSession", *, @@ -17946,6 +18189,25 @@ def get_GetCheckpoint( return v1GetCheckpointResponse.from_json(_resp.json()) raise APIHttpError("get_GetCheckpoint", _resp) +def get_GetClusterMessage( + session: "api.BaseSession", +) -> "v1GetClusterMessageResponse": + """Get the currently configured cluster-wide message.""" + _params = None + _resp = session._do_request( + method="GET", + path="/api/v1/master/cluster_message", + params=_params, + json=None, + data=None, + headers=None, + timeout=None, + stream=False, + ) + if _resp.status_code == 200: + return v1GetClusterMessageResponse.from_json(_resp.json()) + raise APIHttpError("get_GetClusterMessage", _resp) + def get_GetCommand( session: "api.BaseSession", *, @@ -19340,6 +19602,30 @@ def post_GetRolesByID( return v1GetRolesByIDResponse.from_json(_resp.json()) raise APIHttpError("post_GetRolesByID", _resp) +def get_GetRunMetadata( + session: "api.BaseSession", + *, + runId: int, +) -> "v1GetRunMetadataResponse": + """Get run metadata. + + - runId: The ID of the run to get metadata for. + """ + _params = None + _resp = session._do_request( + method="GET", + path=f"/api/v1/runs/{runId}/metadata", + params=_params, + json=None, + data=None, + headers=None, + timeout=None, + stream=False, + ) + if _resp.status_code == 200: + return v1GetRunMetadataResponse.from_json(_resp.json()) + raise APIHttpError("get_GetRunMetadata", _resp) + def get_GetSearcherEvents( session: "api.BaseSession", *, @@ -21887,6 +22173,31 @@ def post_PostProject( return v1PostProjectResponse.from_json(_resp.json()) raise APIHttpError("post_PostProject", _resp) +def post_PostRunMetadata( + session: "api.BaseSession", + *, + body: "v1PostRunMetadataRequest", + runId: int, +) -> "v1PostRunMetadataResponse": + """Update run metadata. + + - runId: The ID of the run to post metadata for. + """ + _params = None + _resp = session._do_request( + method="POST", + path=f"/api/v1/runs/{runId}/metadata", + params=_params, + json=body.to_json(True), + data=None, + headers=None, + timeout=None, + stream=False, + ) + if _resp.status_code == 200: + return v1PostRunMetadataResponse.from_json(_resp.json()) + raise APIHttpError("post_PostRunMetadata", _resp) + def post_PostSearcherOperations( session: "api.BaseSession", *, @@ -22770,6 +23081,29 @@ def get_SearchRuns( return v1SearchRunsResponse.from_json(_resp.json()) raise APIHttpError("get_SearchRuns", _resp) +def put_SetClusterMessage( + session: "api.BaseSession", + *, + body: "v1SetClusterMessageRequest", +) -> None: + """Set the cluster-wide message shown to users. Only one can be set at at + time, so any existing message will be disabled. + """ + _params = None + _resp = session._do_request( + method="PUT", + path="/api/v1/master/cluster_message", + params=_params, + json=body.to_json(True), + data=None, + headers=None, + timeout=None, + stream=False, + ) + if _resp.status_code == 200: + return + raise APIHttpError("put_SetClusterMessage", _resp) + def post_SetCommandPriority( session: "api.BaseSession", *, diff --git a/proto/pkg/runv1/run.pb.go b/proto/pkg/runv1/run.pb.go index 998a1e8d711..2c9308e2650 100644 --- a/proto/pkg/runv1/run.pb.go +++ b/proto/pkg/runv1/run.pb.go @@ -216,10 +216,12 @@ type FlatRun struct { ParentArchived bool `protobuf:"varint,18,opt,name=parent_archived,json=parentArchived,proto3" json:"parent_archived,omitempty"` // Data related the the experiment associated with this run. Experiment *FlatRunExperiment `protobuf:"bytes,19,opt,name=experiment,proto3,oneof" json:"experiment,omitempty"` + // The arbitrary metadata of the run. + Metadata *_struct.Struct `protobuf:"bytes,20,opt,name=metadata,proto3,oneof" json:"metadata,omitempty"` // The archived status of this run. // This is only looking at the archived status at the run level and not taking // into account whether the experiment is archived or not. - Archived bool `protobuf:"varint,20,opt,name=archived,proto3" json:"archived,omitempty"` + Archived bool `protobuf:"varint,21,opt,name=archived,proto3" json:"archived,omitempty"` } func (x *FlatRun) Reset() { @@ -387,6 +389,13 @@ func (x *FlatRun) GetExperiment() *FlatRunExperiment { return nil } +func (x *FlatRun) GetMetadata() *_struct.Struct { + if x != nil { + return x.Metadata + } + return nil +} + func (x *FlatRun) GetArchived() bool { if x != nil { return x.Archived @@ -451,7 +460,7 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x70, 0x61, 0x63, 0x68, 0x79, 0x64, 0x65, 0x72, 0x6d, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xa0, 0x09, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0xe7, 0x09, 0x0a, 0x07, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, @@ -505,31 +514,35 @@ var file_determined_run_v1_run_proto_rawDesc = []byte{ 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2e, 0x72, 0x75, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x46, 0x6c, 0x61, 0x74, 0x52, 0x75, 0x6e, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x48, 0x06, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x1a, 0x0a, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x3a, 0xa6, 0x01, 0x92, 0x41, - 0xa2, 0x01, 0x0a, 0x9f, 0x01, 0xd2, 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, 0x0a, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0xd2, - 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, - 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0a, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, - 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0xd2, 0x01, 0x08, 0x61, 0x72, 0x63, 0x68, - 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, 0x0a, 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, - 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, - 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, - 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, - 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, - 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, - 0x6e, 0x74, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, - 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x38, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x14, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x07, 0x52, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x72, 0x63, + 0x68, 0x69, 0x76, 0x65, 0x64, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x72, 0x63, + 0x68, 0x69, 0x76, 0x65, 0x64, 0x3a, 0xa6, 0x01, 0x92, 0x41, 0xa2, 0x01, 0x0a, 0x9f, 0x01, 0xd2, + 0x01, 0x02, 0x69, 0x64, 0xd2, 0x01, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, + 0x65, 0xd2, 0x01, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0xd2, 0x01, 0x04, 0x74, 0x61, 0x67, 0x73, + 0xd2, 0x01, 0x0f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0xd2, 0x01, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0xd2, 0x01, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, + 0x69, 0x64, 0xd2, 0x01, 0x0c, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0xd2, 0x01, 0x0c, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0xd2, 0x01, 0x0e, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0xd2, 0x01, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, + 0x76, 0x65, 0x64, 0xd2, 0x01, 0x08, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x64, 0x42, 0x18, + 0x0a, 0x16, 0x5f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x65, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x75, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x12, 0x0a, 0x10, + 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, + 0x42, 0x12, 0x0a, 0x10, 0x5f, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0d, 0x0a, + 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x0b, 0x0a, 0x09, + 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, + 0x65, 0x64, 0x2d, 0x61, 0x69, 0x2f, 0x64, 0x65, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x65, 0x64, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x72, 0x75, 0x6e, 0x76, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -560,11 +573,12 @@ var file_determined_run_v1_run_proto_depIdxs = []int32{ 2, // 4: determined.run.v1.FlatRun.hyperparameters:type_name -> google.protobuf.Struct 2, // 5: determined.run.v1.FlatRun.summary_metrics:type_name -> google.protobuf.Struct 0, // 6: determined.run.v1.FlatRun.experiment:type_name -> determined.run.v1.FlatRunExperiment - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 2, // 7: determined.run.v1.FlatRun.metadata:type_name -> google.protobuf.Struct + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_determined_run_v1_run_proto_init() } diff --git a/webui/react/src/components/RunActionDropdown.tsx b/webui/react/src/components/RunActionDropdown.tsx index b84eb87cd8b..fe41c108dd0 100644 --- a/webui/react/src/components/RunActionDropdown.tsx +++ b/webui/react/src/components/RunActionDropdown.tsx @@ -175,7 +175,7 @@ const RunActionDropdown: React.FC = ({ flatRuns={[run]} sourceProjectId={projectId} sourceWorkspaceId={run.workspaceId} - onActionComplete={() => onComplete?.(FlatRunAction.Move, run.id)} + onSubmit={() => onComplete?.(FlatRunAction.Move, run.id)} /> ); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx index 54a1d2f0a67..07c52276c64 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.test.tsx @@ -85,20 +85,20 @@ describe('FlatRunMoveModalComponent', () => { const { user } = setup(); await user.click(screen.getByRole('button', { name: OPEN_MODAL_TEXT })); - expect((await screen.findAllByText('Move Runs')).length).toBe(2); + expect((await screen.findAllByText('Move Run')).length).toBe(2); expect(await screen.findByText('Workspace')).toBeInTheDocument(); expect(await screen.findByRole('button', { name: 'Cancel' })).toBeInTheDocument(); - expect(await screen.findByRole('button', { name: 'Move Runs' })).toBeInTheDocument(); + expect(await screen.findByRole('button', { name: 'Move Run' })).toBeInTheDocument(); }); it('should submit modal', async () => { const { user, handlers } = setup(); await user.click(screen.getByRole('button', { name: OPEN_MODAL_TEXT })); - expect((await screen.findAllByText('Move Runs')).length).toBe(2); + expect((await screen.findAllByText('Move Run')).length).toBe(2); expect(await screen.findByText('Workspace')).toBeInTheDocument(); - expect(await screen.findByRole('button', { name: 'Move Runs' })).not.toBeDisabled(); - await user.click(await screen.findByRole('button', { name: 'Move Runs' })); + expect(await screen.findByRole('button', { name: 'Move Run' })).not.toBeDisabled(); + await user.click(await screen.findByRole('button', { name: 'Move Run' })); expect(handlers.onSubmit).toBeCalled(); }); }); diff --git a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx index 58d031b2bfd..68f3544f87d 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunMoveModal.tsx @@ -127,9 +127,9 @@ const FlatRunMoveModalComponent: React.FC = ({ form: idPrefix + FORM_ID, handleError, handler: handleSubmit, - text: `Move ${pluralizer(flatRuns.length, 'Runs')}`, + text: `Move ${pluralizer(flatRuns.length, 'Run')}`, }} - title={`Move ${pluralizer(flatRuns.length, 'Runs')}`}> + title={`Move ${pluralizer(flatRuns.length, 'Run')}`}> ; } +/** + * Response to get the metadata of a run. + * @export + * @interface V1GetRunMetadataResponse + */ +export interface V1GetRunMetadataResponse { + /** + * The arbitrary metadata of the run. + * @type {any} + * @memberof V1GetRunMetadataResponse + */ + metadata?: any; +} /** * Response to GetSearcherEventsRequest. * @export @@ -7968,6 +8050,38 @@ export interface V1PostProjectResponse { */ project: V1Project; } +/** + * Request to post metadata for a run. + * @export + * @interface V1PostRunMetadataRequest + */ +export interface V1PostRunMetadataRequest { + /** + * The ID of the run to post metadata for. + * @type {number} + * @memberof V1PostRunMetadataRequest + */ + runId?: number; + /** + * The arbitrary metadata to post. + * @type {any} + * @memberof V1PostRunMetadataRequest + */ + metadata: any; +} +/** + * Response to post metadata for a run. + * @export + * @interface V1PostRunMetadataResponse + */ +export interface V1PostRunMetadataResponse { + /** + * The new metadata of the run. + * @type {any} + * @memberof V1PostRunMetadataResponse + */ + metadata?: any; +} /** * Request for sending operations from a custom search method. * @export @@ -10087,6 +10201,44 @@ export interface V1SearchRunsResponse { */ pagination: V1Pagination; } +/** + * Set the cluster-wide message. + * @export + * @interface V1SetClusterMessageRequest + */ +export interface V1SetClusterMessageRequest { + /** + * Text content of message. + * @type {string} + * @memberof V1SetClusterMessageRequest + */ + message: string; + /** + * Time to begin showing message. + * @type {Date | DateString} + * @memberof V1SetClusterMessageRequest + */ + startTime: Date | DateString; + /** + * Time to stop showing message. + * @type {Date | DateString} + * @memberof V1SetClusterMessageRequest + */ + endTime?: Date | DateString; + /** + * Duration expressing how long the message should last. Should be a Go-format duration (e.g. 24h, 2w, 5d) + * @type {string} + * @memberof V1SetClusterMessageRequest + */ + duration?: string; +} +/** + * Response to SetClusterMessageRequest. + * @export + * @interface V1SetClusterMessageResponse + */ +export interface V1SetClusterMessageResponse { +} /** * Set the priority of the requested command. * @export @@ -12704,6 +12856,36 @@ export class CheckpointsApi extends BaseAPI { */ export const ClusterApiFetchParamCreator = function (configuration?: Configuration) { return { + /** + * + * @summary Clear the cluster-wide message shown to all users. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteClusterMessage(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/master/cluster_message`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, /** * * @summary Disable the agent. @@ -12977,6 +13159,36 @@ export const ClusterApiFetchParamCreator = function (configuration?: Configurati options: localVarRequestOptions, }; }, + /** + * + * @summary Get the currently configured cluster-wide message. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getClusterMessage(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/master/cluster_message`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, /** * * @summary Get master information. @@ -13320,6 +13532,44 @@ export const ClusterApiFetchParamCreator = function (configuration?: Configurati objToSearchParams(options.query || {}, localVarUrlObj.searchParams); localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. + * @param {V1SetClusterMessageRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setClusterMessage(body: V1SetClusterMessageRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling setClusterMessage.'); + } + const localVarPath = `/api/v1/master/cluster_message`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + return { url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, options: localVarRequestOptions, @@ -13334,6 +13584,24 @@ export const ClusterApiFetchParamCreator = function (configuration?: Configurati */ export const ClusterApiFp = function (configuration?: Configuration) { return { + /** + * + * @summary Clear the cluster-wide message shown to all users. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteClusterMessage(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).deleteClusterMessage(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * * @summary Disable the agent. @@ -13458,6 +13726,24 @@ export const ClusterApiFp = function (configuration?: Configuration) { }); }; }, + /** + * + * @summary Get the currently configured cluster-wide message. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getClusterMessage(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getClusterMessage(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * * @summary Get master information. @@ -13632,6 +13918,25 @@ export const ClusterApiFp = function (configuration?: Configuration) { }); }; }, + /** + * + * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. + * @param {V1SetClusterMessageRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setClusterMessage(body: V1SetClusterMessageRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).setClusterMessage(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, } }; @@ -13641,6 +13946,15 @@ export const ClusterApiFp = function (configuration?: Configuration) { */ export const ClusterApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { return { + /** + * + * @summary Clear the cluster-wide message shown to all users. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteClusterMessage(options?: any) { + return ClusterApiFp(configuration).deleteClusterMessage(options)(fetch, basePath); + }, /** * * @summary Disable the agent. @@ -13711,6 +14025,15 @@ export const ClusterApiFactory = function (configuration?: Configuration, fetch? getAgents(sortBy?: V1GetAgentsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, label?: string, excludeSlots?: boolean, excludeContainers?: boolean, options?: any) { return ClusterApiFp(configuration).getAgents(sortBy, orderBy, offset, limit, label, excludeSlots, excludeContainers, options)(fetch, basePath); }, + /** + * + * @summary Get the currently configured cluster-wide message. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getClusterMessage(options?: any) { + return ClusterApiFp(configuration).getClusterMessage(options)(fetch, basePath); + }, /** * * @summary Get master information. @@ -13804,6 +14127,16 @@ export const ClusterApiFactory = function (configuration?: Configuration, fetch? resourceAllocationRaw(timestampAfter: Date | DateString, timestampBefore: Date | DateString, options?: any) { return ClusterApiFp(configuration).resourceAllocationRaw(timestampAfter, timestampBefore, options)(fetch, basePath); }, + /** + * + * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. + * @param {V1SetClusterMessageRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setClusterMessage(body: V1SetClusterMessageRequest, options?: any) { + return ClusterApiFp(configuration).setClusterMessage(body, options)(fetch, basePath); + }, } }; @@ -13814,6 +14147,17 @@ export const ClusterApiFactory = function (configuration?: Configuration, fetch? * @extends {BaseAPI} */ export class ClusterApi extends BaseAPI { + /** + * + * @summary Clear the cluster-wide message shown to all users. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ClusterApi + */ + public deleteClusterMessage(options?: any) { + return ClusterApiFp(this.configuration).deleteClusterMessage(options)(this.fetch, this.basePath) + } + /** * * @summary Disable the agent. @@ -13896,6 +14240,17 @@ export class ClusterApi extends BaseAPI { return ClusterApiFp(this.configuration).getAgents(sortBy, orderBy, offset, limit, label, excludeSlots, excludeContainers, options)(this.fetch, this.basePath) } + /** + * + * @summary Get the currently configured cluster-wide message. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ClusterApi + */ + public getClusterMessage(options?: any) { + return ClusterApiFp(this.configuration).getClusterMessage(options)(this.fetch, this.basePath) + } + /** * * @summary Get master information. @@ -14007,6 +14362,18 @@ export class ClusterApi extends BaseAPI { return ClusterApiFp(this.configuration).resourceAllocationRaw(timestampAfter, timestampBefore, options)(this.fetch, this.basePath) } + /** + * + * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. + * @param {V1SetClusterMessageRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ClusterApi + */ + public setClusterMessage(body: V1SetClusterMessageRequest, options?: any) { + return ClusterApiFp(this.configuration).setClusterMessage(body, options)(this.fetch, this.basePath) + } + } /** @@ -19741,6 +20108,42 @@ export const InternalApiFetchParamCreator = function (configuration?: Configurat options: localVarRequestOptions, }; }, + /** + * + * @summary Get run metadata. + * @param {number} runId The ID of the run to get metadata for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRunMetadata(runId: number, options: any = {}): FetchArgs { + // verify required parameter 'runId' is not null or undefined + if (runId === null || runId === undefined) { + throw new RequiredError('runId','Required parameter runId was null or undefined when calling getRunMetadata.'); + } + const localVarPath = `/api/v1/runs/{runId}/metadata` + .replace(`{${"runId"}}`, encodeURIComponent(String(runId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, /** * * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. @@ -20792,6 +21195,50 @@ export const InternalApiFetchParamCreator = function (configuration?: Configurat options: localVarRequestOptions, }; }, + /** + * + * @summary Update run metadata. + * @param {number} runId The ID of the run to post metadata for. + * @param {V1PostRunMetadataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options: any = {}): FetchArgs { + // verify required parameter 'runId' is not null or undefined + if (runId === null || runId === undefined) { + throw new RequiredError('runId','Required parameter runId was null or undefined when calling postRunMetadata.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postRunMetadata.'); + } + const localVarPath = `/api/v1/runs/{runId}/metadata` + .replace(`{${"runId"}}`, encodeURIComponent(String(runId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, /** * * @summary Persist the given task logs. @@ -22511,6 +22958,25 @@ export const InternalApiFp = function (configuration?: Configuration) { }); }; }, + /** + * + * @summary Get run metadata. + * @param {number} runId The ID of the run to get metadata for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRunMetadata(runId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getRunMetadata(runId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. @@ -22998,6 +23464,26 @@ export const InternalApiFp = function (configuration?: Configuration) { }); }; }, + /** + * + * @summary Update run metadata. + * @param {number} runId The ID of the run to post metadata for. + * @param {V1PostRunMetadataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).postRunMetadata(runId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, /** * * @summary Persist the given task logs. @@ -23835,6 +24321,16 @@ export const InternalApiFactory = function (configuration?: Configuration, fetch getResourcePools(offset?: number, limit?: number, unbound?: boolean, options?: any) { return InternalApiFp(configuration).getResourcePools(offset, limit, unbound, options)(fetch, basePath); }, + /** + * + * @summary Get run metadata. + * @param {number} runId The ID of the run to get metadata for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRunMetadata(runId: number, options?: any) { + return InternalApiFp(configuration).getRunMetadata(runId, options)(fetch, basePath); + }, /** * * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. @@ -24106,6 +24602,17 @@ export const InternalApiFactory = function (configuration?: Configuration, fetch postAllocationProxyAddress(allocationId: string, body: V1PostAllocationProxyAddressRequest, options?: any) { return InternalApiFp(configuration).postAllocationProxyAddress(allocationId, body, options)(fetch, basePath); }, + /** + * + * @summary Update run metadata. + * @param {number} runId The ID of the run to post metadata for. + * @param {V1PostRunMetadataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options?: any) { + return InternalApiFp(configuration).postRunMetadata(runId, body, options)(fetch, basePath); + }, /** * * @summary Persist the given task logs. @@ -24792,6 +25299,18 @@ export class InternalApi extends BaseAPI { return InternalApiFp(this.configuration).getResourcePools(offset, limit, unbound, options)(this.fetch, this.basePath) } + /** + * + * @summary Get run metadata. + * @param {number} runId The ID of the run to get metadata for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InternalApi + */ + public getRunMetadata(runId: number, options?: any) { + return InternalApiFp(this.configuration).getRunMetadata(runId, options)(this.fetch, this.basePath) + } + /** * * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. @@ -25111,6 +25630,19 @@ export class InternalApi extends BaseAPI { return InternalApiFp(this.configuration).postAllocationProxyAddress(allocationId, body, options)(this.fetch, this.basePath) } + /** + * + * @summary Update run metadata. + * @param {number} runId The ID of the run to post metadata for. + * @param {V1PostRunMetadataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InternalApi + */ + public postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options?: any) { + return InternalApiFp(this.configuration).postRunMetadata(runId, body, options)(this.fetch, this.basePath) + } + /** * * @summary Persist the given task logs. From 14169804c96b0d10cfad8f3f5e19b118bb2fbfdc Mon Sep 17 00:00:00 2001 From: John Kim Date: Tue, 18 Jun 2024 11:50:41 -0400 Subject: [PATCH 152/161] test fixes --- .../src/components/RunActionDropdown.test.tsx | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/webui/react/src/components/RunActionDropdown.test.tsx b/webui/react/src/components/RunActionDropdown.test.tsx index 8985cd7036e..3cd2dc3a7f1 100644 --- a/webui/react/src/components/RunActionDropdown.test.tsx +++ b/webui/react/src/components/RunActionDropdown.test.tsx @@ -23,6 +23,7 @@ const mockNavigatorClipboard = () => { vi.mock('routes/utils', () => ({ handlePath: vi.fn(), + serverAddress: () => 'http://localhost', })); vi.mock('services/api', () => ({ @@ -34,8 +35,8 @@ vi.mock('services/api', () => ({ const mocks = vi.hoisted(() => { return { - canDeleteFlatRuns: vi.fn(), - canModifyExperiment: vi.fn(), + canDeleteFlatRun: vi.fn(), + canModifyFlatRun: vi.fn(), canMoveFlatRun: vi.fn(), }; }); @@ -43,8 +44,8 @@ const mocks = vi.hoisted(() => { vi.mock('hooks/usePermissions', () => { const usePermissions = vi.fn(() => { return { - canDeleteFlatRun: mocks.canDeleteFlatRuns, - canModifyExperiment: mocks.canModifyExperiment, + canDeleteFlatRun: mocks.canDeleteFlatRun, + canModifyFlatRun: mocks.canModifyFlatRun, canMoveFlatRun: mocks.canMoveFlatRun, }; }); @@ -111,7 +112,7 @@ describe('RunActionDropdown', () => { }); it('should provide Delete option', async () => { - mocks.canDeleteFlatRuns.mockImplementation(() => true); + mocks.canDeleteFlatRun.mockImplementation(() => true); setup(); await user.click(screen.getByText('Delete')); await user.click(screen.getByRole('button', { name: 'Delete' })); @@ -119,13 +120,13 @@ describe('RunActionDropdown', () => { }); it('should hide Delete option without permissions', () => { - mocks.canDeleteFlatRuns.mockImplementation(() => false); + mocks.canDeleteFlatRun.mockImplementation(() => false); setup(); expect(screen.queryByText('Delete')).not.toBeInTheDocument(); }); it('should provide Kill option', async () => { - mocks.canModifyExperiment.mockImplementation(() => true); + mocks.canModifyFlatRun.mockImplementation(() => true); setup(undefined, RunState.Paused, undefined); await user.click(screen.getByText('Kill')); await user.click(screen.getByRole('button', { name: 'Kill' })); @@ -133,33 +134,33 @@ describe('RunActionDropdown', () => { }); it('should hide Kill option without permissions', () => { - mocks.canModifyExperiment.mockImplementation(() => false); + mocks.canModifyFlatRun.mockImplementation(() => false); setup(undefined, RunState.Paused, undefined); expect(screen.queryByText('Kill')).not.toBeInTheDocument(); }); it('should provide Archive option', async () => { - mocks.canModifyExperiment.mockImplementation(() => true); + mocks.canModifyFlatRun.mockImplementation(() => true); setup(); await user.click(screen.getByText('Archive')); expect(vi.mocked(archiveRuns)).toBeCalled(); }); it('should hide Archive option without permissions', () => { - mocks.canModifyExperiment.mockImplementation(() => false); + mocks.canModifyFlatRun.mockImplementation(() => false); setup(); expect(screen.queryByText('Archive')).not.toBeInTheDocument(); }); it('should provide Unarchive option', async () => { - mocks.canModifyExperiment.mockImplementation(() => true); + mocks.canModifyFlatRun.mockImplementation(() => true); setup(undefined, undefined, true); await user.click(screen.getByText('Unarchive')); expect(vi.mocked(unarchiveRuns)).toBeCalled(); }); it('should hide Unarchive option without permissions', () => { - mocks.canModifyExperiment.mockImplementation(() => false); + mocks.canModifyFlatRun.mockImplementation(() => false); setup(undefined, undefined, true); expect(screen.queryByText('Unarchive')).not.toBeInTheDocument(); }); From d044c06d5cd54a1cb64a7f7ec1b0a02687b41051 Mon Sep 17 00:00:00 2001 From: John Kim Date: Fri, 28 Jun 2024 11:14:51 -0400 Subject: [PATCH 153/161] fmt --- .../RunFilterInterstitialModalComponent.tsx | 30 +++---- .../pages/FlatRuns/FlatRunActionButton.tsx | 10 ++- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 88 +++++++++---------- 3 files changed, 65 insertions(+), 63 deletions(-) diff --git a/webui/react/src/components/RunFilterInterstitialModalComponent.tsx b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx index 2c268bc9903..b99d9c6b711 100644 --- a/webui/react/src/components/RunFilterInterstitialModalComponent.tsx +++ b/webui/react/src/components/RunFilterInterstitialModalComponent.tsx @@ -88,22 +88,22 @@ export const RunFilterInterstitialModalComponent = forwardRef = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, { max: heatmap.max, @@ -383,8 +383,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -395,8 +395,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); break; @@ -407,8 +407,8 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { currentColumn.column, currentColumn.displayName || currentColumn.column, settings.columnWidths[currentColumn.column] ?? - defaultColumnWidths[currentColumn.column as RunColumn] ?? - MIN_COLUMN_WIDTH, + defaultColumnWidths[currentColumn.column as RunColumn] ?? + MIN_COLUMN_WIDTH, dataPath, ); } @@ -421,9 +421,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { settings.columnWidths[currentColumn.column], heatmap && settings.heatmapOn && !settings.heatmapSkipped.includes(currentColumn.column) ? { - max: heatmap.max, - min: heatmap.min, - } + max: heatmap.max, + min: heatmap.min, + } : undefined, ); } @@ -819,12 +819,12 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { const items: MenuItem[] = [ settings.selection.type === 'ALL_EXCEPT' || settings.selection.selections.length > 0 ? { - key: 'select-none', - label: 'Clear selected', - onClick: () => { - handleSelectionChange?.('remove-all'); - }, - } + key: 'select-none', + label: 'Clear selected', + onClick: () => { + handleSelectionChange?.('remove-all'); + }, + } : null, ...[5, 10, 25].map((n) => ({ key: `select-${n}`, @@ -853,32 +853,32 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { ? null : !isPinned ? { - icon: , - key: 'pin', - label: 'Pin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), - ); - }, - } + icon: , + key: 'pin', + label: 'Pin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.min(settings.pinnedColumnsCount + 1, columnsIfLoaded.length), + ); + }, + } : { - disabled: settings.pinnedColumnsCount <= 1, - icon: , - key: 'unpin', - label: 'Unpin column', - onClick: () => { - const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); - newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); - handleColumnsOrderChange( - newColumnsOrder, - Math.max(settings.pinnedColumnsCount - 1, 0), - ); + disabled: settings.pinnedColumnsCount <= 1, + icon: , + key: 'unpin', + label: 'Unpin column', + onClick: () => { + const newColumnsOrder = columnsIfLoaded.filter((c) => c !== columnId); + newColumnsOrder.splice(settings.pinnedColumnsCount - 1, 0, columnId); + handleColumnsOrderChange( + newColumnsOrder, + Math.max(settings.pinnedColumnsCount - 1, 0), + ); + }, }, - }, { icon: , key: 'hide', @@ -907,9 +907,9 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { sortCount === 0 ? [] : [ - { type: 'divider' as const }, - ...sortMenuItemsForColumn(column, sorts, handleSortChange), - ]; + { type: 'divider' as const }, + ...sortMenuItemsForColumn(column, sorts, handleSortChange), + ]; items.push(...sortMenuItems); } From c2ecdc20b9cb82711f9a99aa04582c35e15bf5f3 Mon Sep 17 00:00:00 2001 From: John Kim Date: Fri, 28 Jun 2024 11:16:51 -0400 Subject: [PATCH 154/161] merge fix --- harness/determined/common/api/bindings.py | 94 +- webui/react/src/services/api-ts-sdk/api.ts | 69392 +++++++++---------- 2 files changed, 31146 insertions(+), 38340 deletions(-) diff --git a/harness/determined/common/api/bindings.py b/harness/determined/common/api/bindings.py index 5e29e637b15..46e8b5aa186 100644 --- a/harness/determined/common/api/bindings.py +++ b/harness/determined/common/api/bindings.py @@ -11538,6 +11538,7 @@ def __init__( notes: "typing.Sequence[v1Note]", numActiveExperiments: int, numExperiments: int, + numRuns: int, state: "v1WorkspaceState", userId: int, username: str, @@ -11555,6 +11556,7 @@ def __init__( self.notes = notes self.numActiveExperiments = numActiveExperiments self.numExperiments = numExperiments + self.numRuns = numRuns self.state = state self.userId = userId self.username = username @@ -11578,6 +11580,7 @@ def from_json(cls, obj: Json) -> "v1Project": "notes": [v1Note.from_json(x) for x in obj["notes"]], "numActiveExperiments": obj["numActiveExperiments"], "numExperiments": obj["numExperiments"], + "numRuns": obj["numRuns"], "state": v1WorkspaceState(obj["state"]), "userId": obj["userId"], "username": obj["username"], @@ -11602,6 +11605,7 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: "notes": [x.to_json(omit_unset) for x in self.notes], "numActiveExperiments": self.numActiveExperiments, "numExperiments": self.numExperiments, + "numRuns": self.numRuns, "state": self.state.value, "userId": self.userId, "username": self.username, @@ -13755,6 +13759,65 @@ def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: out["roles"] = None if self.roles is None else [x.to_json(omit_unset) for x in self.roles] return out +class v1SearchRunsRequest(Printable): + """Get a list of runs.""" + filter: "typing.Optional[str]" = None + limit: "typing.Optional[int]" = None + offset: "typing.Optional[int]" = None + projectId: "typing.Optional[int]" = None + sort: "typing.Optional[str]" = None + + def __init__( + self, + *, + filter: "typing.Union[str, None, Unset]" = _unset, + limit: "typing.Union[int, None, Unset]" = _unset, + offset: "typing.Union[int, None, Unset]" = _unset, + projectId: "typing.Union[int, None, Unset]" = _unset, + sort: "typing.Union[str, None, Unset]" = _unset, + ): + if not isinstance(filter, Unset): + self.filter = filter + if not isinstance(limit, Unset): + self.limit = limit + if not isinstance(offset, Unset): + self.offset = offset + if not isinstance(projectId, Unset): + self.projectId = projectId + if not isinstance(sort, Unset): + self.sort = sort + + @classmethod + def from_json(cls, obj: Json) -> "v1SearchRunsRequest": + kwargs: "typing.Dict[str, typing.Any]" = { + } + if "filter" in obj: + kwargs["filter"] = obj["filter"] + if "limit" in obj: + kwargs["limit"] = obj["limit"] + if "offset" in obj: + kwargs["offset"] = obj["offset"] + if "projectId" in obj: + kwargs["projectId"] = obj["projectId"] + if "sort" in obj: + kwargs["sort"] = obj["sort"] + return cls(**kwargs) + + def to_json(self, omit_unset: bool = False) -> typing.Dict[str, typing.Any]: + out: "typing.Dict[str, typing.Any]" = { + } + if not omit_unset or "filter" in vars(self): + out["filter"] = self.filter + if not omit_unset or "limit" in vars(self): + out["limit"] = self.limit + if not omit_unset or "offset" in vars(self): + out["offset"] = self.offset + if not omit_unset or "projectId" in vars(self): + out["projectId"] = self.projectId + if not omit_unset or "sort" in vars(self): + out["sort"] = self.sort + return out + class v1SearchRunsResponse(Printable): """Response to SearchRunsResponse.""" @@ -23043,35 +23106,18 @@ def post_SearchRolesAssignableToScope( return v1SearchRolesAssignableToScopeResponse.from_json(_resp.json()) raise APIHttpError("post_SearchRolesAssignableToScope", _resp) -def get_SearchRuns( +def post_SearchRuns( session: "api.BaseSession", *, - filter: "typing.Optional[str]" = None, - limit: "typing.Optional[int]" = None, - offset: "typing.Optional[int]" = None, - projectId: "typing.Optional[int]" = None, - sort: "typing.Optional[str]" = None, + body: "v1SearchRunsRequest", ) -> "v1SearchRunsResponse": - """Get a list of runs. - - - filter: Filter expression. - - limit: How many results to show. - - offset: How many experiments to skip before including in the results. - - projectId: ID of the project to look at. - - sort: Sort parameters in the format =(asc|desc),=(asc|desc). - """ - _params = { - "filter": filter, - "limit": limit, - "offset": offset, - "projectId": projectId, - "sort": sort, - } + """Get a list of runs.""" + _params = None _resp = session._do_request( - method="GET", + method="POST", path="/api/v1/runs", params=_params, - json=None, + json=body.to_json(True), data=None, headers=None, timeout=None, @@ -23079,7 +23125,7 @@ def get_SearchRuns( ) if _resp.status_code == 200: return v1SearchRunsResponse.from_json(_resp.json()) - raise APIHttpError("get_SearchRuns", _resp) + raise APIHttpError("post_SearchRuns", _resp) def put_SetClusterMessage( session: "api.BaseSession", diff --git a/webui/react/src/services/api-ts-sdk/api.ts b/webui/react/src/services/api-ts-sdk/api.ts index 8d4b75b43d8..10861349c5d 100644 --- a/webui/react/src/services/api-ts-sdk/api.ts +++ b/webui/react/src/services/api-ts-sdk/api.ts @@ -8,42 +8,42 @@ * NOTE: Do not edit the class manually. */ -import { DateString } from 'ioTypes'; -import { Configuration } from './configuration'; +import { DateString } from "ioTypes"; +import { Configuration } from "./configuration"; type ValueOf = T[keyof T]; -const BASE_PATH = 'http://localhost'.replace(/\/+$/, ''); +const BASE_PATH = "http://localhost".replace(/\/+$/, ""); const convert = (v: unknown): string => { - switch (typeof v) { - case 'string': - case 'boolean': { - return v.toString(); + switch (typeof v) { + case 'string': + case 'boolean': { + return v.toString(); + } + case 'bigint': { + return '' + v + } + case 'number': { + if (Number.isFinite(v)) { + return encodeURIComponent(v); + } + return ''; + } + default: { + return ''; + } } - case 'bigint': { - return '' + v; - } - case 'number': { - if (Number.isFinite(v)) { - return encodeURIComponent(v); - } - return ''; - } - default: { - return ''; - } - } -}; +} const objToSearchParams = (obj: {}, searchParams: URLSearchParams) => { - Object.entries(obj).forEach(([key, value]) => { - if (Array.isArray(value) && value.length > 0) { - searchParams.set(key, convert(value[0])); - value.slice(1).forEach((subValue) => searchParams.append(key, convert(subValue))); - } else if (!Array.isArray(value)) { - searchParams.set(key, convert(value)); - } - }); + Object.entries(obj).forEach(([key, value]) => { + if (Array.isArray(value) && value.length > 0) { + searchParams.set(key, convert(value[0])) + value.slice(1).forEach((subValue) => searchParams.append(key, convert(subValue))) + } else if (!Array.isArray(value)) { + searchParams.set(key, convert(value)) + } + }); }; /** @@ -51,10 +51,10 @@ const objToSearchParams = (obj: {}, searchParams: URLSearchParams) => { * @export */ export const COLLECTION_FORMATS = { - csv: ',', - ssv: ' ', - tsv: '\t', - pipes: '|', + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", }; /** @@ -63,7 +63,7 @@ export const COLLECTION_FORMATS = { * @interface FetchAPI */ export interface FetchAPI { - (url: string, init?: any): Promise; + (url: string, init?: any): Promise; } /** @@ -72,8 +72,8 @@ export interface FetchAPI { * @interface FetchArgs */ export interface FetchArgs { - url: string; - options: any; + url: string; + options: any; } /** @@ -82,21 +82,17 @@ export interface FetchArgs { * @class BaseAPI */ export class BaseAPI { - protected configuration: Configuration; - - constructor( - configuration?: Configuration, - protected basePath: string = BASE_PATH, - protected fetch: FetchAPI = window.fetch, - ) { - if (configuration) { - this.configuration = configuration; - this.basePath = configuration.basePath || this.basePath; - } else { - this.configuration = new Configuration(); - } - } -} + protected configuration: Configuration; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected fetch: FetchAPI = window.fetch) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } else { + this.configuration = new Configuration() + } + } +}; /** * @@ -105,196 +101,192 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - override name: 'RequiredError'; - constructor( - public field: string, - msg?: string, - ) { - super(msg); - this.name = 'RequiredError'; - } + override name: "RequiredError" + constructor(public field: string, msg?: string) { + super(msg); + this.name = "RequiredError" + } } + /** * Sorts options for checkpoints by the given field. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. * @export * @enum {string} */ export const Checkpointv1SortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - UUID: 'SORT_BY_UUID', - TRIALID: 'SORT_BY_TRIAL_ID', - BATCHNUMBER: 'SORT_BY_BATCH_NUMBER', - ENDTIME: 'SORT_BY_END_TIME', - STATE: 'SORT_BY_STATE', - SEARCHERMETRIC: 'SORT_BY_SEARCHER_METRIC', -} as const; -export type Checkpointv1SortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + UUID: 'SORT_BY_UUID', + TRIALID: 'SORT_BY_TRIAL_ID', + BATCHNUMBER: 'SORT_BY_BATCH_NUMBER', + ENDTIME: 'SORT_BY_END_TIME', + STATE: 'SORT_BY_STATE', + SEARCHERMETRIC: 'SORT_BY_SEARCHER_METRIC', +} as const +export type Checkpointv1SortBy = ValueOf /** * The current state of the checkpoint. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. * @export * @enum {string} */ export const Checkpointv1State = { - UNSPECIFIED: 'STATE_UNSPECIFIED', - ACTIVE: 'STATE_ACTIVE', - COMPLETED: 'STATE_COMPLETED', - ERROR: 'STATE_ERROR', - DELETED: 'STATE_DELETED', - PARTIALLYDELETED: 'STATE_PARTIALLY_DELETED', -} as const; -export type Checkpointv1State = ValueOf; + UNSPECIFIED: 'STATE_UNSPECIFIED', + ACTIVE: 'STATE_ACTIVE', + COMPLETED: 'STATE_COMPLETED', + ERROR: 'STATE_ERROR', + DELETED: 'STATE_DELETED', + PARTIALLYDELETED: 'STATE_PARTIALLY_DELETED', +} as const +export type Checkpointv1State = ValueOf /** * The current state of the container. - STATE_UNSPECIFIED: The container state is unknown. - STATE_ASSIGNED: The container has been assigned to an agent but has not started yet. - STATE_PULLING: The container's base image is being pulled from the Docker registry. - STATE_STARTING: The image has been built and the container is being started, but the service in the container is not ready yet. - STATE_RUNNING: The service in the container is able to accept requests. - STATE_TERMINATED: The container has completely exited or the container has been aborted prior to getting assigned. * @export * @enum {string} */ export const Containerv1State = { - UNSPECIFIED: 'STATE_UNSPECIFIED', - ASSIGNED: 'STATE_ASSIGNED', - PULLING: 'STATE_PULLING', - STARTING: 'STATE_STARTING', - RUNNING: 'STATE_RUNNING', - TERMINATED: 'STATE_TERMINATED', -} as const; -export type Containerv1State = ValueOf; + UNSPECIFIED: 'STATE_UNSPECIFIED', + ASSIGNED: 'STATE_ASSIGNED', + PULLING: 'STATE_PULLING', + STARTING: 'STATE_STARTING', + RUNNING: 'STATE_RUNNING', + TERMINATED: 'STATE_TERMINATED', +} as const +export type Containerv1State = ValueOf /** * The type of the Device. - TYPE_UNSPECIFIED: An unspecified device type. - TYPE_CPU: A CPU device. - TYPE_CUDA: CUDA device. - TYPE_ROCM: ROCM. * @export * @enum {string} */ export const Devicev1Type = { - UNSPECIFIED: 'TYPE_UNSPECIFIED', - CPU: 'TYPE_CPU', - CUDA: 'TYPE_CUDA', - ROCM: 'TYPE_ROCM', -} as const; -export type Devicev1Type = ValueOf; + UNSPECIFIED: 'TYPE_UNSPECIFIED', + CPU: 'TYPE_CPU', + CUDA: 'TYPE_CUDA', + ROCM: 'TYPE_ROCM', +} as const +export type Devicev1Type = ValueOf /** * The current state of the experiment. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. * @export * @enum {string} */ export const Experimentv1State = { - UNSPECIFIED: 'STATE_UNSPECIFIED', - ACTIVE: 'STATE_ACTIVE', - PAUSED: 'STATE_PAUSED', - STOPPINGCOMPLETED: 'STATE_STOPPING_COMPLETED', - STOPPINGCANCELED: 'STATE_STOPPING_CANCELED', - STOPPINGERROR: 'STATE_STOPPING_ERROR', - COMPLETED: 'STATE_COMPLETED', - CANCELED: 'STATE_CANCELED', - ERROR: 'STATE_ERROR', - DELETED: 'STATE_DELETED', - DELETING: 'STATE_DELETING', - DELETEFAILED: 'STATE_DELETE_FAILED', - STOPPINGKILLED: 'STATE_STOPPING_KILLED', - QUEUED: 'STATE_QUEUED', - PULLING: 'STATE_PULLING', - STARTING: 'STATE_STARTING', - RUNNING: 'STATE_RUNNING', -} as const; -export type Experimentv1State = ValueOf; + UNSPECIFIED: 'STATE_UNSPECIFIED', + ACTIVE: 'STATE_ACTIVE', + PAUSED: 'STATE_PAUSED', + STOPPINGCOMPLETED: 'STATE_STOPPING_COMPLETED', + STOPPINGCANCELED: 'STATE_STOPPING_CANCELED', + STOPPINGERROR: 'STATE_STOPPING_ERROR', + COMPLETED: 'STATE_COMPLETED', + CANCELED: 'STATE_CANCELED', + ERROR: 'STATE_ERROR', + DELETED: 'STATE_DELETED', + DELETING: 'STATE_DELETING', + DELETEFAILED: 'STATE_DELETE_FAILED', + STOPPINGKILLED: 'STATE_STOPPING_KILLED', + QUEUED: 'STATE_QUEUED', + PULLING: 'STATE_PULLING', + STARTING: 'STATE_STARTING', + RUNNING: 'STATE_RUNNING', +} as const +export type Experimentv1State = ValueOf /** * Different kinds of Determined Cloud offerings - PRODUCT_UNSPECIFIED: Not a Cloud Community offering - PRODUCT_COMMUNITY: Determined Cloud, Community Edition * @export * @enum {string} */ export const GetMasterResponseProduct = { - UNSPECIFIED: 'PRODUCT_UNSPECIFIED', - COMMUNITY: 'PRODUCT_COMMUNITY', -} as const; -export type GetMasterResponseProduct = ValueOf; + UNSPECIFIED: 'PRODUCT_UNSPECIFIED', + COMMUNITY: 'PRODUCT_COMMUNITY', +} as const +export type GetMasterResponseProduct = ValueOf /** * Filter workloads with training, validation, and checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. * @export * @enum {string} */ export const GetTrialWorkloadsRequestFilterOption = { - UNSPECIFIED: 'FILTER_OPTION_UNSPECIFIED', - CHECKPOINT: 'FILTER_OPTION_CHECKPOINT', - VALIDATION: 'FILTER_OPTION_VALIDATION', - CHECKPOINTORVALIDATION: 'FILTER_OPTION_CHECKPOINT_OR_VALIDATION', -} as const; -export type GetTrialWorkloadsRequestFilterOption = ValueOf< - typeof GetTrialWorkloadsRequestFilterOption ->; + UNSPECIFIED: 'FILTER_OPTION_UNSPECIFIED', + CHECKPOINT: 'FILTER_OPTION_CHECKPOINT', + VALIDATION: 'FILTER_OPTION_VALIDATION', + CHECKPOINTORVALIDATION: 'FILTER_OPTION_CHECKPOINT_OR_VALIDATION', +} as const +export type GetTrialWorkloadsRequestFilterOption = ValueOf /** - * + * * @export * @interface HealthCheck */ export interface HealthCheck { - /** - * - * @type {HealthStatus} - * @memberof HealthCheck - */ - database?: HealthStatus; - /** - * - * @type {Array} - * @memberof HealthCheck - */ - resource_managers?: Array; - /** - * - * @type {HealthStatus} - * @memberof HealthCheck - */ - status?: HealthStatus; + /** + * + * @type {HealthStatus} + * @memberof HealthCheck + */ + database?: HealthStatus; + /** + * + * @type {Array} + * @memberof HealthCheck + */ + resource_managers?: Array; + /** + * + * @type {HealthStatus} + * @memberof HealthCheck + */ + status?: HealthStatus; } /** - * + * * @export * @enum {string} */ export const HealthStatus = { - up: 'up', - down: 'down', -} as const; -export type HealthStatus = ValueOf; + up: 'up', + down: 'down', +} as const +export type HealthStatus = ValueOf /** * Job state. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. * @export * @enum {string} */ export const Jobv1State = { - UNSPECIFIED: 'STATE_UNSPECIFIED', - QUEUED: 'STATE_QUEUED', - SCHEDULED: 'STATE_SCHEDULED', - SCHEDULEDBACKFILLED: 'STATE_SCHEDULED_BACKFILLED', -} as const; -export type Jobv1State = ValueOf; + UNSPECIFIED: 'STATE_UNSPECIFIED', + QUEUED: 'STATE_QUEUED', + SCHEDULED: 'STATE_SCHEDULED', + SCHEDULEDBACKFILLED: 'STATE_SCHEDULED_BACKFILLED', +} as const +export type Jobv1State = ValueOf /** * Job type. - TYPE_UNSPECIFIED: Unspecified state. - TYPE_EXPERIMENT: Experiement Job. - TYPE_NOTEBOOK: Jupyter Notebook Job. - TYPE_TENSORBOARD: TensorBoard Job. - TYPE_SHELL: Shell Job. - TYPE_COMMAND: Command Job. - TYPE_CHECKPOINT_GC: CheckpointGC Job. - TYPE_EXTERNAL: External Job. - TYPE_GENERIC: Generic Job. * @export * @enum {string} */ export const Jobv1Type = { - UNSPECIFIED: 'TYPE_UNSPECIFIED', - EXPERIMENT: 'TYPE_EXPERIMENT', - NOTEBOOK: 'TYPE_NOTEBOOK', - TENSORBOARD: 'TYPE_TENSORBOARD', - SHELL: 'TYPE_SHELL', - COMMAND: 'TYPE_COMMAND', - CHECKPOINTGC: 'TYPE_CHECKPOINT_GC', - EXTERNAL: 'TYPE_EXTERNAL', - GENERIC: 'TYPE_GENERIC', -} as const; -export type Jobv1Type = ValueOf; + UNSPECIFIED: 'TYPE_UNSPECIFIED', + EXPERIMENT: 'TYPE_EXPERIMENT', + NOTEBOOK: 'TYPE_NOTEBOOK', + TENSORBOARD: 'TYPE_TENSORBOARD', + SHELL: 'TYPE_SHELL', + COMMAND: 'TYPE_COMMAND', + CHECKPOINTGC: 'TYPE_CHECKPOINT_GC', + EXTERNAL: 'TYPE_EXTERNAL', + GENERIC: 'TYPE_GENERIC', +} as const +export type Jobv1Type = ValueOf /** * Gets around not being able to do "Optional map". Not ideal but this API is marked internal for now. * @export * @interface PatchCheckpointOptionalResources */ export interface PatchCheckpointOptionalResources { - /** - * Resources. - * @type {{ [key: string]: string; }} - * @memberof PatchCheckpointOptionalResources - */ - resources?: { [key: string]: string }; + /** + * Resources. + * @type {{ [key: string]: string; }} + * @memberof PatchCheckpointOptionalResources + */ + resources?: { [key: string]: string; }; } /** * Nested object for checkpoint_storage field patch. @@ -302,24 +294,24 @@ export interface PatchCheckpointOptionalResources { * @interface PatchExperimentPatchCheckpointStorage */ export interface PatchExperimentPatchCheckpointStorage { - /** - * Experiment config checkpoint_storage.save_experiment_best. - * @type {number} - * @memberof PatchExperimentPatchCheckpointStorage - */ - saveExperimentBest?: number; - /** - * Experiment config checkpoint_storage.save_trial_best. - * @type {number} - * @memberof PatchExperimentPatchCheckpointStorage - */ - saveTrialBest?: number; - /** - * Experiment config checkpoint_storage.save_trial_latest. - * @type {number} - * @memberof PatchExperimentPatchCheckpointStorage - */ - saveTrialLatest?: number; + /** + * Experiment config checkpoint_storage.save_experiment_best. + * @type {number} + * @memberof PatchExperimentPatchCheckpointStorage + */ + saveExperimentBest?: number; + /** + * Experiment config checkpoint_storage.save_trial_best. + * @type {number} + * @memberof PatchExperimentPatchCheckpointStorage + */ + saveTrialBest?: number; + /** + * Experiment config checkpoint_storage.save_trial_latest. + * @type {number} + * @memberof PatchExperimentPatchCheckpointStorage + */ + saveTrialLatest?: number; } /** * Nested object for resources field patch. @@ -327,24 +319,24 @@ export interface PatchExperimentPatchCheckpointStorage { * @interface PatchExperimentPatchResources */ export interface PatchExperimentPatchResources { - /** - * Experiment config resources.max_slots. - * @type {number} - * @memberof PatchExperimentPatchResources - */ - maxSlots?: number; - /** - * Experiment config resources.weight. - * @type {number} - * @memberof PatchExperimentPatchResources - */ - weight?: number; - /** - * Experiment config resources.priority. - * @type {number} - * @memberof PatchExperimentPatchResources - */ - priority?: number; + /** + * Experiment config resources.max_slots. + * @type {number} + * @memberof PatchExperimentPatchResources + */ + maxSlots?: number; + /** + * Experiment config resources.weight. + * @type {number} + * @memberof PatchExperimentPatchResources + */ + weight?: number; + /** + * Experiment config resources.priority. + * @type {number} + * @memberof PatchExperimentPatchResources + */ + priority?: number; } /** * https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/Any @@ -352,18 +344,18 @@ export interface PatchExperimentPatchResources { * @interface ProtobufAny */ export interface ProtobufAny { - /** - * https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/Any - * @type {string} - * @memberof ProtobufAny - */ - typeUrl?: string; - /** - * Must be a valid serialized protocol buffer of the above specified type. - * @type {string} - * @memberof ProtobufAny - */ - value?: string; + /** + * https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/Any + * @type {string} + * @memberof ProtobufAny + */ + typeUrl?: string; + /** + * Must be a valid serialized protocol buffer of the above specified type. + * @type {string} + * @memberof ProtobufAny + */ + value?: string; } /** * https://protobuf.dev/reference/java/api-docs/com/google/protobuf/FieldMask @@ -371,12 +363,12 @@ export interface ProtobufAny { * @interface ProtobufFieldMask */ export interface ProtobufFieldMask { - /** - * The set of field mask paths. - * @type {Array} - * @memberof ProtobufFieldMask - */ - paths?: Array; + /** + * The set of field mask paths. + * @type {Array} + * @memberof ProtobufFieldMask + */ + paths?: Array; } /** * `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value. @@ -384,27 +376,27 @@ export interface ProtobufFieldMask { * @enum {string} */ export const ProtobufNullValue = { - NULLVALUE: 'NULL_VALUE', -} as const; -export type ProtobufNullValue = ValueOf; + NULLVALUE: 'NULL_VALUE', +} as const +export type ProtobufNullValue = ValueOf /** - * + * * @export * @interface ResourceManagerHealth */ export interface ResourceManagerHealth { - /** - * - * @type {string} - * @memberof ResourceManagerHealth - */ - name?: string; - /** - * - * @type {HealthStatus} - * @memberof ResourceManagerHealth - */ - status?: HealthStatus; + /** + * + * @type {string} + * @memberof ResourceManagerHealth + */ + name?: string; + /** + * + * @type {HealthStatus} + * @memberof ResourceManagerHealth + */ + status?: HealthStatus; } /** * A wrapper message of a list of devices. @@ -412,346 +404,346 @@ export interface ResourceManagerHealth { * @interface ResourcesSummaryDevices */ export interface ResourcesSummaryDevices { - /** - * The devices on an agent. - * @type {Array} - * @memberof ResourcesSummaryDevices - */ - devices?: Array; + /** + * The devices on an agent. + * @type {Array} + * @memberof ResourcesSummaryDevices + */ + devices?: Array; } /** - * + * * @export * @interface RuntimeError */ export interface RuntimeError { - /** - * - * @type {string} - * @memberof RuntimeError - */ - error?: string; - /** - * - * @type {number} - * @memberof RuntimeError - */ - code?: number; - /** - * - * @type {string} - * @memberof RuntimeError - */ - message?: string; - /** - * - * @type {Array} - * @memberof RuntimeError - */ - details?: Array; + /** + * + * @type {string} + * @memberof RuntimeError + */ + error?: string; + /** + * + * @type {number} + * @memberof RuntimeError + */ + code?: number; + /** + * + * @type {string} + * @memberof RuntimeError + */ + message?: string; + /** + * + * @type {Array} + * @memberof RuntimeError + */ + details?: Array; } /** - * + * * @export * @interface RuntimeStreamError */ export interface RuntimeStreamError { - /** - * - * @type {number} - * @memberof RuntimeStreamError - */ - grpcCode?: number; - /** - * - * @type {number} - * @memberof RuntimeStreamError - */ - httpCode?: number; - /** - * - * @type {string} - * @memberof RuntimeStreamError - */ - message?: string; - /** - * - * @type {string} - * @memberof RuntimeStreamError - */ - httpStatus?: string; - /** - * - * @type {Array} - * @memberof RuntimeStreamError - */ - details?: Array; + /** + * + * @type {number} + * @memberof RuntimeStreamError + */ + grpcCode?: number; + /** + * + * @type {number} + * @memberof RuntimeStreamError + */ + httpCode?: number; + /** + * + * @type {string} + * @memberof RuntimeStreamError + */ + message?: string; + /** + * + * @type {string} + * @memberof RuntimeStreamError + */ + httpStatus?: string; + /** + * + * @type {Array} + * @memberof RuntimeStreamError + */ + details?: Array; } /** - * + * * @export * @interface StreamResultOfV1ExpMetricNamesResponse */ export interface StreamResultOfV1ExpMetricNamesResponse { - /** - * - * @type {V1ExpMetricNamesResponse} - * @memberof StreamResultOfV1ExpMetricNamesResponse - */ - result?: V1ExpMetricNamesResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1ExpMetricNamesResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1ExpMetricNamesResponse} + * @memberof StreamResultOfV1ExpMetricNamesResponse + */ + result?: V1ExpMetricNamesResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1ExpMetricNamesResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1GetMetricsResponse */ export interface StreamResultOfV1GetMetricsResponse { - /** - * - * @type {V1GetMetricsResponse} - * @memberof StreamResultOfV1GetMetricsResponse - */ - result?: V1GetMetricsResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1GetMetricsResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1GetMetricsResponse} + * @memberof StreamResultOfV1GetMetricsResponse + */ + result?: V1GetMetricsResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1GetMetricsResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1GetTrainingMetricsResponse */ export interface StreamResultOfV1GetTrainingMetricsResponse { - /** - * - * @type {V1GetTrainingMetricsResponse} - * @memberof StreamResultOfV1GetTrainingMetricsResponse - */ - result?: V1GetTrainingMetricsResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1GetTrainingMetricsResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1GetTrainingMetricsResponse} + * @memberof StreamResultOfV1GetTrainingMetricsResponse + */ + result?: V1GetTrainingMetricsResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1GetTrainingMetricsResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1GetTrialProfilerAvailableSeriesResponse */ export interface StreamResultOfV1GetTrialProfilerAvailableSeriesResponse { - /** - * - * @type {V1GetTrialProfilerAvailableSeriesResponse} - * @memberof StreamResultOfV1GetTrialProfilerAvailableSeriesResponse - */ - result?: V1GetTrialProfilerAvailableSeriesResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1GetTrialProfilerAvailableSeriesResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1GetTrialProfilerAvailableSeriesResponse} + * @memberof StreamResultOfV1GetTrialProfilerAvailableSeriesResponse + */ + result?: V1GetTrialProfilerAvailableSeriesResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1GetTrialProfilerAvailableSeriesResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1GetTrialProfilerMetricsResponse */ export interface StreamResultOfV1GetTrialProfilerMetricsResponse { - /** - * - * @type {V1GetTrialProfilerMetricsResponse} - * @memberof StreamResultOfV1GetTrialProfilerMetricsResponse - */ - result?: V1GetTrialProfilerMetricsResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1GetTrialProfilerMetricsResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1GetTrialProfilerMetricsResponse} + * @memberof StreamResultOfV1GetTrialProfilerMetricsResponse + */ + result?: V1GetTrialProfilerMetricsResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1GetTrialProfilerMetricsResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1GetValidationMetricsResponse */ export interface StreamResultOfV1GetValidationMetricsResponse { - /** - * - * @type {V1GetValidationMetricsResponse} - * @memberof StreamResultOfV1GetValidationMetricsResponse - */ - result?: V1GetValidationMetricsResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1GetValidationMetricsResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1GetValidationMetricsResponse} + * @memberof StreamResultOfV1GetValidationMetricsResponse + */ + result?: V1GetValidationMetricsResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1GetValidationMetricsResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1MasterLogsResponse */ export interface StreamResultOfV1MasterLogsResponse { - /** - * - * @type {V1MasterLogsResponse} - * @memberof StreamResultOfV1MasterLogsResponse - */ - result?: V1MasterLogsResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1MasterLogsResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1MasterLogsResponse} + * @memberof StreamResultOfV1MasterLogsResponse + */ + result?: V1MasterLogsResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1MasterLogsResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1MetricBatchesResponse */ export interface StreamResultOfV1MetricBatchesResponse { - /** - * - * @type {V1MetricBatchesResponse} - * @memberof StreamResultOfV1MetricBatchesResponse - */ - result?: V1MetricBatchesResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1MetricBatchesResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1MetricBatchesResponse} + * @memberof StreamResultOfV1MetricBatchesResponse + */ + result?: V1MetricBatchesResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1MetricBatchesResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1TaskLogsFieldsResponse */ export interface StreamResultOfV1TaskLogsFieldsResponse { - /** - * - * @type {V1TaskLogsFieldsResponse} - * @memberof StreamResultOfV1TaskLogsFieldsResponse - */ - result?: V1TaskLogsFieldsResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1TaskLogsFieldsResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1TaskLogsFieldsResponse} + * @memberof StreamResultOfV1TaskLogsFieldsResponse + */ + result?: V1TaskLogsFieldsResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1TaskLogsFieldsResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1TaskLogsResponse */ export interface StreamResultOfV1TaskLogsResponse { - /** - * - * @type {V1TaskLogsResponse} - * @memberof StreamResultOfV1TaskLogsResponse - */ - result?: V1TaskLogsResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1TaskLogsResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1TaskLogsResponse} + * @memberof StreamResultOfV1TaskLogsResponse + */ + result?: V1TaskLogsResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1TaskLogsResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1TrialLogsFieldsResponse */ export interface StreamResultOfV1TrialLogsFieldsResponse { - /** - * - * @type {V1TrialLogsFieldsResponse} - * @memberof StreamResultOfV1TrialLogsFieldsResponse - */ - result?: V1TrialLogsFieldsResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1TrialLogsFieldsResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1TrialLogsFieldsResponse} + * @memberof StreamResultOfV1TrialLogsFieldsResponse + */ + result?: V1TrialLogsFieldsResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1TrialLogsFieldsResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1TrialLogsResponse */ export interface StreamResultOfV1TrialLogsResponse { - /** - * - * @type {V1TrialLogsResponse} - * @memberof StreamResultOfV1TrialLogsResponse - */ - result?: V1TrialLogsResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1TrialLogsResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1TrialLogsResponse} + * @memberof StreamResultOfV1TrialLogsResponse + */ + result?: V1TrialLogsResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1TrialLogsResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1TrialsSampleResponse */ export interface StreamResultOfV1TrialsSampleResponse { - /** - * - * @type {V1TrialsSampleResponse} - * @memberof StreamResultOfV1TrialsSampleResponse - */ - result?: V1TrialsSampleResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1TrialsSampleResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1TrialsSampleResponse} + * @memberof StreamResultOfV1TrialsSampleResponse + */ + result?: V1TrialsSampleResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1TrialsSampleResponse + */ + error?: RuntimeStreamError; } /** - * + * * @export * @interface StreamResultOfV1TrialsSnapshotResponse */ export interface StreamResultOfV1TrialsSnapshotResponse { - /** - * - * @type {V1TrialsSnapshotResponse} - * @memberof StreamResultOfV1TrialsSnapshotResponse - */ - result?: V1TrialsSnapshotResponse; - /** - * - * @type {RuntimeStreamError} - * @memberof StreamResultOfV1TrialsSnapshotResponse - */ - error?: RuntimeStreamError; + /** + * + * @type {V1TrialsSnapshotResponse} + * @memberof StreamResultOfV1TrialsSnapshotResponse + */ + result?: V1TrialsSnapshotResponse; + /** + * + * @type {RuntimeStreamError} + * @memberof StreamResultOfV1TrialsSnapshotResponse + */ + error?: RuntimeStreamError; } /** * The current state of the task. - STATE_UNSPECIFIED: The task state is unknown. - STATE_PULLING: The task's base image is being pulled from the Docker registry. - STATE_STARTING: The image has been pulled and the task is being started, but the task is not ready yet. - STATE_RUNNING: The service in the task is running. - STATE_TERMINATED: The task has exited or has been aborted. - STATE_TERMINATING: The task has begun to exit. - STATE_WAITING: The task is waiting on something to complete. - STATE_QUEUED: Additional state to cover queueing operations. @@ -759,233 +751,231 @@ export interface StreamResultOfV1TrialsSnapshotResponse { * @enum {string} */ export const Taskv1State = { - UNSPECIFIED: 'STATE_UNSPECIFIED', - PULLING: 'STATE_PULLING', - STARTING: 'STATE_STARTING', - RUNNING: 'STATE_RUNNING', - TERMINATED: 'STATE_TERMINATED', - TERMINATING: 'STATE_TERMINATING', - WAITING: 'STATE_WAITING', - QUEUED: 'STATE_QUEUED', -} as const; -export type Taskv1State = ValueOf; + UNSPECIFIED: 'STATE_UNSPECIFIED', + PULLING: 'STATE_PULLING', + STARTING: 'STATE_STARTING', + RUNNING: 'STATE_RUNNING', + TERMINATED: 'STATE_TERMINATED', + TERMINATING: 'STATE_TERMINATING', + WAITING: 'STATE_WAITING', + QUEUED: 'STATE_QUEUED', +} as const +export type Taskv1State = ValueOf /** * To distinguish the 2 different categories of metrics. - PROFILER_METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - PROFILER_METRIC_TYPE_SYSTEM: For systems metrics, like GPU utilization or memory. - PROFILER_METRIC_TYPE_TIMING: For timing metrics, like how long a backwards pass or getting a batch from the dataloader took. - PROFILER_METRIC_TYPE_MISC: For other miscellaneous metrics. * @export * @enum {string} */ export const TrialProfilerMetricLabelsProfilerMetricType = { - UNSPECIFIED: 'PROFILER_METRIC_TYPE_UNSPECIFIED', - SYSTEM: 'PROFILER_METRIC_TYPE_SYSTEM', - TIMING: 'PROFILER_METRIC_TYPE_TIMING', - MISC: 'PROFILER_METRIC_TYPE_MISC', -} as const; -export type TrialProfilerMetricLabelsProfilerMetricType = ValueOf< - typeof TrialProfilerMetricLabelsProfilerMetricType ->; + UNSPECIFIED: 'PROFILER_METRIC_TYPE_UNSPECIFIED', + SYSTEM: 'PROFILER_METRIC_TYPE_SYSTEM', + TIMING: 'PROFILER_METRIC_TYPE_TIMING', + MISC: 'PROFILER_METRIC_TYPE_MISC', +} as const +export type TrialProfilerMetricLabelsProfilerMetricType = ValueOf /** * The current state of the trial. see \dT+ trial_state in db - STATE_UNSPECIFIED: The trial is in an unspecified state. - STATE_ACTIVE: The trial is in an active state. - STATE_PAUSED: The trial is in a paused state - STATE_STOPPING_CANCELED: The trial is canceled and is shutting down. - STATE_STOPPING_KILLED: The trial is killed and is shutting down. - STATE_STOPPING_COMPLETED: The trial is completed and is shutting down. - STATE_STOPPING_ERROR: The trial is errored and is shutting down. - STATE_CANCELED: The trial is canceled and is shut down. - STATE_COMPLETED: The trial is completed and is shut down. - STATE_ERROR: The trial is errored and is shut down. - STATE_QUEUED: The trial is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The trial is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The trial is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The trial's allocation is actively running. Running is a substate of the Active state. * @export * @enum {string} */ export const Trialv1State = { - UNSPECIFIED: 'STATE_UNSPECIFIED', - ACTIVE: 'STATE_ACTIVE', - PAUSED: 'STATE_PAUSED', - STOPPINGCANCELED: 'STATE_STOPPING_CANCELED', - STOPPINGKILLED: 'STATE_STOPPING_KILLED', - STOPPINGCOMPLETED: 'STATE_STOPPING_COMPLETED', - STOPPINGERROR: 'STATE_STOPPING_ERROR', - CANCELED: 'STATE_CANCELED', - COMPLETED: 'STATE_COMPLETED', - ERROR: 'STATE_ERROR', - QUEUED: 'STATE_QUEUED', - PULLING: 'STATE_PULLING', - STARTING: 'STATE_STARTING', - RUNNING: 'STATE_RUNNING', -} as const; -export type Trialv1State = ValueOf; + UNSPECIFIED: 'STATE_UNSPECIFIED', + ACTIVE: 'STATE_ACTIVE', + PAUSED: 'STATE_PAUSED', + STOPPINGCANCELED: 'STATE_STOPPING_CANCELED', + STOPPINGKILLED: 'STATE_STOPPING_KILLED', + STOPPINGCOMPLETED: 'STATE_STOPPING_COMPLETED', + STOPPINGERROR: 'STATE_STOPPING_ERROR', + CANCELED: 'STATE_CANCELED', + COMPLETED: 'STATE_COMPLETED', + ERROR: 'STATE_ERROR', + QUEUED: 'STATE_QUEUED', + PULLING: 'STATE_PULLING', + STARTING: 'STATE_STARTING', + RUNNING: 'STATE_RUNNING', +} as const +export type Trialv1State = ValueOf /** * Trial is a set of workloads and are exploring a determined set of hyperparameters. * @export * @interface Trialv1Trial */ export interface Trialv1Trial { - /** - * The id of the trial. - * @type {number} - * @memberof Trialv1Trial - */ - id: number; - /** - * The id of the parent experiment. - * @type {number} - * @memberof Trialv1Trial - */ - experimentId: number; - /** - * The time the trial was started. - * @type {Date | DateString} - * @memberof Trialv1Trial - */ - startTime: Date | DateString; - /** - * The time the trial ended if the trial is stopped. - * @type {Date | DateString} - * @memberof Trialv1Trial - */ - endTime?: Date | DateString; - /** - * The current state of the trial. - * @type {Trialv1State} - * @memberof Trialv1Trial - */ - state: Trialv1State; - /** - * Number times the trial restarted. - * @type {number} - * @memberof Trialv1Trial - */ - restarts: number; - /** - * Trial hyperparameters. - * @type {any} - * @memberof Trialv1Trial - */ - hparams: any; - /** - * The current processed batches. - * @type {number} - * @memberof Trialv1Trial - */ - totalBatchesProcessed: number; - /** - * Best validation. - * @type {V1MetricsWorkload} - * @memberof Trialv1Trial - */ - bestValidation?: V1MetricsWorkload; - /** - * Latest validation. - * @type {V1MetricsWorkload} - * @memberof Trialv1Trial - */ - latestValidation?: V1MetricsWorkload; - /** - * Best checkpoint. - * @type {V1CheckpointWorkload} - * @memberof Trialv1Trial - */ - bestCheckpoint?: V1CheckpointWorkload; - /** - * The last reported state of the trial runner (harness code). - * @type {string} - * @memberof Trialv1Trial - */ - runnerState?: string; - /** - * The wall clock time is all active time of the cluster for the trial, inclusive of everything (restarts, initiailization, etc), in seconds. - * @type {number} - * @memberof Trialv1Trial - */ - wallClockTime?: number; - /** - * UUID of checkpoint that this trial started from. - * @type {string} - * @memberof Trialv1Trial - */ - warmStartCheckpointUuid?: string; - /** - * Id of the first task associated with this trial. This field is deprecated since trials can have multiple tasks. - * @type {string} - * @memberof Trialv1Trial - */ - taskId?: string; - /** - * The sum of sizes of all resources in all checkpoints for the trial. - * @type {string} - * @memberof Trialv1Trial - */ - totalCheckpointSize?: string; - /** - * The count of checkpoints. - * @type {number} - * @memberof Trialv1Trial - */ - checkpointCount?: number; - /** - * summary metrics - * @type {any} - * @memberof Trialv1Trial - */ - summaryMetrics?: any; - /** - * Task IDs of tasks associated with this trial. Length of task_ids will always be greater or equal to one when TaskID is sent. For example CompareTrial we will send a reduced Trial object, without TaskID or TaskIDs fileld in. The first element of task_ids will be the same as task_id. task_ids is sorted ascending by task_run_id. - * @type {Array} - * @memberof Trialv1Trial - */ - taskIds?: Array; - /** - * Signed searcher metrics value. - * @type {number} - * @memberof Trialv1Trial - */ - searcherMetricValue?: number; - /** - * Number of days to retain logs for. - * @type {number} - * @memberof Trialv1Trial - */ - logRetentionDays?: number; - /** - * metadata associated with the trial (based off the metadata stored in the run). - * @type {any} - * @memberof Trialv1Trial - */ - metadata?: any; + /** + * The id of the trial. + * @type {number} + * @memberof Trialv1Trial + */ + id: number; + /** + * The id of the parent experiment. + * @type {number} + * @memberof Trialv1Trial + */ + experimentId: number; + /** + * The time the trial was started. + * @type {Date | DateString} + * @memberof Trialv1Trial + */ + startTime: Date | DateString; + /** + * The time the trial ended if the trial is stopped. + * @type {Date | DateString} + * @memberof Trialv1Trial + */ + endTime?: Date | DateString; + /** + * The current state of the trial. + * @type {Trialv1State} + * @memberof Trialv1Trial + */ + state: Trialv1State; + /** + * Number times the trial restarted. + * @type {number} + * @memberof Trialv1Trial + */ + restarts: number; + /** + * Trial hyperparameters. + * @type {any} + * @memberof Trialv1Trial + */ + hparams: any; + /** + * The current processed batches. + * @type {number} + * @memberof Trialv1Trial + */ + totalBatchesProcessed: number; + /** + * Best validation. + * @type {V1MetricsWorkload} + * @memberof Trialv1Trial + */ + bestValidation?: V1MetricsWorkload; + /** + * Latest validation. + * @type {V1MetricsWorkload} + * @memberof Trialv1Trial + */ + latestValidation?: V1MetricsWorkload; + /** + * Best checkpoint. + * @type {V1CheckpointWorkload} + * @memberof Trialv1Trial + */ + bestCheckpoint?: V1CheckpointWorkload; + /** + * The last reported state of the trial runner (harness code). + * @type {string} + * @memberof Trialv1Trial + */ + runnerState?: string; + /** + * The wall clock time is all active time of the cluster for the trial, inclusive of everything (restarts, initiailization, etc), in seconds. + * @type {number} + * @memberof Trialv1Trial + */ + wallClockTime?: number; + /** + * UUID of checkpoint that this trial started from. + * @type {string} + * @memberof Trialv1Trial + */ + warmStartCheckpointUuid?: string; + /** + * Id of the first task associated with this trial. This field is deprecated since trials can have multiple tasks. + * @type {string} + * @memberof Trialv1Trial + */ + taskId?: string; + /** + * The sum of sizes of all resources in all checkpoints for the trial. + * @type {string} + * @memberof Trialv1Trial + */ + totalCheckpointSize?: string; + /** + * The count of checkpoints. + * @type {number} + * @memberof Trialv1Trial + */ + checkpointCount?: number; + /** + * summary metrics + * @type {any} + * @memberof Trialv1Trial + */ + summaryMetrics?: any; + /** + * Task IDs of tasks associated with this trial. Length of task_ids will always be greater or equal to one when TaskID is sent. For example CompareTrial we will send a reduced Trial object, without TaskID or TaskIDs fileld in. The first element of task_ids will be the same as task_id. task_ids is sorted ascending by task_run_id. + * @type {Array} + * @memberof Trialv1Trial + */ + taskIds?: Array; + /** + * Signed searcher metrics value. + * @type {number} + * @memberof Trialv1Trial + */ + searcherMetricValue?: number; + /** + * Number of days to retain logs for. + * @type {number} + * @memberof Trialv1Trial + */ + logRetentionDays?: number; + /** + * metadata associated with the trial (based off the metadata stored in the run). + * @type {any} + * @memberof Trialv1Trial + */ + metadata?: any; } /** - * + * * @export * @interface V1AcceleratorData */ export interface V1AcceleratorData { - /** - * The id of the container. - * @type {string} - * @memberof V1AcceleratorData - */ - containerId?: string; - /** - * The id of the allocation. - * @type {string} - * @memberof V1AcceleratorData - */ - allocationId?: string; - /** - * The name of the node the allocation is on. - * @type {string} - * @memberof V1AcceleratorData - */ - nodeName?: string; - /** - * The id of the agent associated with the allocation. - * @type {string} - * @memberof V1AcceleratorData - */ - taskId?: string; - /** - * The type of accelerator. - * @type {string} - * @memberof V1AcceleratorData - */ - acceleratorType?: string; - /** - * An array of UUIDs of the accelerators associated with the allocation. - * @type {Array} - * @memberof V1AcceleratorData - */ - acceleratorUuids?: Array; + /** + * The id of the container. + * @type {string} + * @memberof V1AcceleratorData + */ + containerId?: string; + /** + * The id of the allocation. + * @type {string} + * @memberof V1AcceleratorData + */ + allocationId?: string; + /** + * The name of the node the allocation is on. + * @type {string} + * @memberof V1AcceleratorData + */ + nodeName?: string; + /** + * The id of the agent associated with the allocation. + * @type {string} + * @memberof V1AcceleratorData + */ + taskId?: string; + /** + * The type of accelerator. + * @type {string} + * @memberof V1AcceleratorData + */ + acceleratorType?: string; + /** + * An array of UUIDs of the accelerators associated with the allocation. + * @type {Array} + * @memberof V1AcceleratorData + */ + acceleratorUuids?: Array; } /** * Acknowledge the receipt of some stop signal. @@ -993,49 +983,51 @@ export interface V1AcceleratorData { * @interface V1AckAllocationPreemptionSignalRequest */ export interface V1AckAllocationPreemptionSignalRequest { - /** - * The allocation that is acknowledging the request. - * @type {string} - * @memberof V1AckAllocationPreemptionSignalRequest - */ - allocationId: string; + /** + * The allocation that is acknowledging the request. + * @type {string} + * @memberof V1AckAllocationPreemptionSignalRequest + */ + allocationId: string; } /** * Response to AckAllocationPreemptionSignalRequest. * @export * @interface V1AckAllocationPreemptionSignalResponse */ -export interface V1AckAllocationPreemptionSignalResponse {} +export interface V1AckAllocationPreemptionSignalResponse { +} /** * Response to ActivateExperimentRequest. * @export * @interface V1ActivateExperimentResponse */ -export interface V1ActivateExperimentResponse {} +export interface V1ActivateExperimentResponse { +} /** * Activate multiple experiments. * @export * @interface V1ActivateExperimentsRequest */ export interface V1ActivateExperimentsRequest { - /** - * Select experiments by id. - * @type {Array} - * @memberof V1ActivateExperimentsRequest - */ - experimentIds: Array; - /** - * Targets all experiments matching filters. - * @type {V1BulkExperimentFilters} - * @memberof V1ActivateExperimentsRequest - */ - filters?: V1BulkExperimentFilters; - /** - * Project id that the experiments belong to. - * @type {number} - * @memberof V1ActivateExperimentsRequest - */ - projectId: number; + /** + * Select experiments by id. + * @type {Array} + * @memberof V1ActivateExperimentsRequest + */ + experimentIds: Array; + /** + * Targets all experiments matching filters. + * @type {V1BulkExperimentFilters} + * @memberof V1ActivateExperimentsRequest + */ + filters?: V1BulkExperimentFilters; + /** + * Project id that the experiments belong to. + * @type {number} + * @memberof V1ActivateExperimentsRequest + */ + projectId: number; } /** * Response to ActivateExperimentsRequest. @@ -1043,12 +1035,12 @@ export interface V1ActivateExperimentsRequest { * @interface V1ActivateExperimentsResponse */ export interface V1ActivateExperimentsResponse { - /** - * Details on success or error for each experiment. - * @type {Array} - * @memberof V1ActivateExperimentsResponse - */ - results: Array; + /** + * Details on success or error for each experiment. + * @type {Array} + * @memberof V1ActivateExperimentsResponse + */ + results: Array; } /** * ActivityType represents a user activity - ACTIVITY_TYPE_UNSPECIFIED: Default activity type. - ACTIVITY_TYPE_GET: Represents a get request. @@ -1056,22 +1048,22 @@ export interface V1ActivateExperimentsResponse { * @enum {string} */ export const V1ActivityType = { - UNSPECIFIED: 'ACTIVITY_TYPE_UNSPECIFIED', - GET: 'ACTIVITY_TYPE_GET', -} as const; -export type V1ActivityType = ValueOf; + UNSPECIFIED: 'ACTIVITY_TYPE_UNSPECIFIED', + GET: 'ACTIVITY_TYPE_GET', +} as const +export type V1ActivityType = ValueOf /** * Response to AddProjectNoteRequest. * @export * @interface V1AddProjectNoteResponse */ export interface V1AddProjectNoteResponse { - /** - * The complete list of notes on a project. - * @type {Array} - * @memberof V1AddProjectNoteResponse - */ - notes: Array; + /** + * The complete list of notes on a project. + * @type {Array} + * @memberof V1AddProjectNoteResponse + */ + notes: Array; } /** * Address represents an exposed port on a container. @@ -1079,30 +1071,30 @@ export interface V1AddProjectNoteResponse { * @interface V1Address */ export interface V1Address { - /** - * ContainerIP is the IP address from inside the container. - * @type {string} - * @memberof V1Address - */ - containerIp?: string; - /** - * ContainerPort is the port from inside the container. - * @type {number} - * @memberof V1Address - */ - containerPort?: number; - /** - * HostIP is the IP address from outside the container. This can be different than the ContainerIP because of network forwarding on the host machine. - * @type {string} - * @memberof V1Address - */ - hostIp?: string; - /** - * HostPort is the IP port from outside the container. This can be different than the ContainerPort because of network forwarding on the host machine. - * @type {number} - * @memberof V1Address - */ - hostPort?: number; + /** + * ContainerIP is the IP address from inside the container. + * @type {string} + * @memberof V1Address + */ + containerIp?: string; + /** + * ContainerPort is the port from inside the container. + * @type {number} + * @memberof V1Address + */ + containerPort?: number; + /** + * HostIP is the IP address from outside the container. This can be different than the ContainerIP because of network forwarding on the host machine. + * @type {string} + * @memberof V1Address + */ + hostIp?: string; + /** + * HostPort is the IP port from outside the container. This can be different than the ContainerPort because of network forwarding on the host machine. + * @type {number} + * @memberof V1Address + */ + hostPort?: number; } /** * Agent is a pool of resources where containers are run. @@ -1110,72 +1102,72 @@ export interface V1Address { * @interface V1Agent */ export interface V1Agent { - /** - * The unique id of the agent. - * @type {string} - * @memberof V1Agent - */ - id: string; - /** - * The time when the agent registered with the master. - * @type {Date | DateString} - * @memberof V1Agent - */ - registeredTime?: Date | DateString; - /** - * A map of slot id to each slot of this agent. - * @type {{ [key: string]: V1Slot; }} - * @memberof V1Agent - */ - slots?: { [key: string]: V1Slot }; - /** - * A map of container id to all containers assigned to this agent. - * @type {{ [key: string]: V1Container; }} - * @memberof V1Agent - */ - containers?: { [key: string]: V1Container }; - /** - * This field has been deprecated and will be empty. - * @type {string} - * @memberof V1Agent - */ - label?: string; - /** - * The addresses of the agent. - * @type {Array} - * @memberof V1Agent - */ - addresses?: Array; - /** - * Flag notifying if containers can be scheduled on this agent. - * @type {boolean} - * @memberof V1Agent - */ - enabled?: boolean; - /** - * Flag notifying if this agent is in the draining mode: current containers will be allowed to finish but no new ones will be scheduled. - * @type {boolean} - * @memberof V1Agent - */ - draining?: boolean; - /** - * The Determined version that this agent was built from. - * @type {string} - * @memberof V1Agent - */ - version?: string; - /** - * The name of the resource pools the agent is in. Only slurm can contain multiples. - * @type {Array} - * @memberof V1Agent - */ - resourcePools?: Array; - /** - * The slot stats for this agent. - * @type {V1SlotStats} - * @memberof V1Agent - */ - slotStats: V1SlotStats; + /** + * The unique id of the agent. + * @type {string} + * @memberof V1Agent + */ + id: string; + /** + * The time when the agent registered with the master. + * @type {Date | DateString} + * @memberof V1Agent + */ + registeredTime?: Date | DateString; + /** + * A map of slot id to each slot of this agent. + * @type {{ [key: string]: V1Slot; }} + * @memberof V1Agent + */ + slots?: { [key: string]: V1Slot; }; + /** + * A map of container id to all containers assigned to this agent. + * @type {{ [key: string]: V1Container; }} + * @memberof V1Agent + */ + containers?: { [key: string]: V1Container; }; + /** + * This field has been deprecated and will be empty. + * @type {string} + * @memberof V1Agent + */ + label?: string; + /** + * The addresses of the agent. + * @type {Array} + * @memberof V1Agent + */ + addresses?: Array; + /** + * Flag notifying if containers can be scheduled on this agent. + * @type {boolean} + * @memberof V1Agent + */ + enabled?: boolean; + /** + * Flag notifying if this agent is in the draining mode: current containers will be allowed to finish but no new ones will be scheduled. + * @type {boolean} + * @memberof V1Agent + */ + draining?: boolean; + /** + * The Determined version that this agent was built from. + * @type {string} + * @memberof V1Agent + */ + version?: string; + /** + * The name of the resource pools the agent is in. Only slurm can contain multiples. + * @type {Array} + * @memberof V1Agent + */ + resourcePools?: Array; + /** + * The slot stats for this agent. + * @type {V1SlotStats} + * @memberof V1Agent + */ + slotStats: V1SlotStats; } /** * AgentUserGroup represents a username and primary group for a user on an agent host machine. @@ -1183,30 +1175,30 @@ export interface V1Agent { * @interface V1AgentUserGroup */ export interface V1AgentUserGroup { - /** - * The user id on the agent. - * @type {number} - * @memberof V1AgentUserGroup - */ - agentUid?: number; - /** - * The group id on the agent. - * @type {number} - * @memberof V1AgentUserGroup - */ - agentGid?: number; - /** - * User name. - * @type {string} - * @memberof V1AgentUserGroup - */ - agentUser?: string; - /** - * Group name. - * @type {string} - * @memberof V1AgentUserGroup - */ - agentGroup?: string; + /** + * The user id on the agent. + * @type {number} + * @memberof V1AgentUserGroup + */ + agentUid?: number; + /** + * The group id on the agent. + * @type {number} + * @memberof V1AgentUserGroup + */ + agentGid?: number; + /** + * User name. + * @type {string} + * @memberof V1AgentUserGroup + */ + agentUser?: string; + /** + * Group name. + * @type {string} + * @memberof V1AgentUserGroup + */ + agentGroup?: string; } /** * Aggregate statistics for a queue. @@ -1214,18 +1206,18 @@ export interface V1AgentUserGroup { * @interface V1AggregateQueueStats */ export interface V1AggregateQueueStats { - /** - * The date of this entry. - * @type {string} - * @memberof V1AggregateQueueStats - */ - periodStart: string; - /** - * The total number of seconds queued. - * @type {number} - * @memberof V1AggregateQueueStats - */ - seconds: number; + /** + * The date of this entry. + * @type {string} + * @memberof V1AggregateQueueStats + */ + periodStart: string; + /** + * The total number of seconds queued. + * @type {number} + * @memberof V1AggregateQueueStats + */ + seconds: number; } /** * Allocation tracks a specific instance of a Task. @@ -1233,136 +1225,137 @@ export interface V1AggregateQueueStats { * @interface V1Allocation */ export interface V1Allocation { - /** - * Unique ID of task associated with the allocation. - * @type {string} - * @memberof V1Allocation - */ - taskId: string; - /** - * The current state of the allocation. - * @type {Taskv1State} - * @memberof V1Allocation - */ - state: Taskv1State; - /** - * Whether the allocation is ready to access. - * @type {boolean} - * @memberof V1Allocation - */ - isReady?: boolean; - /** - * Start timestamp. - * @type {string} - * @memberof V1Allocation - */ - startTime?: string; - /** - * End timestamp if completed. - * @type {string} - * @memberof V1Allocation - */ - endTime?: string; - /** - * Unique ID of the allocation. - * @type {string} - * @memberof V1Allocation - */ - allocationId: string; - /** - * The number of slots associated with the allocation. - * @type {number} - * @memberof V1Allocation - */ - slots: number; - /** - * The exit reason for the allocation. - * @type {string} - * @memberof V1Allocation - */ - exitReason?: string; - /** - * The status code the allocation exits with. - * @type {number} - * @memberof V1Allocation - */ - statusCode?: number; -} -/** - * Arguments to an all gather. - * @export - * @interface V1AllocationAllGatherRequest - */ -export interface V1AllocationAllGatherRequest { - /** - * The ID of the allocation. - * @type {string} - * @memberof V1AllocationAllGatherRequest - */ - allocationId: string; - /** - * The UUID of the participant in an all gather. - * @type {string} - * @memberof V1AllocationAllGatherRequest - */ - requestUuid?: string; - /** - * The number of process to wait for. - * @type {number} - * @memberof V1AllocationAllGatherRequest - */ - numPeers?: number; - /** - * The data from this process. - * @type {any} - * @memberof V1AllocationAllGatherRequest - */ - data: any; + /** + * Unique ID of task associated with the allocation. + * @type {string} + * @memberof V1Allocation + */ + taskId: string; + /** + * The current state of the allocation. + * @type {Taskv1State} + * @memberof V1Allocation + */ + state: Taskv1State; + /** + * Whether the allocation is ready to access. + * @type {boolean} + * @memberof V1Allocation + */ + isReady?: boolean; + /** + * Start timestamp. + * @type {string} + * @memberof V1Allocation + */ + startTime?: string; + /** + * End timestamp if completed. + * @type {string} + * @memberof V1Allocation + */ + endTime?: string; + /** + * Unique ID of the allocation. + * @type {string} + * @memberof V1Allocation + */ + allocationId: string; + /** + * The number of slots associated with the allocation. + * @type {number} + * @memberof V1Allocation + */ + slots: number; + /** + * The exit reason for the allocation. + * @type {string} + * @memberof V1Allocation + */ + exitReason?: string; + /** + * The status code the allocation exits with. + * @type {number} + * @memberof V1Allocation + */ + statusCode?: number; } /** - * + * Arguments to an all gather. + * @export + * @interface V1AllocationAllGatherRequest + */ +export interface V1AllocationAllGatherRequest { + /** + * The ID of the allocation. + * @type {string} + * @memberof V1AllocationAllGatherRequest + */ + allocationId: string; + /** + * The UUID of the participant in an all gather. + * @type {string} + * @memberof V1AllocationAllGatherRequest + */ + requestUuid?: string; + /** + * The number of process to wait for. + * @type {number} + * @memberof V1AllocationAllGatherRequest + */ + numPeers?: number; + /** + * The data from this process. + * @type {any} + * @memberof V1AllocationAllGatherRequest + */ + data: any; +} +/** + * * @export * @interface V1AllocationAllGatherResponse */ export interface V1AllocationAllGatherResponse { - /** - * The data for all the processes. - * @type {Array} - * @memberof V1AllocationAllGatherResponse - */ - data: Array; + /** + * The data for all the processes. + * @type {Array} + * @memberof V1AllocationAllGatherResponse + */ + data: Array; } /** - * + * * @export * @interface V1AllocationPendingPreemptionSignalRequest */ export interface V1AllocationPendingPreemptionSignalRequest { - /** - * The id of the allocation. - * @type {string} - * @memberof V1AllocationPendingPreemptionSignalRequest - */ - allocationId: string; + /** + * The id of the allocation. + * @type {string} + * @memberof V1AllocationPendingPreemptionSignalRequest + */ + allocationId: string; } /** - * + * * @export * @interface V1AllocationPendingPreemptionSignalResponse */ -export interface V1AllocationPendingPreemptionSignalResponse {} +export interface V1AllocationPendingPreemptionSignalResponse { +} /** * Response to AllocationPreemptionSignalRequest. * @export * @interface V1AllocationPreemptionSignalResponse */ export interface V1AllocationPreemptionSignalResponse { - /** - * True if signaling preempt, otherwise just a synchronization marker. - * @type {boolean} - * @memberof V1AllocationPreemptionSignalResponse - */ - preempt?: boolean; + /** + * True if signaling preempt, otherwise just a synchronization marker. + * @type {boolean} + * @memberof V1AllocationPreemptionSignalResponse + */ + preempt?: boolean; } /** * Mark the given task as ready. @@ -1370,31 +1363,32 @@ export interface V1AllocationPreemptionSignalResponse { * @interface V1AllocationReadyRequest */ export interface V1AllocationReadyRequest { - /** - * The id of the allocation. - * @type {string} - * @memberof V1AllocationReadyRequest - */ - allocationId?: string; + /** + * The id of the allocation. + * @type {string} + * @memberof V1AllocationReadyRequest + */ + allocationId?: string; } /** * Response to AllocationReadyRequest. * @export * @interface V1AllocationReadyResponse */ -export interface V1AllocationReadyResponse {} +export interface V1AllocationReadyResponse { +} /** - * + * * @export * @interface V1AllocationRendezvousInfoResponse */ export interface V1AllocationRendezvousInfoResponse { - /** - * The rendezvous information. - * @type {V1RendezvousInfo} - * @memberof V1AllocationRendezvousInfoResponse - */ - rendezvousInfo: V1RendezvousInfo; + /** + * The rendezvous information. + * @type {V1RendezvousInfo} + * @memberof V1AllocationRendezvousInfoResponse + */ + rendezvousInfo: V1RendezvousInfo; } /** * AllocationSummary contains information about a task for external display. @@ -1402,66 +1396,66 @@ export interface V1AllocationRendezvousInfoResponse { * @interface V1AllocationSummary */ export interface V1AllocationSummary { - /** - * TaskID is the unique ID of a task among all tasks. - * @type {string} - * @memberof V1AllocationSummary - */ - taskId?: string; - /** - * AllocationID is the ID of an allocation of a task. It is usually of the form TaskID.allocation_number, maybe with some other metadata if different types of allocations run. - * @type {string} - * @memberof V1AllocationSummary - */ - allocationId?: string; - /** - * The name of the task. - * @type {string} - * @memberof V1AllocationSummary - */ - name?: string; - /** - * The registered time of the task. - * @type {Date | DateString} - * @memberof V1AllocationSummary - */ - registeredTime?: Date | DateString; - /** - * The name of the resource pool. - * @type {string} - * @memberof V1AllocationSummary - */ - resourcePool?: string; - /** - * The number of slots that are needed. - * @type {number} - * @memberof V1AllocationSummary - */ - slotsNeeded?: number; - /** - * ResourcesSummary provides a summary of the resources comprising what we know at the time the allocation is granted. - * @type {Array} - * @memberof V1AllocationSummary - */ - resources?: Array; - /** - * The type of the scheduler. Either 'FAIR_SHARE', 'PRIORITY', or 'ROUND_ROBIN'. - * @type {string} - * @memberof V1AllocationSummary - */ - schedulerType?: string; - /** - * THe priority of the task. - * @type {number} - * @memberof V1AllocationSummary - */ - priority?: number; - /** - * ProxyPortConfig configures a proxy the allocation should start. - * @type {Array} - * @memberof V1AllocationSummary - */ - proxyPorts?: Array; + /** + * TaskID is the unique ID of a task among all tasks. + * @type {string} + * @memberof V1AllocationSummary + */ + taskId?: string; + /** + * AllocationID is the ID of an allocation of a task. It is usually of the form TaskID.allocation_number, maybe with some other metadata if different types of allocations run. + * @type {string} + * @memberof V1AllocationSummary + */ + allocationId?: string; + /** + * The name of the task. + * @type {string} + * @memberof V1AllocationSummary + */ + name?: string; + /** + * The registered time of the task. + * @type {Date | DateString} + * @memberof V1AllocationSummary + */ + registeredTime?: Date | DateString; + /** + * The name of the resource pool. + * @type {string} + * @memberof V1AllocationSummary + */ + resourcePool?: string; + /** + * The number of slots that are needed. + * @type {number} + * @memberof V1AllocationSummary + */ + slotsNeeded?: number; + /** + * ResourcesSummary provides a summary of the resources comprising what we know at the time the allocation is granted. + * @type {Array} + * @memberof V1AllocationSummary + */ + resources?: Array; + /** + * The type of the scheduler. Either 'FAIR_SHARE', 'PRIORITY', or 'ROUND_ROBIN'. + * @type {string} + * @memberof V1AllocationSummary + */ + schedulerType?: string; + /** + * THe priority of the task. + * @type {number} + * @memberof V1AllocationSummary + */ + priority?: number; + /** + * ProxyPortConfig configures a proxy the allocation should start. + * @type {Array} + * @memberof V1AllocationSummary + */ + proxyPorts?: Array; } /** * Mark the given task as waiting. @@ -1469,49 +1463,51 @@ export interface V1AllocationSummary { * @interface V1AllocationWaitingRequest */ export interface V1AllocationWaitingRequest { - /** - * The id of the allocation. - * @type {string} - * @memberof V1AllocationWaitingRequest - */ - allocationId?: string; + /** + * The id of the allocation. + * @type {string} + * @memberof V1AllocationWaitingRequest + */ + allocationId?: string; } /** * Response to AllocationWaitingRequest. * @export * @interface V1AllocationWaitingResponse */ -export interface V1AllocationWaitingResponse {} +export interface V1AllocationWaitingResponse { +} /** * Response to ArchiveExperimentRequest. * @export * @interface V1ArchiveExperimentResponse */ -export interface V1ArchiveExperimentResponse {} +export interface V1ArchiveExperimentResponse { +} /** * Archive multiple experiments. * @export * @interface V1ArchiveExperimentsRequest */ export interface V1ArchiveExperimentsRequest { - /** - * Selecting experiments by id. - * @type {Array} - * @memberof V1ArchiveExperimentsRequest - */ - experimentIds: Array; - /** - * Targets all experiments matching filters. - * @type {V1BulkExperimentFilters} - * @memberof V1ArchiveExperimentsRequest - */ - filters?: V1BulkExperimentFilters; - /** - * Project id that the experiments belong to. - * @type {number} - * @memberof V1ArchiveExperimentsRequest - */ - projectId: number; + /** + * Selecting experiments by id. + * @type {Array} + * @memberof V1ArchiveExperimentsRequest + */ + experimentIds: Array; + /** + * Targets all experiments matching filters. + * @type {V1BulkExperimentFilters} + * @memberof V1ArchiveExperimentsRequest + */ + filters?: V1BulkExperimentFilters; + /** + * Project id that the experiments belong to. + * @type {number} + * @memberof V1ArchiveExperimentsRequest + */ + projectId: number; } /** * Response to ArchiveExperimentsRequest. @@ -1519,49 +1515,51 @@ export interface V1ArchiveExperimentsRequest { * @interface V1ArchiveExperimentsResponse */ export interface V1ArchiveExperimentsResponse { - /** - * Details on success or error for each experiment. - * @type {Array} - * @memberof V1ArchiveExperimentsResponse - */ - results: Array; + /** + * Details on success or error for each experiment. + * @type {Array} + * @memberof V1ArchiveExperimentsResponse + */ + results: Array; } /** - * + * * @export * @interface V1ArchiveModelResponse */ -export interface V1ArchiveModelResponse {} +export interface V1ArchiveModelResponse { +} /** * Response to ArchiveProjectRequest. * @export * @interface V1ArchiveProjectResponse */ -export interface V1ArchiveProjectResponse {} +export interface V1ArchiveProjectResponse { +} /** - * + * * @export * @interface V1ArchiveRunsRequest */ export interface V1ArchiveRunsRequest { - /** - * The ids of the runs being archived. - * @type {Array} - * @memberof V1ArchiveRunsRequest - */ - runIds: Array; - /** - * The id of the current parent project. - * @type {number} - * @memberof V1ArchiveRunsRequest - */ - projectId: number; - /** - * Filter expression - * @type {string} - * @memberof V1ArchiveRunsRequest - */ - filter?: string; + /** + * The ids of the runs being archived. + * @type {Array} + * @memberof V1ArchiveRunsRequest + */ + runIds: Array; + /** + * The id of the current parent project. + * @type {number} + * @memberof V1ArchiveRunsRequest + */ + projectId: number; + /** + * Filter expression + * @type {string} + * @memberof V1ArchiveRunsRequest + */ + filter?: string; } /** * Response to ArchiveRunsRequest. @@ -1569,210 +1567,215 @@ export interface V1ArchiveRunsRequest { * @interface V1ArchiveRunsResponse */ export interface V1ArchiveRunsResponse { - /** - * Details on success or error for each run. - * @type {Array} - * @memberof V1ArchiveRunsResponse - */ - results: Array; + /** + * Details on success or error for each run. + * @type {Array} + * @memberof V1ArchiveRunsResponse + */ + results: Array; } /** * Response to ArchiveWorkspaceRequest. * @export * @interface V1ArchiveWorkspaceResponse */ -export interface V1ArchiveWorkspaceResponse {} +export interface V1ArchiveWorkspaceResponse { +} /** * Add and remove multiple users from multiple groups. * @export * @interface V1AssignMultipleGroupsRequest */ export interface V1AssignMultipleGroupsRequest { - /** - * The user ids of users to edit group associations. - * @type {Array} - * @memberof V1AssignMultipleGroupsRequest - */ - userIds: Array; - /** - * The ids of groups to associate with users. - * @type {Array} - * @memberof V1AssignMultipleGroupsRequest - */ - addGroups: Array; - /** - * The ids of groups to disassociate from users. - * @type {Array} - * @memberof V1AssignMultipleGroupsRequest - */ - removeGroups: Array; + /** + * The user ids of users to edit group associations. + * @type {Array} + * @memberof V1AssignMultipleGroupsRequest + */ + userIds: Array; + /** + * The ids of groups to associate with users. + * @type {Array} + * @memberof V1AssignMultipleGroupsRequest + */ + addGroups: Array; + /** + * The ids of groups to disassociate from users. + * @type {Array} + * @memberof V1AssignMultipleGroupsRequest + */ + removeGroups: Array; } /** * Response to AssignMultipleGroupsRequest. * @export * @interface V1AssignMultipleGroupsResponse */ -export interface V1AssignMultipleGroupsResponse {} +export interface V1AssignMultipleGroupsResponse { +} /** * AssignRolesRequest is the body of the request for the call to grant a user or group a role. It requires group_id, role_id, and either scope_workspace_id or scope_project_id. * @export * @interface V1AssignRolesRequest */ export interface V1AssignRolesRequest { - /** - * the set of groups being assigned to a role. - * @type {Array} - * @memberof V1AssignRolesRequest - */ - groupRoleAssignments?: Array; - /** - * the set of users being assigned to a role. - * @type {Array} - * @memberof V1AssignRolesRequest - */ - userRoleAssignments?: Array; + /** + * the set of groups being assigned to a role. + * @type {Array} + * @memberof V1AssignRolesRequest + */ + groupRoleAssignments?: Array; + /** + * the set of users being assigned to a role. + * @type {Array} + * @memberof V1AssignRolesRequest + */ + userRoleAssignments?: Array; } /** * AssignRolesResponse is the body of the request for the call to grant a user or group a role. * @export * @interface V1AssignRolesResponse */ -export interface V1AssignRolesResponse {} +export interface V1AssignRolesResponse { +} /** - * + * * @export * @interface V1AwsCustomTag */ export interface V1AwsCustomTag { - /** - * The key of the custom tag - * @type {string} - * @memberof V1AwsCustomTag - */ - key: string; - /** - * The value of the custom tag - * @type {string} - * @memberof V1AwsCustomTag - */ - value: string; + /** + * The key of the custom tag + * @type {string} + * @memberof V1AwsCustomTag + */ + key: string; + /** + * The value of the custom tag + * @type {string} + * @memberof V1AwsCustomTag + */ + value: string; } /** - * + * * @export * @interface V1BindRPToWorkspaceRequest */ export interface V1BindRPToWorkspaceRequest { - /** - * The resource pool name. - * @type {string} - * @memberof V1BindRPToWorkspaceRequest - */ - resourcePoolName: string; - /** - * The workspace IDs to be bound to the resource pool. - * @type {Array} - * @memberof V1BindRPToWorkspaceRequest - */ - workspaceIds?: Array; - /** - * The workspace names to be bound to the resource pool. - * @type {Array} - * @memberof V1BindRPToWorkspaceRequest - */ - workspaceNames?: Array; + /** + * The resource pool name. + * @type {string} + * @memberof V1BindRPToWorkspaceRequest + */ + resourcePoolName: string; + /** + * The workspace IDs to be bound to the resource pool. + * @type {Array} + * @memberof V1BindRPToWorkspaceRequest + */ + workspaceIds?: Array; + /** + * The workspace names to be bound to the resource pool. + * @type {Array} + * @memberof V1BindRPToWorkspaceRequest + */ + workspaceNames?: Array; } /** * Bind a resource pool to workspaces response. * @export * @interface V1BindRPToWorkspaceResponse */ -export interface V1BindRPToWorkspaceResponse {} +export interface V1BindRPToWorkspaceResponse { +} /** * Filters to apply actions to multiple experiments. * @export * @interface V1BulkExperimentFilters */ export interface V1BulkExperimentFilters { - /** - * Limit experiments to those that match the description. - * @type {string} - * @memberof V1BulkExperimentFilters - */ - description?: string; - /** - * Limit experiments to those that match the name. - * @type {string} - * @memberof V1BulkExperimentFilters - */ - name?: string; - /** - * Limit experiments to those that match the provided labels. - * @type {Array} - * @memberof V1BulkExperimentFilters - */ - labels?: Array; - /** - * Limit experiments to those that are archived. - * @type {boolean} - * @memberof V1BulkExperimentFilters - */ - archived?: boolean; - /** - * Limit experiments to those that match the provided state. - * @type {Array} - * @memberof V1BulkExperimentFilters - */ - states?: Array; - /** - * Limit experiments to those that are owned by users with the specified userIds. - * @type {Array} - * @memberof V1BulkExperimentFilters - */ - userIds?: Array; - /** - * Limit experiments to those within a specified project, or 0 for all projects. - * @type {number} - * @memberof V1BulkExperimentFilters - */ - projectId?: number; - /** - * Experiment ids to exclude when filters are used. - * @type {Array} - * @memberof V1BulkExperimentFilters - */ - excludedExperimentIds?: Array; + /** + * Limit experiments to those that match the description. + * @type {string} + * @memberof V1BulkExperimentFilters + */ + description?: string; + /** + * Limit experiments to those that match the name. + * @type {string} + * @memberof V1BulkExperimentFilters + */ + name?: string; + /** + * Limit experiments to those that match the provided labels. + * @type {Array} + * @memberof V1BulkExperimentFilters + */ + labels?: Array; + /** + * Limit experiments to those that are archived. + * @type {boolean} + * @memberof V1BulkExperimentFilters + */ + archived?: boolean; + /** + * Limit experiments to those that match the provided state. + * @type {Array} + * @memberof V1BulkExperimentFilters + */ + states?: Array; + /** + * Limit experiments to those that are owned by users with the specified userIds. + * @type {Array} + * @memberof V1BulkExperimentFilters + */ + userIds?: Array; + /** + * Limit experiments to those within a specified project, or 0 for all projects. + * @type {number} + * @memberof V1BulkExperimentFilters + */ + projectId?: number; + /** + * Experiment ids to exclude when filters are used. + * @type {Array} + * @memberof V1BulkExperimentFilters + */ + excludedExperimentIds?: Array; } /** * Response to CancelExperimentRequest. * @export * @interface V1CancelExperimentResponse */ -export interface V1CancelExperimentResponse {} +export interface V1CancelExperimentResponse { +} /** * Cancel multiple experiments. * @export * @interface V1CancelExperimentsRequest */ export interface V1CancelExperimentsRequest { - /** - * Selecting experiments by id. - * @type {Array} - * @memberof V1CancelExperimentsRequest - */ - experimentIds: Array; - /** - * Targets all experiments matching filters. - * @type {V1BulkExperimentFilters} - * @memberof V1CancelExperimentsRequest - */ - filters?: V1BulkExperimentFilters; - /** - * Project id that the experiments belong to. - * @type {number} - * @memberof V1CancelExperimentsRequest - */ - projectId: number; + /** + * Selecting experiments by id. + * @type {Array} + * @memberof V1CancelExperimentsRequest + */ + experimentIds: Array; + /** + * Targets all experiments matching filters. + * @type {V1BulkExperimentFilters} + * @memberof V1CancelExperimentsRequest + */ + filters?: V1BulkExperimentFilters; + /** + * Project id that the experiments belong to. + * @type {number} + * @memberof V1CancelExperimentsRequest + */ + projectId: number; } /** * Response to CancelExperimentsRequest. @@ -1780,12 +1783,12 @@ export interface V1CancelExperimentsRequest { * @interface V1CancelExperimentsResponse */ export interface V1CancelExperimentsResponse { - /** - * Details on success or error for each experiment. - * @type {Array} - * @memberof V1CancelExperimentsResponse - */ - results: Array; + /** + * Details on success or error for each experiment. + * @type {Array} + * @memberof V1CancelExperimentsResponse + */ + results: Array; } /** * Checkpoint a collection of files saved by a task. @@ -1793,60 +1796,60 @@ export interface V1CancelExperimentsResponse { * @interface V1Checkpoint */ export interface V1Checkpoint { - /** - * ID of the task which generated this checkpoint. - * @type {string} - * @memberof V1Checkpoint - */ - taskId?: string; - /** - * ID of the allocation which generated this checkpoint. - * @type {string} - * @memberof V1Checkpoint - */ - allocationId?: string; - /** - * UUID of the checkpoint. - * @type {string} - * @memberof V1Checkpoint - */ - uuid: string; - /** - * Timestamp when the checkpoint was reported. - * @type {Date | DateString} - * @memberof V1Checkpoint - */ - reportTime?: Date | DateString; - /** - * Dictionary of file paths to file sizes in bytes of all files in the checkpoint. - * @type {{ [key: string]: string; }} - * @memberof V1Checkpoint - */ - resources: { [key: string]: string }; - /** - * User defined metadata associated with the checkpoint. - * @type {any} - * @memberof V1Checkpoint - */ - metadata: any; - /** - * The state of the underlying checkpoint. - * @type {Checkpointv1State} - * @memberof V1Checkpoint - */ - state: Checkpointv1State; - /** - * Training-related data for this checkpoint. - * @type {V1CheckpointTrainingMetadata} - * @memberof V1Checkpoint - */ - training: V1CheckpointTrainingMetadata; - /** - * Optional ID that describes where this checkpoint is stored. It will be null on every checkpoint pre 0.27.1. It can also be null when a user does not specify the storageID calling the report API themselves or when users don't provide a storage config to core_context. - * @type {number} - * @memberof V1Checkpoint - */ - storageId?: number; + /** + * ID of the task which generated this checkpoint. + * @type {string} + * @memberof V1Checkpoint + */ + taskId?: string; + /** + * ID of the allocation which generated this checkpoint. + * @type {string} + * @memberof V1Checkpoint + */ + allocationId?: string; + /** + * UUID of the checkpoint. + * @type {string} + * @memberof V1Checkpoint + */ + uuid: string; + /** + * Timestamp when the checkpoint was reported. + * @type {Date | DateString} + * @memberof V1Checkpoint + */ + reportTime?: Date | DateString; + /** + * Dictionary of file paths to file sizes in bytes of all files in the checkpoint. + * @type {{ [key: string]: string; }} + * @memberof V1Checkpoint + */ + resources: { [key: string]: string; }; + /** + * User defined metadata associated with the checkpoint. + * @type {any} + * @memberof V1Checkpoint + */ + metadata: any; + /** + * The state of the underlying checkpoint. + * @type {Checkpointv1State} + * @memberof V1Checkpoint + */ + state: Checkpointv1State; + /** + * Training-related data for this checkpoint. + * @type {V1CheckpointTrainingMetadata} + * @memberof V1Checkpoint + */ + training: V1CheckpointTrainingMetadata; + /** + * Optional ID that describes where this checkpoint is stored. It will be null on every checkpoint pre 0.27.1. It can also be null when a user does not specify the storageID calling the report API themselves or when users don't provide a storage config to core_context. + * @type {number} + * @memberof V1Checkpoint + */ + storageId?: number; } /** * Request to delete files matching globs in checkpoints. @@ -1854,73 +1857,74 @@ export interface V1Checkpoint { * @interface V1CheckpointsRemoveFilesRequest */ export interface V1CheckpointsRemoveFilesRequest { - /** - * The list of checkpoint_uuids for the requested checkpoints. - * @type {Array} - * @memberof V1CheckpointsRemoveFilesRequest - */ - checkpointUuids: Array; - /** - * The list of checkpoint_globs for the requested checkpoints. If a value is set to the empty string the checkpoint will only have its metadata refreshed. - * @type {Array} - * @memberof V1CheckpointsRemoveFilesRequest - */ - checkpointGlobs: Array; + /** + * The list of checkpoint_uuids for the requested checkpoints. + * @type {Array} + * @memberof V1CheckpointsRemoveFilesRequest + */ + checkpointUuids: Array; + /** + * The list of checkpoint_globs for the requested checkpoints. If a value is set to the empty string the checkpoint will only have its metadata refreshed. + * @type {Array} + * @memberof V1CheckpointsRemoveFilesRequest + */ + checkpointGlobs: Array; } /** * Response to CheckpointRemoveFilesRequest. * @export * @interface V1CheckpointsRemoveFilesResponse */ -export interface V1CheckpointsRemoveFilesResponse {} +export interface V1CheckpointsRemoveFilesResponse { +} /** * CheckpointTrainingMetadata is specifically metadata about training. * @export * @interface V1CheckpointTrainingMetadata */ export interface V1CheckpointTrainingMetadata { - /** - * The ID of the trial that created this checkpoint. - * @type {number} - * @memberof V1CheckpointTrainingMetadata - */ - trialId?: number; - /** - * The ID of the experiment that created this checkpoint. - * @type {number} - * @memberof V1CheckpointTrainingMetadata - */ - experimentId?: number; - /** - * The configuration of the experiment that created this checkpoint. - * @type {any} - * @memberof V1CheckpointTrainingMetadata - */ - experimentConfig?: any; - /** - * Hyperparameter values for the trial that created this checkpoint. - * @type {any} - * @memberof V1CheckpointTrainingMetadata - */ - hparams?: any; - /** - * Training metrics reported at the same steps_completed as the checkpoint. - * @type {V1Metrics} - * @memberof V1CheckpointTrainingMetadata - */ - trainingMetrics?: V1Metrics; - /** - * Validation metrics reported at the same steps_completed as the checkpoint. - * @type {V1Metrics} - * @memberof V1CheckpointTrainingMetadata - */ - validationMetrics?: V1Metrics; - /** - * Searcher metric (as specified by the expconf) at the same steps_completed of the checkpoint. - * @type {number} - * @memberof V1CheckpointTrainingMetadata - */ - searcherMetric?: number; + /** + * The ID of the trial that created this checkpoint. + * @type {number} + * @memberof V1CheckpointTrainingMetadata + */ + trialId?: number; + /** + * The ID of the experiment that created this checkpoint. + * @type {number} + * @memberof V1CheckpointTrainingMetadata + */ + experimentId?: number; + /** + * The configuration of the experiment that created this checkpoint. + * @type {any} + * @memberof V1CheckpointTrainingMetadata + */ + experimentConfig?: any; + /** + * Hyperparameter values for the trial that created this checkpoint. + * @type {any} + * @memberof V1CheckpointTrainingMetadata + */ + hparams?: any; + /** + * Training metrics reported at the same steps_completed as the checkpoint. + * @type {V1Metrics} + * @memberof V1CheckpointTrainingMetadata + */ + trainingMetrics?: V1Metrics; + /** + * Validation metrics reported at the same steps_completed as the checkpoint. + * @type {V1Metrics} + * @memberof V1CheckpointTrainingMetadata + */ + validationMetrics?: V1Metrics; + /** + * Searcher metric (as specified by the expconf) at the same steps_completed of the checkpoint. + * @type {number} + * @memberof V1CheckpointTrainingMetadata + */ + searcherMetric?: number; } /** * CheckpointWorkload is an artifact created by a trial during training. @@ -1928,42 +1932,42 @@ export interface V1CheckpointTrainingMetadata { * @interface V1CheckpointWorkload */ export interface V1CheckpointWorkload { - /** - * UUID of the checkpoint. - * @type {string} - * @memberof V1CheckpointWorkload - */ - uuid?: string; - /** - * The time the workload finished or was stopped. - * @type {Date | DateString} - * @memberof V1CheckpointWorkload - */ - endTime?: Date | DateString; - /** - * The state of the checkpoint. - * @type {Checkpointv1State} - * @memberof V1CheckpointWorkload - */ - state: Checkpointv1State; - /** - * Dictionary of file paths to file sizes in bytes of all files in the checkpoint. - * @type {{ [key: string]: string; }} - * @memberof V1CheckpointWorkload - */ - resources?: { [key: string]: string }; - /** - * Total number of batches as of this workload's completion. - * @type {number} - * @memberof V1CheckpointWorkload - */ - totalBatches: number; - /** - * User defined metadata associated with the checkpoint. - * @type {any} - * @memberof V1CheckpointWorkload - */ - metadata?: any; + /** + * UUID of the checkpoint. + * @type {string} + * @memberof V1CheckpointWorkload + */ + uuid?: string; + /** + * The time the workload finished or was stopped. + * @type {Date | DateString} + * @memberof V1CheckpointWorkload + */ + endTime?: Date | DateString; + /** + * The state of the checkpoint. + * @type {Checkpointv1State} + * @memberof V1CheckpointWorkload + */ + state: Checkpointv1State; + /** + * Dictionary of file paths to file sizes in bytes of all files in the checkpoint. + * @type {{ [key: string]: string; }} + * @memberof V1CheckpointWorkload + */ + resources?: { [key: string]: string; }; + /** + * Total number of batches as of this workload's completion. + * @type {number} + * @memberof V1CheckpointWorkload + */ + totalBatches: number; + /** + * User defined metadata associated with the checkpoint. + * @type {any} + * @memberof V1CheckpointWorkload + */ + metadata?: any; } /** * Response to CleanupLogsRequest. @@ -1971,12 +1975,12 @@ export interface V1CheckpointWorkload { * @interface V1CleanupLogsResponse */ export interface V1CleanupLogsResponse { - /** - * How many row of logs were removed. - * @type {string} - * @memberof V1CleanupLogsResponse - */ - removedCount: string; + /** + * How many row of logs were removed. + * @type {string} + * @memberof V1CleanupLogsResponse + */ + removedCount: string; } /** * Close a trial with given ID. @@ -1984,12 +1988,12 @@ export interface V1CleanupLogsResponse { * @interface V1CloseTrialOperation */ export interface V1CloseTrialOperation { - /** - * The ID of the trial to close. - * @type {string} - * @memberof V1CloseTrialOperation - */ - requestId?: string; + /** + * The ID of the trial to close. + * @type {string} + * @memberof V1CloseTrialOperation + */ + requestId?: string; } /** * Active notice from the server admin. @@ -1997,30 +2001,30 @@ export interface V1CloseTrialOperation { * @interface V1ClusterMessage */ export interface V1ClusterMessage { - /** - * Text content of message. - * @type {string} - * @memberof V1ClusterMessage - */ - message: string; - /** - * Time to begin showing message. - * @type {Date | DateString} - * @memberof V1ClusterMessage - */ - startTime: Date | DateString; - /** - * Time to stop showing message. - * @type {Date | DateString} - * @memberof V1ClusterMessage - */ - endTime?: Date | DateString; - /** - * Time message was created. - * @type {Date | DateString} - * @memberof V1ClusterMessage - */ - createdTime?: Date | DateString; + /** + * Text content of message. + * @type {string} + * @memberof V1ClusterMessage + */ + message: string; + /** + * Time to begin showing message. + * @type {Date | DateString} + * @memberof V1ClusterMessage + */ + startTime: Date | DateString; + /** + * Time to stop showing message. + * @type {Date | DateString} + * @memberof V1ClusterMessage + */ + endTime?: Date | DateString; + /** + * Time message was created. + * @type {Date | DateString} + * @memberof V1ClusterMessage + */ + createdTime?: Date | DateString; } /** * ColumnType indicates the type of data under the column - COLUMN_TYPE_UNSPECIFIED: data type is unknown/mixed - COLUMN_TYPE_TEXT: data type is textual - COLUMN_TYPE_NUMBER: data type is numeric - COLUMN_TYPE_DATE: data type is a date @@ -2028,90 +2032,90 @@ export interface V1ClusterMessage { * @enum {string} */ export const V1ColumnType = { - UNSPECIFIED: 'COLUMN_TYPE_UNSPECIFIED', - TEXT: 'COLUMN_TYPE_TEXT', - NUMBER: 'COLUMN_TYPE_NUMBER', - DATE: 'COLUMN_TYPE_DATE', -} as const; -export type V1ColumnType = ValueOf; + UNSPECIFIED: 'COLUMN_TYPE_UNSPECIFIED', + TEXT: 'COLUMN_TYPE_TEXT', + NUMBER: 'COLUMN_TYPE_NUMBER', + DATE: 'COLUMN_TYPE_DATE', +} as const +export type V1ColumnType = ValueOf /** * Command is a single container running the configured command. * @export * @interface V1Command */ export interface V1Command { - /** - * The id of the command. - * @type {string} - * @memberof V1Command - */ - id: string; - /** - * The description of the command. - * @type {string} - * @memberof V1Command - */ - description: string; - /** - * The state of the command. - * @type {Taskv1State} - * @memberof V1Command - */ - state: Taskv1State; - /** - * The time the command was started. - * @type {Date | DateString} - * @memberof V1Command - */ - startTime: Date | DateString; - /** - * The container running the command. - * @type {V1Container} - * @memberof V1Command - */ - container?: V1Container; - /** - * The display name of the user that created the command. - * @type {string} - * @memberof V1Command - */ - displayName?: string; - /** - * The id of the user that created the command. - * @type {number} - * @memberof V1Command - */ - userId?: number; - /** - * The username of the user that created the command. - * @type {string} - * @memberof V1Command - */ - username: string; - /** - * The name of the resource pool the command was created in - * @type {string} - * @memberof V1Command - */ - resourcePool: string; - /** - * The exit status; - * @type {string} - * @memberof V1Command - */ - exitStatus?: string; - /** - * The associated job id. - * @type {string} - * @memberof V1Command - */ - jobId: string; - /** - * The workspace id. - * @type {number} - * @memberof V1Command - */ - workspaceId: number; + /** + * The id of the command. + * @type {string} + * @memberof V1Command + */ + id: string; + /** + * The description of the command. + * @type {string} + * @memberof V1Command + */ + description: string; + /** + * The state of the command. + * @type {Taskv1State} + * @memberof V1Command + */ + state: Taskv1State; + /** + * The time the command was started. + * @type {Date | DateString} + * @memberof V1Command + */ + startTime: Date | DateString; + /** + * The container running the command. + * @type {V1Container} + * @memberof V1Command + */ + container?: V1Container; + /** + * The display name of the user that created the command. + * @type {string} + * @memberof V1Command + */ + displayName?: string; + /** + * The id of the user that created the command. + * @type {number} + * @memberof V1Command + */ + userId?: number; + /** + * The username of the user that created the command. + * @type {string} + * @memberof V1Command + */ + username: string; + /** + * The name of the resource pool the command was created in + * @type {string} + * @memberof V1Command + */ + resourcePool: string; + /** + * The exit status; + * @type {string} + * @memberof V1Command + */ + exitStatus?: string; + /** + * The associated job id. + * @type {string} + * @memberof V1Command + */ + jobId: string; + /** + * The workspace id. + * @type {number} + * @memberof V1Command + */ + workspaceId: number; } /** * Container for a requested trial and its metrics. @@ -2119,18 +2123,18 @@ export interface V1Command { * @interface V1ComparableTrial */ export interface V1ComparableTrial { - /** - * The requested trial. - * @type {Trialv1Trial} - * @memberof V1ComparableTrial - */ - trial: Trialv1Trial; - /** - * The downsampled datapoints. - * @type {Array} - * @memberof V1ComparableTrial - */ - metrics: Array; + /** + * The requested trial. + * @type {Trialv1Trial} + * @memberof V1ComparableTrial + */ + trial: Trialv1Trial; + /** + * The downsampled datapoints. + * @type {Array} + * @memberof V1ComparableTrial + */ + metrics: Array; } /** * Response to CompareTrialsRequest. @@ -2138,37 +2142,38 @@ export interface V1ComparableTrial { * @interface V1CompareTrialsResponse */ export interface V1CompareTrialsResponse { - /** - * A list of objects containing trial and metrics information. - * @type {Array} - * @memberof V1CompareTrialsResponse - */ - trials: Array; + /** + * A list of objects containing trial and metrics information. + * @type {Array} + * @memberof V1CompareTrialsResponse + */ + trials: Array; } /** - * + * * @export * @interface V1CompleteTrialSearcherValidationResponse */ -export interface V1CompleteTrialSearcherValidationResponse {} +export interface V1CompleteTrialSearcherValidationResponse { +} /** * Used to complete a ValidateAfterOperation. * @export * @interface V1CompleteValidateAfterOperation */ export interface V1CompleteValidateAfterOperation { - /** - * The ValidateAfterOperation being completed. - * @type {V1ValidateAfterOperation} - * @memberof V1CompleteValidateAfterOperation - */ - op?: V1ValidateAfterOperation; - /** - * The value of searcher metric associated with this completed operation. The metric provided should be the metric used to guide HP search. - * @type {any} - * @memberof V1CompleteValidateAfterOperation - */ - searcherMetric?: any; + /** + * The ValidateAfterOperation being completed. + * @type {V1ValidateAfterOperation} + * @memberof V1CompleteValidateAfterOperation + */ + op?: V1ValidateAfterOperation; + /** + * The value of searcher metric associated with this completed operation. The metric provided should be the metric used to guide HP search. + * @type {any} + * @memberof V1CompleteValidateAfterOperation + */ + searcherMetric?: any; } /** * The config to be patched into Master Config. @@ -2176,12 +2181,12 @@ export interface V1CompleteValidateAfterOperation { * @interface V1Config */ export interface V1Config { - /** - * The log config to be patched into Master Config. - * @type {V1LogConfig} - * @memberof V1Config - */ - log?: V1LogConfig; + /** + * The log config to be patched into Master Config. + * @type {V1LogConfig} + * @memberof V1Config + */ + log?: V1LogConfig; } /** * Container is a Docker container that is either scheduled to run or is currently running on a set of slots. @@ -2189,36 +2194,36 @@ export interface V1Config { * @interface V1Container */ export interface V1Container { - /** - * The id of the task that is currently managing this container. - * @type {string} - * @memberof V1Container - */ - parent?: string; - /** - * The unique id of this instance of a container. - * @type {string} - * @memberof V1Container - */ - id: string; - /** - * The current state that the container is currently in. - * @type {Containerv1State} - * @memberof V1Container - */ - state: Containerv1State; - /** - * A list of devices that is being used by this container. - * @type {Array} - * @memberof V1Container - */ - devices?: Array; - /** - * User has insufficient permissions to view this container's details. If true, we obfuscate: (1) parent (2) id (4) devices - * @type {boolean} - * @memberof V1Container - */ - permissionDenied?: boolean; + /** + * The id of the task that is currently managing this container. + * @type {string} + * @memberof V1Container + */ + parent?: string; + /** + * The unique id of this instance of a container. + * @type {string} + * @memberof V1Container + */ + id: string; + /** + * The current state that the container is currently in. + * @type {Containerv1State} + * @memberof V1Container + */ + state: Containerv1State; + /** + * A list of devices that is being used by this container. + * @type {Array} + * @memberof V1Container + */ + devices?: Array; + /** + * User has insufficient permissions to view this container's details. If true, we obfuscate: (1) parent (2) id (4) devices + * @type {boolean} + * @memberof V1Container + */ + permissionDenied?: boolean; } /** * Request to continue an experiment. @@ -2226,37 +2231,37 @@ export interface V1Container { * @interface V1ContinueExperimentRequest */ export interface V1ContinueExperimentRequest { - /** - * Experiment ID to continue. - * @type {number} - * @memberof V1ContinueExperimentRequest - */ - id: number; - /** - * Experiment config (YAML) to merge with the experiment's config. - * @type {string} - * @memberof V1ContinueExperimentRequest - */ - overrideConfig?: string; -} -/** - * Request to continue an experiment. + /** + * Experiment ID to continue. + * @type {number} + * @memberof V1ContinueExperimentRequest + */ + id: number; + /** + * Experiment config (YAML) to merge with the experiment's config. + * @type {string} + * @memberof V1ContinueExperimentRequest + */ + overrideConfig?: string; +} +/** + * Request to continue an experiment. * @export * @interface V1ContinueExperimentResponse */ export interface V1ContinueExperimentResponse { - /** - * The created experiment. - * @type {V1Experiment} - * @memberof V1ContinueExperimentResponse - */ - experiment: V1Experiment; - /** - * List of any related warnings. - * @type {Array} - * @memberof V1ContinueExperimentResponse - */ - warnings?: Array; + /** + * The created experiment. + * @type {V1Experiment} + * @memberof V1ContinueExperimentResponse + */ + experiment: V1Experiment; + /** + * List of any related warnings. + * @type {Array} + * @memberof V1ContinueExperimentResponse + */ + warnings?: Array; } /** * Request to create a new experiment. @@ -2264,54 +2269,54 @@ export interface V1ContinueExperimentResponse { * @interface V1CreateExperimentRequest */ export interface V1CreateExperimentRequest { - /** - * Experiment context. - * @type {Array} - * @memberof V1CreateExperimentRequest - */ - modelDefinition?: Array; - /** - * Experiment config (YAML). - * @type {string} - * @memberof V1CreateExperimentRequest - */ - config?: string; - /** - * Only validate instead of creating the experiment. A dry run. - * @type {boolean} - * @memberof V1CreateExperimentRequest - */ - validateOnly?: boolean; - /** - * Parent experiment id. - * @type {number} - * @memberof V1CreateExperimentRequest - */ - parentId?: number; - /** - * Request to auto-activate the experiment. - * @type {boolean} - * @memberof V1CreateExperimentRequest - */ - activate?: boolean; - /** - * Project id to contain the experiment. - * @type {number} - * @memberof V1CreateExperimentRequest - */ - projectId?: number; - /** - * Template to use for the experiment. - * @type {string} - * @memberof V1CreateExperimentRequest - */ - template?: string; - /** - * Unmanaged experiments are detached. - * @type {boolean} - * @memberof V1CreateExperimentRequest - */ - unmanaged?: boolean; + /** + * Experiment context. + * @type {Array} + * @memberof V1CreateExperimentRequest + */ + modelDefinition?: Array; + /** + * Experiment config (YAML). + * @type {string} + * @memberof V1CreateExperimentRequest + */ + config?: string; + /** + * Only validate instead of creating the experiment. A dry run. + * @type {boolean} + * @memberof V1CreateExperimentRequest + */ + validateOnly?: boolean; + /** + * Parent experiment id. + * @type {number} + * @memberof V1CreateExperimentRequest + */ + parentId?: number; + /** + * Request to auto-activate the experiment. + * @type {boolean} + * @memberof V1CreateExperimentRequest + */ + activate?: boolean; + /** + * Project id to contain the experiment. + * @type {number} + * @memberof V1CreateExperimentRequest + */ + projectId?: number; + /** + * Template to use for the experiment. + * @type {string} + * @memberof V1CreateExperimentRequest + */ + template?: string; + /** + * Unmanaged experiments are detached. + * @type {boolean} + * @memberof V1CreateExperimentRequest + */ + unmanaged?: boolean; } /** * Response to CreateExperimentRequest. @@ -2319,24 +2324,24 @@ export interface V1CreateExperimentRequest { * @interface V1CreateExperimentResponse */ export interface V1CreateExperimentResponse { - /** - * The created experiment. - * @type {V1Experiment} - * @memberof V1CreateExperimentResponse - */ - experiment: V1Experiment; - /** - * The created experiment config. - * @type {any} - * @memberof V1CreateExperimentResponse - */ - config: any; - /** - * List of any related warnings. - * @type {Array} - * @memberof V1CreateExperimentResponse - */ - warnings?: Array; + /** + * The created experiment. + * @type {V1Experiment} + * @memberof V1CreateExperimentResponse + */ + experiment: V1Experiment; + /** + * The created experiment config. + * @type {any} + * @memberof V1CreateExperimentResponse + */ + config: any; + /** + * List of any related warnings. + * @type {Array} + * @memberof V1CreateExperimentResponse + */ + warnings?: Array; } /** * Request to create a new generic task. @@ -2344,48 +2349,48 @@ export interface V1CreateExperimentResponse { * @interface V1CreateGenericTaskRequest */ export interface V1CreateGenericTaskRequest { - /** - * Generic task context. - * @type {Array} - * @memberof V1CreateGenericTaskRequest - */ - contextDirectory: Array; - /** - * Generic task config (YAML). - * @type {string} - * @memberof V1CreateGenericTaskRequest - */ - config: string; - /** - * Project id to contain the experiment. - * @type {number} - * @memberof V1CreateGenericTaskRequest - */ - projectId?: number; - /** - * Parent ID of new task - * @type {string} - * @memberof V1CreateGenericTaskRequest - */ - parentId?: string; - /** - * If True inherits the context directory from the paren task (requires parent_id) - * @type {boolean} - * @memberof V1CreateGenericTaskRequest - */ - inheritContext?: boolean; - /** - * Id of the task that this task is forked from - * @type {string} - * @memberof V1CreateGenericTaskRequest - */ - forkedFrom?: string; - /** - * Flag for whether task can be paused or not. - * @type {boolean} - * @memberof V1CreateGenericTaskRequest - */ - noPause?: boolean; + /** + * Generic task context. + * @type {Array} + * @memberof V1CreateGenericTaskRequest + */ + contextDirectory: Array; + /** + * Generic task config (YAML). + * @type {string} + * @memberof V1CreateGenericTaskRequest + */ + config: string; + /** + * Project id to contain the experiment. + * @type {number} + * @memberof V1CreateGenericTaskRequest + */ + projectId?: number; + /** + * Parent ID of new task + * @type {string} + * @memberof V1CreateGenericTaskRequest + */ + parentId?: string; + /** + * If True inherits the context directory from the paren task (requires parent_id) + * @type {boolean} + * @memberof V1CreateGenericTaskRequest + */ + inheritContext?: boolean; + /** + * Id of the task that this task is forked from + * @type {string} + * @memberof V1CreateGenericTaskRequest + */ + forkedFrom?: string; + /** + * Flag for whether task can be paused or not. + * @type {boolean} + * @memberof V1CreateGenericTaskRequest + */ + noPause?: boolean; } /** * Response to CreateExperimentRequest. @@ -2393,18 +2398,18 @@ export interface V1CreateGenericTaskRequest { * @interface V1CreateGenericTaskResponse */ export interface V1CreateGenericTaskResponse { - /** - * The created generic taskID. - * @type {string} - * @memberof V1CreateGenericTaskResponse - */ - taskId: string; - /** - * List of any related warnings. - * @type {Array} - * @memberof V1CreateGenericTaskResponse - */ - warnings?: Array; + /** + * The created generic taskID. + * @type {string} + * @memberof V1CreateGenericTaskResponse + */ + taskId: string; + /** + * List of any related warnings. + * @type {Array} + * @memberof V1CreateGenericTaskResponse + */ + warnings?: Array; } /** * CreateGroupRequest is the body of the request for the call to create a group. @@ -2412,18 +2417,18 @@ export interface V1CreateGenericTaskResponse { * @interface V1CreateGroupRequest */ export interface V1CreateGroupRequest { - /** - * The name the new group should have - * @type {string} - * @memberof V1CreateGroupRequest - */ - name: string; - /** - * The ids of users that should be added to the new group - * @type {Array} - * @memberof V1CreateGroupRequest - */ - addUsers?: Array; + /** + * The name the new group should have + * @type {string} + * @memberof V1CreateGroupRequest + */ + name: string; + /** + * The ids of users that should be added to the new group + * @type {Array} + * @memberof V1CreateGroupRequest + */ + addUsers?: Array; } /** * CreateGroupResponse is the body of the response for the call to update a group and its members. @@ -2431,12 +2436,12 @@ export interface V1CreateGroupRequest { * @interface V1CreateGroupResponse */ export interface V1CreateGroupResponse { - /** - * Info about the group after the update succeeded. - * @type {V1GroupDetails} - * @memberof V1CreateGroupResponse - */ - group: V1GroupDetails; + /** + * Info about the group after the update succeeded. + * @type {V1GroupDetails} + * @memberof V1CreateGroupResponse + */ + group: V1GroupDetails; } /** * Create a trial with given hyperparameters. @@ -2444,18 +2449,18 @@ export interface V1CreateGroupResponse { * @interface V1CreateTrialOperation */ export interface V1CreateTrialOperation { - /** - * The ID of the trial to create. - * @type {string} - * @memberof V1CreateTrialOperation - */ - requestId?: string; - /** - * A JSON object representing the hyperparameters. - * @type {string} - * @memberof V1CreateTrialOperation - */ - hyperparams?: string; + /** + * The ID of the trial to create. + * @type {string} + * @memberof V1CreateTrialOperation + */ + requestId?: string; + /** + * A JSON object representing the hyperparameters. + * @type {string} + * @memberof V1CreateTrialOperation + */ + hyperparams?: string; } /** * Create a trial. @@ -2463,24 +2468,24 @@ export interface V1CreateTrialOperation { * @interface V1CreateTrialRequest */ export interface V1CreateTrialRequest { - /** - * The id of the parent experiment. - * @type {number} - * @memberof V1CreateTrialRequest - */ - experimentId?: number; - /** - * Trial hyperparameters. - * @type {any} - * @memberof V1CreateTrialRequest - */ - hparams?: any; - /** - * Currently only unmanaged trials are supported, must be true. - * @type {boolean} - * @memberof V1CreateTrialRequest - */ - unmanaged?: boolean; + /** + * The id of the parent experiment. + * @type {number} + * @memberof V1CreateTrialRequest + */ + experimentId?: number; + /** + * Trial hyperparameters. + * @type {any} + * @memberof V1CreateTrialRequest + */ + hparams?: any; + /** + * Currently only unmanaged trials are supported, must be true. + * @type {boolean} + * @memberof V1CreateTrialRequest + */ + unmanaged?: boolean; } /** * Response to CreateTrialRequest. @@ -2488,12 +2493,12 @@ export interface V1CreateTrialRequest { * @interface V1CreateTrialResponse */ export interface V1CreateTrialResponse { - /** - * The requested trial. - * @type {Trialv1Trial} - * @memberof V1CreateTrialResponse - */ - trial: Trialv1Trial; + /** + * The requested trial. + * @type {Trialv1Trial} + * @memberof V1CreateTrialResponse + */ + trial: Trialv1Trial; } /** * Response to CurrentUserRequest. @@ -2501,12 +2506,12 @@ export interface V1CreateTrialResponse { * @interface V1CurrentUserResponse */ export interface V1CurrentUserResponse { - /** - * The currently logged in user. - * @type {V1User} - * @memberof V1CurrentUserResponse - */ - user: V1User; + /** + * The currently logged in user. + * @type {V1User} + * @memberof V1CurrentUserResponse + */ + user: V1User; } /** * One datapoint in a series of metrics from a trial in batch. @@ -2514,99 +2519,102 @@ export interface V1CurrentUserResponse { * @interface V1DataPoint */ export interface V1DataPoint { - /** - * Total batches processed by the time this measurement is taken. - * @type {number} - * @memberof V1DataPoint - */ - batches: number; - /** - * Values of the requested metrics at this point in the trial. - * @type {any} - * @memberof V1DataPoint - */ - values?: any; - /** - * The time the measurement is taken. - * @type {Date | DateString} - * @memberof V1DataPoint - */ - time: Date | DateString; - /** - * The epoch this measurement is taken. - * @type {number} - * @memberof V1DataPoint - */ - epoch?: number; + /** + * Total batches processed by the time this measurement is taken. + * @type {number} + * @memberof V1DataPoint + */ + batches: number; + /** + * Values of the requested metrics at this point in the trial. + * @type {any} + * @memberof V1DataPoint + */ + values?: any; + /** + * The time the measurement is taken. + * @type {Date | DateString} + * @memberof V1DataPoint + */ + time: Date | DateString; + /** + * The epoch this measurement is taken. + * @type {number} + * @memberof V1DataPoint + */ + epoch?: number; } /** - * + * * @export * @interface V1DeleteCheckpointsRequest */ export interface V1DeleteCheckpointsRequest { - /** - * The list of checkpoint_uuids for the requested checkpoint. - * @type {Array} - * @memberof V1DeleteCheckpointsRequest - */ - checkpointUuids: Array; + /** + * The list of checkpoint_uuids for the requested checkpoint. + * @type {Array} + * @memberof V1DeleteCheckpointsRequest + */ + checkpointUuids: Array; } /** - * + * * @export * @interface V1DeleteCheckpointsResponse */ -export interface V1DeleteCheckpointsResponse {} +export interface V1DeleteCheckpointsResponse { +} /** * Response to DeleteClusterMessageRequest. * @export * @interface V1DeleteClusterMessageResponse */ -export interface V1DeleteClusterMessageResponse {} +export interface V1DeleteClusterMessageResponse { +} /** * Response to DeleteExperimentLabelRequest. * @export * @interface V1DeleteExperimentLabelResponse */ export interface V1DeleteExperimentLabelResponse { - /** - * The complete list of labels associated with the experiment. - * @type {Array} - * @memberof V1DeleteExperimentLabelResponse - */ - labels: Array; + /** + * The complete list of labels associated with the experiment. + * @type {Array} + * @memberof V1DeleteExperimentLabelResponse + */ + labels: Array; } /** * Response to DeleteExperimentRequest. * @export * @interface V1DeleteExperimentResponse */ -export interface V1DeleteExperimentResponse {} +export interface V1DeleteExperimentResponse { +} /** * Delete multiple experiments. * @export * @interface V1DeleteExperimentsRequest */ export interface V1DeleteExperimentsRequest { - /** - * Selecting experiments by id. - * @type {Array} - * @memberof V1DeleteExperimentsRequest - */ - experimentIds: Array; - /** - * Targets all experiments matching filters. - * @type {V1BulkExperimentFilters} - * @memberof V1DeleteExperimentsRequest - */ - filters?: V1BulkExperimentFilters; - /** - * Project id that the experiments belong to. - * @type {number} - * @memberof V1DeleteExperimentsRequest - */ - projectId: number; + /** + * Selecting experiments by id. + * @type {Array} + * @memberof V1DeleteExperimentsRequest + */ + experimentIds: Array; + /** + * Targets all experiments matching filters. + * @type {V1BulkExperimentFilters} + * @memberof V1DeleteExperimentsRequest + */ + filters?: V1BulkExperimentFilters; + /** + * Project id that the experiments belong to. + * @type {number} + * @memberof V1DeleteExperimentsRequest + */ + projectId: number; } /** * Response to DeleteExperimentsRequest. @@ -2614,43 +2622,46 @@ export interface V1DeleteExperimentsRequest { * @interface V1DeleteExperimentsResponse */ export interface V1DeleteExperimentsResponse { - /** - * Details on success or error for each experiment. - * @type {Array} - * @memberof V1DeleteExperimentsResponse - */ - results: Array; + /** + * Details on success or error for each experiment. + * @type {Array} + * @memberof V1DeleteExperimentsResponse + */ + results: Array; } /** * DeleteGroupResponse is the body of the response for the call to delete a group. * @export * @interface V1DeleteGroupResponse */ -export interface V1DeleteGroupResponse {} +export interface V1DeleteGroupResponse { +} /** - * + * * @export * @interface V1DeleteModelResponse */ -export interface V1DeleteModelResponse {} +export interface V1DeleteModelResponse { +} /** - * + * * @export * @interface V1DeleteModelVersionResponse */ -export interface V1DeleteModelVersionResponse {} +export interface V1DeleteModelVersionResponse { +} /** * Response to DeleteProjectRequest. * @export * @interface V1DeleteProjectResponse */ export interface V1DeleteProjectResponse { - /** - * Status of deletion. - * @type {boolean} - * @memberof V1DeleteProjectResponse - */ - completed: boolean; + /** + * Status of deletion. + * @type {boolean} + * @memberof V1DeleteProjectResponse + */ + completed: boolean; } /** * Delete runs. @@ -2658,24 +2669,24 @@ export interface V1DeleteProjectResponse { * @interface V1DeleteRunsRequest */ export interface V1DeleteRunsRequest { - /** - * The ids of the runs being deleted. - * @type {Array} - * @memberof V1DeleteRunsRequest - */ - runIds: Array; - /** - * Project id of the runs being deleted. - * @type {number} - * @memberof V1DeleteRunsRequest - */ - projectId?: number; - /** - * Filter expression - * @type {string} - * @memberof V1DeleteRunsRequest - */ - filter?: string; + /** + * The ids of the runs being deleted. + * @type {Array} + * @memberof V1DeleteRunsRequest + */ + runIds: Array; + /** + * Project id of the runs being deleted. + * @type {number} + * @memberof V1DeleteRunsRequest + */ + projectId?: number; + /** + * Filter expression + * @type {string} + * @memberof V1DeleteRunsRequest + */ + filter?: string; } /** * Response to DeleteRunsResponse. @@ -2683,43 +2694,46 @@ export interface V1DeleteRunsRequest { * @interface V1DeleteRunsResponse */ export interface V1DeleteRunsResponse { - /** - * Details on success or error for each run. - * @type {Array} - * @memberof V1DeleteRunsResponse - */ - results: Array; + /** + * Details on success or error for each run. + * @type {Array} + * @memberof V1DeleteRunsResponse + */ + results: Array; } /** * Response to DeleteTemplateRequest. * @export * @interface V1DeleteTemplateResponse */ -export interface V1DeleteTemplateResponse {} +export interface V1DeleteTemplateResponse { +} /** * Response to DeleteTensorboardRequest. * @export * @interface V1DeleteTensorboardFilesResponse */ -export interface V1DeleteTensorboardFilesResponse {} +export interface V1DeleteTensorboardFilesResponse { +} /** * Response to DeleteWebhookRequest. * @export * @interface V1DeleteWebhookResponse */ -export interface V1DeleteWebhookResponse {} +export interface V1DeleteWebhookResponse { +} /** * Response to DeleteWorkspaceRequest. * @export * @interface V1DeleteWorkspaceResponse */ export interface V1DeleteWorkspaceResponse { - /** - * Status of deletion. - * @type {boolean} - * @memberof V1DeleteWorkspaceResponse - */ - completed: boolean; + /** + * Status of deletion. + * @type {boolean} + * @memberof V1DeleteWorkspaceResponse + */ + completed: boolean; } /** * Device represents a single computational device on an agent. @@ -2727,30 +2741,30 @@ export interface V1DeleteWorkspaceResponse { * @interface V1Device */ export interface V1Device { - /** - * The index of the device. - * @type {number} - * @memberof V1Device - */ - id?: number; - /** - * The brand name of the device. - * @type {string} - * @memberof V1Device - */ - brand?: string; - /** - * The unique UUID of the device. - * @type {string} - * @memberof V1Device - */ - uuid?: string; - /** - * The type of the Device. - * @type {Devicev1Type} - * @memberof V1Device - */ - type?: Devicev1Type; + /** + * The index of the device. + * @type {number} + * @memberof V1Device + */ + id?: number; + /** + * The brand name of the device. + * @type {string} + * @memberof V1Device + */ + brand?: string; + /** + * The unique UUID of the device. + * @type {string} + * @memberof V1Device + */ + uuid?: string; + /** + * The type of the Device. + * @type {Devicev1Type} + * @memberof V1Device + */ + type?: Devicev1Type; } /** * DeviceStats contains statistics about a single device group. @@ -2758,30 +2772,30 @@ export interface V1Device { * @interface V1DeviceStats */ export interface V1DeviceStats { - /** - * The number of slots in each state if there's an associated container. - * @type {{ [key: string]: number; }} - * @memberof V1DeviceStats - */ - states?: { [key: string]: number }; - /** - * the number of draining slots. - * @type {number} - * @memberof V1DeviceStats - */ - draining: number; - /** - * the number of disabled slots. - * @type {number} - * @memberof V1DeviceStats - */ - disabled: number; - /** - * the total number of slots. - * @type {number} - * @memberof V1DeviceStats - */ - total: number; + /** + * The number of slots in each state if there's an associated container. + * @type {{ [key: string]: number; }} + * @memberof V1DeviceStats + */ + states?: { [key: string]: number; }; + /** + * the number of draining slots. + * @type {number} + * @memberof V1DeviceStats + */ + draining: number; + /** + * the number of disabled slots. + * @type {number} + * @memberof V1DeviceStats + */ + disabled: number; + /** + * the total number of slots. + * @type {number} + * @memberof V1DeviceStats + */ + total: number; } /** * Disable the agent. @@ -2789,18 +2803,18 @@ export interface V1DeviceStats { * @interface V1DisableAgentRequest */ export interface V1DisableAgentRequest { - /** - * The id of the agent. - * @type {string} - * @memberof V1DisableAgentRequest - */ - agentId?: string; - /** - * If true, wait for running tasks to finish. - * @type {boolean} - * @memberof V1DisableAgentRequest - */ - drain?: boolean; + /** + * The id of the agent. + * @type {string} + * @memberof V1DisableAgentRequest + */ + agentId?: string; + /** + * If true, wait for running tasks to finish. + * @type {boolean} + * @memberof V1DisableAgentRequest + */ + drain?: boolean; } /** * Response to DisableAgentRequest. @@ -2808,12 +2822,12 @@ export interface V1DisableAgentRequest { * @interface V1DisableAgentResponse */ export interface V1DisableAgentResponse { - /** - * The disabled agent. - * @type {V1Agent} - * @memberof V1DisableAgentResponse - */ - agent?: V1Agent; + /** + * The disabled agent. + * @type {V1Agent} + * @memberof V1DisableAgentResponse + */ + agent?: V1Agent; } /** * Disable the slot. @@ -2821,24 +2835,24 @@ export interface V1DisableAgentResponse { * @interface V1DisableSlotRequest */ export interface V1DisableSlotRequest { - /** - * The id of the agent. - * @type {string} - * @memberof V1DisableSlotRequest - */ - agentId?: string; - /** - * The id of the slot. - * @type {string} - * @memberof V1DisableSlotRequest - */ - slotId?: string; - /** - * If true, wait for running task to finish. - * @type {boolean} - * @memberof V1DisableSlotRequest - */ - drain?: boolean; + /** + * The id of the agent. + * @type {string} + * @memberof V1DisableSlotRequest + */ + agentId?: string; + /** + * The id of the slot. + * @type {string} + * @memberof V1DisableSlotRequest + */ + slotId?: string; + /** + * If true, wait for running task to finish. + * @type {boolean} + * @memberof V1DisableSlotRequest + */ + drain?: boolean; } /** * Response to DisableSlotRequest. @@ -2846,12 +2860,12 @@ export interface V1DisableSlotRequest { * @interface V1DisableSlotResponse */ export interface V1DisableSlotResponse { - /** - * The disabled slot. - * @type {V1Slot} - * @memberof V1DisableSlotResponse - */ - slot?: V1Slot; + /** + * The disabled slot. + * @type {V1Slot} + * @memberof V1DisableSlotResponse + */ + slot?: V1Slot; } /** * Double filters. @@ -2859,30 +2873,30 @@ export interface V1DisableSlotResponse { * @interface V1DoubleFieldFilter */ export interface V1DoubleFieldFilter { - /** - * Less than. - * @type {number} - * @memberof V1DoubleFieldFilter - */ - lt?: number; - /** - * Less than or equal. - * @type {number} - * @memberof V1DoubleFieldFilter - */ - lte?: number; - /** - * Greater than. - * @type {number} - * @memberof V1DoubleFieldFilter - */ - gt?: number; - /** - * Greater than or equal. - * @type {number} - * @memberof V1DoubleFieldFilter - */ - gte?: number; + /** + * Less than. + * @type {number} + * @memberof V1DoubleFieldFilter + */ + lt?: number; + /** + * Less than or equal. + * @type {number} + * @memberof V1DoubleFieldFilter + */ + lte?: number; + /** + * Greater than. + * @type {number} + * @memberof V1DoubleFieldFilter + */ + gt?: number; + /** + * Greater than or equal. + * @type {number} + * @memberof V1DoubleFieldFilter + */ + gte?: number; } /** * DownsampledMetrics captures a metric's name and downsampled data points. @@ -2890,24 +2904,24 @@ export interface V1DoubleFieldFilter { * @interface V1DownsampledMetrics */ export interface V1DownsampledMetrics { - /** - * A possibly down-sampled series of metrics' readings through the progress of the trial. - * @type {Array} - * @memberof V1DownsampledMetrics - */ - data: Array; - /** - * Metric group (training, validation, or unset). - * @type {V1MetricType} - * @memberof V1DownsampledMetrics - */ - type: V1MetricType; - /** - * Metric group (training, validation, etc). - * @type {string} - * @memberof V1DownsampledMetrics - */ - group: string; + /** + * A possibly down-sampled series of metrics' readings through the progress of the trial. + * @type {Array} + * @memberof V1DownsampledMetrics + */ + data: Array; + /** + * Metric group (training, validation, or unset). + * @type {V1MetricType} + * @memberof V1DownsampledMetrics + */ + type: V1MetricType; + /** + * Metric group (training, validation, etc). + * @type {string} + * @memberof V1DownsampledMetrics + */ + group: string; } /** * Response to EnableAgentRequest. @@ -2915,12 +2929,12 @@ export interface V1DownsampledMetrics { * @interface V1EnableAgentResponse */ export interface V1EnableAgentResponse { - /** - * The enabled agent. - * @type {V1Agent} - * @memberof V1EnableAgentResponse - */ - agent?: V1Agent; + /** + * The enabled agent. + * @type {V1Agent} + * @memberof V1EnableAgentResponse + */ + agent?: V1Agent; } /** * Response to EnableSlotRequest. @@ -2928,12 +2942,12 @@ export interface V1EnableAgentResponse { * @interface V1EnableSlotResponse */ export interface V1EnableSlotResponse { - /** - * The enabled slot. - * @type {V1Slot} - * @memberof V1EnableSlotResponse - */ - slot?: V1Slot; + /** + * The enabled slot. + * @type {V1Slot} + * @memberof V1EnableSlotResponse + */ + slot?: V1Slot; } /** * EntityType represents an entity - ENTITY_TYPE_UNSPECIFIED: Default entity type. - ENTITY_TYPE_PROJECT: Represents a project. @@ -2941,250 +2955,250 @@ export interface V1EnableSlotResponse { * @enum {string} */ export const V1EntityType = { - UNSPECIFIED: 'ENTITY_TYPE_UNSPECIFIED', - PROJECT: 'ENTITY_TYPE_PROJECT', -} as const; -export type V1EntityType = ValueOf; + UNSPECIFIED: 'ENTITY_TYPE_UNSPECIFIED', + PROJECT: 'ENTITY_TYPE_PROJECT', +} as const +export type V1EntityType = ValueOf /** * Experiment is a collection of one or more trials that are exploring a user-defined hyperparameter space. * @export * @interface V1Experiment */ export interface V1Experiment { - /** - * The id of the experiment. - * @type {number} - * @memberof V1Experiment - */ - id: number; - /** - * The description of the experiment. - * @type {string} - * @memberof V1Experiment - */ - description?: string; - /** - * Labels attached to the experiment. - * @type {Array} - * @memberof V1Experiment - */ - labels?: Array; - /** - * The time the experiment was started. - * @type {Date | DateString} - * @memberof V1Experiment - */ - startTime: Date | DateString; - /** - * The time the experiment ended if the experiment is stopped. - * @type {Date | DateString} - * @memberof V1Experiment - */ - endTime?: Date | DateString; - /** - * The current state of the experiment. - * @type {Experimentv1State} - * @memberof V1Experiment - */ - state: Experimentv1State; - /** - * Boolean denoting whether the experiment was archived. - * @type {boolean} - * @memberof V1Experiment - */ - archived: boolean; - /** - * The number of trials linked to the experiment. - * @type {number} - * @memberof V1Experiment - */ - numTrials: number; - /** - * The ids of trials linked to the experiment. - * @type {Array} - * @memberof V1Experiment - */ - trialIds?: Array; - /** - * The display name of the user that created the experiment. - * @type {string} - * @memberof V1Experiment - */ - displayName?: string; - /** - * The id of the user that created the experiment. - * @type {number} - * @memberof V1Experiment - */ - userId?: number; - /** - * The username of the user that created the experiment. - * @type {string} - * @memberof V1Experiment - */ - username: string; - /** - * The resource pool the experiment was created in - * @type {string} - * @memberof V1Experiment - */ - resourcePool?: string; - /** - * The type of searcher for the experiment - * @type {string} - * @memberof V1Experiment - */ - searcherType: string; - /** - * The searcher metric name for the experiment - * @type {string} - * @memberof V1Experiment - */ - searcherMetric?: string; - /** - * The hyperparameters for the experiment - * @type {any} - * @memberof V1Experiment - */ - hyperparameters?: any; - /** - * The experiment name. - * @type {string} - * @memberof V1Experiment - */ - name: string; - /** - * The experiment notes. - * @type {string} - * @memberof V1Experiment - */ - notes?: string; - /** - * Associated job's id. - * @type {string} - * @memberof V1Experiment - */ - jobId: string; - /** - * Original id of a forked or continued experiment. - * @type {number} - * @memberof V1Experiment - */ - forkedFrom?: number; - /** - * The current progress of a running experiment. - * @type {number} - * @memberof V1Experiment - */ - progress?: number; - /** - * The id of the project associated with this experiment. - * @type {number} - * @memberof V1Experiment - */ - projectId: number; - /** - * The name of the project associated with this experiment. - * @type {string} - * @memberof V1Experiment - */ - projectName?: string; - /** - * The id of the workspace associated with this experiment. - * @type {number} - * @memberof V1Experiment - */ - workspaceId?: number; - /** - * The name of the workspace associated with this experiment. - * @type {string} - * @memberof V1Experiment - */ - workspaceName?: string; - /** - * The archived status of the parent project (can be inherited from workspace). - * @type {boolean} - * @memberof V1Experiment - */ - parentArchived?: boolean; - /** - * The configuration of the experiment. Is deprecated for performance reasons on the listing experiment route. Use GetExperimentResponse.config instead. - * @type {any} - * @memberof V1Experiment - */ - config: any; - /** - * The original configuration that the user submitted. - * @type {string} - * @memberof V1Experiment - */ - originalConfig: string; - /** - * The id of the user who created the parent project. - * @type {number} - * @memberof V1Experiment - */ - projectOwnerId: number; - /** - * The total size of checkpoints. - * @type {string} - * @memberof V1Experiment - */ - checkpointSize?: string; - /** - * The count of checkpoints. - * @type {number} - * @memberof V1Experiment - */ - checkpointCount?: number; - /** - * The metrics and hyperparameters associated with the best trial by searcher metric. - * @type {number} - * @memberof V1Experiment - */ - bestTrialSearcherMetric?: number; - /** - * Id of experiment's best trial, calculated by the best searcher metrics value of trial's best validation. - * @type {number} - * @memberof V1Experiment - */ - bestTrialId?: number; - /** - * Unmanaged experiments are detached. - * @type {boolean} - * @memberof V1Experiment - */ - unmanaged?: boolean; - /** - * Time in seconds which experiment ran or has been running. - * @type {number} - * @memberof V1Experiment - */ - duration?: number; - /** - * The id of external experiment - * @type {string} - * @memberof V1Experiment - */ - externalExperimentId?: string; - /** - * The id of external trial - * @type {string} - * @memberof V1Experiment - */ - externalTrialId?: string; - /** - * Size of model definition file, for unmanaged experiments this should be 0. - * @type {number} - * @memberof V1Experiment - */ - modelDefinitionSize?: number; - /** - * The experiment pachyderm integration config. - * @type {any} - * @memberof V1Experiment - */ - pachydermIntegration?: any; + /** + * The id of the experiment. + * @type {number} + * @memberof V1Experiment + */ + id: number; + /** + * The description of the experiment. + * @type {string} + * @memberof V1Experiment + */ + description?: string; + /** + * Labels attached to the experiment. + * @type {Array} + * @memberof V1Experiment + */ + labels?: Array; + /** + * The time the experiment was started. + * @type {Date | DateString} + * @memberof V1Experiment + */ + startTime: Date | DateString; + /** + * The time the experiment ended if the experiment is stopped. + * @type {Date | DateString} + * @memberof V1Experiment + */ + endTime?: Date | DateString; + /** + * The current state of the experiment. + * @type {Experimentv1State} + * @memberof V1Experiment + */ + state: Experimentv1State; + /** + * Boolean denoting whether the experiment was archived. + * @type {boolean} + * @memberof V1Experiment + */ + archived: boolean; + /** + * The number of trials linked to the experiment. + * @type {number} + * @memberof V1Experiment + */ + numTrials: number; + /** + * The ids of trials linked to the experiment. + * @type {Array} + * @memberof V1Experiment + */ + trialIds?: Array; + /** + * The display name of the user that created the experiment. + * @type {string} + * @memberof V1Experiment + */ + displayName?: string; + /** + * The id of the user that created the experiment. + * @type {number} + * @memberof V1Experiment + */ + userId?: number; + /** + * The username of the user that created the experiment. + * @type {string} + * @memberof V1Experiment + */ + username: string; + /** + * The resource pool the experiment was created in + * @type {string} + * @memberof V1Experiment + */ + resourcePool?: string; + /** + * The type of searcher for the experiment + * @type {string} + * @memberof V1Experiment + */ + searcherType: string; + /** + * The searcher metric name for the experiment + * @type {string} + * @memberof V1Experiment + */ + searcherMetric?: string; + /** + * The hyperparameters for the experiment + * @type {any} + * @memberof V1Experiment + */ + hyperparameters?: any; + /** + * The experiment name. + * @type {string} + * @memberof V1Experiment + */ + name: string; + /** + * The experiment notes. + * @type {string} + * @memberof V1Experiment + */ + notes?: string; + /** + * Associated job's id. + * @type {string} + * @memberof V1Experiment + */ + jobId: string; + /** + * Original id of a forked or continued experiment. + * @type {number} + * @memberof V1Experiment + */ + forkedFrom?: number; + /** + * The current progress of a running experiment. + * @type {number} + * @memberof V1Experiment + */ + progress?: number; + /** + * The id of the project associated with this experiment. + * @type {number} + * @memberof V1Experiment + */ + projectId: number; + /** + * The name of the project associated with this experiment. + * @type {string} + * @memberof V1Experiment + */ + projectName?: string; + /** + * The id of the workspace associated with this experiment. + * @type {number} + * @memberof V1Experiment + */ + workspaceId?: number; + /** + * The name of the workspace associated with this experiment. + * @type {string} + * @memberof V1Experiment + */ + workspaceName?: string; + /** + * The archived status of the parent project (can be inherited from workspace). + * @type {boolean} + * @memberof V1Experiment + */ + parentArchived?: boolean; + /** + * The configuration of the experiment. Is deprecated for performance reasons on the listing experiment route. Use GetExperimentResponse.config instead. + * @type {any} + * @memberof V1Experiment + */ + config: any; + /** + * The original configuration that the user submitted. + * @type {string} + * @memberof V1Experiment + */ + originalConfig: string; + /** + * The id of the user who created the parent project. + * @type {number} + * @memberof V1Experiment + */ + projectOwnerId: number; + /** + * The total size of checkpoints. + * @type {string} + * @memberof V1Experiment + */ + checkpointSize?: string; + /** + * The count of checkpoints. + * @type {number} + * @memberof V1Experiment + */ + checkpointCount?: number; + /** + * The metrics and hyperparameters associated with the best trial by searcher metric. + * @type {number} + * @memberof V1Experiment + */ + bestTrialSearcherMetric?: number; + /** + * Id of experiment's best trial, calculated by the best searcher metrics value of trial's best validation. + * @type {number} + * @memberof V1Experiment + */ + bestTrialId?: number; + /** + * Unmanaged experiments are detached. + * @type {boolean} + * @memberof V1Experiment + */ + unmanaged?: boolean; + /** + * Time in seconds which experiment ran or has been running. + * @type {number} + * @memberof V1Experiment + */ + duration?: number; + /** + * The id of external experiment + * @type {string} + * @memberof V1Experiment + */ + externalExperimentId?: string; + /** + * The id of external trial + * @type {string} + * @memberof V1Experiment + */ + externalTrialId?: string; + /** + * Size of model definition file, for unmanaged experiments this should be 0. + * @type {number} + * @memberof V1Experiment + */ + modelDefinitionSize?: number; + /** + * The experiment pachyderm integration config. + * @type {any} + * @memberof V1Experiment + */ + pachydermIntegration?: any; } /** * Message for results of individual experiments in a multi-experiment action. @@ -3192,18 +3206,18 @@ export interface V1Experiment { * @interface V1ExperimentActionResult */ export interface V1ExperimentActionResult { - /** - * Optional error message. - * @type {string} - * @memberof V1ExperimentActionResult - */ - error: string; - /** - * Experiment ID. - * @type {number} - * @memberof V1ExperimentActionResult - */ - id: number; + /** + * Optional error message. + * @type {string} + * @memberof V1ExperimentActionResult + */ + error: string; + /** + * Experiment ID. + * @type {number} + * @memberof V1ExperimentActionResult + */ + id: number; } /** * ExperimentInactive is a searcher event triggered when an experiment is no longer active. @@ -3211,12 +3225,12 @@ export interface V1ExperimentActionResult { * @interface V1ExperimentInactive */ export interface V1ExperimentInactive { - /** - * Current state of the experiment. - * @type {Experimentv1State} - * @memberof V1ExperimentInactive - */ - experimentState: Experimentv1State; + /** + * Current state of the experiment. + * @type {Experimentv1State} + * @memberof V1ExperimentInactive + */ + experimentState: Experimentv1State; } /** * ExperimentSimulation holds the configuration and results of simulated run of a searcher. @@ -3224,24 +3238,24 @@ export interface V1ExperimentInactive { * @interface V1ExperimentSimulation */ export interface V1ExperimentSimulation { - /** - * The simulated experiment config. - * @type {any} - * @memberof V1ExperimentSimulation - */ - config?: any; - /** - * The searcher simulation seed. - * @type {number} - * @memberof V1ExperimentSimulation - */ - seed?: number; - /** - * The list of trials in the simulation. - * @type {Array} - * @memberof V1ExperimentSimulation - */ - trials?: Array; + /** + * The simulated experiment config. + * @type {any} + * @memberof V1ExperimentSimulation + */ + config?: any; + /** + * The searcher simulation seed. + * @type {number} + * @memberof V1ExperimentSimulation + */ + seed?: number; + /** + * The list of trials in the simulation. + * @type {Array} + * @memberof V1ExperimentSimulation + */ + trials?: Array; } /** * Response to ExpMetricNamesRequest. @@ -3249,97 +3263,97 @@ export interface V1ExperimentSimulation { * @interface V1ExpMetricNamesResponse */ export interface V1ExpMetricNamesResponse { - /** - * The names of the searcher metrics. - * @type {Array} - * @memberof V1ExpMetricNamesResponse - */ - searcherMetrics?: Array; - /** - * List of training metric names. - * @type {Array} - * @memberof V1ExpMetricNamesResponse - */ - trainingMetrics?: Array; - /** - * List of validation metric names. - * @type {Array} - * @memberof V1ExpMetricNamesResponse - */ - validationMetrics?: Array; - /** - * List of metric group-name pairs. - * @type {Array} - * @memberof V1ExpMetricNamesResponse - */ - metricNames?: Array; -} -/** + /** + * The names of the searcher metrics. + * @type {Array} + * @memberof V1ExpMetricNamesResponse + */ + searcherMetrics?: Array; + /** + * List of training metric names. + * @type {Array} + * @memberof V1ExpMetricNamesResponse + */ + trainingMetrics?: Array; + /** + * List of validation metric names. + * @type {Array} + * @memberof V1ExpMetricNamesResponse + */ + validationMetrics?: Array; + /** + * List of metric group-name pairs. + * @type {Array} + * @memberof V1ExpMetricNamesResponse + */ + metricNames?: Array; +} +/** * The failure type of a resource. - FAILURE_TYPE_UNSPECIFIED: UNSPECIFIED denotes an error that is not defined below. - FAILURE_TYPE_RESOURCES_FAILED: ResourcesFailed denotes that the container ran but failed with a non-zero exit code. - FAILURE_TYPE_RESOURCES_ABORTED: ResourcesAborted denotes the container was canceled before it was started. - FAILURE_TYPE_RESOURCES_MISSING: ResourcesMissing denotes the resources were missing when the master asked about it. - FAILURE_TYPE_TASK_ABORTED: TaskAborted denotes that the task was canceled before it was started. - FAILURE_TYPE_TASK_ERROR: TaskError denotes that the task failed without an associated exit code. - FAILURE_TYPE_AGENT_FAILED: AgentFailed denotes that the agent failed while the container was running. - FAILURE_TYPE_AGENT_ERROR: AgentError denotes that the agent failed to launch the container. - FAILURE_TYPE_RESTORE_ERROR: RestoreError denotes a failure to restore a running allocation on master blip. - FAILURE_TYPE_UNKNOWN_ERROR: UnknownError denotes an internal error that did not map to a know failure type. * @export * @enum {string} */ export const V1FailureType = { - UNSPECIFIED: 'FAILURE_TYPE_UNSPECIFIED', - RESOURCESFAILED: 'FAILURE_TYPE_RESOURCES_FAILED', - RESOURCESABORTED: 'FAILURE_TYPE_RESOURCES_ABORTED', - RESOURCESMISSING: 'FAILURE_TYPE_RESOURCES_MISSING', - TASKABORTED: 'FAILURE_TYPE_TASK_ABORTED', - TASKERROR: 'FAILURE_TYPE_TASK_ERROR', - AGENTFAILED: 'FAILURE_TYPE_AGENT_FAILED', - AGENTERROR: 'FAILURE_TYPE_AGENT_ERROR', - RESTOREERROR: 'FAILURE_TYPE_RESTORE_ERROR', - UNKNOWNERROR: 'FAILURE_TYPE_UNKNOWN_ERROR', -} as const; -export type V1FailureType = ValueOf; + UNSPECIFIED: 'FAILURE_TYPE_UNSPECIFIED', + RESOURCESFAILED: 'FAILURE_TYPE_RESOURCES_FAILED', + RESOURCESABORTED: 'FAILURE_TYPE_RESOURCES_ABORTED', + RESOURCESMISSING: 'FAILURE_TYPE_RESOURCES_MISSING', + TASKABORTED: 'FAILURE_TYPE_TASK_ABORTED', + TASKERROR: 'FAILURE_TYPE_TASK_ERROR', + AGENTFAILED: 'FAILURE_TYPE_AGENT_FAILED', + AGENTERROR: 'FAILURE_TYPE_AGENT_ERROR', + RESTOREERROR: 'FAILURE_TYPE_RESTORE_ERROR', + UNKNOWNERROR: 'FAILURE_TYPE_UNKNOWN_ERROR', +} as const +export type V1FailureType = ValueOf /** * File is a Unix file. * @export * @interface V1File */ export interface V1File { - /** - * Path to the file. - * @type {string} - * @memberof V1File - */ - path: string; - /** - * File type. - * @type {number} - * @memberof V1File - */ - type: number; - /** - * base64 encoded contents of the file. - * @type {string} - * @memberof V1File - */ - content: string; - /** - * Modified time (Unix timestamp). - * @type {string} - * @memberof V1File - */ - mtime: string; - /** - * File mode. - * @type {number} - * @memberof V1File - */ - mode: number; - /** - * User ID. - * @type {number} - * @memberof V1File - */ - uid: number; - /** - * Group ID. - * @type {number} - * @memberof V1File - */ - gid: number; + /** + * Path to the file. + * @type {string} + * @memberof V1File + */ + path: string; + /** + * File type. + * @type {number} + * @memberof V1File + */ + type: number; + /** + * base64 encoded contents of the file. + * @type {string} + * @memberof V1File + */ + content: string; + /** + * Modified time (Unix timestamp). + * @type {string} + * @memberof V1File + */ + mtime: string; + /** + * File mode. + * @type {number} + * @memberof V1File + */ + mode: number; + /** + * User ID. + * @type {number} + * @memberof V1File + */ + uid: number; + /** + * Group ID. + * @type {number} + * @memberof V1File + */ + gid: number; } /** * File node is one node of file in experiment model definition file tree. @@ -3347,48 +3361,48 @@ export interface V1File { * @interface V1FileNode */ export interface V1FileNode { - /** - * Path of file. - * @type {string} - * @memberof V1FileNode - */ - path?: string; - /** - * Name of file. - * @type {string} - * @memberof V1FileNode - */ - name?: string; - /** - * Modification time of file. - * @type {Date | DateString} - * @memberof V1FileNode - */ - modifiedTime?: Date | DateString; - /** - * Number of bytes in file content. - * @type {number} - * @memberof V1FileNode - */ - contentLength?: number; - /** - * Is this a directory. - * @type {boolean} - * @memberof V1FileNode - */ - isDir?: boolean; - /** - * MIME type of file. - * @type {string} - * @memberof V1FileNode - */ - contentType?: string; - /** - * Subdirectory files. - * @type {Array} - * @memberof V1FileNode - */ - files?: Array; + /** + * Path of file. + * @type {string} + * @memberof V1FileNode + */ + path?: string; + /** + * Name of file. + * @type {string} + * @memberof V1FileNode + */ + name?: string; + /** + * Modification time of file. + * @type {Date | DateString} + * @memberof V1FileNode + */ + modifiedTime?: Date | DateString; + /** + * Number of bytes in file content. + * @type {number} + * @memberof V1FileNode + */ + contentLength?: number; + /** + * Is this a directory. + * @type {boolean} + * @memberof V1FileNode + */ + isDir?: boolean; + /** + * MIME type of file. + * @type {string} + * @memberof V1FileNode + */ + contentType?: string; + /** + * Subdirectory files. + * @type {Array} + * @memberof V1FileNode + */ + files?: Array; } /** * The fitting policy of the scheduler. - FITTING_POLICY_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - FITTING_POLICY_BEST: Best fit. Tasks are preferentially “packed” together on the smallest number of agents - FITTING_POLICY_WORST: Worst fit. Tasks are placed on under-utilized agents, spreading out the tasks. - FITTING_POLICY_KUBERNETES: A kubernetes placeholder. In k8s, the task placement is delegated to the k8s scheduler so the fitting policy is not relevant. - FITTING_POLICY_SLURM: A slurm placeholder. When running on slurm, task placement is delegated. - FITTING_POLICY_PBS: A PBS placeholder. When running on PBS, task placement is delegated. @@ -3396,225 +3410,225 @@ export interface V1FileNode { * @enum {string} */ export const V1FittingPolicy = { - UNSPECIFIED: 'FITTING_POLICY_UNSPECIFIED', - BEST: 'FITTING_POLICY_BEST', - WORST: 'FITTING_POLICY_WORST', - KUBERNETES: 'FITTING_POLICY_KUBERNETES', - SLURM: 'FITTING_POLICY_SLURM', - PBS: 'FITTING_POLICY_PBS', -} as const; -export type V1FittingPolicy = ValueOf; + UNSPECIFIED: 'FITTING_POLICY_UNSPECIFIED', + BEST: 'FITTING_POLICY_BEST', + WORST: 'FITTING_POLICY_WORST', + KUBERNETES: 'FITTING_POLICY_KUBERNETES', + SLURM: 'FITTING_POLICY_SLURM', + PBS: 'FITTING_POLICY_PBS', +} as const +export type V1FittingPolicy = ValueOf /** * Flat run respresentation. * @export * @interface V1FlatRun */ export interface V1FlatRun { - /** - * The id of the run. - * @type {number} - * @memberof V1FlatRun - */ - id: number; - /** - * The time the run was started. - * @type {Date | DateString} - * @memberof V1FlatRun - */ - startTime: Date | DateString; - /** - * The time the run ended. - * @type {Date | DateString} - * @memberof V1FlatRun - */ - endTime?: Date | DateString; - /** - * The current state of the run(trial). - * @type {Trialv1State} - * @memberof V1FlatRun - */ - state: Trialv1State; - /** - * The tags of the associated experiment. TODO(aaron.amanuel): Create add/remove tags for runs. - * @type {Array} - * @memberof V1FlatRun - */ - labels?: Array; - /** - * The total size of checkpoints. - * @type {string} - * @memberof V1FlatRun - */ - checkpointSize: string; - /** - * The count of checkpoints. - * @type {number} - * @memberof V1FlatRun - */ - checkpointCount: number; - /** - * Signed searcher metrics value. - * @type {number} - * @memberof V1FlatRun - */ - searcherMetricValue?: number; - /** - * The id of external run - * @type {number} - * @memberof V1FlatRun - */ - externalRunId?: number; - /** - * Trial hyperparameters. - * @type {any} - * @memberof V1FlatRun - */ - hyperparameters?: any; - /** - * summary metrics. - * @type {any} - * @memberof V1FlatRun - */ - summaryMetrics?: any; - /** - * The id of the user who created the run. - * @type {number} - * @memberof V1FlatRun - */ - userId?: number; - /** - * Time in seconds which the run ran or has been running. - * @type {number} - * @memberof V1FlatRun - */ - duration?: number; - /** - * The id of the project associated with this run. - * @type {number} - * @memberof V1FlatRun - */ - projectId: number; - /** - * The name of the project associated with this run. - * @type {string} - * @memberof V1FlatRun - */ - projectName: string; - /** - * The id of the workspace associated with this run. - * @type {number} - * @memberof V1FlatRun - */ - workspaceId: number; - /** - * The name of the workspace associated with this run. - * @type {string} - * @memberof V1FlatRun - */ - workspaceName: string; - /** - * The archived status of the parent project (can be inherited from workspace). - * @type {boolean} - * @memberof V1FlatRun - */ - parentArchived: boolean; - /** - * Data related the the experiment associated with this run. - * @type {V1FlatRunExperiment} - * @memberof V1FlatRun - */ - experiment?: V1FlatRunExperiment; - /** - * The arbitrary metadata of the run. - * @type {any} - * @memberof V1FlatRun - */ - metadata?: any; - /** - * The archived status of this run. This is only looking at the archived status at the run level and not taking into account whether the experiment is archived or not. - * @type {boolean} - * @memberof V1FlatRun - */ - archived: boolean; + /** + * The id of the run. + * @type {number} + * @memberof V1FlatRun + */ + id: number; + /** + * The time the run was started. + * @type {Date | DateString} + * @memberof V1FlatRun + */ + startTime: Date | DateString; + /** + * The time the run ended. + * @type {Date | DateString} + * @memberof V1FlatRun + */ + endTime?: Date | DateString; + /** + * The current state of the run(trial). + * @type {Trialv1State} + * @memberof V1FlatRun + */ + state: Trialv1State; + /** + * The tags of the associated experiment. TODO(aaron.amanuel): Create add/remove tags for runs. + * @type {Array} + * @memberof V1FlatRun + */ + labels?: Array; + /** + * The total size of checkpoints. + * @type {string} + * @memberof V1FlatRun + */ + checkpointSize: string; + /** + * The count of checkpoints. + * @type {number} + * @memberof V1FlatRun + */ + checkpointCount: number; + /** + * Signed searcher metrics value. + * @type {number} + * @memberof V1FlatRun + */ + searcherMetricValue?: number; + /** + * The id of external run + * @type {number} + * @memberof V1FlatRun + */ + externalRunId?: number; + /** + * Trial hyperparameters. + * @type {any} + * @memberof V1FlatRun + */ + hyperparameters?: any; + /** + * summary metrics. + * @type {any} + * @memberof V1FlatRun + */ + summaryMetrics?: any; + /** + * The id of the user who created the run. + * @type {number} + * @memberof V1FlatRun + */ + userId?: number; + /** + * Time in seconds which the run ran or has been running. + * @type {number} + * @memberof V1FlatRun + */ + duration?: number; + /** + * The id of the project associated with this run. + * @type {number} + * @memberof V1FlatRun + */ + projectId: number; + /** + * The name of the project associated with this run. + * @type {string} + * @memberof V1FlatRun + */ + projectName: string; + /** + * The id of the workspace associated with this run. + * @type {number} + * @memberof V1FlatRun + */ + workspaceId: number; + /** + * The name of the workspace associated with this run. + * @type {string} + * @memberof V1FlatRun + */ + workspaceName: string; + /** + * The archived status of the parent project (can be inherited from workspace). + * @type {boolean} + * @memberof V1FlatRun + */ + parentArchived: boolean; + /** + * Data related the the experiment associated with this run. + * @type {V1FlatRunExperiment} + * @memberof V1FlatRun + */ + experiment?: V1FlatRunExperiment; + /** + * The arbitrary metadata of the run. + * @type {any} + * @memberof V1FlatRun + */ + metadata?: any; + /** + * The archived status of this run. This is only looking at the archived status at the run level and not taking into account whether the experiment is archived or not. + * @type {boolean} + * @memberof V1FlatRun + */ + archived: boolean; } /** - * + * * @export * @interface V1FlatRunExperiment */ export interface V1FlatRunExperiment { - /** - * The id of the experiment linked to the run. - * @type {number} - * @memberof V1FlatRunExperiment - */ - id: number; - /** - * The type of searcher for the experiment. - * @type {string} - * @memberof V1FlatRunExperiment - */ - searcherType: string; - /** - * The searcher metric name for the experiment. - * @type {string} - * @memberof V1FlatRunExperiment - */ - searcherMetric: string; - /** - * Original id of a forked or continued experiment. - * @type {number} - * @memberof V1FlatRunExperiment - */ - forkedFrom?: number; - /** - * The id of external experiment - * @type {string} - * @memberof V1FlatRunExperiment - */ - externalExperimentId?: string; - /** - * The resource pool the experiment was created in. - * @type {string} - * @memberof V1FlatRunExperiment - */ - resourcePool: string; - /** - * The current progress of a running experiment. - * @type {number} - * @memberof V1FlatRunExperiment - */ - progress: number; - /** - * The description of the experiment. - * @type {string} - * @memberof V1FlatRunExperiment - */ - description: string; - /** - * The experiment name. - * @type {string} - * @memberof V1FlatRunExperiment - */ - name: string; - /** - * Unmanaged experiments are detached. - * @type {boolean} - * @memberof V1FlatRunExperiment - */ - unmanaged: boolean; - /** - * True if the associated experiment is a multitrial experiment - * @type {boolean} - * @memberof V1FlatRunExperiment - */ - isMultitrial: boolean; - /** - * The experiment pachyderm integration config. - * @type {any} - * @memberof V1FlatRunExperiment - */ - pachydermIntegration?: any; + /** + * The id of the experiment linked to the run. + * @type {number} + * @memberof V1FlatRunExperiment + */ + id: number; + /** + * The type of searcher for the experiment. + * @type {string} + * @memberof V1FlatRunExperiment + */ + searcherType: string; + /** + * The searcher metric name for the experiment. + * @type {string} + * @memberof V1FlatRunExperiment + */ + searcherMetric: string; + /** + * Original id of a forked or continued experiment. + * @type {number} + * @memberof V1FlatRunExperiment + */ + forkedFrom?: number; + /** + * The id of external experiment + * @type {string} + * @memberof V1FlatRunExperiment + */ + externalExperimentId?: string; + /** + * The resource pool the experiment was created in. + * @type {string} + * @memberof V1FlatRunExperiment + */ + resourcePool: string; + /** + * The current progress of a running experiment. + * @type {number} + * @memberof V1FlatRunExperiment + */ + progress: number; + /** + * The description of the experiment. + * @type {string} + * @memberof V1FlatRunExperiment + */ + description: string; + /** + * The experiment name. + * @type {string} + * @memberof V1FlatRunExperiment + */ + name: string; + /** + * Unmanaged experiments are detached. + * @type {boolean} + * @memberof V1FlatRunExperiment + */ + unmanaged: boolean; + /** + * True if the associated experiment is a multitrial experiment + * @type {boolean} + * @memberof V1FlatRunExperiment + */ + isMultitrial: boolean; + /** + * The experiment pachyderm integration config. + * @type {any} + * @memberof V1FlatRunExperiment + */ + pachydermIntegration?: any; } /** * State of a Generic task - GENERIC_TASK_STATE_UNSPECIFIED: The task state unknown - GENERIC_TASK_STATE_ACTIVE: The task state unknown - GENERIC_TASK_STATE_CANCELED: The task state unknown - GENERIC_TASK_STATE_COMPLETED: The task state unknown - GENERIC_TASK_STATE_ERROR: The task state unknown - GENERIC_TASK_STATE_PAUSED: The task state unknown - GENERIC_TASK_STATE_STOPPING_PAUSED: The task state unknown - GENERIC_TASK_STATE_STOPPING_CANCELED: The task state unknown - GENERIC_TASK_STATE_STOPPING_COMPLETED: The task state unknown - GENERIC_TASK_STATE_STOPPING_ERROR: The task state unknown @@ -3622,48 +3636,48 @@ export interface V1FlatRunExperiment { * @enum {string} */ export const V1GenericTaskState = { - UNSPECIFIED: 'GENERIC_TASK_STATE_UNSPECIFIED', - ACTIVE: 'GENERIC_TASK_STATE_ACTIVE', - CANCELED: 'GENERIC_TASK_STATE_CANCELED', - COMPLETED: 'GENERIC_TASK_STATE_COMPLETED', - ERROR: 'GENERIC_TASK_STATE_ERROR', - PAUSED: 'GENERIC_TASK_STATE_PAUSED', - STOPPINGPAUSED: 'GENERIC_TASK_STATE_STOPPING_PAUSED', - STOPPINGCANCELED: 'GENERIC_TASK_STATE_STOPPING_CANCELED', - STOPPINGCOMPLETED: 'GENERIC_TASK_STATE_STOPPING_COMPLETED', - STOPPINGERROR: 'GENERIC_TASK_STATE_STOPPING_ERROR', -} as const; -export type V1GenericTaskState = ValueOf; + UNSPECIFIED: 'GENERIC_TASK_STATE_UNSPECIFIED', + ACTIVE: 'GENERIC_TASK_STATE_ACTIVE', + CANCELED: 'GENERIC_TASK_STATE_CANCELED', + COMPLETED: 'GENERIC_TASK_STATE_COMPLETED', + ERROR: 'GENERIC_TASK_STATE_ERROR', + PAUSED: 'GENERIC_TASK_STATE_PAUSED', + STOPPINGPAUSED: 'GENERIC_TASK_STATE_STOPPING_PAUSED', + STOPPINGCANCELED: 'GENERIC_TASK_STATE_STOPPING_CANCELED', + STOPPINGCOMPLETED: 'GENERIC_TASK_STATE_STOPPING_COMPLETED', + STOPPINGERROR: 'GENERIC_TASK_STATE_STOPPING_ERROR', +} as const +export type V1GenericTaskState = ValueOf /** * Response to GetActiveTasksCountRequest. * @export * @interface V1GetActiveTasksCountResponse */ export interface V1GetActiveTasksCountResponse { - /** - * The count of commands. - * @type {number} - * @memberof V1GetActiveTasksCountResponse - */ - commands: number; - /** - * The count of notebooks. - * @type {number} - * @memberof V1GetActiveTasksCountResponse - */ - notebooks: number; - /** - * The count of shells. - * @type {number} - * @memberof V1GetActiveTasksCountResponse - */ - shells: number; - /** - * The count of TensorBoards. - * @type {number} - * @memberof V1GetActiveTasksCountResponse - */ - tensorboards: number; + /** + * The count of commands. + * @type {number} + * @memberof V1GetActiveTasksCountResponse + */ + commands: number; + /** + * The count of notebooks. + * @type {number} + * @memberof V1GetActiveTasksCountResponse + */ + notebooks: number; + /** + * The count of shells. + * @type {number} + * @memberof V1GetActiveTasksCountResponse + */ + shells: number; + /** + * The count of TensorBoards. + * @type {number} + * @memberof V1GetActiveTasksCountResponse + */ + tensorboards: number; } /** * Response to GetAgentRequest. @@ -3671,12 +3685,12 @@ export interface V1GetActiveTasksCountResponse { * @interface V1GetAgentResponse */ export interface V1GetAgentResponse { - /** - * The requested agent. - * @type {V1Agent} - * @memberof V1GetAgentResponse - */ - agent: V1Agent; + /** + * The requested agent. + * @type {V1Agent} + * @memberof V1GetAgentResponse + */ + agent: V1Agent; } /** * Sorts agents by the given field. - SORT_BY_UNSPECIFIED: Returns agents in an unsorted list. - SORT_BY_ID: Returns agents sorted by id. - SORT_BY_TIME: Returns agents sorted by time. @@ -3684,42 +3698,42 @@ export interface V1GetAgentResponse { * @enum {string} */ export const V1GetAgentsRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - ID: 'SORT_BY_ID', - TIME: 'SORT_BY_TIME', -} as const; -export type V1GetAgentsRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + ID: 'SORT_BY_ID', + TIME: 'SORT_BY_TIME', +} as const +export type V1GetAgentsRequestSortBy = ValueOf /** * Response to GetAgentsRequest. * @export * @interface V1GetAgentsResponse */ export interface V1GetAgentsResponse { - /** - * The list of returned agents. - * @type {Array} - * @memberof V1GetAgentsResponse - */ - agents: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetAgentsResponse - */ - pagination?: V1Pagination; + /** + * The list of returned agents. + * @type {Array} + * @memberof V1GetAgentsResponse + */ + agents: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetAgentsResponse + */ + pagination?: V1Pagination; } /** - * + * * @export * @interface V1GetAllocationResponse */ export interface V1GetAllocationResponse { - /** - * The id of the allocation. - * @type {V1Allocation} - * @memberof V1GetAllocationResponse - */ - allocation: V1Allocation; + /** + * The id of the allocation. + * @type {V1Allocation} + * @memberof V1GetAllocationResponse + */ + allocation: V1Allocation; } /** * Response to GetBestSearcherValidationMetricRequest. @@ -3727,12 +3741,12 @@ export interface V1GetAllocationResponse { * @interface V1GetBestSearcherValidationMetricResponse */ export interface V1GetBestSearcherValidationMetricResponse { - /** - * The value of the metric. - * @type {number} - * @memberof V1GetBestSearcherValidationMetricResponse - */ - metric?: number; + /** + * The value of the metric. + * @type {number} + * @memberof V1GetBestSearcherValidationMetricResponse + */ + metric?: number; } /** * Response to GetCheckpointRequest. @@ -3740,12 +3754,12 @@ export interface V1GetBestSearcherValidationMetricResponse { * @interface V1GetCheckpointResponse */ export interface V1GetCheckpointResponse { - /** - * The requested checkpoint. - * @type {V1Checkpoint} - * @memberof V1GetCheckpointResponse - */ - checkpoint: V1Checkpoint; + /** + * The requested checkpoint. + * @type {V1Checkpoint} + * @memberof V1GetCheckpointResponse + */ + checkpoint: V1Checkpoint; } /** * GetClusterMessageResponse is the response that contains the current cluster message. @@ -3753,12 +3767,12 @@ export interface V1GetCheckpointResponse { * @interface V1GetClusterMessageResponse */ export interface V1GetClusterMessageResponse { - /** - * cluster_message is the current cluster message. - * @type {V1ClusterMessage} - * @memberof V1GetClusterMessageResponse - */ - clusterMessage?: V1ClusterMessage; + /** + * cluster_message is the current cluster message. + * @type {V1ClusterMessage} + * @memberof V1GetClusterMessageResponse + */ + clusterMessage?: V1ClusterMessage; } /** * Response to GetCommandRequest. @@ -3766,18 +3780,18 @@ export interface V1GetClusterMessageResponse { * @interface V1GetCommandResponse */ export interface V1GetCommandResponse { - /** - * The requested command. - * @type {V1Command} - * @memberof V1GetCommandResponse - */ - command: V1Command; - /** - * The command config. - * @type {any} - * @memberof V1GetCommandResponse - */ - config: any; + /** + * The requested command. + * @type {V1Command} + * @memberof V1GetCommandResponse + */ + command: V1Command; + /** + * The command config. + * @type {any} + * @memberof V1GetCommandResponse + */ + config: any; } /** * Sorts commands by the given field. - SORT_BY_UNSPECIFIED: Returns commands in an unsorted list. - SORT_BY_ID: Returns commands sorted by id. - SORT_BY_DESCRIPTION: Returns commands sorted by description. - SORT_BY_START_TIME: Return commands sorted by start time. - SORT_BY_WORKSPACE_ID: Return commands sorted by workspace_id. @@ -3785,50 +3799,50 @@ export interface V1GetCommandResponse { * @enum {string} */ export const V1GetCommandsRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - ID: 'SORT_BY_ID', - DESCRIPTION: 'SORT_BY_DESCRIPTION', - STARTTIME: 'SORT_BY_START_TIME', - WORKSPACEID: 'SORT_BY_WORKSPACE_ID', -} as const; -export type V1GetCommandsRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + ID: 'SORT_BY_ID', + DESCRIPTION: 'SORT_BY_DESCRIPTION', + STARTTIME: 'SORT_BY_START_TIME', + WORKSPACEID: 'SORT_BY_WORKSPACE_ID', +} as const +export type V1GetCommandsRequestSortBy = ValueOf /** * Response to GetCommandsRequest. * @export * @interface V1GetCommandsResponse */ export interface V1GetCommandsResponse { - /** - * The list of returned commands. - * @type {Array} - * @memberof V1GetCommandsResponse - */ - commands: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetCommandsResponse - */ - pagination?: V1Pagination; + /** + * The list of returned commands. + * @type {Array} + * @memberof V1GetCommandsResponse + */ + commands: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetCommandsResponse + */ + pagination?: V1Pagination; } /** - * + * * @export * @interface V1GetCurrentTrialSearcherOperationResponse */ export interface V1GetCurrentTrialSearcherOperationResponse { - /** - * The current searcher operation. - * @type {V1TrialOperation} - * @memberof V1GetCurrentTrialSearcherOperationResponse - */ - op?: V1TrialOperation; - /** - * The status of the searcher operation. - * @type {boolean} - * @memberof V1GetCurrentTrialSearcherOperationResponse - */ - completed?: boolean; + /** + * The current searcher operation. + * @type {V1TrialOperation} + * @memberof V1GetCurrentTrialSearcherOperationResponse + */ + op?: V1TrialOperation; + /** + * The status of the searcher operation. + * @type {boolean} + * @memberof V1GetCurrentTrialSearcherOperationResponse + */ + completed?: boolean; } /** * Response to GetExperimentCheckpointsRequest. @@ -3836,18 +3850,18 @@ export interface V1GetCurrentTrialSearcherOperationResponse { * @interface V1GetExperimentCheckpointsResponse */ export interface V1GetExperimentCheckpointsResponse { - /** - * The list of returned checkpoints. - * @type {Array} - * @memberof V1GetExperimentCheckpointsResponse - */ - checkpoints: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetExperimentCheckpointsResponse - */ - pagination: V1Pagination; + /** + * The list of returned checkpoints. + * @type {Array} + * @memberof V1GetExperimentCheckpointsResponse + */ + checkpoints: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetExperimentCheckpointsResponse + */ + pagination: V1Pagination; } /** * Response to GetExperimentsLabelsRequest. @@ -3855,12 +3869,12 @@ export interface V1GetExperimentCheckpointsResponse { * @interface V1GetExperimentLabelsResponse */ export interface V1GetExperimentLabelsResponse { - /** - * The list of labels used across all experiments. - * @type {Array} - * @memberof V1GetExperimentLabelsResponse - */ - labels?: Array; + /** + * The list of labels used across all experiments. + * @type {Array} + * @memberof V1GetExperimentLabelsResponse + */ + labels?: Array; } /** * Response to GetExperimentRequest. @@ -3868,24 +3882,24 @@ export interface V1GetExperimentLabelsResponse { * @interface V1GetExperimentResponse */ export interface V1GetExperimentResponse { - /** - * The requested experiment. - * @type {V1Experiment} - * @memberof V1GetExperimentResponse - */ - experiment: V1Experiment; - /** - * Associated job summary. - * @type {V1JobSummary} - * @memberof V1GetExperimentResponse - */ - jobSummary?: V1JobSummary; - /** - * The experiment's config. - * @type {any} - * @memberof V1GetExperimentResponse - */ - config?: any; + /** + * The requested experiment. + * @type {V1Experiment} + * @memberof V1GetExperimentResponse + */ + experiment: V1Experiment; + /** + * Associated job summary. + * @type {V1JobSummary} + * @memberof V1GetExperimentResponse + */ + jobSummary?: V1JobSummary; + /** + * The experiment's config. + * @type {any} + * @memberof V1GetExperimentResponse + */ + config?: any; } /** * Sorts experiments by the given field. - SORT_BY_UNSPECIFIED: Returns experiments in an unsorted list. - SORT_BY_ID: Returns experiments sorted by id. - SORT_BY_DESCRIPTION: Returns experiments sorted by description. - SORT_BY_START_TIME: Return experiments sorted by start time. - SORT_BY_END_TIME: Return experiments sorted by end time. Experiments without end_time are returned after the ones with end_time. - SORT_BY_STATE: Return experiments sorted by state. - SORT_BY_NUM_TRIALS: Return experiments sorted by number of trials. - SORT_BY_PROGRESS: Return experiments sorted by progress. - SORT_BY_USER: Return experiments sorted by user. - SORT_BY_NAME: Returns experiments sorted by name. - SORT_BY_FORKED_FROM: Returns experiments sorted by originating model. - SORT_BY_RESOURCE_POOL: Returns experiments sorted by resource pool. - SORT_BY_PROJECT_ID: Returns experiments sorted by project. - SORT_BY_CHECKPOINT_SIZE: Returns experiments sorted by checkpoint size. - SORT_BY_CHECKPOINT_COUNT: Returns experiments sorted by checkpoint count. - SORT_BY_SEARCHER_METRIC_VAL: Returns experiments sorted by searcher metric value.. @@ -3893,42 +3907,42 @@ export interface V1GetExperimentResponse { * @enum {string} */ export const V1GetExperimentsRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - ID: 'SORT_BY_ID', - DESCRIPTION: 'SORT_BY_DESCRIPTION', - STARTTIME: 'SORT_BY_START_TIME', - ENDTIME: 'SORT_BY_END_TIME', - STATE: 'SORT_BY_STATE', - NUMTRIALS: 'SORT_BY_NUM_TRIALS', - PROGRESS: 'SORT_BY_PROGRESS', - USER: 'SORT_BY_USER', - NAME: 'SORT_BY_NAME', - FORKEDFROM: 'SORT_BY_FORKED_FROM', - RESOURCEPOOL: 'SORT_BY_RESOURCE_POOL', - PROJECTID: 'SORT_BY_PROJECT_ID', - CHECKPOINTSIZE: 'SORT_BY_CHECKPOINT_SIZE', - CHECKPOINTCOUNT: 'SORT_BY_CHECKPOINT_COUNT', - SEARCHERMETRICVAL: 'SORT_BY_SEARCHER_METRIC_VAL', -} as const; -export type V1GetExperimentsRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + ID: 'SORT_BY_ID', + DESCRIPTION: 'SORT_BY_DESCRIPTION', + STARTTIME: 'SORT_BY_START_TIME', + ENDTIME: 'SORT_BY_END_TIME', + STATE: 'SORT_BY_STATE', + NUMTRIALS: 'SORT_BY_NUM_TRIALS', + PROGRESS: 'SORT_BY_PROGRESS', + USER: 'SORT_BY_USER', + NAME: 'SORT_BY_NAME', + FORKEDFROM: 'SORT_BY_FORKED_FROM', + RESOURCEPOOL: 'SORT_BY_RESOURCE_POOL', + PROJECTID: 'SORT_BY_PROJECT_ID', + CHECKPOINTSIZE: 'SORT_BY_CHECKPOINT_SIZE', + CHECKPOINTCOUNT: 'SORT_BY_CHECKPOINT_COUNT', + SEARCHERMETRICVAL: 'SORT_BY_SEARCHER_METRIC_VAL', +} as const +export type V1GetExperimentsRequestSortBy = ValueOf /** * Response to GetExperimentsRequest. * @export * @interface V1GetExperimentsResponse */ export interface V1GetExperimentsResponse { - /** - * The list of returned experiments. - * @type {Array} - * @memberof V1GetExperimentsResponse - */ - experiments: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetExperimentsResponse - */ - pagination: V1Pagination; + /** + * The list of returned experiments. + * @type {Array} + * @memberof V1GetExperimentsResponse + */ + experiments: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetExperimentsResponse + */ + pagination: V1Pagination; } /** * Sorts trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. @@ -3936,38 +3950,38 @@ export interface V1GetExperimentsResponse { * @enum {string} */ export const V1GetExperimentTrialsRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - ID: 'SORT_BY_ID', - STARTTIME: 'SORT_BY_START_TIME', - ENDTIME: 'SORT_BY_END_TIME', - STATE: 'SORT_BY_STATE', - BESTVALIDATIONMETRIC: 'SORT_BY_BEST_VALIDATION_METRIC', - LATESTVALIDATIONMETRIC: 'SORT_BY_LATEST_VALIDATION_METRIC', - BATCHESPROCESSED: 'SORT_BY_BATCHES_PROCESSED', - DURATION: 'SORT_BY_DURATION', - RESTARTS: 'SORT_BY_RESTARTS', - CHECKPOINTSIZE: 'SORT_BY_CHECKPOINT_SIZE', - LOGRETENTIONDAYS: 'SORT_BY_LOG_RETENTION_DAYS', -} as const; -export type V1GetExperimentTrialsRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + ID: 'SORT_BY_ID', + STARTTIME: 'SORT_BY_START_TIME', + ENDTIME: 'SORT_BY_END_TIME', + STATE: 'SORT_BY_STATE', + BESTVALIDATIONMETRIC: 'SORT_BY_BEST_VALIDATION_METRIC', + LATESTVALIDATIONMETRIC: 'SORT_BY_LATEST_VALIDATION_METRIC', + BATCHESPROCESSED: 'SORT_BY_BATCHES_PROCESSED', + DURATION: 'SORT_BY_DURATION', + RESTARTS: 'SORT_BY_RESTARTS', + CHECKPOINTSIZE: 'SORT_BY_CHECKPOINT_SIZE', + LOGRETENTIONDAYS: 'SORT_BY_LOG_RETENTION_DAYS', +} as const +export type V1GetExperimentTrialsRequestSortBy = ValueOf /** * Response to GetExperimentTrialsRequest. * @export * @interface V1GetExperimentTrialsResponse */ export interface V1GetExperimentTrialsResponse { - /** - * The list of returned trials. - * @type {Array} - * @memberof V1GetExperimentTrialsResponse - */ - trials: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetExperimentTrialsResponse - */ - pagination: V1Pagination; + /** + * The list of returned trials. + * @type {Array} + * @memberof V1GetExperimentTrialsResponse + */ + trials: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetExperimentTrialsResponse + */ + pagination: V1Pagination; } /** * Response to GetExperimentValidationHistoryRequest. @@ -3975,25 +3989,25 @@ export interface V1GetExperimentTrialsResponse { * @interface V1GetExperimentValidationHistoryResponse */ export interface V1GetExperimentValidationHistoryResponse { - /** - * validation_history is a collection of zero or more validation metrics for an experiment, describing the best metrics as they were reported through the lifetime of an experiment. The historical list of best validations. - * @type {Array} - * @memberof V1GetExperimentValidationHistoryResponse - */ - validationHistory?: Array; + /** + * validation_history is a collection of zero or more validation metrics for an experiment, describing the best metrics as they were reported through the lifetime of an experiment. The historical list of best validations. + * @type {Array} + * @memberof V1GetExperimentValidationHistoryResponse + */ + validationHistory?: Array; } /** - * + * * @export * @interface V1GetGenericTaskConfigResponse */ export interface V1GetGenericTaskConfigResponse { - /** - * The config of the task - * @type {string} - * @memberof V1GetGenericTaskConfigResponse - */ - config: string; + /** + * The config of the task + * @type {string} + * @memberof V1GetGenericTaskConfigResponse + */ + config: string; } /** * GetGroupResponse is the body of the response for the call to get a group by id. @@ -4001,12 +4015,12 @@ export interface V1GetGenericTaskConfigResponse { * @interface V1GetGroupResponse */ export interface V1GetGroupResponse { - /** - * The group info - * @type {V1GroupDetails} - * @memberof V1GetGroupResponse - */ - group: V1GroupDetails; + /** + * The group info + * @type {V1GroupDetails} + * @memberof V1GetGroupResponse + */ + group: V1GroupDetails; } /** * Response object for GetGroupsAndUsersAssignedToWorkspace. @@ -4014,24 +4028,24 @@ export interface V1GetGroupResponse { * @interface V1GetGroupsAndUsersAssignedToWorkspaceResponse */ export interface V1GetGroupsAndUsersAssignedToWorkspaceResponse { - /** - * Groups with a role assigned to the given workspace scope. Contains user membership of each group. - * @type {Array} - * @memberof V1GetGroupsAndUsersAssignedToWorkspaceResponse - */ - groups: Array; - /** - * Only contains users assigned directly to roles on the workspace scope. - * @type {Array} - * @memberof V1GetGroupsAndUsersAssignedToWorkspaceResponse - */ - usersAssignedDirectly: Array; - /** - * Roles assigned to workspace with associations between groups and users_assigned_directly with roles. - * @type {Array} - * @memberof V1GetGroupsAndUsersAssignedToWorkspaceResponse - */ - assignments: Array; + /** + * Groups with a role assigned to the given workspace scope. Contains user membership of each group. + * @type {Array} + * @memberof V1GetGroupsAndUsersAssignedToWorkspaceResponse + */ + groups: Array; + /** + * Only contains users assigned directly to roles on the workspace scope. + * @type {Array} + * @memberof V1GetGroupsAndUsersAssignedToWorkspaceResponse + */ + usersAssignedDirectly: Array; + /** + * Roles assigned to workspace with associations between groups and users_assigned_directly with roles. + * @type {Array} + * @memberof V1GetGroupsAndUsersAssignedToWorkspaceResponse + */ + assignments: Array; } /** * GetGroupsRequest is the body of the request for the call to search for groups. @@ -4039,30 +4053,30 @@ export interface V1GetGroupsAndUsersAssignedToWorkspaceResponse { * @interface V1GetGroupsRequest */ export interface V1GetGroupsRequest { - /** - * The id of the user to use to find groups to which the user belongs. - * @type {number} - * @memberof V1GetGroupsRequest - */ - userId?: number; - /** - * The group name to use when searching. - * @type {string} - * @memberof V1GetGroupsRequest - */ - name?: string; - /** - * Skip the number of groups before returning results. Negative values denote number of groups to skip from the end before returning results. - * @type {number} - * @memberof V1GetGroupsRequest - */ - offset?: number; - /** - * Limit the number of groups. Required and must be must be <= 500. - * @type {number} - * @memberof V1GetGroupsRequest - */ - limit: number; + /** + * The id of the user to use to find groups to which the user belongs. + * @type {number} + * @memberof V1GetGroupsRequest + */ + userId?: number; + /** + * The group name to use when searching. + * @type {string} + * @memberof V1GetGroupsRequest + */ + name?: string; + /** + * Skip the number of groups before returning results. Negative values denote number of groups to skip from the end before returning results. + * @type {number} + * @memberof V1GetGroupsRequest + */ + offset?: number; + /** + * Limit the number of groups. Required and must be must be <= 500. + * @type {number} + * @memberof V1GetGroupsRequest + */ + limit: number; } /** * GetGroupsResponse is the body of the response for the call to search for groups. @@ -4070,18 +4084,18 @@ export interface V1GetGroupsRequest { * @interface V1GetGroupsResponse */ export interface V1GetGroupsResponse { - /** - * The found groups - * @type {Array} - * @memberof V1GetGroupsResponse - */ - groups?: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetGroupsResponse - */ - pagination?: V1Pagination; + /** + * The found groups + * @type {Array} + * @memberof V1GetGroupsResponse + */ + groups?: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetGroupsResponse + */ + pagination?: V1Pagination; } /** * Response to GetJobQueueStatsRequest. @@ -4089,12 +4103,12 @@ export interface V1GetGroupsResponse { * @interface V1GetJobQueueStatsResponse */ export interface V1GetJobQueueStatsResponse { - /** - * List of queue stats per resource pool. - * @type {Array} - * @memberof V1GetJobQueueStatsResponse - */ - results: Array; + /** + * List of queue stats per resource pool. + * @type {Array} + * @memberof V1GetJobQueueStatsResponse + */ + results: Array; } /** * Response to GetJobsRequest. @@ -4102,18 +4116,18 @@ export interface V1GetJobQueueStatsResponse { * @interface V1GetJobsResponse */ export interface V1GetJobsResponse { - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetJobsResponse - */ - pagination: V1Pagination; - /** - * List of the request jobs. - * @type {Array} - * @memberof V1GetJobsResponse - */ - jobs: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetJobsResponse + */ + pagination: V1Pagination; + /** + * List of the request jobs. + * @type {Array} + * @memberof V1GetJobsResponse + */ + jobs: Array; } /** * Response to GetJobsV2Request. @@ -4121,18 +4135,18 @@ export interface V1GetJobsResponse { * @interface V1GetJobsV2Response */ export interface V1GetJobsV2Response { - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetJobsV2Response - */ - pagination: V1Pagination; - /** - * List of the requested jobs. - * @type {Array} - * @memberof V1GetJobsV2Response - */ - jobs: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetJobsV2Response + */ + pagination: V1Pagination; + /** + * List of the requested jobs. + * @type {Array} + * @memberof V1GetJobsV2Response + */ + jobs: Array; } /** * Response to GetMasterRequest. @@ -4140,12 +4154,12 @@ export interface V1GetJobsV2Response { * @interface V1GetMasterConfigResponse */ export interface V1GetMasterConfigResponse { - /** - * The config file loaded by the master. - * @type {any} - * @memberof V1GetMasterConfigResponse - */ - config: any; + /** + * The config file loaded by the master. + * @type {any} + * @memberof V1GetMasterConfigResponse + */ + config: any; } /** * Response to GetMasterRequest. @@ -4153,96 +4167,96 @@ export interface V1GetMasterConfigResponse { * @interface V1GetMasterResponse */ export interface V1GetMasterResponse { - /** - * The current version of the master. - * @type {string} - * @memberof V1GetMasterResponse - */ - version: string; - /** - * The current instance id of the master. - * @type {string} - * @memberof V1GetMasterResponse - */ - masterId: string; - /** - * The global cluster id of the master. - * @type {string} - * @memberof V1GetMasterResponse - */ - clusterId: string; - /** - * The cluster name. - * @type {string} - * @memberof V1GetMasterResponse - */ - clusterName: string; - /** - * Telemetry status. - * @type {boolean} - * @memberof V1GetMasterResponse - */ - telemetryEnabled?: boolean; - /** - * SSO providers. - * @type {Array} - * @memberof V1GetMasterResponse - */ - ssoProviders?: Array; - /** - * Redirect for starting internal sessions.. - * @type {string} - * @memberof V1GetMasterResponse - */ - externalLoginUri?: string; - /** - * Redirect for ending external sessions. - * @type {string} - * @memberof V1GetMasterResponse - */ - externalLogoutUri?: string; - /** - * Branding style to use on front-end. - * @type {string} - * @memberof V1GetMasterResponse - */ - branding?: string; - /** - * Feature flag for RBAC and user groups. - * @type {boolean} - * @memberof V1GetMasterResponse - */ - rbacEnabled?: boolean; - /** - * What kind of product offering the cluster is part of, if any - * @type {GetMasterResponseProduct} - * @memberof V1GetMasterResponse - */ - product?: GetMasterResponseProduct; - /** - * List of features that is on. - * @type {Array} - * @memberof V1GetMasterResponse - */ - featureSwitches?: Array; - /** - * Feature flag for user management. - * @type {boolean} - * @memberof V1GetMasterResponse - */ - userManagementEnabled?: boolean; - /** - * Feature flag for strict job queue control. - * @type {boolean} - * @memberof V1GetMasterResponse - */ - strictJobQueueControl: boolean; - /** - * Active server cluster-wide message if any. - * @type {V1ClusterMessage} - * @memberof V1GetMasterResponse - */ - clusterMessage?: V1ClusterMessage; + /** + * The current version of the master. + * @type {string} + * @memberof V1GetMasterResponse + */ + version: string; + /** + * The current instance id of the master. + * @type {string} + * @memberof V1GetMasterResponse + */ + masterId: string; + /** + * The global cluster id of the master. + * @type {string} + * @memberof V1GetMasterResponse + */ + clusterId: string; + /** + * The cluster name. + * @type {string} + * @memberof V1GetMasterResponse + */ + clusterName: string; + /** + * Telemetry status. + * @type {boolean} + * @memberof V1GetMasterResponse + */ + telemetryEnabled?: boolean; + /** + * SSO providers. + * @type {Array} + * @memberof V1GetMasterResponse + */ + ssoProviders?: Array; + /** + * Redirect for starting internal sessions.. + * @type {string} + * @memberof V1GetMasterResponse + */ + externalLoginUri?: string; + /** + * Redirect for ending external sessions. + * @type {string} + * @memberof V1GetMasterResponse + */ + externalLogoutUri?: string; + /** + * Branding style to use on front-end. + * @type {string} + * @memberof V1GetMasterResponse + */ + branding?: string; + /** + * Feature flag for RBAC and user groups. + * @type {boolean} + * @memberof V1GetMasterResponse + */ + rbacEnabled?: boolean; + /** + * What kind of product offering the cluster is part of, if any + * @type {GetMasterResponseProduct} + * @memberof V1GetMasterResponse + */ + product?: GetMasterResponseProduct; + /** + * List of features that is on. + * @type {Array} + * @memberof V1GetMasterResponse + */ + featureSwitches?: Array; + /** + * Feature flag for user management. + * @type {boolean} + * @memberof V1GetMasterResponse + */ + userManagementEnabled?: boolean; + /** + * Feature flag for strict job queue control. + * @type {boolean} + * @memberof V1GetMasterResponse + */ + strictJobQueueControl: boolean; + /** + * Active server cluster-wide message if any. + * @type {V1ClusterMessage} + * @memberof V1GetMasterResponse + */ + clusterMessage?: V1ClusterMessage; } /** * Response to GetMeRequest. @@ -4250,12 +4264,12 @@ export interface V1GetMasterResponse { * @interface V1GetMeResponse */ export interface V1GetMeResponse { - /** - * The requested user. - * @type {V1User} - * @memberof V1GetMeResponse - */ - user: V1User; + /** + * The requested user. + * @type {V1User} + * @memberof V1GetMeResponse + */ + user: V1User; } /** * Response to GetMetricsRequest. @@ -4263,12 +4277,12 @@ export interface V1GetMeResponse { * @interface V1GetMetricsResponse */ export interface V1GetMetricsResponse { - /** - * Metric response. - * @type {Array} - * @memberof V1GetMetricsResponse - */ - metrics: Array; + /** + * Metric response. + * @type {Array} + * @memberof V1GetMetricsResponse + */ + metrics: Array; } /** * Request to get a file of model definition. @@ -4276,18 +4290,18 @@ export interface V1GetMetricsResponse { * @interface V1GetModelDefFileRequest */ export interface V1GetModelDefFileRequest { - /** - * The id of the experiment. - * @type {number} - * @memberof V1GetModelDefFileRequest - */ - experimentId?: number; - /** - * The path of file. - * @type {string} - * @memberof V1GetModelDefFileRequest - */ - path?: string; + /** + * The id of the experiment. + * @type {number} + * @memberof V1GetModelDefFileRequest + */ + experimentId?: number; + /** + * The path of file. + * @type {string} + * @memberof V1GetModelDefFileRequest + */ + path?: string; } /** * Response to GetModelDefFileRequest. @@ -4295,12 +4309,12 @@ export interface V1GetModelDefFileRequest { * @interface V1GetModelDefFileResponse */ export interface V1GetModelDefFileResponse { - /** - * Content of file. - * @type {string} - * @memberof V1GetModelDefFileResponse - */ - file?: string; + /** + * Content of file. + * @type {string} + * @memberof V1GetModelDefFileResponse + */ + file?: string; } /** * Response to GetModelDefRequest. @@ -4308,12 +4322,12 @@ export interface V1GetModelDefFileResponse { * @interface V1GetModelDefResponse */ export interface V1GetModelDefResponse { - /** - * The base64-encoded, gzipped, tarball. - * @type {string} - * @memberof V1GetModelDefResponse - */ - b64Tgz: string; + /** + * The base64-encoded, gzipped, tarball. + * @type {string} + * @memberof V1GetModelDefResponse + */ + b64Tgz: string; } /** * Response to GetModelDefTreeRequest. @@ -4321,12 +4335,12 @@ export interface V1GetModelDefResponse { * @interface V1GetModelDefTreeResponse */ export interface V1GetModelDefTreeResponse { - /** - * File tree of an experiment. - * @type {Array} - * @memberof V1GetModelDefTreeResponse - */ - files?: Array; + /** + * File tree of an experiment. + * @type {Array} + * @memberof V1GetModelDefTreeResponse + */ + files?: Array; } /** * Response to GetModelLabelsRequest. @@ -4334,12 +4348,12 @@ export interface V1GetModelDefTreeResponse { * @interface V1GetModelLabelsResponse */ export interface V1GetModelLabelsResponse { - /** - * List of labels used across all models. - * @type {Array} - * @memberof V1GetModelLabelsResponse - */ - labels: Array; + /** + * List of labels used across all models. + * @type {Array} + * @memberof V1GetModelLabelsResponse + */ + labels: Array; } /** * Response to GetModelRequest. @@ -4347,12 +4361,12 @@ export interface V1GetModelLabelsResponse { * @interface V1GetModelResponse */ export interface V1GetModelResponse { - /** - * The model requested. - * @type {V1Model} - * @memberof V1GetModelResponse - */ - model: V1Model; + /** + * The model requested. + * @type {V1Model} + * @memberof V1GetModelResponse + */ + model: V1Model; } /** * Sort models by the given field. - SORT_BY_UNSPECIFIED: Returns models in an unsorted list. - SORT_BY_NAME: Returns models sorted by name. - SORT_BY_DESCRIPTION: Returns models sorted by description. - SORT_BY_CREATION_TIME: Returns models sorted by creation time. - SORT_BY_LAST_UPDATED_TIME: Returns models sorted by last updated time. - SORT_BY_NUM_VERSIONS: Returns models sorted by number of version. - SORT_BY_WORKSPACE: Returns models sorted by workspace name. @@ -4360,33 +4374,33 @@ export interface V1GetModelResponse { * @enum {string} */ export const V1GetModelsRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - NAME: 'SORT_BY_NAME', - DESCRIPTION: 'SORT_BY_DESCRIPTION', - CREATIONTIME: 'SORT_BY_CREATION_TIME', - LASTUPDATEDTIME: 'SORT_BY_LAST_UPDATED_TIME', - NUMVERSIONS: 'SORT_BY_NUM_VERSIONS', - WORKSPACE: 'SORT_BY_WORKSPACE', -} as const; -export type V1GetModelsRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + NAME: 'SORT_BY_NAME', + DESCRIPTION: 'SORT_BY_DESCRIPTION', + CREATIONTIME: 'SORT_BY_CREATION_TIME', + LASTUPDATEDTIME: 'SORT_BY_LAST_UPDATED_TIME', + NUMVERSIONS: 'SORT_BY_NUM_VERSIONS', + WORKSPACE: 'SORT_BY_WORKSPACE', +} as const +export type V1GetModelsRequestSortBy = ValueOf /** * Response to GetModelsRequest. * @export * @interface V1GetModelsResponse */ export interface V1GetModelsResponse { - /** - * The list of returned models. - * @type {Array} - * @memberof V1GetModelsResponse - */ - models: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetModelsResponse - */ - pagination: V1Pagination; + /** + * The list of returned models. + * @type {Array} + * @memberof V1GetModelsResponse + */ + models: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetModelsResponse + */ + pagination: V1Pagination; } /** * Response for GetModelVersionRequest. @@ -4394,12 +4408,12 @@ export interface V1GetModelsResponse { * @interface V1GetModelVersionResponse */ export interface V1GetModelVersionResponse { - /** - * The model version requested. - * @type {V1ModelVersion} - * @memberof V1GetModelVersionResponse - */ - modelVersion: V1ModelVersion; + /** + * The model version requested. + * @type {V1ModelVersion} + * @memberof V1GetModelVersionResponse + */ + modelVersion: V1ModelVersion; } /** * Sort models by the given field. - SORT_BY_UNSPECIFIED: Returns model versions in an unsorted list. - SORT_BY_VERSION: Returns model versions sorted by version number. - SORT_BY_CREATION_TIME: Returns model versions sorted by creation_time. @@ -4407,54 +4421,54 @@ export interface V1GetModelVersionResponse { * @enum {string} */ export const V1GetModelVersionsRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - VERSION: 'SORT_BY_VERSION', - CREATIONTIME: 'SORT_BY_CREATION_TIME', -} as const; -export type V1GetModelVersionsRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + VERSION: 'SORT_BY_VERSION', + CREATIONTIME: 'SORT_BY_CREATION_TIME', +} as const +export type V1GetModelVersionsRequestSortBy = ValueOf /** * Response for GetModelVersionRequest. * @export * @interface V1GetModelVersionsResponse */ export interface V1GetModelVersionsResponse { - /** - * The model requested. - * @type {V1Model} - * @memberof V1GetModelVersionsResponse - */ - model: V1Model; - /** - * The list of returned model versions. - * @type {Array} - * @memberof V1GetModelVersionsResponse - */ - modelVersions: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetModelVersionsResponse - */ - pagination: V1Pagination; -} -/** - * Response to GetNotebookRequest. - * @export + /** + * The model requested. + * @type {V1Model} + * @memberof V1GetModelVersionsResponse + */ + model: V1Model; + /** + * The list of returned model versions. + * @type {Array} + * @memberof V1GetModelVersionsResponse + */ + modelVersions: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetModelVersionsResponse + */ + pagination: V1Pagination; +} +/** + * Response to GetNotebookRequest. + * @export * @interface V1GetNotebookResponse */ export interface V1GetNotebookResponse { - /** - * The requested notebook. - * @type {V1Notebook} - * @memberof V1GetNotebookResponse - */ - notebook: V1Notebook; - /** - * The notebook config. - * @type {any} - * @memberof V1GetNotebookResponse - */ - config: any; + /** + * The requested notebook. + * @type {V1Notebook} + * @memberof V1GetNotebookResponse + */ + notebook: V1Notebook; + /** + * The notebook config. + * @type {any} + * @memberof V1GetNotebookResponse + */ + config: any; } /** * Sorts notebooks by the given field. - SORT_BY_UNSPECIFIED: Returns notebooks in an unsorted list. - SORT_BY_ID: Returns notebooks sorted by id. - SORT_BY_DESCRIPTION: Returns notebooks sorted by description. - SORT_BY_START_TIME: Return notebooks sorted by start time. - SORT_BY_WORKSPACE_ID: Return notebooks sorted by workspace_id @@ -4462,31 +4476,31 @@ export interface V1GetNotebookResponse { * @enum {string} */ export const V1GetNotebooksRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - ID: 'SORT_BY_ID', - DESCRIPTION: 'SORT_BY_DESCRIPTION', - STARTTIME: 'SORT_BY_START_TIME', - WORKSPACEID: 'SORT_BY_WORKSPACE_ID', -} as const; -export type V1GetNotebooksRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + ID: 'SORT_BY_ID', + DESCRIPTION: 'SORT_BY_DESCRIPTION', + STARTTIME: 'SORT_BY_START_TIME', + WORKSPACEID: 'SORT_BY_WORKSPACE_ID', +} as const +export type V1GetNotebooksRequestSortBy = ValueOf /** * Response to GetNotebooksRequest. * @export * @interface V1GetNotebooksResponse */ export interface V1GetNotebooksResponse { - /** - * The list of returned notebooks. - * @type {Array} - * @memberof V1GetNotebooksResponse - */ - notebooks: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetNotebooksResponse - */ - pagination?: V1Pagination; + /** + * The list of returned notebooks. + * @type {Array} + * @memberof V1GetNotebooksResponse + */ + notebooks: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetNotebooksResponse + */ + pagination?: V1Pagination; } /** * Response to GetPermissionsSummaryRequest. @@ -4494,18 +4508,18 @@ export interface V1GetNotebooksResponse { * @interface V1GetPermissionsSummaryResponse */ export interface V1GetPermissionsSummaryResponse { - /** - * A group of roles in cluster and other scopes. - * @type {Array} - * @memberof V1GetPermissionsSummaryResponse - */ - roles: Array; - /** - * Lists of assignments for the cluster and other scopes. - * @type {Array} - * @memberof V1GetPermissionsSummaryResponse - */ - assignments: Array; + /** + * A group of roles in cluster and other scopes. + * @type {Array} + * @memberof V1GetPermissionsSummaryResponse + */ + roles: Array; + /** + * Lists of assignments for the cluster and other scopes. + * @type {Array} + * @memberof V1GetPermissionsSummaryResponse + */ + assignments: Array; } /** * Response to GetProjectByKeyRequest. @@ -4513,38 +4527,38 @@ export interface V1GetPermissionsSummaryResponse { * @interface V1GetProjectByKeyResponse */ export interface V1GetProjectByKeyResponse { - /** - * The project requested. - * @type {V1Project} - * @memberof V1GetProjectByKeyResponse - */ - project: V1Project; + /** + * The project requested. + * @type {V1Project} + * @memberof V1GetProjectByKeyResponse + */ + project: V1Project; } /** - * + * * @export * @interface V1GetProjectColumnsResponse */ export interface V1GetProjectColumnsResponse { - /** - * List of columns. - * @type {Array} - * @memberof V1GetProjectColumnsResponse - */ - columns: Array; + /** + * List of columns. + * @type {Array} + * @memberof V1GetProjectColumnsResponse + */ + columns: Array; } /** - * + * * @export * @interface V1GetProjectNumericMetricsRangeResponse */ export interface V1GetProjectNumericMetricsRangeResponse { - /** - * List of ranges. - * @type {Array} - * @memberof V1GetProjectNumericMetricsRangeResponse - */ - ranges?: Array; + /** + * List of ranges. + * @type {Array} + * @memberof V1GetProjectNumericMetricsRangeResponse + */ + ranges?: Array; } /** * Response to GetProjectRequest. @@ -4552,12 +4566,12 @@ export interface V1GetProjectNumericMetricsRangeResponse { * @interface V1GetProjectResponse */ export interface V1GetProjectResponse { - /** - * The project requested. - * @type {V1Project} - * @memberof V1GetProjectResponse - */ - project: V1Project; + /** + * The project requested. + * @type {V1Project} + * @memberof V1GetProjectResponse + */ + project: V1Project; } /** * Response to GetProjectsByUserActivityRequest. @@ -4565,12 +4579,12 @@ export interface V1GetProjectResponse { * @interface V1GetProjectsByUserActivityResponse */ export interface V1GetProjectsByUserActivityResponse { - /** - * A list of projects - * @type {Array} - * @memberof V1GetProjectsByUserActivityResponse - */ - projects?: Array; + /** + * A list of projects + * @type {Array} + * @memberof V1GetProjectsByUserActivityResponse + */ + projects?: Array; } /** * Response to GetResourcePoolsRequest. @@ -4578,76 +4592,76 @@ export interface V1GetProjectsByUserActivityResponse { * @interface V1GetResourcePoolsResponse */ export interface V1GetResourcePoolsResponse { - /** - * The list of returned resource pools. - * @type {Array} - * @memberof V1GetResourcePoolsResponse - */ - resourcePools?: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetResourcePoolsResponse - */ - pagination?: V1Pagination; + /** + * The list of returned resource pools. + * @type {Array} + * @memberof V1GetResourcePoolsResponse + */ + resourcePools?: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetResourcePoolsResponse + */ + pagination?: V1Pagination; } /** - * + * * @export * @interface V1GetRolesAssignedToGroupResponse */ export interface V1GetRolesAssignedToGroupResponse { - /** - * The roles assigned to the requested groups. - * @type {Array} - * @memberof V1GetRolesAssignedToGroupResponse - */ - roles: Array; - /** - * What scope each role is assigned to. - * @type {Array} - * @memberof V1GetRolesAssignedToGroupResponse - */ - assignments: Array; + /** + * The roles assigned to the requested groups. + * @type {Array} + * @memberof V1GetRolesAssignedToGroupResponse + */ + roles: Array; + /** + * What scope each role is assigned to. + * @type {Array} + * @memberof V1GetRolesAssignedToGroupResponse + */ + assignments: Array; } /** - * + * * @export * @interface V1GetRolesAssignedToUserResponse */ export interface V1GetRolesAssignedToUserResponse { - /** - * The roles assigned to the requested user with assignment information. - * @type {Array} - * @memberof V1GetRolesAssignedToUserResponse - */ - roles: Array; + /** + * The roles assigned to the requested user with assignment information. + * @type {Array} + * @memberof V1GetRolesAssignedToUserResponse + */ + roles: Array; } /** - * + * * @export * @interface V1GetRolesByIDRequest */ export interface V1GetRolesByIDRequest { - /** - * The ids of the roles to be returned - * @type {Array} - * @memberof V1GetRolesByIDRequest - */ - roleIds?: Array; + /** + * The ids of the roles to be returned + * @type {Array} + * @memberof V1GetRolesByIDRequest + */ + roleIds?: Array; } /** - * + * * @export * @interface V1GetRolesByIDResponse */ export interface V1GetRolesByIDResponse { - /** - * The roles requested - * @type {Array} - * @memberof V1GetRolesByIDResponse - */ - roles?: Array; + /** + * The roles requested + * @type {Array} + * @memberof V1GetRolesByIDResponse + */ + roles?: Array; } /** * Response to get the metadata of a run. @@ -4655,12 +4669,12 @@ export interface V1GetRolesByIDResponse { * @interface V1GetRunMetadataResponse */ export interface V1GetRunMetadataResponse { - /** - * The arbitrary metadata of the run. - * @type {any} - * @memberof V1GetRunMetadataResponse - */ - metadata?: any; + /** + * The arbitrary metadata of the run. + * @type {any} + * @memberof V1GetRunMetadataResponse + */ + metadata?: any; } /** * Response to GetSearcherEventsRequest. @@ -4668,12 +4682,12 @@ export interface V1GetRunMetadataResponse { * @interface V1GetSearcherEventsResponse */ export interface V1GetSearcherEventsResponse { - /** - * The list of events in the queue. - * @type {Array} - * @memberof V1GetSearcherEventsResponse - */ - searcherEvents?: Array; + /** + * The list of events in the queue. + * @type {Array} + * @memberof V1GetSearcherEventsResponse + */ + searcherEvents?: Array; } /** * Response to GetShellRequest. @@ -4681,18 +4695,18 @@ export interface V1GetSearcherEventsResponse { * @interface V1GetShellResponse */ export interface V1GetShellResponse { - /** - * The requested shell. - * @type {V1Shell} - * @memberof V1GetShellResponse - */ - shell: V1Shell; - /** - * The shell config. - * @type {any} - * @memberof V1GetShellResponse - */ - config: any; + /** + * The requested shell. + * @type {V1Shell} + * @memberof V1GetShellResponse + */ + shell: V1Shell; + /** + * The shell config. + * @type {any} + * @memberof V1GetShellResponse + */ + config: any; } /** * Sorts shells by the given field. - SORT_BY_UNSPECIFIED: Returns shells in an unsorted list. - SORT_BY_ID: Returns shells sorted by id. - SORT_BY_DESCRIPTION: Returns shells sorted by description. - SORT_BY_START_TIME: Return shells sorted by start time. - SORT_BY_WORKSPACE_ID: Return shells sorted by workspace_id. @@ -4700,31 +4714,31 @@ export interface V1GetShellResponse { * @enum {string} */ export const V1GetShellsRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - ID: 'SORT_BY_ID', - DESCRIPTION: 'SORT_BY_DESCRIPTION', - STARTTIME: 'SORT_BY_START_TIME', - WORKSPACEID: 'SORT_BY_WORKSPACE_ID', -} as const; -export type V1GetShellsRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + ID: 'SORT_BY_ID', + DESCRIPTION: 'SORT_BY_DESCRIPTION', + STARTTIME: 'SORT_BY_START_TIME', + WORKSPACEID: 'SORT_BY_WORKSPACE_ID', +} as const +export type V1GetShellsRequestSortBy = ValueOf /** * Response to GetShellsRequest. * @export * @interface V1GetShellsResponse */ export interface V1GetShellsResponse { - /** - * The list of returned shells. - * @type {Array} - * @memberof V1GetShellsResponse - */ - shells: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetShellsResponse - */ - pagination?: V1Pagination; + /** + * The list of returned shells. + * @type {Array} + * @memberof V1GetShellsResponse + */ + shells: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetShellsResponse + */ + pagination?: V1Pagination; } /** * Response to GetSlotRequest. @@ -4732,12 +4746,12 @@ export interface V1GetShellsResponse { * @interface V1GetSlotResponse */ export interface V1GetSlotResponse { - /** - * The requested slot. - * @type {V1Slot} - * @memberof V1GetSlotResponse - */ - slot?: V1Slot; + /** + * The requested slot. + * @type {V1Slot} + * @memberof V1GetSlotResponse + */ + slot?: V1Slot; } /** * Response to GetSlotsRequest. @@ -4745,25 +4759,25 @@ export interface V1GetSlotResponse { * @interface V1GetSlotsResponse */ export interface V1GetSlotsResponse { - /** - * The requested slots. - * @type {Array} - * @memberof V1GetSlotsResponse - */ - slots?: Array; + /** + * The requested slots. + * @type {Array} + * @memberof V1GetSlotsResponse + */ + slots?: Array; } /** - * + * * @export * @interface V1GetTaskAcceleratorDataResponse */ export interface V1GetTaskAcceleratorDataResponse { - /** - * The accelerator data for each allocation associated with the task. - * @type {Array} - * @memberof V1GetTaskAcceleratorDataResponse - */ - acceleratorData: Array; + /** + * The accelerator data for each allocation associated with the task. + * @type {Array} + * @memberof V1GetTaskAcceleratorDataResponse + */ + acceleratorData: Array; } /** * Response to GetTaskContextDirectoryRequest. @@ -4771,12 +4785,12 @@ export interface V1GetTaskAcceleratorDataResponse { * @interface V1GetTaskContextDirectoryResponse */ export interface V1GetTaskContextDirectoryResponse { - /** - * The base64-encoded, gzipped, tarball. - * @type {string} - * @memberof V1GetTaskContextDirectoryResponse - */ - b64Tgz: string; + /** + * The base64-encoded, gzipped, tarball. + * @type {string} + * @memberof V1GetTaskContextDirectoryResponse + */ + b64Tgz: string; } /** * Response to GetTaskRequest. @@ -4784,12 +4798,12 @@ export interface V1GetTaskContextDirectoryResponse { * @interface V1GetTaskResponse */ export interface V1GetTaskResponse { - /** - * The requested task. - * @type {V1Task} - * @memberof V1GetTaskResponse - */ - task: V1Task; + /** + * The requested task. + * @type {V1Task} + * @memberof V1GetTaskResponse + */ + task: V1Task; } /** * Response to GetTasksRequest. @@ -4797,12 +4811,12 @@ export interface V1GetTaskResponse { * @interface V1GetTasksResponse */ export interface V1GetTasksResponse { - /** - * Information about a task for external display. - * @type {{ [key: string]: V1AllocationSummary; }} - * @memberof V1GetTasksResponse - */ - allocationIdToSummary?: { [key: string]: V1AllocationSummary }; + /** + * Information about a task for external display. + * @type {{ [key: string]: V1AllocationSummary; }} + * @memberof V1GetTasksResponse + */ + allocationIdToSummary?: { [key: string]: V1AllocationSummary; }; } /** * Response to GetTelemetryRequest. @@ -4810,18 +4824,18 @@ export interface V1GetTasksResponse { * @interface V1GetTelemetryResponse */ export interface V1GetTelemetryResponse { - /** - * Whether telemetry is enabled or not. - * @type {boolean} - * @memberof V1GetTelemetryResponse - */ - enabled: boolean; - /** - * The key used for analytics in the UI. - * @type {string} - * @memberof V1GetTelemetryResponse - */ - segmentKey?: string; + /** + * Whether telemetry is enabled or not. + * @type {boolean} + * @memberof V1GetTelemetryResponse + */ + enabled: boolean; + /** + * The key used for analytics in the UI. + * @type {string} + * @memberof V1GetTelemetryResponse + */ + segmentKey?: string; } /** * Response to GetTemplateRequest. @@ -4829,12 +4843,12 @@ export interface V1GetTelemetryResponse { * @interface V1GetTemplateResponse */ export interface V1GetTemplateResponse { - /** - * The requested template. - * @type {V1Template} - * @memberof V1GetTemplateResponse - */ - template: V1Template; + /** + * The requested template. + * @type {V1Template} + * @memberof V1GetTemplateResponse + */ + template: V1Template; } /** * Sorts templates by the given field. - SORT_BY_UNSPECIFIED: Returns templates in an unsorted list. - SORT_BY_NAME: Returns templates sorted by name. @@ -4842,28 +4856,28 @@ export interface V1GetTemplateResponse { * @enum {string} */ export const V1GetTemplatesRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - NAME: 'SORT_BY_NAME', -} as const; -export type V1GetTemplatesRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + NAME: 'SORT_BY_NAME', +} as const +export type V1GetTemplatesRequestSortBy = ValueOf /** * Response to GetTemplatesRequest. * @export * @interface V1GetTemplatesResponse */ export interface V1GetTemplatesResponse { - /** - * the list of requested templates. - * @type {Array} - * @memberof V1GetTemplatesResponse - */ - templates: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetTemplatesResponse - */ - pagination: V1Pagination; + /** + * the list of requested templates. + * @type {Array} + * @memberof V1GetTemplatesResponse + */ + templates: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetTemplatesResponse + */ + pagination: V1Pagination; } /** * Response to GetTensorboardRequest. @@ -4871,18 +4885,18 @@ export interface V1GetTemplatesResponse { * @interface V1GetTensorboardResponse */ export interface V1GetTensorboardResponse { - /** - * The requested tensorboard. - * @type {V1Tensorboard} - * @memberof V1GetTensorboardResponse - */ - tensorboard: V1Tensorboard; - /** - * The config; - * @type {any} - * @memberof V1GetTensorboardResponse - */ - config: any; + /** + * The requested tensorboard. + * @type {V1Tensorboard} + * @memberof V1GetTensorboardResponse + */ + tensorboard: V1Tensorboard; + /** + * The config; + * @type {any} + * @memberof V1GetTensorboardResponse + */ + config: any; } /** * Sorts tensorboards by the given field. - SORT_BY_UNSPECIFIED: Returns tensorboards in an unsorted list. - SORT_BY_ID: Returns tensorboards sorted by id. - SORT_BY_DESCRIPTION: Returns tensorboards sorted by description. - SORT_BY_START_TIME: Return tensorboards sorted by start time. - SORT_BY_WORKSPACE_ID: Return tensorboards sorted by workspace_id. @@ -4890,31 +4904,31 @@ export interface V1GetTensorboardResponse { * @enum {string} */ export const V1GetTensorboardsRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - ID: 'SORT_BY_ID', - DESCRIPTION: 'SORT_BY_DESCRIPTION', - STARTTIME: 'SORT_BY_START_TIME', - WORKSPACEID: 'SORT_BY_WORKSPACE_ID', -} as const; -export type V1GetTensorboardsRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + ID: 'SORT_BY_ID', + DESCRIPTION: 'SORT_BY_DESCRIPTION', + STARTTIME: 'SORT_BY_START_TIME', + WORKSPACEID: 'SORT_BY_WORKSPACE_ID', +} as const +export type V1GetTensorboardsRequestSortBy = ValueOf /** * Response to GetTensorboardsRequest. * @export * @interface V1GetTensorboardsResponse */ export interface V1GetTensorboardsResponse { - /** - * The list of returned tensorboards. - * @type {Array} - * @memberof V1GetTensorboardsResponse - */ - tensorboards: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetTensorboardsResponse - */ - pagination?: V1Pagination; + /** + * The list of returned tensorboards. + * @type {Array} + * @memberof V1GetTensorboardsResponse + */ + tensorboards: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetTensorboardsResponse + */ + pagination?: V1Pagination; } /** * Response to GetTrainingMetricsRequest. @@ -4922,12 +4936,12 @@ export interface V1GetTensorboardsResponse { * @interface V1GetTrainingMetricsResponse */ export interface V1GetTrainingMetricsResponse { - /** - * Metric response. - * @type {Array} - * @memberof V1GetTrainingMetricsResponse - */ - metrics: Array; + /** + * Metric response. + * @type {Array} + * @memberof V1GetTrainingMetricsResponse + */ + metrics: Array; } /** * Response to GetTrialByExternalIDRequest. @@ -4935,12 +4949,12 @@ export interface V1GetTrainingMetricsResponse { * @interface V1GetTrialByExternalIDResponse */ export interface V1GetTrialByExternalIDResponse { - /** - * The requested trial. - * @type {Trialv1Trial} - * @memberof V1GetTrialByExternalIDResponse - */ - trial: Trialv1Trial; + /** + * The requested trial. + * @type {Trialv1Trial} + * @memberof V1GetTrialByExternalIDResponse + */ + trial: Trialv1Trial; } /** * Response to GetTrialCheckpointsRequest. @@ -4948,44 +4962,44 @@ export interface V1GetTrialByExternalIDResponse { * @interface V1GetTrialCheckpointsResponse */ export interface V1GetTrialCheckpointsResponse { - /** - * The list of returned checkpoints. - * @type {Array} - * @memberof V1GetTrialCheckpointsResponse - */ - checkpoints: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetTrialCheckpointsResponse - */ - pagination: V1Pagination; + /** + * The list of returned checkpoints. + * @type {Array} + * @memberof V1GetTrialCheckpointsResponse + */ + checkpoints: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetTrialCheckpointsResponse + */ + pagination: V1Pagination; } /** - * + * * @export * @interface V1GetTrialMetricsByCheckpointResponse */ export interface V1GetTrialMetricsByCheckpointResponse { - /** - * All the related trials and their metrics - * @type {Array} - * @memberof V1GetTrialMetricsByCheckpointResponse - */ - metrics: Array; + /** + * All the related trials and their metrics + * @type {Array} + * @memberof V1GetTrialMetricsByCheckpointResponse + */ + metrics: Array; } /** - * + * * @export * @interface V1GetTrialMetricsByModelVersionResponse */ export interface V1GetTrialMetricsByModelVersionResponse { - /** - * All the related trials and their metrics - * @type {Array} - * @memberof V1GetTrialMetricsByModelVersionResponse - */ - metrics: Array; + /** + * All the related trials and their metrics + * @type {Array} + * @memberof V1GetTrialMetricsByModelVersionResponse + */ + metrics: Array; } /** * Response to TrialProfilerAvailableSeriesRequest. @@ -4993,25 +5007,25 @@ export interface V1GetTrialMetricsByModelVersionResponse { * @interface V1GetTrialProfilerAvailableSeriesResponse */ export interface V1GetTrialProfilerAvailableSeriesResponse { - /** - * The labels for the series. - * @type {Array} - * @memberof V1GetTrialProfilerAvailableSeriesResponse - */ - labels: Array; + /** + * The labels for the series. + * @type {Array} + * @memberof V1GetTrialProfilerAvailableSeriesResponse + */ + labels: Array; } /** - * + * * @export * @interface V1GetTrialProfilerMetricsResponse */ export interface V1GetTrialProfilerMetricsResponse { - /** - * A batch matching the series requested. - * @type {V1TrialProfilerMetricsBatch} - * @memberof V1GetTrialProfilerMetricsResponse - */ - batch: V1TrialProfilerMetricsBatch; + /** + * A batch matching the series requested. + * @type {V1TrialProfilerMetricsBatch} + * @memberof V1GetTrialProfilerMetricsResponse + */ + batch: V1TrialProfilerMetricsBatch; } /** * Response to GetTrialRemainingLogRetentionDaysRequest. @@ -5019,12 +5033,12 @@ export interface V1GetTrialProfilerMetricsResponse { * @interface V1GetTrialRemainingLogRetentionDaysResponse */ export interface V1GetTrialRemainingLogRetentionDaysResponse { - /** - * The remaining log retention days for the trial id. - * @type {number} - * @memberof V1GetTrialRemainingLogRetentionDaysResponse - */ - remainingDays?: number; + /** + * The remaining log retention days for the trial id. + * @type {number} + * @memberof V1GetTrialRemainingLogRetentionDaysResponse + */ + remainingDays?: number; } /** * Response to GetTrialRequest. @@ -5032,12 +5046,12 @@ export interface V1GetTrialRemainingLogRetentionDaysResponse { * @interface V1GetTrialResponse */ export interface V1GetTrialResponse { - /** - * The requested trial. - * @type {Trialv1Trial} - * @memberof V1GetTrialResponse - */ - trial: Trialv1Trial; + /** + * The requested trial. + * @type {Trialv1Trial} + * @memberof V1GetTrialResponse + */ + trial: Trialv1Trial; } /** * Response to GetTrialWorkloadsRequest. @@ -5045,18 +5059,18 @@ export interface V1GetTrialResponse { * @interface V1GetTrialWorkloadsResponse */ export interface V1GetTrialWorkloadsResponse { - /** - * The list of returned workloads. - * @type {Array} - * @memberof V1GetTrialWorkloadsResponse - */ - workloads: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetTrialWorkloadsResponse - */ - pagination: V1Pagination; + /** + * The list of returned workloads. + * @type {Array} + * @memberof V1GetTrialWorkloadsResponse + */ + workloads: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetTrialWorkloadsResponse + */ + pagination: V1Pagination; } /** * Response to GetUserByUsernameRequest. @@ -5064,12 +5078,12 @@ export interface V1GetTrialWorkloadsResponse { * @interface V1GetUserByUsernameResponse */ export interface V1GetUserByUsernameResponse { - /** - * The requested user. - * @type {V1User} - * @memberof V1GetUserByUsernameResponse - */ - user: V1User; + /** + * The requested user. + * @type {V1User} + * @memberof V1GetUserByUsernameResponse + */ + user: V1User; } /** * Response to GetUserRequest. @@ -5077,12 +5091,12 @@ export interface V1GetUserByUsernameResponse { * @interface V1GetUserResponse */ export interface V1GetUserResponse { - /** - * The requested user. - * @type {V1User} - * @memberof V1GetUserResponse - */ - user: V1User; + /** + * The requested user. + * @type {V1User} + * @memberof V1GetUserResponse + */ + user: V1User; } /** * Response to GetUserSettingRequest. @@ -5090,12 +5104,12 @@ export interface V1GetUserResponse { * @interface V1GetUserSettingResponse */ export interface V1GetUserSettingResponse { - /** - * List of user settings. - * @type {Array} - * @memberof V1GetUserSettingResponse - */ - settings: Array; + /** + * List of user settings. + * @type {Array} + * @memberof V1GetUserSettingResponse + */ + settings: Array; } /** * Sort users by the given field. - SORT_BY_UNSPECIFIED: Returns users in an unsorted list. - SORT_BY_DISPLAY_NAME: Returns users sorted by display name. - SORT_BY_USER_NAME: Returns users sorted by user name. - SORT_BY_ADMIN: Returns users sorted by if they are admin. - SORT_BY_ACTIVE: Returns users sorted by if they are active. - SORT_BY_MODIFIED_TIME: Returns users sorted by modified time. - SORT_BY_NAME: Returns users sorted by username unless display name exist. - SORT_BY_LAST_AUTH_TIME: Returns users sorted by last authenticated time. - SORT_BY_REMOTE: Returns users sorted by local or remote auth. @@ -5103,35 +5117,35 @@ export interface V1GetUserSettingResponse { * @enum {string} */ export const V1GetUsersRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - DISPLAYNAME: 'SORT_BY_DISPLAY_NAME', - USERNAME: 'SORT_BY_USER_NAME', - ADMIN: 'SORT_BY_ADMIN', - ACTIVE: 'SORT_BY_ACTIVE', - MODIFIEDTIME: 'SORT_BY_MODIFIED_TIME', - NAME: 'SORT_BY_NAME', - LASTAUTHTIME: 'SORT_BY_LAST_AUTH_TIME', - REMOTE: 'SORT_BY_REMOTE', -} as const; -export type V1GetUsersRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + DISPLAYNAME: 'SORT_BY_DISPLAY_NAME', + USERNAME: 'SORT_BY_USER_NAME', + ADMIN: 'SORT_BY_ADMIN', + ACTIVE: 'SORT_BY_ACTIVE', + MODIFIEDTIME: 'SORT_BY_MODIFIED_TIME', + NAME: 'SORT_BY_NAME', + LASTAUTHTIME: 'SORT_BY_LAST_AUTH_TIME', + REMOTE: 'SORT_BY_REMOTE', +} as const +export type V1GetUsersRequestSortBy = ValueOf /** * Response to GetUsersRequest. * @export * @interface V1GetUsersResponse */ export interface V1GetUsersResponse { - /** - * The list of requested users. - * @type {Array} - * @memberof V1GetUsersResponse - */ - users?: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetUsersResponse - */ - pagination?: V1Pagination; + /** + * The list of requested users. + * @type {Array} + * @memberof V1GetUsersResponse + */ + users?: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetUsersResponse + */ + pagination?: V1Pagination; } /** * Response to GetTrainingMetricsRequest. @@ -5139,12 +5153,12 @@ export interface V1GetUsersResponse { * @interface V1GetValidationMetricsResponse */ export interface V1GetValidationMetricsResponse { - /** - * Metric response. - * @type {Array} - * @memberof V1GetValidationMetricsResponse - */ - metrics: Array; + /** + * Metric response. + * @type {Array} + * @memberof V1GetValidationMetricsResponse + */ + metrics: Array; } /** * Response to GetWebhooksRequest. @@ -5152,12 +5166,12 @@ export interface V1GetValidationMetricsResponse { * @interface V1GetWebhooksResponse */ export interface V1GetWebhooksResponse { - /** - * The list of returned webhooks. - * @type {Array} - * @memberof V1GetWebhooksResponse - */ - webhooks: Array; + /** + * The list of returned webhooks. + * @type {Array} + * @memberof V1GetWebhooksResponse + */ + webhooks: Array; } /** * Sort associated projects by the given field. - SORT_BY_UNSPECIFIED: Returns projects in an unsorted list. - SORT_BY_CREATION_TIME: Returns projects sorted by time that they were created. - SORT_BY_LAST_EXPERIMENT_START_TIME: Returns projects sorted by most recent start of an experiment. - SORT_BY_NAME: Returns projects sorted by name. - SORT_BY_DESCRIPTION: Returns projects sorted by description. - SORT_BY_ID: Returns projects sorted by ID. @@ -5165,34 +5179,32 @@ export interface V1GetWebhooksResponse { * @enum {string} */ export const V1GetWorkspaceProjectsRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - CREATIONTIME: 'SORT_BY_CREATION_TIME', - LASTEXPERIMENTSTARTTIME: 'SORT_BY_LAST_EXPERIMENT_START_TIME', - NAME: 'SORT_BY_NAME', - DESCRIPTION: 'SORT_BY_DESCRIPTION', - ID: 'SORT_BY_ID', -} as const; -export type V1GetWorkspaceProjectsRequestSortBy = ValueOf< - typeof V1GetWorkspaceProjectsRequestSortBy ->; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + CREATIONTIME: 'SORT_BY_CREATION_TIME', + LASTEXPERIMENTSTARTTIME: 'SORT_BY_LAST_EXPERIMENT_START_TIME', + NAME: 'SORT_BY_NAME', + DESCRIPTION: 'SORT_BY_DESCRIPTION', + ID: 'SORT_BY_ID', +} as const +export type V1GetWorkspaceProjectsRequestSortBy = ValueOf /** * Response to GetWorkspaceProjectsRequest. * @export * @interface V1GetWorkspaceProjectsResponse */ export interface V1GetWorkspaceProjectsResponse { - /** - * The projects associated with the workspace. - * @type {Array} - * @memberof V1GetWorkspaceProjectsResponse - */ - projects: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetWorkspaceProjectsResponse - */ - pagination: V1Pagination; + /** + * The projects associated with the workspace. + * @type {Array} + * @memberof V1GetWorkspaceProjectsResponse + */ + projects: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetWorkspaceProjectsResponse + */ + pagination: V1Pagination; } /** * Response to GetWorkspaceRequest. @@ -5200,12 +5212,12 @@ export interface V1GetWorkspaceProjectsResponse { * @interface V1GetWorkspaceResponse */ export interface V1GetWorkspaceResponse { - /** - * The workspace requested. - * @type {V1Workspace} - * @memberof V1GetWorkspaceResponse - */ - workspace: V1Workspace; + /** + * The workspace requested. + * @type {V1Workspace} + * @memberof V1GetWorkspaceResponse + */ + workspace: V1Workspace; } /** * Sort workspaces by the given field. - SORT_BY_UNSPECIFIED: Returns workspaces in an unsorted list. - SORT_BY_ID: Returns workspaces sorted by id. - SORT_BY_NAME: Returns workspaces sorted by name. @@ -5213,48 +5225,48 @@ export interface V1GetWorkspaceResponse { * @enum {string} */ export const V1GetWorkspacesRequestSortBy = { - UNSPECIFIED: 'SORT_BY_UNSPECIFIED', - ID: 'SORT_BY_ID', - NAME: 'SORT_BY_NAME', -} as const; -export type V1GetWorkspacesRequestSortBy = ValueOf; + UNSPECIFIED: 'SORT_BY_UNSPECIFIED', + ID: 'SORT_BY_ID', + NAME: 'SORT_BY_NAME', +} as const +export type V1GetWorkspacesRequestSortBy = ValueOf /** * Response to GetWorkspacesRequest. * @export * @interface V1GetWorkspacesResponse */ export interface V1GetWorkspacesResponse { - /** - * The list of returned workspaces. - * @type {Array} - * @memberof V1GetWorkspacesResponse - */ - workspaces: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1GetWorkspacesResponse - */ - pagination: V1Pagination; + /** + * The list of returned workspaces. + * @type {Array} + * @memberof V1GetWorkspacesResponse + */ + workspaces: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1GetWorkspacesResponse + */ + pagination: V1Pagination; } /** - * + * * @export * @interface V1Group */ export interface V1Group { - /** - * The id of the group being detailed - * @type {number} - * @memberof V1Group - */ - groupId?: number; - /** - * The name of the group - * @type {string} - * @memberof V1Group - */ - name?: string; + /** + * The id of the group being detailed + * @type {number} + * @memberof V1Group + */ + groupId?: number; + /** + * The name of the group + * @type {string} + * @memberof V1Group + */ + name?: string; } /** * GroupDetails contains detailed information about a specific Group including which users belong to the group. @@ -5262,24 +5274,24 @@ export interface V1Group { * @interface V1GroupDetails */ export interface V1GroupDetails { - /** - * The id of the group being detailed - * @type {number} - * @memberof V1GroupDetails - */ - groupId?: number; - /** - * The name of the group - * @type {string} - * @memberof V1GroupDetails - */ - name?: string; - /** - * The members of the group - * @type {Array} - * @memberof V1GroupDetails - */ - users?: Array; + /** + * The id of the group being detailed + * @type {number} + * @memberof V1GroupDetails + */ + groupId?: number; + /** + * The name of the group + * @type {string} + * @memberof V1GroupDetails + */ + name?: string; + /** + * The members of the group + * @type {Array} + * @memberof V1GroupDetails + */ + users?: Array; } /** * GroupRoleAssignment contains information about the groups belonging to a role. @@ -5287,18 +5299,18 @@ export interface V1GroupDetails { * @interface V1GroupRoleAssignment */ export interface V1GroupRoleAssignment { - /** - * The group id of the role assignment - * @type {number} - * @memberof V1GroupRoleAssignment - */ - groupId: number; - /** - * The role and scope of the assignment. - * @type {V1RoleAssignment} - * @memberof V1GroupRoleAssignment - */ - roleAssignment: V1RoleAssignment; + /** + * The group id of the role assignment + * @type {number} + * @memberof V1GroupRoleAssignment + */ + groupId: number; + /** + * The role and scope of the assignment. + * @type {V1RoleAssignment} + * @memberof V1GroupRoleAssignment + */ + roleAssignment: V1RoleAssignment; } /** * GroupSearchResult is the representation of groups as they're returned by the search endpoint. @@ -5306,18 +5318,18 @@ export interface V1GroupRoleAssignment { * @interface V1GroupSearchResult */ export interface V1GroupSearchResult { - /** - * A group matching the search criteria - * @type {V1Group} - * @memberof V1GroupSearchResult - */ - group: V1Group; - /** - * The number of users that are in this group - * @type {number} - * @memberof V1GroupSearchResult - */ - numMembers: number; + /** + * A group matching the search criteria + * @type {V1Group} + * @memberof V1GroupSearchResult + */ + group: V1Group; + /** + * The number of users that are in this group + * @type {number} + * @memberof V1GroupSearchResult + */ + numMembers: number; } /** * Kill the requested notebook if idle. @@ -5325,37 +5337,38 @@ export interface V1GroupSearchResult { * @interface V1IdleNotebookRequest */ export interface V1IdleNotebookRequest { - /** - * The id of the notebook. - * @type {string} - * @memberof V1IdleNotebookRequest - */ - notebookId?: string; - /** - * The value of idle timeout - * @type {boolean} - * @memberof V1IdleNotebookRequest - */ - idle?: boolean; + /** + * The id of the notebook. + * @type {string} + * @memberof V1IdleNotebookRequest + */ + notebookId?: string; + /** + * The value of idle timeout + * @type {boolean} + * @memberof V1IdleNotebookRequest + */ + idle?: boolean; } /** * Response to IdleNotebookRequest. * @export * @interface V1IdleNotebookResponse */ -export interface V1IdleNotebookResponse {} +export interface V1IdleNotebookResponse { +} /** * InitialOperations is a searcher event signaling the creation of an experiment. * @export * @interface V1InitialOperations */ export interface V1InitialOperations { - /** - * Cannot have an empty message type. - * @type {number} - * @memberof V1InitialOperations - */ - placeholder?: number; + /** + * Cannot have an empty message type. + * @type {number} + * @memberof V1InitialOperations + */ + placeholder?: number; } /** * Int32 filters. @@ -5363,42 +5376,42 @@ export interface V1InitialOperations { * @interface V1Int32FieldFilter */ export interface V1Int32FieldFilter { - /** - * Less than. - * @type {number} - * @memberof V1Int32FieldFilter - */ - lt?: number; - /** - * Less than or equal. - * @type {number} - * @memberof V1Int32FieldFilter - */ - lte?: number; - /** - * Greater than. - * @type {number} - * @memberof V1Int32FieldFilter - */ - gt?: number; - /** - * Greater than or equal. - * @type {number} - * @memberof V1Int32FieldFilter - */ - gte?: number; - /** - * In a set. `in` is a reserved word in python. - * @type {Array} - * @memberof V1Int32FieldFilter - */ - incl?: Array; - /** - * Not in a set. - * @type {Array} - * @memberof V1Int32FieldFilter - */ - notIn?: Array; + /** + * Less than. + * @type {number} + * @memberof V1Int32FieldFilter + */ + lt?: number; + /** + * Less than or equal. + * @type {number} + * @memberof V1Int32FieldFilter + */ + lte?: number; + /** + * Greater than. + * @type {number} + * @memberof V1Int32FieldFilter + */ + gt?: number; + /** + * Greater than or equal. + * @type {number} + * @memberof V1Int32FieldFilter + */ + gte?: number; + /** + * In a set. `in` is a reserved word in python. + * @type {Array} + * @memberof V1Int32FieldFilter + */ + incl?: Array; + /** + * Not in a set. + * @type {Array} + * @memberof V1Int32FieldFilter + */ + notIn?: Array; } /** * Job represents a user submitted work that is not in a terminal state. @@ -5406,102 +5419,102 @@ export interface V1Int32FieldFilter { * @interface V1Job */ export interface V1Job { - /** - * Job summary. - * @type {V1JobSummary} - * @memberof V1Job - */ - summary?: V1JobSummary; - /** - * Job type. - * @type {Jobv1Type} - * @memberof V1Job - */ - type: Jobv1Type; - /** - * The time when the job was submitted by the user. - * @type {Date | DateString} - * @memberof V1Job - */ - submissionTime: Date | DateString; - /** - * The username of the user who submitted the job. - * @type {string} - * @memberof V1Job - */ - username: string; - /** - * The id of the user who submitted the job. - * @type {number} - * @memberof V1Job - */ - userId?: number; - /** - * Associated resource pool. - * @type {string} - * @memberof V1Job - */ - resourcePool: string; - /** - * Whether the job is preemptible. - * @type {boolean} - * @memberof V1Job - */ - isPreemptible: boolean; - /** - * The job priority in priority scheduler. - * @type {number} - * @memberof V1Job - */ - priority?: number; - /** - * The job weight in fairshare scheduler. - * @type {number} - * @memberof V1Job - */ - weight?: number; - /** - * Entity ID. - * @type {string} - * @memberof V1Job - */ - entityId: string; - /** - * Job type. - * @type {string} - * @memberof V1Job - */ - jobId: string; - /** - * Number of requested slots. - * @type {number} - * @memberof V1Job - */ - requestedSlots: number; - /** - * Number of allocated slots. - * @type {number} - * @memberof V1Job - */ - allocatedSlots: number; - /** - * Job name. - * @type {string} - * @memberof V1Job - */ - name: string; - /** - * Job's progress from 0 to 1. - * @type {number} - * @memberof V1Job - */ - progress?: number; - /** - * Job's workspace id. - * @type {number} - * @memberof V1Job - */ - workspaceId: number; + /** + * Job summary. + * @type {V1JobSummary} + * @memberof V1Job + */ + summary?: V1JobSummary; + /** + * Job type. + * @type {Jobv1Type} + * @memberof V1Job + */ + type: Jobv1Type; + /** + * The time when the job was submitted by the user. + * @type {Date | DateString} + * @memberof V1Job + */ + submissionTime: Date | DateString; + /** + * The username of the user who submitted the job. + * @type {string} + * @memberof V1Job + */ + username: string; + /** + * The id of the user who submitted the job. + * @type {number} + * @memberof V1Job + */ + userId?: number; + /** + * Associated resource pool. + * @type {string} + * @memberof V1Job + */ + resourcePool: string; + /** + * Whether the job is preemptible. + * @type {boolean} + * @memberof V1Job + */ + isPreemptible: boolean; + /** + * The job priority in priority scheduler. + * @type {number} + * @memberof V1Job + */ + priority?: number; + /** + * The job weight in fairshare scheduler. + * @type {number} + * @memberof V1Job + */ + weight?: number; + /** + * Entity ID. + * @type {string} + * @memberof V1Job + */ + entityId: string; + /** + * Job type. + * @type {string} + * @memberof V1Job + */ + jobId: string; + /** + * Number of requested slots. + * @type {number} + * @memberof V1Job + */ + requestedSlots: number; + /** + * Number of allocated slots. + * @type {number} + * @memberof V1Job + */ + allocatedSlots: number; + /** + * Job name. + * @type {string} + * @memberof V1Job + */ + name: string; + /** + * Job's progress from 0 to 1. + * @type {number} + * @memberof V1Job + */ + progress?: number; + /** + * Job's workspace id. + * @type {number} + * @memberof V1Job + */ + workspaceId: number; } /** * Job summary. @@ -5509,37 +5522,37 @@ export interface V1Job { * @interface V1JobSummary */ export interface V1JobSummary { - /** - * The scheduling state of the job. - * @type {Jobv1State} - * @memberof V1JobSummary - */ - state: Jobv1State; - /** - * The number of jobs ahead of this one in the queue. - * @type {number} - * @memberof V1JobSummary - */ - jobsAhead: number; + /** + * The scheduling state of the job. + * @type {Jobv1State} + * @memberof V1JobSummary + */ + state: Jobv1State; + /** + * The number of jobs ahead of this one in the queue. + * @type {number} + * @memberof V1JobSummary + */ + jobsAhead: number; } /** - * + * * @export * @interface V1K8PriorityClass */ export interface V1K8PriorityClass { - /** - * Priority class name. - * @type {string} - * @memberof V1K8PriorityClass - */ - priorityClass?: string; - /** - * Priority class value. - * @type {number} - * @memberof V1K8PriorityClass - */ - priorityValue?: number; + /** + * Priority class name. + * @type {string} + * @memberof V1K8PriorityClass + */ + priorityClass?: string; + /** + * Priority class value. + * @type {number} + * @memberof V1K8PriorityClass + */ + priorityValue?: number; } /** * Response to KillCommandRequest. @@ -5547,43 +5560,44 @@ export interface V1K8PriorityClass { * @interface V1KillCommandResponse */ export interface V1KillCommandResponse { - /** - * The requested command. - * @type {V1Command} - * @memberof V1KillCommandResponse - */ - command?: V1Command; + /** + * The requested command. + * @type {V1Command} + * @memberof V1KillCommandResponse + */ + command?: V1Command; } /** * Response to KillExperimentRequest. * @export * @interface V1KillExperimentResponse */ -export interface V1KillExperimentResponse {} +export interface V1KillExperimentResponse { +} /** * Kill multiple experiments. * @export * @interface V1KillExperimentsRequest */ export interface V1KillExperimentsRequest { - /** - * Selecting experiments by id. - * @type {Array} - * @memberof V1KillExperimentsRequest - */ - experimentIds: Array; - /** - * Targets all experiments matching filters. - * @type {V1BulkExperimentFilters} - * @memberof V1KillExperimentsRequest - */ - filters?: V1BulkExperimentFilters; - /** - * Project id that the experiments belong to. - * @type {number} - * @memberof V1KillExperimentsRequest - */ - projectId: number; + /** + * Selecting experiments by id. + * @type {Array} + * @memberof V1KillExperimentsRequest + */ + experimentIds: Array; + /** + * Targets all experiments matching filters. + * @type {V1BulkExperimentFilters} + * @memberof V1KillExperimentsRequest + */ + filters?: V1BulkExperimentFilters; + /** + * Project id that the experiments belong to. + * @type {number} + * @memberof V1KillExperimentsRequest + */ + projectId: number; } /** * Response to KillExperimentsRequest. @@ -5591,50 +5605,51 @@ export interface V1KillExperimentsRequest { * @interface V1KillExperimentsResponse */ export interface V1KillExperimentsResponse { - /** - * Details on success or error for each experiment. - * @type {Array} - * @memberof V1KillExperimentsResponse - */ - results: Array; + /** + * Details on success or error for each experiment. + * @type {Array} + * @memberof V1KillExperimentsResponse + */ + results: Array; } /** - * + * * @export * @interface V1KillGenericTaskRequest */ export interface V1KillGenericTaskRequest { - /** - * The id of the task. - * @type {string} - * @memberof V1KillGenericTaskRequest - */ - taskId: string; - /** - * Kill entire task tree - * @type {boolean} - * @memberof V1KillGenericTaskRequest - */ - killFromRoot?: boolean; + /** + * The id of the task. + * @type {string} + * @memberof V1KillGenericTaskRequest + */ + taskId: string; + /** + * Kill entire task tree + * @type {boolean} + * @memberof V1KillGenericTaskRequest + */ + killFromRoot?: boolean; } /** - * + * * @export * @interface V1KillGenericTaskResponse */ -export interface V1KillGenericTaskResponse {} +export interface V1KillGenericTaskResponse { +} /** * Response to KillNotebookRequest. * @export * @interface V1KillNotebookResponse */ export interface V1KillNotebookResponse { - /** - * The requested notebook. - * @type {V1Notebook} - * @memberof V1KillNotebookResponse - */ - notebook?: V1Notebook; + /** + * The requested notebook. + * @type {V1Notebook} + * @memberof V1KillNotebookResponse + */ + notebook?: V1Notebook; } /** * Kill runs. @@ -5642,24 +5657,24 @@ export interface V1KillNotebookResponse { * @interface V1KillRunsRequest */ export interface V1KillRunsRequest { - /** - * The ids of the runs being killed. - * @type {Array} - * @memberof V1KillRunsRequest - */ - runIds: Array; - /** - * Project id of the runs being killed. - * @type {number} - * @memberof V1KillRunsRequest - */ - projectId?: number; - /** - * Filter expression - * @type {string} - * @memberof V1KillRunsRequest - */ - filter?: string; + /** + * The ids of the runs being killed. + * @type {Array} + * @memberof V1KillRunsRequest + */ + runIds: Array; + /** + * Project id of the runs being killed. + * @type {number} + * @memberof V1KillRunsRequest + */ + projectId?: number; + /** + * Filter expression + * @type {string} + * @memberof V1KillRunsRequest + */ + filter?: string; } /** * Response to KillRunsResponse. @@ -5667,12 +5682,12 @@ export interface V1KillRunsRequest { * @interface V1KillRunsResponse */ export interface V1KillRunsResponse { - /** - * Details on success or error for each run. - * @type {Array} - * @memberof V1KillRunsResponse - */ - results: Array; + /** + * Details on success or error for each run. + * @type {Array} + * @memberof V1KillRunsResponse + */ + results: Array; } /** * Response to KillShellRequest. @@ -5680,12 +5695,12 @@ export interface V1KillRunsResponse { * @interface V1KillShellResponse */ export interface V1KillShellResponse { - /** - * The requested shell. - * @type {V1Shell} - * @memberof V1KillShellResponse - */ - shell?: V1Shell; + /** + * The requested shell. + * @type {V1Shell} + * @memberof V1KillShellResponse + */ + shell?: V1Shell; } /** * Response to KillTensorboardRequest. @@ -5693,55 +5708,56 @@ export interface V1KillShellResponse { * @interface V1KillTensorboardResponse */ export interface V1KillTensorboardResponse { - /** - * The requested tensorboard. - * @type {V1Tensorboard} - * @memberof V1KillTensorboardResponse - */ - tensorboard?: V1Tensorboard; -} + /** + * The requested tensorboard. + * @type {V1Tensorboard} + * @memberof V1KillTensorboardResponse + */ + tensorboard?: V1Tensorboard; +} /** * Response to KillTrialRequest. * @export * @interface V1KillTrialResponse */ -export interface V1KillTrialResponse {} +export interface V1KillTrialResponse { +} /** * Request to launch a command. * @export * @interface V1LaunchCommandRequest */ export interface V1LaunchCommandRequest { - /** - * Command config (JSON). - * @type {any} - * @memberof V1LaunchCommandRequest - */ - config?: any; - /** - * Template name. - * @type {string} - * @memberof V1LaunchCommandRequest - */ - templateName?: string; - /** - * The files to run with the command. - * @type {Array} - * @memberof V1LaunchCommandRequest - */ - files?: Array; - /** - * Additional data. - * @type {string} - * @memberof V1LaunchCommandRequest - */ - data?: string; - /** - * Workspace ID. Defaults to the 'Uncategorized' workspace if not specified. - * @type {number} - * @memberof V1LaunchCommandRequest - */ - workspaceId?: number; + /** + * Command config (JSON). + * @type {any} + * @memberof V1LaunchCommandRequest + */ + config?: any; + /** + * Template name. + * @type {string} + * @memberof V1LaunchCommandRequest + */ + templateName?: string; + /** + * The files to run with the command. + * @type {Array} + * @memberof V1LaunchCommandRequest + */ + files?: Array; + /** + * Additional data. + * @type {string} + * @memberof V1LaunchCommandRequest + */ + data?: string; + /** + * Workspace ID. Defaults to the 'Uncategorized' workspace if not specified. + * @type {number} + * @memberof V1LaunchCommandRequest + */ + workspaceId?: number; } /** * Response to LaunchCommandRequest. @@ -5749,24 +5765,24 @@ export interface V1LaunchCommandRequest { * @interface V1LaunchCommandResponse */ export interface V1LaunchCommandResponse { - /** - * The requested command. - * @type {V1Command} - * @memberof V1LaunchCommandResponse - */ - command: V1Command; - /** - * The config; - * @type {any} - * @memberof V1LaunchCommandResponse - */ - config: any; - /** - * If the requested slots exceeded the current max available. - * @type {Array} - * @memberof V1LaunchCommandResponse - */ - warnings?: Array; + /** + * The requested command. + * @type {V1Command} + * @memberof V1LaunchCommandResponse + */ + command: V1Command; + /** + * The config; + * @type {any} + * @memberof V1LaunchCommandResponse + */ + config: any; + /** + * If the requested slots exceeded the current max available. + * @type {Array} + * @memberof V1LaunchCommandResponse + */ + warnings?: Array; } /** * Request to launch a notebook. @@ -5774,36 +5790,36 @@ export interface V1LaunchCommandResponse { * @interface V1LaunchNotebookRequest */ export interface V1LaunchNotebookRequest { - /** - * Notebook config (JSON). - * @type {any} - * @memberof V1LaunchNotebookRequest - */ - config?: any; - /** - * Template name. - * @type {string} - * @memberof V1LaunchNotebookRequest - */ - templateName?: string; - /** - * The files to run with the command. - * @type {Array} - * @memberof V1LaunchNotebookRequest - */ - files?: Array; - /** - * Preview a launching request without actually creating a Notebook. - * @type {boolean} - * @memberof V1LaunchNotebookRequest - */ - preview?: boolean; - /** - * Workspace ID. Defaults to 'Uncategorized' workspace if not specified. - * @type {number} - * @memberof V1LaunchNotebookRequest - */ - workspaceId?: number; + /** + * Notebook config (JSON). + * @type {any} + * @memberof V1LaunchNotebookRequest + */ + config?: any; + /** + * Template name. + * @type {string} + * @memberof V1LaunchNotebookRequest + */ + templateName?: string; + /** + * The files to run with the command. + * @type {Array} + * @memberof V1LaunchNotebookRequest + */ + files?: Array; + /** + * Preview a launching request without actually creating a Notebook. + * @type {boolean} + * @memberof V1LaunchNotebookRequest + */ + preview?: boolean; + /** + * Workspace ID. Defaults to 'Uncategorized' workspace if not specified. + * @type {number} + * @memberof V1LaunchNotebookRequest + */ + workspaceId?: number; } /** * Response to LaunchNotebookRequest. @@ -5811,24 +5827,24 @@ export interface V1LaunchNotebookRequest { * @interface V1LaunchNotebookResponse */ export interface V1LaunchNotebookResponse { - /** - * The requested notebook. - * @type {V1Notebook} - * @memberof V1LaunchNotebookResponse - */ - notebook: V1Notebook; - /** - * The config; - * @type {any} - * @memberof V1LaunchNotebookResponse - */ - config: any; - /** - * List of any related warnings. - * @type {Array} - * @memberof V1LaunchNotebookResponse - */ - warnings?: Array; + /** + * The requested notebook. + * @type {V1Notebook} + * @memberof V1LaunchNotebookResponse + */ + notebook: V1Notebook; + /** + * The config; + * @type {any} + * @memberof V1LaunchNotebookResponse + */ + config: any; + /** + * List of any related warnings. + * @type {Array} + * @memberof V1LaunchNotebookResponse + */ + warnings?: Array; } /** * Request to launch a shell. @@ -5836,36 +5852,36 @@ export interface V1LaunchNotebookResponse { * @interface V1LaunchShellRequest */ export interface V1LaunchShellRequest { - /** - * Shell config (JSON). - * @type {any} - * @memberof V1LaunchShellRequest - */ - config?: any; - /** - * Template name. - * @type {string} - * @memberof V1LaunchShellRequest - */ - templateName?: string; - /** - * The files to run with the command. - * @type {Array} - * @memberof V1LaunchShellRequest - */ - files?: Array; - /** - * Additional data. - * @type {string} - * @memberof V1LaunchShellRequest - */ - data?: string; - /** - * Workspace ID. Defaults to 'Uncategorized' workspace if not specified. - * @type {number} - * @memberof V1LaunchShellRequest - */ - workspaceId?: number; + /** + * Shell config (JSON). + * @type {any} + * @memberof V1LaunchShellRequest + */ + config?: any; + /** + * Template name. + * @type {string} + * @memberof V1LaunchShellRequest + */ + templateName?: string; + /** + * The files to run with the command. + * @type {Array} + * @memberof V1LaunchShellRequest + */ + files?: Array; + /** + * Additional data. + * @type {string} + * @memberof V1LaunchShellRequest + */ + data?: string; + /** + * Workspace ID. Defaults to 'Uncategorized' workspace if not specified. + * @type {number} + * @memberof V1LaunchShellRequest + */ + workspaceId?: number; } /** * Response to LaunchShellRequest. @@ -5873,24 +5889,24 @@ export interface V1LaunchShellRequest { * @interface V1LaunchShellResponse */ export interface V1LaunchShellResponse { - /** - * The requested shell. - * @type {V1Shell} - * @memberof V1LaunchShellResponse - */ - shell: V1Shell; - /** - * The config; - * @type {any} - * @memberof V1LaunchShellResponse - */ - config: any; - /** - * List of any related warnings. - * @type {Array} - * @memberof V1LaunchShellResponse - */ - warnings?: Array; + /** + * The requested shell. + * @type {V1Shell} + * @memberof V1LaunchShellResponse + */ + shell: V1Shell; + /** + * The config; + * @type {any} + * @memberof V1LaunchShellResponse + */ + config: any; + /** + * List of any related warnings. + * @type {Array} + * @memberof V1LaunchShellResponse + */ + warnings?: Array; } /** * Request to launch a tensorboard. @@ -5898,48 +5914,48 @@ export interface V1LaunchShellResponse { * @interface V1LaunchTensorboardRequest */ export interface V1LaunchTensorboardRequest { - /** - * List of source experiment ids. - * @type {Array} - * @memberof V1LaunchTensorboardRequest - */ - experimentIds?: Array; - /** - * List of source trial ids. - * @type {Array} - * @memberof V1LaunchTensorboardRequest - */ - trialIds?: Array; - /** - * Tensorboard config (JSON). - * @type {any} - * @memberof V1LaunchTensorboardRequest - */ - config?: any; - /** - * Tensorboard template name. - * @type {string} - * @memberof V1LaunchTensorboardRequest - */ - templateName?: string; - /** - * The files to run with the command. - * @type {Array} - * @memberof V1LaunchTensorboardRequest - */ - files?: Array; - /** - * Workspace in which to launch tensorboard. Defaults to 'Uncategorized'. - * @type {number} - * @memberof V1LaunchTensorboardRequest - */ - workspaceId?: number; - /** - * Targets all experiments matching filters. - * @type {V1BulkExperimentFilters} - * @memberof V1LaunchTensorboardRequest - */ - filters?: V1BulkExperimentFilters; + /** + * List of source experiment ids. + * @type {Array} + * @memberof V1LaunchTensorboardRequest + */ + experimentIds?: Array; + /** + * List of source trial ids. + * @type {Array} + * @memberof V1LaunchTensorboardRequest + */ + trialIds?: Array; + /** + * Tensorboard config (JSON). + * @type {any} + * @memberof V1LaunchTensorboardRequest + */ + config?: any; + /** + * Tensorboard template name. + * @type {string} + * @memberof V1LaunchTensorboardRequest + */ + templateName?: string; + /** + * The files to run with the command. + * @type {Array} + * @memberof V1LaunchTensorboardRequest + */ + files?: Array; + /** + * Workspace in which to launch tensorboard. Defaults to 'Uncategorized'. + * @type {number} + * @memberof V1LaunchTensorboardRequest + */ + workspaceId?: number; + /** + * Targets all experiments matching filters. + * @type {V1BulkExperimentFilters} + * @memberof V1LaunchTensorboardRequest + */ + filters?: V1BulkExperimentFilters; } /** * Response to LaunchTensorboardRequest. @@ -5947,24 +5963,24 @@ export interface V1LaunchTensorboardRequest { * @interface V1LaunchTensorboardResponse */ export interface V1LaunchTensorboardResponse { - /** - * The requested tensorboard. - * @type {V1Tensorboard} - * @memberof V1LaunchTensorboardResponse - */ - tensorboard: V1Tensorboard; - /** - * The config; - * @type {any} - * @memberof V1LaunchTensorboardResponse - */ - config: any; - /** - * List of any related warnings. - * @type {Array} - * @memberof V1LaunchTensorboardResponse - */ - warnings?: Array; + /** + * The requested tensorboard. + * @type {V1Tensorboard} + * @memberof V1LaunchTensorboardResponse + */ + tensorboard: V1Tensorboard; + /** + * The config; + * @type {any} + * @memberof V1LaunchTensorboardResponse + */ + config: any; + /** + * List of any related warnings. + * @type {Array} + * @memberof V1LaunchTensorboardResponse + */ + warnings?: Array; } /** * Enum values for warnings when launching commands. - LAUNCH_WARNING_UNSPECIFIED: Default value - LAUNCH_WARNING_CURRENT_SLOTS_EXCEEDED: For a default webhook @@ -5972,82 +5988,82 @@ export interface V1LaunchTensorboardResponse { * @enum {string} */ export const V1LaunchWarning = { - UNSPECIFIED: 'LAUNCH_WARNING_UNSPECIFIED', - CURRENTSLOTSEXCEEDED: 'LAUNCH_WARNING_CURRENT_SLOTS_EXCEEDED', -} as const; -export type V1LaunchWarning = ValueOf; + UNSPECIFIED: 'LAUNCH_WARNING_UNSPECIFIED', + CURRENTSLOTSEXCEEDED: 'LAUNCH_WARNING_CURRENT_SLOTS_EXCEEDED', +} as const +export type V1LaunchWarning = ValueOf /** * LimitedJob is a Job with omitted fields. * @export * @interface V1LimitedJob */ export interface V1LimitedJob { - /** - * Job summary. - * @type {V1JobSummary} - * @memberof V1LimitedJob - */ - summary?: V1JobSummary; - /** - * Job type. - * @type {Jobv1Type} - * @memberof V1LimitedJob - */ - type: Jobv1Type; - /** - * Associated resource pool. - * @type {string} - * @memberof V1LimitedJob - */ - resourcePool: string; - /** - * Whether the job is preemptible. - * @type {boolean} - * @memberof V1LimitedJob - */ - isPreemptible: boolean; - /** - * The job priority in priority scheduler. - * @type {number} - * @memberof V1LimitedJob - */ - priority?: number; - /** - * The job weight in fairshare scheduler. - * @type {number} - * @memberof V1LimitedJob - */ - weight?: number; - /** - * Job type. - * @type {string} - * @memberof V1LimitedJob - */ - jobId: string; - /** - * Number of requested slots. - * @type {number} - * @memberof V1LimitedJob - */ - requestedSlots: number; - /** - * Number of allocated slots. - * @type {number} - * @memberof V1LimitedJob - */ - allocatedSlots: number; - /** - * Job's progress from 0 to 1. - * @type {number} - * @memberof V1LimitedJob - */ - progress?: number; - /** - * Job's workspace id. - * @type {number} - * @memberof V1LimitedJob - */ - workspaceId: number; + /** + * Job summary. + * @type {V1JobSummary} + * @memberof V1LimitedJob + */ + summary?: V1JobSummary; + /** + * Job type. + * @type {Jobv1Type} + * @memberof V1LimitedJob + */ + type: Jobv1Type; + /** + * Associated resource pool. + * @type {string} + * @memberof V1LimitedJob + */ + resourcePool: string; + /** + * Whether the job is preemptible. + * @type {boolean} + * @memberof V1LimitedJob + */ + isPreemptible: boolean; + /** + * The job priority in priority scheduler. + * @type {number} + * @memberof V1LimitedJob + */ + priority?: number; + /** + * The job weight in fairshare scheduler. + * @type {number} + * @memberof V1LimitedJob + */ + weight?: number; + /** + * Job type. + * @type {string} + * @memberof V1LimitedJob + */ + jobId: string; + /** + * Number of requested slots. + * @type {number} + * @memberof V1LimitedJob + */ + requestedSlots: number; + /** + * Number of allocated slots. + * @type {number} + * @memberof V1LimitedJob + */ + allocatedSlots: number; + /** + * Job's progress from 0 to 1. + * @type {number} + * @memberof V1LimitedJob + */ + progress?: number; + /** + * Job's workspace id. + * @type {number} + * @memberof V1LimitedJob + */ + workspaceId: number; } /** * ListRolesRequest is the body of the request for the call to search for a role. @@ -6055,18 +6071,18 @@ export interface V1LimitedJob { * @interface V1ListRolesRequest */ export interface V1ListRolesRequest { - /** - * the offset for pagination. - * @type {number} - * @memberof V1ListRolesRequest - */ - offset?: number; - /** - * the limit for pagination. - * @type {number} - * @memberof V1ListRolesRequest - */ - limit: number; + /** + * the offset for pagination. + * @type {number} + * @memberof V1ListRolesRequest + */ + offset?: number; + /** + * the limit for pagination. + * @type {number} + * @memberof V1ListRolesRequest + */ + limit: number; } /** * ListRolesResponse is the body of the response for the call to search for a role. @@ -6074,18 +6090,18 @@ export interface V1ListRolesRequest { * @interface V1ListRolesResponse */ export interface V1ListRolesResponse { - /** - * a set of roles and all assignments belonging to it. - * @type {Array} - * @memberof V1ListRolesResponse - */ - roles: Array; - /** - * pagination information. - * @type {V1Pagination} - * @memberof V1ListRolesResponse - */ - pagination: V1Pagination; + /** + * a set of roles and all assignments belonging to it. + * @type {Array} + * @memberof V1ListRolesResponse + */ + roles: Array; + /** + * pagination information. + * @type {V1Pagination} + * @memberof V1ListRolesResponse + */ + pagination: V1Pagination; } /** * Response to ListWorkspaceRPsRequest. @@ -6093,18 +6109,18 @@ export interface V1ListRolesResponse { * @interface V1ListRPsBoundToWorkspaceResponse */ export interface V1ListRPsBoundToWorkspaceResponse { - /** - * List of resource pools bound to the workspace. - * @type {Array} - * @memberof V1ListRPsBoundToWorkspaceResponse - */ - resourcePools?: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1ListRPsBoundToWorkspaceResponse - */ - pagination?: V1Pagination; + /** + * List of resource pools bound to the workspace. + * @type {Array} + * @memberof V1ListRPsBoundToWorkspaceResponse + */ + resourcePools?: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1ListRPsBoundToWorkspaceResponse + */ + pagination?: V1Pagination; } /** * Response to ListWorkspacesBoundToRPRequest. @@ -6112,18 +6128,18 @@ export interface V1ListRPsBoundToWorkspaceResponse { * @interface V1ListWorkspacesBoundToRPResponse */ export interface V1ListWorkspacesBoundToRPResponse { - /** - * List of workspace IDs. - * @type {Array} - * @memberof V1ListWorkspacesBoundToRPResponse - */ - workspaceIds?: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1ListWorkspacesBoundToRPResponse - */ - pagination?: V1Pagination; + /** + * List of workspace IDs. + * @type {Array} + * @memberof V1ListWorkspacesBoundToRPResponse + */ + workspaceIds?: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1ListWorkspacesBoundToRPResponse + */ + pagination?: V1Pagination; } /** * LocationType indicates where a column comes from - LOCATION_TYPE_UNSPECIFIED: Location unknown - LOCATION_TYPE_EXPERIMENT: Column is located on the experiment - LOCATION_TYPE_HYPERPARAMETERS: Column is located in the hyperparameter config of the experiment - LOCATION_TYPE_VALIDATIONS: Column is located on the experiment's validation metrics - LOCATION_TYPE_TRAINING: Column is located on the experiment's training steps - LOCATION_TYPE_CUSTOM_METRIC: Column is located on the experiment's custom metric - LOCATION_TYPE_RUN: Column is located on the run - LOCATION_TYPE_RUN_HYPERPARAMETERS: Column is located in the hyperparameter of the run @@ -6131,34 +6147,34 @@ export interface V1ListWorkspacesBoundToRPResponse { * @enum {string} */ export const V1LocationType = { - UNSPECIFIED: 'LOCATION_TYPE_UNSPECIFIED', - EXPERIMENT: 'LOCATION_TYPE_EXPERIMENT', - HYPERPARAMETERS: 'LOCATION_TYPE_HYPERPARAMETERS', - VALIDATIONS: 'LOCATION_TYPE_VALIDATIONS', - TRAINING: 'LOCATION_TYPE_TRAINING', - CUSTOMMETRIC: 'LOCATION_TYPE_CUSTOM_METRIC', - RUN: 'LOCATION_TYPE_RUN', - RUNHYPERPARAMETERS: 'LOCATION_TYPE_RUN_HYPERPARAMETERS', -} as const; -export type V1LocationType = ValueOf; -/** - * + UNSPECIFIED: 'LOCATION_TYPE_UNSPECIFIED', + EXPERIMENT: 'LOCATION_TYPE_EXPERIMENT', + HYPERPARAMETERS: 'LOCATION_TYPE_HYPERPARAMETERS', + VALIDATIONS: 'LOCATION_TYPE_VALIDATIONS', + TRAINING: 'LOCATION_TYPE_TRAINING', + CUSTOMMETRIC: 'LOCATION_TYPE_CUSTOM_METRIC', + RUN: 'LOCATION_TYPE_RUN', + RUNHYPERPARAMETERS: 'LOCATION_TYPE_RUN_HYPERPARAMETERS', +} as const +export type V1LocationType = ValueOf +/** + * * @export * @interface V1LogConfig */ export interface V1LogConfig { - /** - * The log level for Master Config. - * @type {V1LogLevel} - * @memberof V1LogConfig - */ - level?: V1LogLevel; - /** - * The color setting for log in Master Config. - * @type {boolean} - * @memberof V1LogConfig - */ - color?: boolean; + /** + * The log level for Master Config. + * @type {V1LogLevel} + * @memberof V1LogConfig + */ + level?: V1LogLevel; + /** + * The color setting for log in Master Config. + * @type {boolean} + * @memberof V1LogConfig + */ + color?: boolean; } /** * LogEntry is a log event. @@ -6166,30 +6182,30 @@ export interface V1LogConfig { * @interface V1LogEntry */ export interface V1LogEntry { - /** - * The id. - * @type {number} - * @memberof V1LogEntry - */ - id: number; - /** - * The message. - * @type {string} - * @memberof V1LogEntry - */ - message: string; - /** - * The timestamp. - * @type {Date | DateString} - * @memberof V1LogEntry - */ - timestamp: Date | DateString; - /** - * The log level. - * @type {V1LogLevel} - * @memberof V1LogEntry - */ - level: V1LogLevel; + /** + * The id. + * @type {number} + * @memberof V1LogEntry + */ + id: number; + /** + * The message. + * @type {string} + * @memberof V1LogEntry + */ + message: string; + /** + * The timestamp. + * @type {Date | DateString} + * @memberof V1LogEntry + */ + timestamp: Date | DateString; + /** + * The log level. + * @type {V1LogLevel} + * @memberof V1LogEntry + */ + level: V1LogLevel; } /** * Login the user. @@ -6197,24 +6213,24 @@ export interface V1LogEntry { * @interface V1LoginRequest */ export interface V1LoginRequest { - /** - * The username of the user. - * @type {string} - * @memberof V1LoginRequest - */ - username: string; - /** - * The password of the user. - * @type {string} - * @memberof V1LoginRequest - */ - password: string; - /** - * Indicate whether the provided password is pre-salted & hashed or not. - * @type {boolean} - * @memberof V1LoginRequest - */ - isHashed?: boolean; + /** + * The username of the user. + * @type {string} + * @memberof V1LoginRequest + */ + username: string; + /** + * The password of the user. + * @type {string} + * @memberof V1LoginRequest + */ + password: string; + /** + * Indicate whether the provided password is pre-salted & hashed or not. + * @type {boolean} + * @memberof V1LoginRequest + */ + isHashed?: boolean; } /** * Response to LoginRequest. @@ -6222,18 +6238,18 @@ export interface V1LoginRequest { * @interface V1LoginResponse */ export interface V1LoginResponse { - /** - * The token to be used when sending results. - * @type {string} - * @memberof V1LoginResponse - */ - token: string; - /** - * The logged in user. - * @type {V1User} - * @memberof V1LoginResponse - */ - user: V1User; + /** + * The token to be used when sending results. + * @type {string} + * @memberof V1LoginResponse + */ + token: string; + /** + * The logged in user. + * @type {V1User} + * @memberof V1LoginResponse + */ + user: V1User; } /** * LogLevel specifies the level for a log. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. @@ -6241,58 +6257,60 @@ export interface V1LoginResponse { * @enum {string} */ export const V1LogLevel = { - UNSPECIFIED: 'LOG_LEVEL_UNSPECIFIED', - TRACE: 'LOG_LEVEL_TRACE', - DEBUG: 'LOG_LEVEL_DEBUG', - INFO: 'LOG_LEVEL_INFO', - WARNING: 'LOG_LEVEL_WARNING', - ERROR: 'LOG_LEVEL_ERROR', - CRITICAL: 'LOG_LEVEL_CRITICAL', -} as const; -export type V1LogLevel = ValueOf; + UNSPECIFIED: 'LOG_LEVEL_UNSPECIFIED', + TRACE: 'LOG_LEVEL_TRACE', + DEBUG: 'LOG_LEVEL_DEBUG', + INFO: 'LOG_LEVEL_INFO', + WARNING: 'LOG_LEVEL_WARNING', + ERROR: 'LOG_LEVEL_ERROR', + CRITICAL: 'LOG_LEVEL_CRITICAL', +} as const +export type V1LogLevel = ValueOf /** * Response to LogoutRequest. * @export * @interface V1LogoutResponse */ -export interface V1LogoutResponse {} +export interface V1LogoutResponse { +} /** * Mark some reservation as a daemon. * @export * @interface V1MarkAllocationResourcesDaemonRequest */ export interface V1MarkAllocationResourcesDaemonRequest { - /** - * The id of the allocation. - * @type {string} - * @memberof V1MarkAllocationResourcesDaemonRequest - */ - allocationId: string; - /** - * The id of the clump of resources to mark as daemon. - * @type {string} - * @memberof V1MarkAllocationResourcesDaemonRequest - */ - resourcesId?: string; + /** + * The id of the allocation. + * @type {string} + * @memberof V1MarkAllocationResourcesDaemonRequest + */ + allocationId: string; + /** + * The id of the clump of resources to mark as daemon. + * @type {string} + * @memberof V1MarkAllocationResourcesDaemonRequest + */ + resourcesId?: string; } /** * Response to MarkAllocationResourcesDaemonRequest. * @export * @interface V1MarkAllocationResourcesDaemonResponse */ -export interface V1MarkAllocationResourcesDaemonResponse {} +export interface V1MarkAllocationResourcesDaemonResponse { +} /** * Response to MasterLogsRequest. * @export * @interface V1MasterLogsResponse */ export interface V1MasterLogsResponse { - /** - * The log entry. - * @type {V1LogEntry} - * @memberof V1MasterLogsResponse - */ - logEntry: V1LogEntry; + /** + * The log entry. + * @type {V1LogEntry} + * @memberof V1MasterLogsResponse + */ + logEntry: V1LogEntry; } /** * Response to MetricBatchesRequest. @@ -6300,12 +6318,12 @@ export interface V1MasterLogsResponse { * @interface V1MetricBatchesResponse */ export interface V1MetricBatchesResponse { - /** - * Milestones (in batches processed) at which the specified metric is recorded. - * @type {Array} - * @memberof V1MetricBatchesResponse - */ - batches?: Array; + /** + * Milestones (in batches processed) at which the specified metric is recorded. + * @type {Array} + * @memberof V1MetricBatchesResponse + */ + batches?: Array; } /** * MetricIdentifier packages metric name and group. @@ -6313,37 +6331,37 @@ export interface V1MetricBatchesResponse { * @interface V1MetricIdentifier */ export interface V1MetricIdentifier { - /** - * The group of the metric. - * @type {string} - * @memberof V1MetricIdentifier - */ - group: string; - /** - * The name of the metric. - * @type {string} - * @memberof V1MetricIdentifier - */ - name: string; + /** + * The group of the metric. + * @type {string} + * @memberof V1MetricIdentifier + */ + group: string; + /** + * The name of the metric. + * @type {string} + * @memberof V1MetricIdentifier + */ + name: string; } /** - * + * * @export * @interface V1Metrics */ export interface V1Metrics { - /** - * Aggregate user-generated metrics - * @type {any} - * @memberof V1Metrics - */ - avgMetrics: any; - /** - * User-generated metrics for each batch - * @type {Array} - * @memberof V1Metrics - */ - batchMetrics?: Array; + /** + * Aggregate user-generated metrics + * @type {any} + * @memberof V1Metrics + */ + avgMetrics: any; + /** + * User-generated metrics for each batch + * @type {Array} + * @memberof V1Metrics + */ + batchMetrics?: Array; } /** * MetricsRange represents the range of a metrics. Range is a in the format of [min, max]. @@ -6351,24 +6369,24 @@ export interface V1Metrics { * @interface V1MetricsRange */ export interface V1MetricsRange { - /** - * The name of metrics formatted as .. - * @type {string} - * @memberof V1MetricsRange - */ - metricsName: string; - /** - * The min of metrics values. - * @type {number} - * @memberof V1MetricsRange - */ - min: number; - /** - * The max of metrics values. - * @type {number} - * @memberof V1MetricsRange - */ - max: number; + /** + * The name of metrics formatted as .. + * @type {string} + * @memberof V1MetricsRange + */ + metricsName: string; + /** + * The min of metrics values. + * @type {number} + * @memberof V1MetricsRange + */ + min: number; + /** + * The max of metrics values. + * @type {number} + * @memberof V1MetricsRange + */ + max: number; } /** * Metrics report. @@ -6376,54 +6394,54 @@ export interface V1MetricsRange { * @interface V1MetricsReport */ export interface V1MetricsReport { - /** - * ID of the trial. - * @type {number} - * @memberof V1MetricsReport - */ - trialId: number; - /** - * End time of when metric was reported. - * @type {Date | DateString} - * @memberof V1MetricsReport - */ - endTime: Date | DateString; - /** - * Struct of the reported metrics. - * @type {any} - * @memberof V1MetricsReport - */ - metrics: any; - /** - * batches completed in the report. - * @type {number} - * @memberof V1MetricsReport - */ - totalBatches: number; - /** - * If metric is archived. - * @type {boolean} - * @memberof V1MetricsReport - */ - archived: boolean; - /** - * ID of metric in table. - * @type {number} - * @memberof V1MetricsReport - */ - id: number; - /** - * Run ID of trial when metric was reported. - * @type {number} - * @memberof V1MetricsReport - */ - trialRunId: number; - /** - * Name of the Metric Group ("training", "validation", anything else) - * @type {string} - * @memberof V1MetricsReport - */ - group: string; + /** + * ID of the trial. + * @type {number} + * @memberof V1MetricsReport + */ + trialId: number; + /** + * End time of when metric was reported. + * @type {Date | DateString} + * @memberof V1MetricsReport + */ + endTime: Date | DateString; + /** + * Struct of the reported metrics. + * @type {any} + * @memberof V1MetricsReport + */ + metrics: any; + /** + * batches completed in the report. + * @type {number} + * @memberof V1MetricsReport + */ + totalBatches: number; + /** + * If metric is archived. + * @type {boolean} + * @memberof V1MetricsReport + */ + archived: boolean; + /** + * ID of metric in table. + * @type {number} + * @memberof V1MetricsReport + */ + id: number; + /** + * Run ID of trial when metric was reported. + * @type {number} + * @memberof V1MetricsReport + */ + trialRunId: number; + /** + * Name of the Metric Group ("training", "validation", anything else) + * @type {string} + * @memberof V1MetricsReport + */ + group: string; } /** * MetricsWorkload is a workload generating metrics. @@ -6431,30 +6449,30 @@ export interface V1MetricsReport { * @interface V1MetricsWorkload */ export interface V1MetricsWorkload { - /** - * The time the workload finished or was stopped. - * @type {Date | DateString} - * @memberof V1MetricsWorkload - */ - endTime?: Date | DateString; - /** - * Metrics. - * @type {V1Metrics} - * @memberof V1MetricsWorkload - */ - metrics: V1Metrics; - /** - * Number of inputs processed. - * @type {number} - * @memberof V1MetricsWorkload - */ - numInputs: number; - /** - * Total number of batches as of this workload's completion. - * @type {number} - * @memberof V1MetricsWorkload - */ - totalBatches: number; + /** + * The time the workload finished or was stopped. + * @type {Date | DateString} + * @memberof V1MetricsWorkload + */ + endTime?: Date | DateString; + /** + * Metrics. + * @type {V1Metrics} + * @memberof V1MetricsWorkload + */ + metrics: V1Metrics; + /** + * Number of inputs processed. + * @type {number} + * @memberof V1MetricsWorkload + */ + numInputs: number; + /** + * Total number of batches as of this workload's completion. + * @type {number} + * @memberof V1MetricsWorkload + */ + totalBatches: number; } /** * To distinguish the different categories of metrics. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. @@ -6462,96 +6480,96 @@ export interface V1MetricsWorkload { * @enum {string} */ export const V1MetricType = { - UNSPECIFIED: 'METRIC_TYPE_UNSPECIFIED', - TRAINING: 'METRIC_TYPE_TRAINING', - VALIDATION: 'METRIC_TYPE_VALIDATION', - PROFILING: 'METRIC_TYPE_PROFILING', -} as const; -export type V1MetricType = ValueOf; + UNSPECIFIED: 'METRIC_TYPE_UNSPECIFIED', + TRAINING: 'METRIC_TYPE_TRAINING', + VALIDATION: 'METRIC_TYPE_VALIDATION', + PROFILING: 'METRIC_TYPE_PROFILING', +} as const +export type V1MetricType = ValueOf /** * Model is a named collection of model versions. * @export * @interface V1Model */ export interface V1Model { - /** - * The name of the model. - * @type {string} - * @memberof V1Model - */ - name: string; - /** - * The description of the model. - * @type {string} - * @memberof V1Model - */ - description?: string; - /** - * The user-defined metadata of the model. - * @type {any} - * @memberof V1Model - */ - metadata: any; - /** - * The time the model was created. - * @type {Date | DateString} - * @memberof V1Model - */ - creationTime: Date | DateString; - /** - * The time the model was last updated. - * @type {Date | DateString} - * @memberof V1Model - */ - lastUpdatedTime: Date | DateString; - /** - * The id of this model. - * @type {number} - * @memberof V1Model - */ - id: number; - /** - * The number of versions associated with this model. - * @type {number} - * @memberof V1Model - */ - numVersions: number; - /** - * Labels associated with this model. - * @type {Array} - * @memberof V1Model - */ - labels?: Array; - /** - * Username of the user who created this model. - * @type {string} - * @memberof V1Model - */ - username: string; - /** - * The id of the workspace associated with this model. - * @type {number} - * @memberof V1Model - */ - workspaceId: number; - /** - * Id of the user who created this model. - * @type {number} - * @memberof V1Model - */ - userId: number; - /** - * Whether this model is archived or not. - * @type {boolean} - * @memberof V1Model - */ - archived: boolean; - /** - * Notes associated with this model. - * @type {string} - * @memberof V1Model - */ - notes?: string; + /** + * The name of the model. + * @type {string} + * @memberof V1Model + */ + name: string; + /** + * The description of the model. + * @type {string} + * @memberof V1Model + */ + description?: string; + /** + * The user-defined metadata of the model. + * @type {any} + * @memberof V1Model + */ + metadata: any; + /** + * The time the model was created. + * @type {Date | DateString} + * @memberof V1Model + */ + creationTime: Date | DateString; + /** + * The time the model was last updated. + * @type {Date | DateString} + * @memberof V1Model + */ + lastUpdatedTime: Date | DateString; + /** + * The id of this model. + * @type {number} + * @memberof V1Model + */ + id: number; + /** + * The number of versions associated with this model. + * @type {number} + * @memberof V1Model + */ + numVersions: number; + /** + * Labels associated with this model. + * @type {Array} + * @memberof V1Model + */ + labels?: Array; + /** + * Username of the user who created this model. + * @type {string} + * @memberof V1Model + */ + username: string; + /** + * The id of the workspace associated with this model. + * @type {number} + * @memberof V1Model + */ + workspaceId: number; + /** + * Id of the user who created this model. + * @type {number} + * @memberof V1Model + */ + userId: number; + /** + * Whether this model is archived or not. + * @type {boolean} + * @memberof V1Model + */ + archived: boolean; + /** + * Notes associated with this model. + * @type {string} + * @memberof V1Model + */ + notes?: string; } /** * A version of a model containing a checkpoint. Users can label checkpoints as a version of a model and use the model name and version to locate a checkpoint. @@ -6559,84 +6577,84 @@ export interface V1Model { * @interface V1ModelVersion */ export interface V1ModelVersion { - /** - * The model the version is related to. - * @type {V1Model} - * @memberof V1ModelVersion - */ - model: V1Model; - /** - * The checkpoint of the model version. - * @type {V1Checkpoint} - * @memberof V1ModelVersion - */ - checkpoint: V1Checkpoint; - /** - * The version number. - * @type {number} - * @memberof V1ModelVersion - */ - version: number; - /** - * The time the model version was created. - * @type {Date | DateString} - * @memberof V1ModelVersion - */ - creationTime: Date | DateString; - /** - * Unique id for each model version. - * @type {number} - * @memberof V1ModelVersion - */ - id: number; - /** - * Name for this model version. - * @type {string} - * @memberof V1ModelVersion - */ - name?: string; - /** - * Metadata associated with this model version. - * @type {any} - * @memberof V1ModelVersion - */ - metadata?: any; - /** - * The time this model version was last updated. - * @type {Date | DateString} - * @memberof V1ModelVersion - */ - lastUpdatedTime: Date | DateString; - /** - * Comment associated with this model version. - * @type {string} - * @memberof V1ModelVersion - */ - comment?: string; - /** - * Username of the user who created this model version. - * @type {string} - * @memberof V1ModelVersion - */ - username?: string; - /** - * Id of the user who created this model version. - * @type {number} - * @memberof V1ModelVersion - */ - userId?: number; - /** - * Labels associated with this model version. - * @type {Array} - * @memberof V1ModelVersion - */ - labels?: Array; - /** - * Notes associated with this model version. - * @type {string} - * @memberof V1ModelVersion - */ - notes?: string; + /** + * The model the version is related to. + * @type {V1Model} + * @memberof V1ModelVersion + */ + model: V1Model; + /** + * The checkpoint of the model version. + * @type {V1Checkpoint} + * @memberof V1ModelVersion + */ + checkpoint: V1Checkpoint; + /** + * The version number. + * @type {number} + * @memberof V1ModelVersion + */ + version: number; + /** + * The time the model version was created. + * @type {Date | DateString} + * @memberof V1ModelVersion + */ + creationTime: Date | DateString; + /** + * Unique id for each model version. + * @type {number} + * @memberof V1ModelVersion + */ + id: number; + /** + * Name for this model version. + * @type {string} + * @memberof V1ModelVersion + */ + name?: string; + /** + * Metadata associated with this model version. + * @type {any} + * @memberof V1ModelVersion + */ + metadata?: any; + /** + * The time this model version was last updated. + * @type {Date | DateString} + * @memberof V1ModelVersion + */ + lastUpdatedTime: Date | DateString; + /** + * Comment associated with this model version. + * @type {string} + * @memberof V1ModelVersion + */ + comment?: string; + /** + * Username of the user who created this model version. + * @type {string} + * @memberof V1ModelVersion + */ + username?: string; + /** + * Id of the user who created this model version. + * @type {number} + * @memberof V1ModelVersion + */ + userId?: number; + /** + * Labels associated with this model version. + * @type {Array} + * @memberof V1ModelVersion + */ + labels?: Array; + /** + * Notes associated with this model version. + * @type {string} + * @memberof V1ModelVersion + */ + notes?: string; } /** * Request to move an experiment into a project. @@ -6644,55 +6662,56 @@ export interface V1ModelVersion { * @interface V1MoveExperimentRequest */ export interface V1MoveExperimentRequest { - /** - * The id of the experiment being moved. - * @type {number} - * @memberof V1MoveExperimentRequest - */ - experimentId: number; - /** - * The id of the new parent project. - * @type {number} - * @memberof V1MoveExperimentRequest - */ - destinationProjectId: number; + /** + * The id of the experiment being moved. + * @type {number} + * @memberof V1MoveExperimentRequest + */ + experimentId: number; + /** + * The id of the new parent project. + * @type {number} + * @memberof V1MoveExperimentRequest + */ + destinationProjectId: number; } /** * Response to MoveExperimentRequest. * @export * @interface V1MoveExperimentResponse */ -export interface V1MoveExperimentResponse {} +export interface V1MoveExperimentResponse { +} /** * Request to move an experiment into a project. * @export * @interface V1MoveExperimentsRequest */ export interface V1MoveExperimentsRequest { - /** - * The ids of the experiments being moved. - * @type {Array} - * @memberof V1MoveExperimentsRequest - */ - experimentIds: Array; - /** - * The id of the new parent project. - * @type {number} - * @memberof V1MoveExperimentsRequest - */ - destinationProjectId: number; - /** - * Targets all experiments matching filters. - * @type {V1BulkExperimentFilters} - * @memberof V1MoveExperimentsRequest - */ - filters?: V1BulkExperimentFilters; - /** - * Project id that the experiments belong to. - * @type {number} - * @memberof V1MoveExperimentsRequest - */ - projectId: number; + /** + * The ids of the experiments being moved. + * @type {Array} + * @memberof V1MoveExperimentsRequest + */ + experimentIds: Array; + /** + * The id of the new parent project. + * @type {number} + * @memberof V1MoveExperimentsRequest + */ + destinationProjectId: number; + /** + * Targets all experiments matching filters. + * @type {V1BulkExperimentFilters} + * @memberof V1MoveExperimentsRequest + */ + filters?: V1BulkExperimentFilters; + /** + * Project id that the experiments belong to. + * @type {number} + * @memberof V1MoveExperimentsRequest + */ + projectId: number; } /** * Response to MoveExperimentsRequest. @@ -6700,12 +6719,12 @@ export interface V1MoveExperimentsRequest { * @interface V1MoveExperimentsResponse */ export interface V1MoveExperimentsResponse { - /** - * Details on success or error for each experiment. - * @type {Array} - * @memberof V1MoveExperimentsResponse - */ - results: Array; + /** + * Details on success or error for each experiment. + * @type {Array} + * @memberof V1MoveExperimentsResponse + */ + results: Array; } /** * Request to move a model to a workspace. @@ -6713,86 +6732,88 @@ export interface V1MoveExperimentsResponse { * @interface V1MoveModelRequest */ export interface V1MoveModelRequest { - /** - * The target model name. - * @type {string} - * @memberof V1MoveModelRequest - */ - modelName: string; - /** - * The workspace id that the model will be stored. - * @type {number} - * @memberof V1MoveModelRequest - */ - destinationWorkspaceId: number; + /** + * The target model name. + * @type {string} + * @memberof V1MoveModelRequest + */ + modelName: string; + /** + * The workspace id that the model will be stored. + * @type {number} + * @memberof V1MoveModelRequest + */ + destinationWorkspaceId: number; } /** - * + * * @export * @interface V1MoveModelResponse */ -export interface V1MoveModelResponse {} +export interface V1MoveModelResponse { +} /** * Request to move a project into a workspace. * @export * @interface V1MoveProjectRequest */ export interface V1MoveProjectRequest { - /** - * The id of the project being moved. - * @type {number} - * @memberof V1MoveProjectRequest - */ - projectId: number; - /** - * The id of the new parent workspace. - * @type {number} - * @memberof V1MoveProjectRequest - */ - destinationWorkspaceId: number; + /** + * The id of the project being moved. + * @type {number} + * @memberof V1MoveProjectRequest + */ + projectId: number; + /** + * The id of the new parent workspace. + * @type {number} + * @memberof V1MoveProjectRequest + */ + destinationWorkspaceId: number; } /** * Response to MoveProjectRequest. * @export * @interface V1MoveProjectResponse */ -export interface V1MoveProjectResponse {} +export interface V1MoveProjectResponse { +} /** * Request to move the run to a different project. * @export * @interface V1MoveRunsRequest */ export interface V1MoveRunsRequest { - /** - * The ids of the runs being moved. - * @type {Array} - * @memberof V1MoveRunsRequest - */ - runIds: Array; - /** - * The id of the current parent project. - * @type {number} - * @memberof V1MoveRunsRequest - */ - sourceProjectId: number; - /** - * The id of the new parent project. - * @type {number} - * @memberof V1MoveRunsRequest - */ - destinationProjectId: number; - /** - * Filter expression - * @type {string} - * @memberof V1MoveRunsRequest - */ - filter?: string; - /** - * If true, skip multi-trial experiments for move. - * @type {boolean} - * @memberof V1MoveRunsRequest - */ - skipMultitrial?: boolean; + /** + * The ids of the runs being moved. + * @type {Array} + * @memberof V1MoveRunsRequest + */ + runIds: Array; + /** + * The id of the current parent project. + * @type {number} + * @memberof V1MoveRunsRequest + */ + sourceProjectId: number; + /** + * The id of the new parent project. + * @type {number} + * @memberof V1MoveRunsRequest + */ + destinationProjectId: number; + /** + * Filter expression + * @type {string} + * @memberof V1MoveRunsRequest + */ + filter?: string; + /** + * If true, skip multi-trial experiments for move. + * @type {boolean} + * @memberof V1MoveRunsRequest + */ + skipMultitrial?: boolean; } /** * Response to MoveRunsRequest. @@ -6800,12 +6821,12 @@ export interface V1MoveRunsRequest { * @interface V1MoveRunsResponse */ export interface V1MoveRunsResponse { - /** - * Details on success or error for each run. - * @type {Array} - * @memberof V1MoveRunsResponse - */ - results: Array; + /** + * Details on success or error for each run. + * @type {Array} + * @memberof V1MoveRunsResponse + */ + results: Array; } /** * Note is a user comment connected to a project. @@ -6813,18 +6834,18 @@ export interface V1MoveRunsResponse { * @interface V1Note */ export interface V1Note { - /** - * The name or title of the note. - * @type {string} - * @memberof V1Note - */ - name: string; - /** - * The text contents of the note. - * @type {string} - * @memberof V1Note - */ - contents: string; + /** + * The name or title of the note. + * @type {string} + * @memberof V1Note + */ + name: string; + /** + * The text contents of the note. + * @type {string} + * @memberof V1Note + */ + contents: string; } /** * Notebook is a Jupyter notebook in a containerized environment. @@ -6832,84 +6853,84 @@ export interface V1Note { * @interface V1Notebook */ export interface V1Notebook { - /** - * The id of the notebook. - * @type {string} - * @memberof V1Notebook - */ - id: string; - /** - * The description of the notebook. - * @type {string} - * @memberof V1Notebook - */ - description: string; - /** - * The state of the notebook. - * @type {Taskv1State} - * @memberof V1Notebook - */ - state: Taskv1State; - /** - * The time the notebook was started. - * @type {Date | DateString} - * @memberof V1Notebook - */ - startTime: Date | DateString; - /** - * The container running the notebook. - * @type {V1Container} - * @memberof V1Notebook - */ - container?: V1Container; - /** - * The display name of the user that created the notebook. - * @type {string} - * @memberof V1Notebook - */ - displayName?: string; - /** - * The id of the user that created the notebook. - * @type {number} - * @memberof V1Notebook - */ - userId?: number; - /** - * The username of the user that created the notebook. - * @type {string} - * @memberof V1Notebook - */ - username: string; - /** - * The service address. - * @type {string} - * @memberof V1Notebook - */ - serviceAddress?: string; - /** - * The name of the resource pool the Notebook was created in. - * @type {string} - * @memberof V1Notebook - */ - resourcePool: string; - /** - * The exit status. - * @type {string} - * @memberof V1Notebook - */ - exitStatus?: string; - /** - * The associated job id. - * @type {string} - * @memberof V1Notebook - */ - jobId: string; - /** - * Workspace ID. - * @type {number} - * @memberof V1Notebook - */ - workspaceId: number; + /** + * The id of the notebook. + * @type {string} + * @memberof V1Notebook + */ + id: string; + /** + * The description of the notebook. + * @type {string} + * @memberof V1Notebook + */ + description: string; + /** + * The state of the notebook. + * @type {Taskv1State} + * @memberof V1Notebook + */ + state: Taskv1State; + /** + * The time the notebook was started. + * @type {Date | DateString} + * @memberof V1Notebook + */ + startTime: Date | DateString; + /** + * The container running the notebook. + * @type {V1Container} + * @memberof V1Notebook + */ + container?: V1Container; + /** + * The display name of the user that created the notebook. + * @type {string} + * @memberof V1Notebook + */ + displayName?: string; + /** + * The id of the user that created the notebook. + * @type {number} + * @memberof V1Notebook + */ + userId?: number; + /** + * The username of the user that created the notebook. + * @type {string} + * @memberof V1Notebook + */ + username: string; + /** + * The service address. + * @type {string} + * @memberof V1Notebook + */ + serviceAddress?: string; + /** + * The name of the resource pool the Notebook was created in. + * @type {string} + * @memberof V1Notebook + */ + resourcePool: string; + /** + * The exit status. + * @type {string} + * @memberof V1Notebook + */ + exitStatus?: string; + /** + * The associated job id. + * @type {string} + * @memberof V1Notebook + */ + jobId: string; + /** + * Workspace ID. + * @type {number} + * @memberof V1Notebook + */ + workspaceId: number; } /** * Arguments to a notify container running. @@ -6917,55 +6938,55 @@ export interface V1Notebook { * @interface V1NotifyContainerRunningRequest */ export interface V1NotifyContainerRunningRequest { - /** - * The ID of the allocation. - * @type {string} - * @memberof V1NotifyContainerRunningRequest - */ - allocationId: string; - /** - * The UUID of the participant in a notify container running message. - * @type {string} - * @memberof V1NotifyContainerRunningRequest - */ - requestUuid?: string; - /** - * The number of process to wait for. - * @type {number} - * @memberof V1NotifyContainerRunningRequest - */ - numPeers?: number; - /** - * The container's rank. - * @type {number} - * @memberof V1NotifyContainerRunningRequest - */ - rank?: number; - /** - * The name of the node who sent the request - * @type {string} - * @memberof V1NotifyContainerRunningRequest - */ - nodeName?: string; - /** - * The data from this process. - * @type {any} - * @memberof V1NotifyContainerRunningRequest - */ - data: any; + /** + * The ID of the allocation. + * @type {string} + * @memberof V1NotifyContainerRunningRequest + */ + allocationId: string; + /** + * The UUID of the participant in a notify container running message. + * @type {string} + * @memberof V1NotifyContainerRunningRequest + */ + requestUuid?: string; + /** + * The number of process to wait for. + * @type {number} + * @memberof V1NotifyContainerRunningRequest + */ + numPeers?: number; + /** + * The container's rank. + * @type {number} + * @memberof V1NotifyContainerRunningRequest + */ + rank?: number; + /** + * The name of the node who sent the request + * @type {string} + * @memberof V1NotifyContainerRunningRequest + */ + nodeName?: string; + /** + * The data from this process. + * @type {any} + * @memberof V1NotifyContainerRunningRequest + */ + data: any; } /** - * + * * @export * @interface V1NotifyContainerRunningResponse */ export interface V1NotifyContainerRunningResponse { - /** - * The data for all the processes. - * @type {Array} - * @memberof V1NotifyContainerRunningResponse - */ - data: Array; + /** + * The data for all the processes. + * @type {Array} + * @memberof V1NotifyContainerRunningResponse + */ + data: Array; } /** * Order records in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. @@ -6973,78 +6994,79 @@ export interface V1NotifyContainerRunningResponse { * @enum {string} */ export const V1OrderBy = { - UNSPECIFIED: 'ORDER_BY_UNSPECIFIED', - ASC: 'ORDER_BY_ASC', - DESC: 'ORDER_BY_DESC', -} as const; -export type V1OrderBy = ValueOf; + UNSPECIFIED: 'ORDER_BY_UNSPECIFIED', + ASC: 'ORDER_BY_ASC', + DESC: 'ORDER_BY_DESC', +} as const +export type V1OrderBy = ValueOf /** * Overwrite and replace the workspaces bound to an RP request. * @export * @interface V1OverwriteRPWorkspaceBindingsRequest */ export interface V1OverwriteRPWorkspaceBindingsRequest { - /** - * The resource pool name. - * @type {string} - * @memberof V1OverwriteRPWorkspaceBindingsRequest - */ - resourcePoolName: string; - /** - * The new workspace IDs to bind to the resource_pool. - * @type {Array} - * @memberof V1OverwriteRPWorkspaceBindingsRequest - */ - workspaceIds?: Array; - /** - * The new workspace names to bind to the resource_pool. - * @type {Array} - * @memberof V1OverwriteRPWorkspaceBindingsRequest - */ - workspaceNames?: Array; + /** + * The resource pool name. + * @type {string} + * @memberof V1OverwriteRPWorkspaceBindingsRequest + */ + resourcePoolName: string; + /** + * The new workspace IDs to bind to the resource_pool. + * @type {Array} + * @memberof V1OverwriteRPWorkspaceBindingsRequest + */ + workspaceIds?: Array; + /** + * The new workspace names to bind to the resource_pool. + * @type {Array} + * @memberof V1OverwriteRPWorkspaceBindingsRequest + */ + workspaceNames?: Array; } /** * Overwrite and replace the workspaces bound to an RP response. * @export * @interface V1OverwriteRPWorkspaceBindingsResponse */ -export interface V1OverwriteRPWorkspaceBindingsResponse {} +export interface V1OverwriteRPWorkspaceBindingsResponse { +} /** * Pagination provides information about the offset, limit, and total number of records returned in the results. * @export * @interface V1Pagination */ export interface V1Pagination { - /** - * The number of records skipped before returning results. - * @type {number} - * @memberof V1Pagination - */ - offset?: number; - /** - * The amount of records limited in the results. - * @type {number} - * @memberof V1Pagination - */ - limit?: number; - /** - * The index of the first record in the dataset. - * @type {number} - * @memberof V1Pagination - */ - startIndex?: number; - /** - * The index+1 of the last record in the dataset. - * @type {number} - * @memberof V1Pagination - */ - endIndex?: number; - /** - * The total number of values that match the filter. - * @type {number} - * @memberof V1Pagination - */ - total?: number; + /** + * The number of records skipped before returning results. + * @type {number} + * @memberof V1Pagination + */ + offset?: number; + /** + * The amount of records limited in the results. + * @type {number} + * @memberof V1Pagination + */ + limit?: number; + /** + * The index of the first record in the dataset. + * @type {number} + * @memberof V1Pagination + */ + startIndex?: number; + /** + * The index+1 of the last record in the dataset. + * @type {number} + * @memberof V1Pagination + */ + endIndex?: number; + /** + * The total number of values that match the filter. + * @type {number} + * @memberof V1Pagination + */ + total?: number; } /** * Request to change checkpoint database information. @@ -7052,18 +7074,18 @@ export interface V1Pagination { * @interface V1PatchCheckpoint */ export interface V1PatchCheckpoint { - /** - * The uuid of the checkpoint. - * @type {string} - * @memberof V1PatchCheckpoint - */ - uuid: string; - /** - * Dictionary of file paths to file sizes in bytes of all files in the checkpoint. This won't update actual checkpoint files. If len(resources) == 0 => the checkpoint is considered deleted Otherwise if resources are updated the checkpoint is considered partially deleted. - * @type {PatchCheckpointOptionalResources} - * @memberof V1PatchCheckpoint - */ - resources?: PatchCheckpointOptionalResources; + /** + * The uuid of the checkpoint. + * @type {string} + * @memberof V1PatchCheckpoint + */ + uuid: string; + /** + * Dictionary of file paths to file sizes in bytes of all files in the checkpoint. This won't update actual checkpoint files. If len(resources) == 0 => the checkpoint is considered deleted Otherwise if resources are updated the checkpoint is considered partially deleted. + * @type {PatchCheckpointOptionalResources} + * @memberof V1PatchCheckpoint + */ + resources?: PatchCheckpointOptionalResources; } /** * Request to patch database info about a checkpoint. @@ -7071,67 +7093,68 @@ export interface V1PatchCheckpoint { * @interface V1PatchCheckpointsRequest */ export interface V1PatchCheckpointsRequest { - /** - * List of checkpoints to patch. - * @type {Array} - * @memberof V1PatchCheckpointsRequest - */ - checkpoints: Array; + /** + * List of checkpoints to patch. + * @type {Array} + * @memberof V1PatchCheckpointsRequest + */ + checkpoints: Array; } /** * Intentionally don't send the updated response for performance reasons. * @export * @interface V1PatchCheckpointsResponse */ -export interface V1PatchCheckpointsResponse {} +export interface V1PatchCheckpointsResponse { +} /** * PatchExperiment is a partial update to an experiment with only id required. * @export * @interface V1PatchExperiment */ export interface V1PatchExperiment { - /** - * The id of the experiment. - * @type {number} - * @memberof V1PatchExperiment - */ - id: number; - /** - * The description of the experiment. - * @type {string} - * @memberof V1PatchExperiment - */ - description?: string; - /** - * Labels attached to the experiment. - * @type {Array} - * @memberof V1PatchExperiment - */ - labels?: Array; - /** - * The experiment name. - * @type {string} - * @memberof V1PatchExperiment - */ - name?: string; - /** - * The experiment notes. - * @type {string} - * @memberof V1PatchExperiment - */ - notes?: string; - /** - * Experiment config resources. - * @type {PatchExperimentPatchResources} - * @memberof V1PatchExperiment - */ - resources?: PatchExperimentPatchResources; - /** - * Experiment config checkpoint_storage. - * @type {PatchExperimentPatchCheckpointStorage} - * @memberof V1PatchExperiment - */ - checkpointStorage?: PatchExperimentPatchCheckpointStorage; + /** + * The id of the experiment. + * @type {number} + * @memberof V1PatchExperiment + */ + id: number; + /** + * The description of the experiment. + * @type {string} + * @memberof V1PatchExperiment + */ + description?: string; + /** + * Labels attached to the experiment. + * @type {Array} + * @memberof V1PatchExperiment + */ + labels?: Array; + /** + * The experiment name. + * @type {string} + * @memberof V1PatchExperiment + */ + name?: string; + /** + * The experiment notes. + * @type {string} + * @memberof V1PatchExperiment + */ + notes?: string; + /** + * Experiment config resources. + * @type {PatchExperimentPatchResources} + * @memberof V1PatchExperiment + */ + resources?: PatchExperimentPatchResources; + /** + * Experiment config checkpoint_storage. + * @type {PatchExperimentPatchCheckpointStorage} + * @memberof V1PatchExperiment + */ + checkpointStorage?: PatchExperimentPatchCheckpointStorage; } /** * Response to PatchExperimentRequest. @@ -7139,12 +7162,12 @@ export interface V1PatchExperiment { * @interface V1PatchExperimentResponse */ export interface V1PatchExperimentResponse { - /** - * Patched experiment. - * @type {V1Experiment} - * @memberof V1PatchExperimentResponse - */ - experiment?: V1Experiment; + /** + * Patched experiment. + * @type {V1Experiment} + * @memberof V1PatchExperimentResponse + */ + experiment?: V1Experiment; } /** * Patch master config. @@ -7152,73 +7175,74 @@ export interface V1PatchExperimentResponse { * @interface V1PatchMasterConfigRequest */ export interface V1PatchMasterConfigRequest { - /** - * The new config that the user wants to patch into the master config. - * @type {V1Config} - * @memberof V1PatchMasterConfigRequest - */ - config?: V1Config; - /** - * The fields from the master config that the user wants to patch. - * @type {ProtobufFieldMask} - * @memberof V1PatchMasterConfigRequest - */ - fieldMask?: ProtobufFieldMask; + /** + * The new config that the user wants to patch into the master config. + * @type {V1Config} + * @memberof V1PatchMasterConfigRequest + */ + config?: V1Config; + /** + * The fields from the master config that the user wants to patch. + * @type {ProtobufFieldMask} + * @memberof V1PatchMasterConfigRequest + */ + fieldMask?: ProtobufFieldMask; } /** * Response to PatchMasterConfigRequest. * @export * @interface V1PatchMasterConfigResponse */ -export interface V1PatchMasterConfigResponse {} +export interface V1PatchMasterConfigResponse { +} /** * PatchModel is a partial update to a model with only name required. * @export * @interface V1PatchModel */ export interface V1PatchModel { - /** - * An updated name for the model. - * @type {string} - * @memberof V1PatchModel - */ - name?: string; - /** - * An updated description for the model. - * @type {string} - * @memberof V1PatchModel - */ - description?: string; - /** - * An updated metadata object for the model. - * @type {any} - * @memberof V1PatchModel - */ - metadata?: any; - /** - * An updated label list for the model. - * @type {Array} - * @memberof V1PatchModel - */ - labels?: Array; - /** - * Updated notes associated with this model. - * @type {string} - * @memberof V1PatchModel - */ - notes?: string; - /** - * The name of the workspace associated with this model. - * @type {string} - * @memberof V1PatchModel - */ - workspaceName?: string; - /** - * The id of the workspace associated with this model. - * @type {number} - * @memberof V1PatchModel - */ - workspaceId?: number; + /** + * An updated name for the model. + * @type {string} + * @memberof V1PatchModel + */ + name?: string; + /** + * An updated description for the model. + * @type {string} + * @memberof V1PatchModel + */ + description?: string; + /** + * An updated metadata object for the model. + * @type {any} + * @memberof V1PatchModel + */ + metadata?: any; + /** + * An updated label list for the model. + * @type {Array} + * @memberof V1PatchModel + */ + labels?: Array; + /** + * Updated notes associated with this model. + * @type {string} + * @memberof V1PatchModel + */ + notes?: string; + /** + * The name of the workspace associated with this model. + * @type {string} + * @memberof V1PatchModel + */ + workspaceName?: string; + /** + * The id of the workspace associated with this model. + * @type {number} + * @memberof V1PatchModel + */ + workspaceId?: number; } /** * Response to PatchModelRequest. @@ -7226,55 +7250,55 @@ export interface V1PatchModel { * @interface V1PatchModelResponse */ export interface V1PatchModelResponse { - /** - * The model created. - * @type {V1Model} - * @memberof V1PatchModelResponse - */ - model: V1Model; + /** + * The model created. + * @type {V1Model} + * @memberof V1PatchModelResponse + */ + model: V1Model; } /** - * + * * @export * @interface V1PatchModelVersion */ export interface V1PatchModelVersion { - /** - * An updated checkpoint to associate with the model version. - * @type {V1Checkpoint} - * @memberof V1PatchModelVersion - */ - checkpoint?: V1Checkpoint; - /** - * An updated name for the model version. - * @type {string} - * @memberof V1PatchModelVersion - */ - name?: string; - /** - * An updated metadata object for the model version. - * @type {any} - * @memberof V1PatchModelVersion - */ - metadata?: any; - /** - * An updated comment for the model version. - * @type {string} - * @memberof V1PatchModelVersion - */ - comment?: string; - /** - * An updated label list for the model version. - * @type {Array} - * @memberof V1PatchModelVersion - */ - labels?: Array; - /** - * Updated text notes for the model version. - * @type {string} - * @memberof V1PatchModelVersion - */ - notes?: string; + /** + * An updated checkpoint to associate with the model version. + * @type {V1Checkpoint} + * @memberof V1PatchModelVersion + */ + checkpoint?: V1Checkpoint; + /** + * An updated name for the model version. + * @type {string} + * @memberof V1PatchModelVersion + */ + name?: string; + /** + * An updated metadata object for the model version. + * @type {any} + * @memberof V1PatchModelVersion + */ + metadata?: any; + /** + * An updated comment for the model version. + * @type {string} + * @memberof V1PatchModelVersion + */ + comment?: string; + /** + * An updated label list for the model version. + * @type {Array} + * @memberof V1PatchModelVersion + */ + labels?: Array; + /** + * Updated text notes for the model version. + * @type {string} + * @memberof V1PatchModelVersion + */ + notes?: string; } /** * Response to PatchModelVersionRequest. @@ -7282,12 +7306,12 @@ export interface V1PatchModelVersion { * @interface V1PatchModelVersionResponse */ export interface V1PatchModelVersionResponse { - /** - * The model version created. - * @type {V1ModelVersion} - * @memberof V1PatchModelVersionResponse - */ - modelVersion: V1ModelVersion; + /** + * The model version created. + * @type {V1ModelVersion} + * @memberof V1PatchModelVersionResponse + */ + modelVersion: V1ModelVersion; } /** * PatchProject is a partial update to a project with all optional fields. @@ -7295,24 +7319,24 @@ export interface V1PatchModelVersionResponse { * @interface V1PatchProject */ export interface V1PatchProject { - /** - * The new name for the project. - * @type {string} - * @memberof V1PatchProject - */ - name?: string; - /** - * The new description for the project. - * @type {string} - * @memberof V1PatchProject - */ - description?: string; - /** - * The new key for the project. - * @type {string} - * @memberof V1PatchProject - */ - key?: string; + /** + * The new name for the project. + * @type {string} + * @memberof V1PatchProject + */ + name?: string; + /** + * The new description for the project. + * @type {string} + * @memberof V1PatchProject + */ + description?: string; + /** + * The new key for the project. + * @type {string} + * @memberof V1PatchProject + */ + key?: string; } /** * Response to PatchProjectRequest. @@ -7320,12 +7344,12 @@ export interface V1PatchProject { * @interface V1PatchProjectResponse */ export interface V1PatchProjectResponse { - /** - * The updated project. - * @type {V1Project} - * @memberof V1PatchProjectResponse - */ - project: V1Project; + /** + * The updated project. + * @type {V1Project} + * @memberof V1PatchProjectResponse + */ + project: V1Project; } /** * Response to PatchTemplateConfigRequest. @@ -7333,44 +7357,44 @@ export interface V1PatchProjectResponse { * @interface V1PatchTemplateConfigResponse */ export interface V1PatchTemplateConfigResponse { - /** - * The updated template. - * @type {V1Template} - * @memberof V1PatchTemplateConfigResponse - */ - template: V1Template; + /** + * The updated template. + * @type {V1Template} + * @memberof V1PatchTemplateConfigResponse + */ + template: V1Template; } /** - * + * * @export * @interface V1PatchTemplateNameRequest */ export interface V1PatchTemplateNameRequest { - /** - * The current name. - * @type {string} - * @memberof V1PatchTemplateNameRequest - */ - oldName: string; - /** - * The updated name. - * @type {string} - * @memberof V1PatchTemplateNameRequest - */ - newName: string; + /** + * The current name. + * @type {string} + * @memberof V1PatchTemplateNameRequest + */ + oldName: string; + /** + * The updated name. + * @type {string} + * @memberof V1PatchTemplateNameRequest + */ + newName: string; } /** - * + * * @export * @interface V1PatchTemplateNameResponse */ export interface V1PatchTemplateNameResponse { - /** - * The updated template. - * @type {V1Template} - * @memberof V1PatchTemplateNameResponse - */ - template: V1Template; + /** + * The updated template. + * @type {V1Template} + * @memberof V1PatchTemplateNameResponse + */ + template: V1Template; } /** * Patch a trial. @@ -7378,18 +7402,18 @@ export interface V1PatchTemplateNameResponse { * @interface V1PatchTrialRequest */ export interface V1PatchTrialRequest { - /** - * Trial id. - * @type {number} - * @memberof V1PatchTrialRequest - */ - trialId: number; - /** - * The state of the trial. - * @type {Trialv1State} - * @memberof V1PatchTrialRequest - */ - state?: Trialv1State; + /** + * Trial id. + * @type {number} + * @memberof V1PatchTrialRequest + */ + trialId: number; + /** + * The state of the trial. + * @type {Trialv1State} + * @memberof V1PatchTrialRequest + */ + state?: Trialv1State; } /** * Response to PatchTrialRequest. @@ -7397,12 +7421,12 @@ export interface V1PatchTrialRequest { * @interface V1PatchTrialResponse */ export interface V1PatchTrialResponse { - /** - * The requested trial. - * @type {Trialv1Trial} - * @memberof V1PatchTrialResponse - */ - trial: Trialv1Trial; + /** + * The requested trial. + * @type {Trialv1Trial} + * @memberof V1PatchTrialResponse + */ + trial: Trialv1Trial; } /** * Request to edit fields for a user. @@ -7410,54 +7434,54 @@ export interface V1PatchTrialResponse { * @interface V1PatchUser */ export interface V1PatchUser { - /** - * String denoting the username of the user. - * @type {string} - * @memberof V1PatchUser - */ - username?: string; - /** - * String denoting the password of the user. - * @type {string} - * @memberof V1PatchUser - */ - password?: string; - /** - * Bool denoting whether the account is an admin account. - * @type {boolean} - * @memberof V1PatchUser - */ - admin?: boolean; - /** - * Bool denoting whether the account is active. - * @type {boolean} - * @memberof V1PatchUser - */ - active?: boolean; - /** - * Name to display in the web UI. - * @type {string} - * @memberof V1PatchUser - */ - displayName?: string; - /** - * The user and group on the agent host machine. - * @type {V1AgentUserGroup} - * @memberof V1PatchUser - */ - agentUserGroup?: V1AgentUserGroup; - /** - * Indicate whether the provided password is pre-salted & hashed or not. - * @type {boolean} - * @memberof V1PatchUser - */ - isHashed?: boolean; - /** - * Bool denoting whether the user should be able to login with or change a password. - * @type {boolean} - * @memberof V1PatchUser - */ - remote?: boolean; + /** + * String denoting the username of the user. + * @type {string} + * @memberof V1PatchUser + */ + username?: string; + /** + * String denoting the password of the user. + * @type {string} + * @memberof V1PatchUser + */ + password?: string; + /** + * Bool denoting whether the account is an admin account. + * @type {boolean} + * @memberof V1PatchUser + */ + admin?: boolean; + /** + * Bool denoting whether the account is active. + * @type {boolean} + * @memberof V1PatchUser + */ + active?: boolean; + /** + * Name to display in the web UI. + * @type {string} + * @memberof V1PatchUser + */ + displayName?: string; + /** + * The user and group on the agent host machine. + * @type {V1AgentUserGroup} + * @memberof V1PatchUser + */ + agentUserGroup?: V1AgentUserGroup; + /** + * Indicate whether the provided password is pre-salted & hashed or not. + * @type {boolean} + * @memberof V1PatchUser + */ + isHashed?: boolean; + /** + * Bool denoting whether the user should be able to login with or change a password. + * @type {boolean} + * @memberof V1PatchUser + */ + remote?: boolean; } /** * Response to PatchUserRequest. @@ -7465,12 +7489,12 @@ export interface V1PatchUser { * @interface V1PatchUserResponse */ export interface V1PatchUserResponse { - /** - * The updated user. - * @type {V1User} - * @memberof V1PatchUserResponse - */ - user: V1User; + /** + * The updated user. + * @type {V1User} + * @memberof V1PatchUserResponse + */ + user: V1User; } /** * Update activation status for multiple users. @@ -7478,24 +7502,24 @@ export interface V1PatchUserResponse { * @interface V1PatchUsersRequest */ export interface V1PatchUsersRequest { - /** - * A list of user IDs to update. - * @type {Array} - * @memberof V1PatchUsersRequest - */ - userIds: Array; - /** - * Intended status (true to activate, false to deactivate). - * @type {boolean} - * @memberof V1PatchUsersRequest - */ - activate: boolean; - /** - * Option to filter to users with these properties. - * @type {V1UserFilters} - * @memberof V1PatchUsersRequest - */ - filters?: V1UserFilters; + /** + * A list of user IDs to update. + * @type {Array} + * @memberof V1PatchUsersRequest + */ + userIds: Array; + /** + * Intended status (true to activate, false to deactivate). + * @type {boolean} + * @memberof V1PatchUsersRequest + */ + activate: boolean; + /** + * Option to filter to users with these properties. + * @type {V1UserFilters} + * @memberof V1PatchUsersRequest + */ + filters?: V1UserFilters; } /** * Response to PatchUsersRequest. @@ -7503,12 +7527,12 @@ export interface V1PatchUsersRequest { * @interface V1PatchUsersResponse */ export interface V1PatchUsersResponse { - /** - * Details on success or error for each user. - * @type {Array} - * @memberof V1PatchUsersResponse - */ - results: Array; + /** + * Details on success or error for each user. + * @type {Array} + * @memberof V1PatchUsersResponse + */ + results: Array; } /** * PatchWorkspace is a partial update to a workspace with all optional fields. @@ -7516,48 +7540,48 @@ export interface V1PatchUsersResponse { * @interface V1PatchWorkspace */ export interface V1PatchWorkspace { - /** - * The new name for the workspace. - * @type {string} - * @memberof V1PatchWorkspace - */ - name?: string; - /** - * Optional agent host uid and gid override. - * @type {V1AgentUserGroup} - * @memberof V1PatchWorkspace - */ - agentUserGroup?: V1AgentUserGroup; - /** - * Optional checkpoint storage config. Expects same format as experiment config's checkpoint storage. - * @type {any} - * @memberof V1PatchWorkspace - */ - checkpointStorageConfig?: any; - /** - * Name of the default compute pool. - * @type {string} - * @memberof V1PatchWorkspace - */ - defaultComputePool?: string; - /** - * Name of the default compute pool can be optional. - * @type {string} - * @memberof V1PatchWorkspace - */ - defaultComputeResourcePool?: string; - /** - * Name of the default aux pool. - * @type {string} - * @memberof V1PatchWorkspace - */ - defaultAuxPool?: string; - /** - * Name of the default aux pool can be optional. - * @type {string} - * @memberof V1PatchWorkspace - */ - defaultAuxResourcePool?: string; + /** + * The new name for the workspace. + * @type {string} + * @memberof V1PatchWorkspace + */ + name?: string; + /** + * Optional agent host uid and gid override. + * @type {V1AgentUserGroup} + * @memberof V1PatchWorkspace + */ + agentUserGroup?: V1AgentUserGroup; + /** + * Optional checkpoint storage config. Expects same format as experiment config's checkpoint storage. + * @type {any} + * @memberof V1PatchWorkspace + */ + checkpointStorageConfig?: any; + /** + * Name of the default compute pool. + * @type {string} + * @memberof V1PatchWorkspace + */ + defaultComputePool?: string; + /** + * Name of the default compute pool can be optional. + * @type {string} + * @memberof V1PatchWorkspace + */ + defaultComputeResourcePool?: string; + /** + * Name of the default aux pool. + * @type {string} + * @memberof V1PatchWorkspace + */ + defaultAuxPool?: string; + /** + * Name of the default aux pool can be optional. + * @type {string} + * @memberof V1PatchWorkspace + */ + defaultAuxResourcePool?: string; } /** * Response to PatchWorkspaceRequest. @@ -7565,43 +7589,44 @@ export interface V1PatchWorkspace { * @interface V1PatchWorkspaceResponse */ export interface V1PatchWorkspaceResponse { - /** - * The updated workspace. - * @type {V1Workspace} - * @memberof V1PatchWorkspaceResponse - */ - workspace: V1Workspace; + /** + * The updated workspace. + * @type {V1Workspace} + * @memberof V1PatchWorkspaceResponse + */ + workspace: V1Workspace; } /** * Response to PauseExperimentRequest. * @export * @interface V1PauseExperimentResponse */ -export interface V1PauseExperimentResponse {} +export interface V1PauseExperimentResponse { +} /** * Pause multiple experiments. * @export * @interface V1PauseExperimentsRequest */ export interface V1PauseExperimentsRequest { - /** - * Selecting experiments by id. - * @type {Array} - * @memberof V1PauseExperimentsRequest - */ - experimentIds: Array; - /** - * Targets all experiments matching filters. - * @type {V1BulkExperimentFilters} - * @memberof V1PauseExperimentsRequest - */ - filters?: V1BulkExperimentFilters; - /** - * Project id that the experiments belong to. - * @type {number} - * @memberof V1PauseExperimentsRequest - */ - projectId: number; + /** + * Selecting experiments by id. + * @type {Array} + * @memberof V1PauseExperimentsRequest + */ + experimentIds: Array; + /** + * Targets all experiments matching filters. + * @type {V1BulkExperimentFilters} + * @memberof V1PauseExperimentsRequest + */ + filters?: V1BulkExperimentFilters; + /** + * Project id that the experiments belong to. + * @type {number} + * @memberof V1PauseExperimentsRequest + */ + projectId: number; } /** * Response to PauseExperimentsRequest. @@ -7609,43 +7634,44 @@ export interface V1PauseExperimentsRequest { * @interface V1PauseExperimentsResponse */ export interface V1PauseExperimentsResponse { - /** - * Details on success or error for each experiment. - * @type {Array} - * @memberof V1PauseExperimentsResponse - */ - results: Array; + /** + * Details on success or error for each experiment. + * @type {Array} + * @memberof V1PauseExperimentsResponse + */ + results: Array; } /** - * + * * @export * @interface V1PauseGenericTaskResponse */ -export interface V1PauseGenericTaskResponse {} +export interface V1PauseGenericTaskResponse { +} /** * Request to pause the experiment associated witha run. * @export * @interface V1PauseRunsRequest */ export interface V1PauseRunsRequest { - /** - * The ids of the runs being moved. - * @type {Array} - * @memberof V1PauseRunsRequest - */ - runIds: Array; - /** - * The id of the project of the runs being paused. - * @type {number} - * @memberof V1PauseRunsRequest - */ - projectId: number; - /** - * Filter expression - * @type {string} - * @memberof V1PauseRunsRequest - */ - filter?: string; + /** + * The ids of the runs being moved. + * @type {Array} + * @memberof V1PauseRunsRequest + */ + runIds: Array; + /** + * The id of the project of the runs being paused. + * @type {number} + * @memberof V1PauseRunsRequest + */ + projectId: number; + /** + * Filter expression + * @type {string} + * @memberof V1PauseRunsRequest + */ + filter?: string; } /** * Response to PauseRunsRequest. @@ -7653,37 +7679,37 @@ export interface V1PauseRunsRequest { * @interface V1PauseRunsResponse */ export interface V1PauseRunsResponse { - /** - * Details on success or error for each run. - * @type {Array} - * @memberof V1PauseRunsResponse - */ - results: Array; + /** + * Details on success or error for each run. + * @type {Array} + * @memberof V1PauseRunsResponse + */ + results: Array; } /** - * + * * @export * @interface V1Permission */ export interface V1Permission { - /** - * The id of the permission - * @type {V1PermissionType} - * @memberof V1Permission - */ - id: V1PermissionType; - /** - * The name of the permission - * @type {string} - * @memberof V1Permission - */ - name?: string; - /** - * Allowed scope types. - * @type {V1ScopeTypeMask} - * @memberof V1Permission - */ - scopeTypeMask?: V1ScopeTypeMask; + /** + * The id of the permission + * @type {V1PermissionType} + * @memberof V1Permission + */ + id: V1PermissionType; + /** + * The name of the permission + * @type {string} + * @memberof V1Permission + */ + name?: string; + /** + * Allowed scope types. + * @type {V1ScopeTypeMask} + * @memberof V1Permission + */ + scopeTypeMask?: V1ScopeTypeMask; } /** * List of permissions types. Value of the enum has 9xxxx for global only permissions. Permissions on the same object share the thousands place value like 2001 and 2002. - PERMISSION_TYPE_UNSPECIFIED: The permission type is unknown. - PERMISSION_TYPE_ADMINISTRATE_USER: Can create and update other users. Allows updating other users passwords making this permission give all other permissions effectively. - PERMISSION_TYPE_ADMINISTRATE_OAUTH: Ability to manage OAuth clients and settings. - PERMISSION_TYPE_CREATE_EXPERIMENT: Ability to create experiments. - PERMISSION_TYPE_VIEW_EXPERIMENT_ARTIFACTS: Ability to view experiment's model code, checkpoints, trials. - PERMISSION_TYPE_VIEW_EXPERIMENT_METADATA: Ability to view experiment's metadata such as experiment config, progress. - PERMISSION_TYPE_UPDATE_EXPERIMENT: Ability to update experiment and experiment's lifecycle. - PERMISSION_TYPE_UPDATE_EXPERIMENT_METADATA: Ability to update experiment's metadata. - PERMISSION_TYPE_DELETE_EXPERIMENT: Ability to delete experiment. - PERMISSION_TYPE_CREATE_NSC: Ability to create Notebooks, Shells, and Commands. - PERMISSION_TYPE_VIEW_NSC: Ability to view Notebooks, Shells, and Commands. - PERMISSION_TYPE_UPDATE_NSC: Ability to terminate Notebooks, Shells, and Commands. - PERMISSION_TYPE_UPDATE_GROUP: Ability to create, update, and add / remove users from groups. - PERMISSION_TYPE_CREATE_WORKSPACE: Ability to create workspaces. - PERMISSION_TYPE_VIEW_WORKSPACE: Ability to view workspace. - PERMISSION_TYPE_UPDATE_WORKSPACE: Ability to update workspace. - PERMISSION_TYPE_DELETE_WORKSPACE: Ability to delete workspace. - PERMISSION_TYPE_SET_WORKSPACE_AGENT_USER_GROUP: Ability to set workspace agent user group config. - PERMISSION_TYPE_SET_WORKSPACE_CHECKPOINT_STORAGE_CONFIG: Ability to set workspace checkpoint storage config. - PERMISSION_TYPE_SET_WORKSPACE_DEFAULT_RESOURCE_POOL: Ability to set workspace default resource pool. - PERMISSION_TYPE_CREATE_PROJECT: Ability to create projects. - PERMISSION_TYPE_VIEW_PROJECT: Ability to view projects. - PERMISSION_TYPE_UPDATE_PROJECT: Ability to update projects. - PERMISSION_TYPE_DELETE_PROJECT: Ability to delete projects. - PERMISSION_TYPE_ASSIGN_ROLES: Ability to assign roles to groups / users. If assigned at a workspace scope, can only assign roles to that workspace scope. - PERMISSION_TYPE_VIEW_MODEL_REGISTRY: Ability to view model registry. - PERMISSION_TYPE_EDIT_MODEL_REGISTRY: Ability to edit model registry. - PERMISSION_TYPE_CREATE_MODEL_REGISTRY: Ability to create model registry. - PERMISSION_TYPE_DELETE_MODEL_REGISTRY: Ability to delete model registry. - PERMISSION_TYPE_DELETE_MODEL_VERSION: Ability to delete model version. - PERMISSION_TYPE_DELETE_OTHER_USER_MODEL_REGISTRY: Ability to delete another user's model registry. - PERMISSION_TYPE_DELETE_OTHER_USER_MODEL_VERSION: Ability to delete another user's model version. - PERMISSION_TYPE_VIEW_MASTER_LOGS: Ability to view master logs. - PERMISSION_TYPE_VIEW_CLUSTER_USAGE: Ability to view detailed cluster usage info. - PERMISSION_TYPE_UPDATE_AGENTS: Ability to update agents. - PERMISSION_TYPE_VIEW_SENSITIVE_AGENT_INFO: Ability to view sensitive subset of agent info. - PERMISSION_TYPE_VIEW_MASTER_CONFIG: Ability to view master configs. - PERMISSION_TYPE_UPDATE_MASTER_CONFIG: Ability to update master configs. - PERMISSION_TYPE_VIEW_EXTERNAL_JOBS: Ability to view external jobs. - PERMISSION_TYPE_CONTROL_STRICT_JOB_QUEUE: Ability to control strict job queue. - PERMISSION_TYPE_VIEW_TEMPLATES: Ability to view templates. - PERMISSION_TYPE_UPDATE_TEMPLATES: Ability to update templates. - PERMISSION_TYPE_CREATE_TEMPLATES: Ability to create templates. - PERMISSION_TYPE_DELETE_TEMPLATES: Ability to delete templates. - PERMISSION_TYPE_UPDATE_ROLES: Ability to create and update role definitions. - PERMISSION_TYPE_EDIT_WEBHOOKS: Ability to create and delete webhooks. - PERMISSION_TYPE_MODIFY_RP_WORKSPACE_BINDINGS: Ability to bind, unbind or overwrite resource pool workspace bindings. @@ -7691,91 +7717,92 @@ export interface V1Permission { * @enum {string} */ export const V1PermissionType = { - UNSPECIFIED: 'PERMISSION_TYPE_UNSPECIFIED', - ADMINISTRATEUSER: 'PERMISSION_TYPE_ADMINISTRATE_USER', - ADMINISTRATEOAUTH: 'PERMISSION_TYPE_ADMINISTRATE_OAUTH', - CREATEEXPERIMENT: 'PERMISSION_TYPE_CREATE_EXPERIMENT', - VIEWEXPERIMENTARTIFACTS: 'PERMISSION_TYPE_VIEW_EXPERIMENT_ARTIFACTS', - VIEWEXPERIMENTMETADATA: 'PERMISSION_TYPE_VIEW_EXPERIMENT_METADATA', - UPDATEEXPERIMENT: 'PERMISSION_TYPE_UPDATE_EXPERIMENT', - UPDATEEXPERIMENTMETADATA: 'PERMISSION_TYPE_UPDATE_EXPERIMENT_METADATA', - DELETEEXPERIMENT: 'PERMISSION_TYPE_DELETE_EXPERIMENT', - CREATENSC: 'PERMISSION_TYPE_CREATE_NSC', - VIEWNSC: 'PERMISSION_TYPE_VIEW_NSC', - UPDATENSC: 'PERMISSION_TYPE_UPDATE_NSC', - UPDATEGROUP: 'PERMISSION_TYPE_UPDATE_GROUP', - CREATEWORKSPACE: 'PERMISSION_TYPE_CREATE_WORKSPACE', - VIEWWORKSPACE: 'PERMISSION_TYPE_VIEW_WORKSPACE', - UPDATEWORKSPACE: 'PERMISSION_TYPE_UPDATE_WORKSPACE', - DELETEWORKSPACE: 'PERMISSION_TYPE_DELETE_WORKSPACE', - SETWORKSPACEAGENTUSERGROUP: 'PERMISSION_TYPE_SET_WORKSPACE_AGENT_USER_GROUP', - SETWORKSPACECHECKPOINTSTORAGECONFIG: 'PERMISSION_TYPE_SET_WORKSPACE_CHECKPOINT_STORAGE_CONFIG', - SETWORKSPACEDEFAULTRESOURCEPOOL: 'PERMISSION_TYPE_SET_WORKSPACE_DEFAULT_RESOURCE_POOL', - CREATEPROJECT: 'PERMISSION_TYPE_CREATE_PROJECT', - VIEWPROJECT: 'PERMISSION_TYPE_VIEW_PROJECT', - UPDATEPROJECT: 'PERMISSION_TYPE_UPDATE_PROJECT', - DELETEPROJECT: 'PERMISSION_TYPE_DELETE_PROJECT', - ASSIGNROLES: 'PERMISSION_TYPE_ASSIGN_ROLES', - VIEWMODELREGISTRY: 'PERMISSION_TYPE_VIEW_MODEL_REGISTRY', - EDITMODELREGISTRY: 'PERMISSION_TYPE_EDIT_MODEL_REGISTRY', - CREATEMODELREGISTRY: 'PERMISSION_TYPE_CREATE_MODEL_REGISTRY', - DELETEMODELREGISTRY: 'PERMISSION_TYPE_DELETE_MODEL_REGISTRY', - DELETEMODELVERSION: 'PERMISSION_TYPE_DELETE_MODEL_VERSION', - DELETEOTHERUSERMODELREGISTRY: 'PERMISSION_TYPE_DELETE_OTHER_USER_MODEL_REGISTRY', - DELETEOTHERUSERMODELVERSION: 'PERMISSION_TYPE_DELETE_OTHER_USER_MODEL_VERSION', - VIEWMASTERLOGS: 'PERMISSION_TYPE_VIEW_MASTER_LOGS', - VIEWCLUSTERUSAGE: 'PERMISSION_TYPE_VIEW_CLUSTER_USAGE', - UPDATEAGENTS: 'PERMISSION_TYPE_UPDATE_AGENTS', - VIEWSENSITIVEAGENTINFO: 'PERMISSION_TYPE_VIEW_SENSITIVE_AGENT_INFO', - VIEWMASTERCONFIG: 'PERMISSION_TYPE_VIEW_MASTER_CONFIG', - UPDATEMASTERCONFIG: 'PERMISSION_TYPE_UPDATE_MASTER_CONFIG', - VIEWEXTERNALJOBS: 'PERMISSION_TYPE_VIEW_EXTERNAL_JOBS', - CONTROLSTRICTJOBQUEUE: 'PERMISSION_TYPE_CONTROL_STRICT_JOB_QUEUE', - VIEWTEMPLATES: 'PERMISSION_TYPE_VIEW_TEMPLATES', - UPDATETEMPLATES: 'PERMISSION_TYPE_UPDATE_TEMPLATES', - CREATETEMPLATES: 'PERMISSION_TYPE_CREATE_TEMPLATES', - DELETETEMPLATES: 'PERMISSION_TYPE_DELETE_TEMPLATES', - UPDATEROLES: 'PERMISSION_TYPE_UPDATE_ROLES', - EDITWEBHOOKS: 'PERMISSION_TYPE_EDIT_WEBHOOKS', - MODIFYRPWORKSPACEBINDINGS: 'PERMISSION_TYPE_MODIFY_RP_WORKSPACE_BINDINGS', -} as const; -export type V1PermissionType = ValueOf; + UNSPECIFIED: 'PERMISSION_TYPE_UNSPECIFIED', + ADMINISTRATEUSER: 'PERMISSION_TYPE_ADMINISTRATE_USER', + ADMINISTRATEOAUTH: 'PERMISSION_TYPE_ADMINISTRATE_OAUTH', + CREATEEXPERIMENT: 'PERMISSION_TYPE_CREATE_EXPERIMENT', + VIEWEXPERIMENTARTIFACTS: 'PERMISSION_TYPE_VIEW_EXPERIMENT_ARTIFACTS', + VIEWEXPERIMENTMETADATA: 'PERMISSION_TYPE_VIEW_EXPERIMENT_METADATA', + UPDATEEXPERIMENT: 'PERMISSION_TYPE_UPDATE_EXPERIMENT', + UPDATEEXPERIMENTMETADATA: 'PERMISSION_TYPE_UPDATE_EXPERIMENT_METADATA', + DELETEEXPERIMENT: 'PERMISSION_TYPE_DELETE_EXPERIMENT', + CREATENSC: 'PERMISSION_TYPE_CREATE_NSC', + VIEWNSC: 'PERMISSION_TYPE_VIEW_NSC', + UPDATENSC: 'PERMISSION_TYPE_UPDATE_NSC', + UPDATEGROUP: 'PERMISSION_TYPE_UPDATE_GROUP', + CREATEWORKSPACE: 'PERMISSION_TYPE_CREATE_WORKSPACE', + VIEWWORKSPACE: 'PERMISSION_TYPE_VIEW_WORKSPACE', + UPDATEWORKSPACE: 'PERMISSION_TYPE_UPDATE_WORKSPACE', + DELETEWORKSPACE: 'PERMISSION_TYPE_DELETE_WORKSPACE', + SETWORKSPACEAGENTUSERGROUP: 'PERMISSION_TYPE_SET_WORKSPACE_AGENT_USER_GROUP', + SETWORKSPACECHECKPOINTSTORAGECONFIG: 'PERMISSION_TYPE_SET_WORKSPACE_CHECKPOINT_STORAGE_CONFIG', + SETWORKSPACEDEFAULTRESOURCEPOOL: 'PERMISSION_TYPE_SET_WORKSPACE_DEFAULT_RESOURCE_POOL', + CREATEPROJECT: 'PERMISSION_TYPE_CREATE_PROJECT', + VIEWPROJECT: 'PERMISSION_TYPE_VIEW_PROJECT', + UPDATEPROJECT: 'PERMISSION_TYPE_UPDATE_PROJECT', + DELETEPROJECT: 'PERMISSION_TYPE_DELETE_PROJECT', + ASSIGNROLES: 'PERMISSION_TYPE_ASSIGN_ROLES', + VIEWMODELREGISTRY: 'PERMISSION_TYPE_VIEW_MODEL_REGISTRY', + EDITMODELREGISTRY: 'PERMISSION_TYPE_EDIT_MODEL_REGISTRY', + CREATEMODELREGISTRY: 'PERMISSION_TYPE_CREATE_MODEL_REGISTRY', + DELETEMODELREGISTRY: 'PERMISSION_TYPE_DELETE_MODEL_REGISTRY', + DELETEMODELVERSION: 'PERMISSION_TYPE_DELETE_MODEL_VERSION', + DELETEOTHERUSERMODELREGISTRY: 'PERMISSION_TYPE_DELETE_OTHER_USER_MODEL_REGISTRY', + DELETEOTHERUSERMODELVERSION: 'PERMISSION_TYPE_DELETE_OTHER_USER_MODEL_VERSION', + VIEWMASTERLOGS: 'PERMISSION_TYPE_VIEW_MASTER_LOGS', + VIEWCLUSTERUSAGE: 'PERMISSION_TYPE_VIEW_CLUSTER_USAGE', + UPDATEAGENTS: 'PERMISSION_TYPE_UPDATE_AGENTS', + VIEWSENSITIVEAGENTINFO: 'PERMISSION_TYPE_VIEW_SENSITIVE_AGENT_INFO', + VIEWMASTERCONFIG: 'PERMISSION_TYPE_VIEW_MASTER_CONFIG', + UPDATEMASTERCONFIG: 'PERMISSION_TYPE_UPDATE_MASTER_CONFIG', + VIEWEXTERNALJOBS: 'PERMISSION_TYPE_VIEW_EXTERNAL_JOBS', + CONTROLSTRICTJOBQUEUE: 'PERMISSION_TYPE_CONTROL_STRICT_JOB_QUEUE', + VIEWTEMPLATES: 'PERMISSION_TYPE_VIEW_TEMPLATES', + UPDATETEMPLATES: 'PERMISSION_TYPE_UPDATE_TEMPLATES', + CREATETEMPLATES: 'PERMISSION_TYPE_CREATE_TEMPLATES', + DELETETEMPLATES: 'PERMISSION_TYPE_DELETE_TEMPLATES', + UPDATEROLES: 'PERMISSION_TYPE_UPDATE_ROLES', + EDITWEBHOOKS: 'PERMISSION_TYPE_EDIT_WEBHOOKS', + MODIFYRPWORKSPACEBINDINGS: 'PERMISSION_TYPE_MODIFY_RP_WORKSPACE_BINDINGS', +} as const +export type V1PermissionType = ValueOf /** * Response to PinWorkspaceRequest. * @export * @interface V1PinWorkspaceResponse */ -export interface V1PinWorkspaceResponse {} +export interface V1PinWorkspaceResponse { +} /** - * + * * @export * @interface V1PolymorphicFilter */ export interface V1PolymorphicFilter { - /** - * metric or column name for the filter - * @type {string} - * @memberof V1PolymorphicFilter - */ - name?: string; - /** - * double value range for the query - * @type {V1DoubleFieldFilter} - * @memberof V1PolymorphicFilter - */ - doubleRange?: V1DoubleFieldFilter; - /** - * integer value range for the query - * @type {V1Int32FieldFilter} - * @memberof V1PolymorphicFilter - */ - integerRange?: V1Int32FieldFilter; - /** - * time value range for the query - * @type {V1TimestampFieldFilter} - * @memberof V1PolymorphicFilter - */ - timeRange?: V1TimestampFieldFilter; + /** + * metric or column name for the filter + * @type {string} + * @memberof V1PolymorphicFilter + */ + name?: string; + /** + * double value range for the query + * @type {V1DoubleFieldFilter} + * @memberof V1PolymorphicFilter + */ + doubleRange?: V1DoubleFieldFilter; + /** + * integer value range for the query + * @type {V1Int32FieldFilter} + * @memberof V1PolymorphicFilter + */ + integerRange?: V1Int32FieldFilter; + /** + * time value range for the query + * @type {V1TimestampFieldFilter} + * @memberof V1PolymorphicFilter + */ + timeRange?: V1TimestampFieldFilter; } /** * Set the accelerator data for some allocation. @@ -7783,62 +7810,64 @@ export interface V1PolymorphicFilter { * @interface V1PostAllocationAcceleratorDataRequest */ export interface V1PostAllocationAcceleratorDataRequest { - /** - * The id of the allocation. - * @type {string} - * @memberof V1PostAllocationAcceleratorDataRequest - */ - allocationId: string; - /** - * The accelerator data used by the allocation. - * @type {V1AcceleratorData} - * @memberof V1PostAllocationAcceleratorDataRequest - */ - acceleratorData: V1AcceleratorData; + /** + * The id of the allocation. + * @type {string} + * @memberof V1PostAllocationAcceleratorDataRequest + */ + allocationId: string; + /** + * The accelerator data used by the allocation. + * @type {V1AcceleratorData} + * @memberof V1PostAllocationAcceleratorDataRequest + */ + acceleratorData: V1AcceleratorData; } /** - * + * * @export * @interface V1PostAllocationAcceleratorDataResponse */ -export interface V1PostAllocationAcceleratorDataResponse {} +export interface V1PostAllocationAcceleratorDataResponse { +} /** * Set the proxy address for some allocation. * @export * @interface V1PostAllocationProxyAddressRequest */ export interface V1PostAllocationProxyAddressRequest { - /** - * The id of the allocation. - * @type {string} - * @memberof V1PostAllocationProxyAddressRequest - */ - allocationId?: string; - /** - * The address of the host where the service is, w.r.t. the master. - * @type {string} - * @memberof V1PostAllocationProxyAddressRequest - */ - proxyAddress?: string; + /** + * The id of the allocation. + * @type {string} + * @memberof V1PostAllocationProxyAddressRequest + */ + allocationId?: string; + /** + * The address of the host where the service is, w.r.t. the master. + * @type {string} + * @memberof V1PostAllocationProxyAddressRequest + */ + proxyAddress?: string; } /** - * + * * @export * @interface V1PostAllocationProxyAddressResponse */ -export interface V1PostAllocationProxyAddressResponse {} +export interface V1PostAllocationProxyAddressResponse { +} /** * Request for updating a checkpoints metadata. * @export * @interface V1PostCheckpointMetadataRequest */ export interface V1PostCheckpointMetadataRequest { - /** - * The desired checkpoint fields and values. - * @type {V1Checkpoint} - * @memberof V1PostCheckpointMetadataRequest - */ - checkpoint?: V1Checkpoint; + /** + * The desired checkpoint fields and values. + * @type {V1Checkpoint} + * @memberof V1PostCheckpointMetadataRequest + */ + checkpoint?: V1Checkpoint; } /** * Response to PostCheckpointRequest. @@ -7846,12 +7875,12 @@ export interface V1PostCheckpointMetadataRequest { * @interface V1PostCheckpointMetadataResponse */ export interface V1PostCheckpointMetadataResponse { - /** - * The updated checkpoint. - * @type {V1Checkpoint} - * @memberof V1PostCheckpointMetadataResponse - */ - checkpoint?: V1Checkpoint; + /** + * The updated checkpoint. + * @type {V1Checkpoint} + * @memberof V1PostCheckpointMetadataResponse + */ + checkpoint?: V1Checkpoint; } /** * Request for creating a model in the registry. @@ -7859,48 +7888,48 @@ export interface V1PostCheckpointMetadataResponse { * @interface V1PostModelRequest */ export interface V1PostModelRequest { - /** - * The name of the model. - * @type {string} - * @memberof V1PostModelRequest - */ - name: string; - /** - * The description of the model. - * @type {string} - * @memberof V1PostModelRequest - */ - description?: string; - /** - * The user-defined metadata of the model. - * @type {any} - * @memberof V1PostModelRequest - */ - metadata?: any; - /** - * Labels associated with this model. - * @type {Array} - * @memberof V1PostModelRequest - */ - labels?: Array; - /** - * The name of the workspace associated with this model. - * @type {string} - * @memberof V1PostModelRequest - */ - workspaceName?: string; - /** - * The id of the workspace associated with this model. - * @type {number} - * @memberof V1PostModelRequest - */ - workspaceId?: number; - /** - * Notes associated with this model. - * @type {string} - * @memberof V1PostModelRequest - */ - notes?: string; + /** + * The name of the model. + * @type {string} + * @memberof V1PostModelRequest + */ + name: string; + /** + * The description of the model. + * @type {string} + * @memberof V1PostModelRequest + */ + description?: string; + /** + * The user-defined metadata of the model. + * @type {any} + * @memberof V1PostModelRequest + */ + metadata?: any; + /** + * Labels associated with this model. + * @type {Array} + * @memberof V1PostModelRequest + */ + labels?: Array; + /** + * The name of the workspace associated with this model. + * @type {string} + * @memberof V1PostModelRequest + */ + workspaceName?: string; + /** + * The id of the workspace associated with this model. + * @type {number} + * @memberof V1PostModelRequest + */ + workspaceId?: number; + /** + * Notes associated with this model. + * @type {string} + * @memberof V1PostModelRequest + */ + notes?: string; } /** * Response to PostModelRequest. @@ -7908,12 +7937,12 @@ export interface V1PostModelRequest { * @interface V1PostModelResponse */ export interface V1PostModelResponse { - /** - * The model created. - * @type {V1Model} - * @memberof V1PostModelResponse - */ - model: V1Model; + /** + * The model created. + * @type {V1Model} + * @memberof V1PostModelResponse + */ + model: V1Model; } /** * Request for creating a model version. @@ -7921,48 +7950,48 @@ export interface V1PostModelResponse { * @interface V1PostModelVersionRequest */ export interface V1PostModelVersionRequest { - /** - * The name of the model to add this version to. - * @type {string} - * @memberof V1PostModelVersionRequest - */ - modelName: string; - /** - * UUID of the checkpoint. - * @type {string} - * @memberof V1PostModelVersionRequest - */ - checkpointUuid: string; - /** - * User-friendly name for the model version. - * @type {string} - * @memberof V1PostModelVersionRequest - */ - name?: string; - /** - * User-written comment for the model version. - * @type {string} - * @memberof V1PostModelVersionRequest - */ - comment?: string; - /** - * The user-defined metadata of the model version. - * @type {any} - * @memberof V1PostModelVersionRequest - */ - metadata?: any; - /** - * Labels associated with this model version. - * @type {Array} - * @memberof V1PostModelVersionRequest - */ - labels?: Array; - /** - * Notes associated with this model version. - * @type {string} - * @memberof V1PostModelVersionRequest - */ - notes?: string; + /** + * The name of the model to add this version to. + * @type {string} + * @memberof V1PostModelVersionRequest + */ + modelName: string; + /** + * UUID of the checkpoint. + * @type {string} + * @memberof V1PostModelVersionRequest + */ + checkpointUuid: string; + /** + * User-friendly name for the model version. + * @type {string} + * @memberof V1PostModelVersionRequest + */ + name?: string; + /** + * User-written comment for the model version. + * @type {string} + * @memberof V1PostModelVersionRequest + */ + comment?: string; + /** + * The user-defined metadata of the model version. + * @type {any} + * @memberof V1PostModelVersionRequest + */ + metadata?: any; + /** + * Labels associated with this model version. + * @type {Array} + * @memberof V1PostModelVersionRequest + */ + labels?: Array; + /** + * Notes associated with this model version. + * @type {string} + * @memberof V1PostModelVersionRequest + */ + notes?: string; } /** * Response for PostModelVersionRequest. @@ -7970,12 +7999,12 @@ export interface V1PostModelVersionRequest { * @interface V1PostModelVersionResponse */ export interface V1PostModelVersionResponse { - /** - * The model version requested. - * @type {V1ModelVersion} - * @memberof V1PostModelVersionResponse - */ - modelVersion: V1ModelVersion; + /** + * The model version requested. + * @type {V1ModelVersion} + * @memberof V1PostModelVersionResponse + */ + modelVersion: V1ModelVersion; } /** * Request for creating a project. @@ -7983,30 +8012,30 @@ export interface V1PostModelVersionResponse { * @interface V1PostProjectRequest */ export interface V1PostProjectRequest { - /** - * The name of the project. - * @type {string} - * @memberof V1PostProjectRequest - */ - name: string; - /** - * Description of the project. - * @type {string} - * @memberof V1PostProjectRequest - */ - description?: string; - /** - * Id of the associated workspace. - * @type {number} - * @memberof V1PostProjectRequest - */ - workspaceId: number; - /** - * Key for the project. - * @type {string} - * @memberof V1PostProjectRequest - */ - key?: string; + /** + * The name of the project. + * @type {string} + * @memberof V1PostProjectRequest + */ + name: string; + /** + * Description of the project. + * @type {string} + * @memberof V1PostProjectRequest + */ + description?: string; + /** + * Id of the associated workspace. + * @type {number} + * @memberof V1PostProjectRequest + */ + workspaceId: number; + /** + * Key for the project. + * @type {string} + * @memberof V1PostProjectRequest + */ + key?: string; } /** * Response to PostProjectRequest. @@ -8014,12 +8043,12 @@ export interface V1PostProjectRequest { * @interface V1PostProjectResponse */ export interface V1PostProjectResponse { - /** - * The project created. - * @type {V1Project} - * @memberof V1PostProjectResponse - */ - project: V1Project; + /** + * The project created. + * @type {V1Project} + * @memberof V1PostProjectResponse + */ + project: V1Project; } /** * Request to post metadata for a run. @@ -8027,18 +8056,18 @@ export interface V1PostProjectResponse { * @interface V1PostRunMetadataRequest */ export interface V1PostRunMetadataRequest { - /** - * The ID of the run to post metadata for. - * @type {number} - * @memberof V1PostRunMetadataRequest - */ - runId?: number; - /** - * The arbitrary metadata to post. - * @type {any} - * @memberof V1PostRunMetadataRequest - */ - metadata: any; + /** + * The ID of the run to post metadata for. + * @type {number} + * @memberof V1PostRunMetadataRequest + */ + runId?: number; + /** + * The arbitrary metadata to post. + * @type {any} + * @memberof V1PostRunMetadataRequest + */ + metadata: any; } /** * Response to post metadata for a run. @@ -8046,12 +8075,12 @@ export interface V1PostRunMetadataRequest { * @interface V1PostRunMetadataResponse */ export interface V1PostRunMetadataResponse { - /** - * The new metadata of the run. - * @type {any} - * @memberof V1PostRunMetadataResponse - */ - metadata?: any; + /** + * The new metadata of the run. + * @type {any} + * @memberof V1PostRunMetadataResponse + */ + metadata?: any; } /** * Request for sending operations from a custom search method. @@ -8059,62 +8088,64 @@ export interface V1PostRunMetadataResponse { * @interface V1PostSearcherOperationsRequest */ export interface V1PostSearcherOperationsRequest { - /** - * The experiment ID. - * @type {number} - * @memberof V1PostSearcherOperationsRequest - */ - experimentId?: number; - /** - * List of operations to submit. - * @type {Array} - * @memberof V1PostSearcherOperationsRequest - */ - searcherOperations?: Array; - /** - * The event that triggered the client to send these operations to the master. - * @type {V1SearcherEvent} - * @memberof V1PostSearcherOperationsRequest - */ - triggeredByEvent?: V1SearcherEvent; + /** + * The experiment ID. + * @type {number} + * @memberof V1PostSearcherOperationsRequest + */ + experimentId?: number; + /** + * List of operations to submit. + * @type {Array} + * @memberof V1PostSearcherOperationsRequest + */ + searcherOperations?: Array; + /** + * The event that triggered the client to send these operations to the master. + * @type {V1SearcherEvent} + * @memberof V1PostSearcherOperationsRequest + */ + triggeredByEvent?: V1SearcherEvent; } /** * Response to PostSearcherOperationsResponse. * @export * @interface V1PostSearcherOperationsResponse */ -export interface V1PostSearcherOperationsResponse {} +export interface V1PostSearcherOperationsResponse { +} /** * Request to PostTaskLogs. * @export * @interface V1PostTaskLogsRequest */ export interface V1PostTaskLogsRequest { - /** - * The logs to persist. - * @type {Array} - * @memberof V1PostTaskLogsRequest - */ - logs: Array; + /** + * The logs to persist. + * @type {Array} + * @memberof V1PostTaskLogsRequest + */ + logs: Array; } /** * Response to PostTaskLogs. * @export * @interface V1PostTaskLogsResponse */ -export interface V1PostTaskLogsResponse {} +export interface V1PostTaskLogsResponse { +} /** * Response to PostTemplateRequest. * @export * @interface V1PostTemplateResponse */ export interface V1PostTemplateResponse { - /** - * The created template. - * @type {V1Template} - * @memberof V1PostTemplateResponse - */ - template: V1Template; + /** + * The created template. + * @type {V1Template} + * @memberof V1PostTemplateResponse + */ + template: V1Template; } /** * Create a batch of trial profiler metrics. @@ -8122,80 +8153,83 @@ export interface V1PostTemplateResponse { * @interface V1PostTrialProfilerMetricsBatchRequest */ export interface V1PostTrialProfilerMetricsBatchRequest { - /** - * The batches to create. - * @type {Array} - * @memberof V1PostTrialProfilerMetricsBatchRequest - */ - batches?: Array; + /** + * The batches to create. + * @type {Array} + * @memberof V1PostTrialProfilerMetricsBatchRequest + */ + batches?: Array; } /** - * + * * @export * @interface V1PostTrialProfilerMetricsBatchResponse */ -export interface V1PostTrialProfilerMetricsBatchResponse {} +export interface V1PostTrialProfilerMetricsBatchResponse { +} /** - * + * * @export * @interface V1PostTrialRunnerMetadataResponse */ -export interface V1PostTrialRunnerMetadataResponse {} +export interface V1PostTrialRunnerMetadataResponse { +} /** * Update user activity. * @export * @interface V1PostUserActivityRequest */ export interface V1PostUserActivityRequest { - /** - * The type of the activity. - * @type {V1ActivityType} - * @memberof V1PostUserActivityRequest - */ - activityType: V1ActivityType; - /** - * The type of the entity. - * @type {V1EntityType} - * @memberof V1PostUserActivityRequest - */ - entityType: V1EntityType; - /** - * The unique id for the entity - * @type {number} - * @memberof V1PostUserActivityRequest - */ - entityId: number; + /** + * The type of the activity. + * @type {V1ActivityType} + * @memberof V1PostUserActivityRequest + */ + activityType: V1ActivityType; + /** + * The type of the entity. + * @type {V1EntityType} + * @memberof V1PostUserActivityRequest + */ + entityType: V1EntityType; + /** + * The unique id for the entity + * @type {number} + * @memberof V1PostUserActivityRequest + */ + entityId: number; } /** * Response to PostUserActivityRequest. * @export * @interface V1PostUserActivityResponse */ -export interface V1PostUserActivityResponse {} +export interface V1PostUserActivityResponse { +} /** * Create a new user. * @export * @interface V1PostUserRequest */ export interface V1PostUserRequest { - /** - * The user to create. - * @type {V1User} - * @memberof V1PostUserRequest - */ - user?: V1User; - /** - * The password of the user. - * @type {string} - * @memberof V1PostUserRequest - */ - password?: string; - /** - * Indicate whether the provided password is pre-salted & hashed or not. - * @type {boolean} - * @memberof V1PostUserRequest - */ - isHashed?: boolean; + /** + * The user to create. + * @type {V1User} + * @memberof V1PostUserRequest + */ + user?: V1User; + /** + * The password of the user. + * @type {string} + * @memberof V1PostUserRequest + */ + password?: string; + /** + * Indicate whether the provided password is pre-salted & hashed or not. + * @type {boolean} + * @memberof V1PostUserRequest + */ + isHashed?: boolean; } /** * Response to PostUserRequest. @@ -8203,12 +8237,12 @@ export interface V1PostUserRequest { * @interface V1PostUserResponse */ export interface V1PostUserResponse { - /** - * The created user. - * @type {V1User} - * @memberof V1PostUserResponse - */ - user?: V1User; + /** + * The created user. + * @type {V1User} + * @memberof V1PostUserResponse + */ + user?: V1User; } /** * Update user settings. @@ -8216,31 +8250,32 @@ export interface V1PostUserResponse { * @interface V1PostUserSettingRequest */ export interface V1PostUserSettingRequest { - /** - * Setting key value pair. - * @type {Array} - * @memberof V1PostUserSettingRequest - */ - settings: Array; + /** + * Setting key value pair. + * @type {Array} + * @memberof V1PostUserSettingRequest + */ + settings: Array; } /** * Response to PostUserSettingRequest. * @export * @interface V1PostUserSettingResponse */ -export interface V1PostUserSettingResponse {} +export interface V1PostUserSettingResponse { +} /** * Response to PostWebhookRequest. * @export * @interface V1PostWebhookResponse */ export interface V1PostWebhookResponse { - /** - * The webhook created. - * @type {V1Webhook} - * @memberof V1PostWebhookResponse - */ - webhook: V1Webhook; + /** + * The webhook created. + * @type {V1Webhook} + * @memberof V1PostWebhookResponse + */ + webhook: V1Webhook; } /** * Request for creating a workspace. @@ -8248,36 +8283,36 @@ export interface V1PostWebhookResponse { * @interface V1PostWorkspaceRequest */ export interface V1PostWorkspaceRequest { - /** - * The name of the workspace. - * @type {string} - * @memberof V1PostWorkspaceRequest - */ - name: string; - /** - * Optional agent host uid and gid override. - * @type {V1AgentUserGroup} - * @memberof V1PostWorkspaceRequest - */ - agentUserGroup?: V1AgentUserGroup; - /** - * Optional checkpoint storage config. - * @type {any} - * @memberof V1PostWorkspaceRequest - */ - checkpointStorageConfig?: any; - /** - * The name of the default compute pool. - * @type {string} - * @memberof V1PostWorkspaceRequest - */ - defaultComputePool?: string; - /** - * The name of the default aux pool. - * @type {string} - * @memberof V1PostWorkspaceRequest - */ - defaultAuxPool?: string; + /** + * The name of the workspace. + * @type {string} + * @memberof V1PostWorkspaceRequest + */ + name: string; + /** + * Optional agent host uid and gid override. + * @type {V1AgentUserGroup} + * @memberof V1PostWorkspaceRequest + */ + agentUserGroup?: V1AgentUserGroup; + /** + * Optional checkpoint storage config. + * @type {any} + * @memberof V1PostWorkspaceRequest + */ + checkpointStorageConfig?: any; + /** + * The name of the default compute pool. + * @type {string} + * @memberof V1PostWorkspaceRequest + */ + defaultComputePool?: string; + /** + * The name of the default aux pool. + * @type {string} + * @memberof V1PostWorkspaceRequest + */ + defaultAuxPool?: string; } /** * Response to PostWorkspaceRequest. @@ -8285,12 +8320,12 @@ export interface V1PostWorkspaceRequest { * @interface V1PostWorkspaceResponse */ export interface V1PostWorkspaceResponse { - /** - * The workspace created. - * @type {V1Workspace} - * @memberof V1PostWorkspaceResponse - */ - workspace: V1Workspace; + /** + * The workspace created. + * @type {V1Workspace} + * @memberof V1PostWorkspaceResponse + */ + workspace: V1Workspace; } /** * Preview hyperparameter search. @@ -8298,18 +8333,18 @@ export interface V1PostWorkspaceResponse { * @interface V1PreviewHPSearchRequest */ export interface V1PreviewHPSearchRequest { - /** - * The experiment config to simulate. - * @type {any} - * @memberof V1PreviewHPSearchRequest - */ - config?: any; - /** - * The searcher simulation seed. - * @type {number} - * @memberof V1PreviewHPSearchRequest - */ - seed?: number; + /** + * The experiment config to simulate. + * @type {any} + * @memberof V1PreviewHPSearchRequest + */ + config?: any; + /** + * The searcher simulation seed. + * @type {number} + * @memberof V1PreviewHPSearchRequest + */ + seed?: number; } /** * Response to PreviewSearchRequest. @@ -8317,12 +8352,12 @@ export interface V1PreviewHPSearchRequest { * @interface V1PreviewHPSearchResponse */ export interface V1PreviewHPSearchResponse { - /** - * The resulting simulation. - * @type {V1ExperimentSimulation} - * @memberof V1PreviewHPSearchResponse - */ - simulation?: V1ExperimentSimulation; + /** + * The resulting simulation. + * @type {V1ExperimentSimulation} + * @memberof V1PreviewHPSearchResponse + */ + simulation?: V1ExperimentSimulation; } /** * Project is a named collection of experiments. @@ -8330,102 +8365,108 @@ export interface V1PreviewHPSearchResponse { * @interface V1Project */ export interface V1Project { - /** - * The unique id of the project. - * @type {number} - * @memberof V1Project - */ - id: number; - /** - * The unique name of the project. - * @type {string} - * @memberof V1Project - */ - name: string; - /** - * The id of the associated workspace. - * @type {number} - * @memberof V1Project - */ - workspaceId: number; - /** - * The description of the project. - * @type {string} - * @memberof V1Project - */ - description?: string; - /** - * Time of most recently started experiment within this project. - * @type {Date | DateString} - * @memberof V1Project - */ - lastExperimentStartedAt?: Date | DateString; - /** - * Notes associated with this project. - * @type {Array} - * @memberof V1Project - */ - notes: Array; - /** - * Count of experiments associated with this project. - * @type {number} - * @memberof V1Project - */ - numExperiments: number; - /** - * Count of active experiments associated with this project. - * @type {number} - * @memberof V1Project - */ - numActiveExperiments: number; - /** - * Whether this project is archived or not. - * @type {boolean} - * @memberof V1Project - */ - archived: boolean; - /** - * User who created this project. - * @type {string} - * @memberof V1Project - */ - username: string; - /** - * Whether this project is immutable (default uncategorized project). - * @type {boolean} - * @memberof V1Project - */ - immutable: boolean; - /** - * ID of the user who created this project. - * @type {number} - * @memberof V1Project - */ - userId: number; - /** - * The name of the associated workspace. - * @type {string} - * @memberof V1Project - */ - workspaceName?: string; - /** - * State of project during deletion. - * @type {V1WorkspaceState} - * @memberof V1Project - */ - state: V1WorkspaceState; - /** - * Message stored from errors on async-deleting a project. - * @type {string} - * @memberof V1Project - */ - errorMessage: string; - /** - * The key of the project. - * @type {string} - * @memberof V1Project - */ - key: string; + /** + * The unique id of the project. + * @type {number} + * @memberof V1Project + */ + id: number; + /** + * The unique name of the project. + * @type {string} + * @memberof V1Project + */ + name: string; + /** + * The id of the associated workspace. + * @type {number} + * @memberof V1Project + */ + workspaceId: number; + /** + * The description of the project. + * @type {string} + * @memberof V1Project + */ + description?: string; + /** + * Time of most recently started experiment within this project. + * @type {Date | DateString} + * @memberof V1Project + */ + lastExperimentStartedAt?: Date | DateString; + /** + * Notes associated with this project. + * @type {Array} + * @memberof V1Project + */ + notes: Array; + /** + * Count of experiments associated with this project. + * @type {number} + * @memberof V1Project + */ + numExperiments: number; + /** + * Count of active experiments associated with this project. + * @type {number} + * @memberof V1Project + */ + numActiveExperiments: number; + /** + * Whether this project is archived or not. + * @type {boolean} + * @memberof V1Project + */ + archived: boolean; + /** + * User who created this project. + * @type {string} + * @memberof V1Project + */ + username: string; + /** + * Whether this project is immutable (default uncategorized project). + * @type {boolean} + * @memberof V1Project + */ + immutable: boolean; + /** + * ID of the user who created this project. + * @type {number} + * @memberof V1Project + */ + userId: number; + /** + * The name of the associated workspace. + * @type {string} + * @memberof V1Project + */ + workspaceName?: string; + /** + * State of project during deletion. + * @type {V1WorkspaceState} + * @memberof V1Project + */ + state: V1WorkspaceState; + /** + * Message stored from errors on async-deleting a project. + * @type {string} + * @memberof V1Project + */ + errorMessage: string; + /** + * The key of the project. + * @type {string} + * @memberof V1Project + */ + key: string; + /** + * Count of runs associated with this project. + * @type {number} + * @memberof V1Project + */ + numRuns: number; } /** * Project Column is a description of a column used on experiments in the project. @@ -8433,30 +8474,30 @@ export interface V1Project { * @interface V1ProjectColumn */ export interface V1ProjectColumn { - /** - * Raw column name. - * @type {string} - * @memberof V1ProjectColumn - */ - column: string; - /** - * Where the column comes from. - * @type {V1LocationType} - * @memberof V1ProjectColumn - */ - location: V1LocationType; - /** - * Type of data in the column. - * @type {V1ColumnType} - * @memberof V1ProjectColumn - */ - type: V1ColumnType; - /** - * Human-friendly name. - * @type {string} - * @memberof V1ProjectColumn - */ - displayName?: string; + /** + * Raw column name. + * @type {string} + * @memberof V1ProjectColumn + */ + column: string; + /** + * Where the column comes from. + * @type {V1LocationType} + * @memberof V1ProjectColumn + */ + location: V1LocationType; + /** + * Type of data in the column. + * @type {V1ColumnType} + * @memberof V1ProjectColumn + */ + type: V1ColumnType; + /** + * Human-friendly name. + * @type {string} + * @memberof V1ProjectColumn + */ + displayName?: string; } /** * ProxyPortConfig configures a proxy the allocation should start. @@ -8464,30 +8505,30 @@ export interface V1ProjectColumn { * @interface V1ProxyPortConfig */ export interface V1ProxyPortConfig { - /** - * The service ID of the proxy port config. - * @type {string} - * @memberof V1ProxyPortConfig - */ - serviceId?: string; - /** - * The port of the proxy port config. - * @type {number} - * @memberof V1ProxyPortConfig - */ - port?: number; - /** - * True if proxy uses TCP. - * @type {boolean} - * @memberof V1ProxyPortConfig - */ - proxyTcp?: boolean; - /** - * True if the proxy is unauthenticated. - * @type {boolean} - * @memberof V1ProxyPortConfig - */ - unauthenticated?: boolean; + /** + * The service ID of the proxy port config. + * @type {string} + * @memberof V1ProxyPortConfig + */ + serviceId?: string; + /** + * The port of the proxy port config. + * @type {number} + * @memberof V1ProxyPortConfig + */ + port?: number; + /** + * True if proxy uses TCP. + * @type {boolean} + * @memberof V1ProxyPortConfig + */ + proxyTcp?: boolean; + /** + * True if the proxy is unauthenticated. + * @type {boolean} + * @memberof V1ProxyPortConfig + */ + unauthenticated?: boolean; } /** * Response to PutExperimentLabelRequest. @@ -8495,12 +8536,12 @@ export interface V1ProxyPortConfig { * @interface V1PutExperimentLabelResponse */ export interface V1PutExperimentLabelResponse { - /** - * The complete list of labels associated with the experiment. - * @type {Array} - * @memberof V1PutExperimentLabelResponse - */ - labels: Array; + /** + * The complete list of labels associated with the experiment. + * @type {Array} + * @memberof V1PutExperimentLabelResponse + */ + labels: Array; } /** * Response to PutExperimentRequest. @@ -8508,18 +8549,18 @@ export interface V1PutExperimentLabelResponse { * @interface V1PutExperimentResponse */ export interface V1PutExperimentResponse { - /** - * The created experiment. - * @type {V1Experiment} - * @memberof V1PutExperimentResponse - */ - experiment: V1Experiment; - /** - * The created experiment config. - * @type {any} - * @memberof V1PutExperimentResponse - */ - config: any; + /** + * The created experiment. + * @type {V1Experiment} + * @memberof V1PutExperimentResponse + */ + experiment: V1Experiment; + /** + * The created experiment config. + * @type {any} + * @memberof V1PutExperimentResponse + */ + config: any; } /** * Request for changing the log retention policy for the an experiment. @@ -8527,55 +8568,56 @@ export interface V1PutExperimentResponse { * @interface V1PutExperimentRetainLogsRequest */ export interface V1PutExperimentRetainLogsRequest { - /** - * The ID of the experiment. - * @type {number} - * @memberof V1PutExperimentRetainLogsRequest - */ - experimentId: number; - /** - * The number of days to retain logs, starting from the end time of the task. - * @type {number} - * @memberof V1PutExperimentRetainLogsRequest - */ - numDays: number; + /** + * The ID of the experiment. + * @type {number} + * @memberof V1PutExperimentRetainLogsRequest + */ + experimentId: number; + /** + * The number of days to retain logs, starting from the end time of the task. + * @type {number} + * @memberof V1PutExperimentRetainLogsRequest + */ + numDays: number; } /** * Response to PutExperimentRetainLogsRequest. * @export * @interface V1PutExperimentRetainLogsResponse */ -export interface V1PutExperimentRetainLogsResponse {} +export interface V1PutExperimentRetainLogsResponse { +} /** * Request for changing the log retention policy for the an experiment. * @export * @interface V1PutExperimentsRetainLogsRequest */ export interface V1PutExperimentsRetainLogsRequest { - /** - * The ids of the experiments being moved. - * @type {Array} - * @memberof V1PutExperimentsRetainLogsRequest - */ - experimentIds: Array; - /** - * The number of days to retain logs, starting from the end time of the task. - * @type {number} - * @memberof V1PutExperimentsRetainLogsRequest - */ - numDays: number; - /** - * Targets all experiments matching filters. - * @type {V1BulkExperimentFilters} - * @memberof V1PutExperimentsRetainLogsRequest - */ - filters?: V1BulkExperimentFilters; - /** - * Project id that the experiments belong to. - * @type {number} - * @memberof V1PutExperimentsRetainLogsRequest - */ - projectId: number; + /** + * The ids of the experiments being moved. + * @type {Array} + * @memberof V1PutExperimentsRetainLogsRequest + */ + experimentIds: Array; + /** + * The number of days to retain logs, starting from the end time of the task. + * @type {number} + * @memberof V1PutExperimentsRetainLogsRequest + */ + numDays: number; + /** + * Targets all experiments matching filters. + * @type {V1BulkExperimentFilters} + * @memberof V1PutExperimentsRetainLogsRequest + */ + filters?: V1BulkExperimentFilters; + /** + * Project id that the experiments belong to. + * @type {number} + * @memberof V1PutExperimentsRetainLogsRequest + */ + projectId: number; } /** * Response to PutExperimentRetainLogsRequest. @@ -8583,12 +8625,12 @@ export interface V1PutExperimentsRetainLogsRequest { * @interface V1PutExperimentsRetainLogsResponse */ export interface V1PutExperimentsRetainLogsResponse { - /** - * Details on success or error for each experiment. - * @type {Array} - * @memberof V1PutExperimentsRetainLogsResponse - */ - results: Array; + /** + * Details on success or error for each experiment. + * @type {Array} + * @memberof V1PutExperimentsRetainLogsResponse + */ + results: Array; } /** * Request for setting project notes. @@ -8596,18 +8638,18 @@ export interface V1PutExperimentsRetainLogsResponse { * @interface V1PutProjectNotesRequest */ export interface V1PutProjectNotesRequest { - /** - * The complete list of notes. - * @type {Array} - * @memberof V1PutProjectNotesRequest - */ - notes: Array; - /** - * The id of the project. - * @type {number} - * @memberof V1PutProjectNotesRequest - */ - projectId: number; + /** + * The complete list of notes. + * @type {Array} + * @memberof V1PutProjectNotesRequest + */ + notes: Array; + /** + * The id of the project. + * @type {number} + * @memberof V1PutProjectNotesRequest + */ + projectId: number; } /** * Response to PutProjectNotesRequest. @@ -8615,12 +8657,12 @@ export interface V1PutProjectNotesRequest { * @interface V1PutProjectNotesResponse */ export interface V1PutProjectNotesResponse { - /** - * The complete list of notes on a project. - * @type {Array} - * @memberof V1PutProjectNotesResponse - */ - notes: Array; + /** + * The complete list of notes on a project. + * @type {Array} + * @memberof V1PutProjectNotesResponse + */ + notes: Array; } /** * Response to PutTemplateRequest. @@ -8628,12 +8670,12 @@ export interface V1PutProjectNotesResponse { * @interface V1PutTemplateResponse */ export interface V1PutTemplateResponse { - /** - * The updated or created template. - * @type {V1Template} - * @memberof V1PutTemplateResponse - */ - template?: V1Template; + /** + * The updated or created template. + * @type {V1Template} + * @memberof V1PutTemplateResponse + */ + template?: V1Template; } /** * Put a trial. @@ -8641,18 +8683,18 @@ export interface V1PutTemplateResponse { * @interface V1PutTrialRequest */ export interface V1PutTrialRequest { - /** - * CreateTrialRequest payload. - * @type {V1CreateTrialRequest} - * @memberof V1PutTrialRequest - */ - createTrialRequest?: V1CreateTrialRequest; - /** - * External trial id. - * @type {string} - * @memberof V1PutTrialRequest - */ - externalTrialId?: string; + /** + * CreateTrialRequest payload. + * @type {V1CreateTrialRequest} + * @memberof V1PutTrialRequest + */ + createTrialRequest?: V1CreateTrialRequest; + /** + * External trial id. + * @type {string} + * @memberof V1PutTrialRequest + */ + externalTrialId?: string; } /** * Response to PutTrialRequest. @@ -8660,12 +8702,12 @@ export interface V1PutTrialRequest { * @interface V1PutTrialResponse */ export interface V1PutTrialResponse { - /** - * The requested trial. - * @type {Trialv1Trial} - * @memberof V1PutTrialResponse - */ - trial: Trialv1Trial; + /** + * The requested trial. + * @type {Trialv1Trial} + * @memberof V1PutTrialResponse + */ + trial: Trialv1Trial; } /** * Request for changing the log retention policy for the an experiment. @@ -8673,67 +8715,68 @@ export interface V1PutTrialResponse { * @interface V1PutTrialRetainLogsRequest */ export interface V1PutTrialRetainLogsRequest { - /** - * The ID of the trial. - * @type {number} - * @memberof V1PutTrialRetainLogsRequest - */ - trialId?: number; - /** - * The number of days to retain logs, starting from the end time of the task. - * @type {number} - * @memberof V1PutTrialRetainLogsRequest - */ - numDays: number; + /** + * The ID of the trial. + * @type {number} + * @memberof V1PutTrialRetainLogsRequest + */ + trialId?: number; + /** + * The number of days to retain logs, starting from the end time of the task. + * @type {number} + * @memberof V1PutTrialRetainLogsRequest + */ + numDays: number; } /** * Response to PutExperimentRetainLogsRequest. * @export * @interface V1PutTrialRetainLogsResponse */ -export interface V1PutTrialRetainLogsResponse {} +export interface V1PutTrialRetainLogsResponse { +} /** * Describes a message to control jobs in a queue. * @export * @interface V1QueueControl */ export interface V1QueueControl { - /** - * Job id. - * @type {string} - * @memberof V1QueueControl - */ - jobId: string; - /** - * The desired job position in the queue in terms of another job. - * @type {string} - * @memberof V1QueueControl - */ - aheadOf?: string; - /** - * The desired job position in the queue in terms of another job. - * @type {string} - * @memberof V1QueueControl - */ - behindOf?: string; - /** - * Name of the target resource_pool to move the job to. - * @type {string} - * @memberof V1QueueControl - */ - resourcePool?: string; - /** - * The desired job priority in priority scheduler. - * @type {number} - * @memberof V1QueueControl - */ - priority?: number; - /** - * The desired job weight in fairshare scheduler. - * @type {number} - * @memberof V1QueueControl - */ - weight?: number; + /** + * Job id. + * @type {string} + * @memberof V1QueueControl + */ + jobId: string; + /** + * The desired job position in the queue in terms of another job. + * @type {string} + * @memberof V1QueueControl + */ + aheadOf?: string; + /** + * The desired job position in the queue in terms of another job. + * @type {string} + * @memberof V1QueueControl + */ + behindOf?: string; + /** + * Name of the target resource_pool to move the job to. + * @type {string} + * @memberof V1QueueControl + */ + resourcePool?: string; + /** + * The desired job priority in priority scheduler. + * @type {number} + * @memberof V1QueueControl + */ + priority?: number; + /** + * The desired job weight in fairshare scheduler. + * @type {number} + * @memberof V1QueueControl + */ + weight?: number; } /** * Statistics for a queue. @@ -8741,18 +8784,18 @@ export interface V1QueueControl { * @interface V1QueueStats */ export interface V1QueueStats { - /** - * Number of queued jobs in the queue. - * @type {number} - * @memberof V1QueueStats - */ - queuedCount: number; - /** - * Number of scheduled jobs in the queue. - * @type {number} - * @memberof V1QueueStats - */ - scheduledCount: number; + /** + * Number of queued jobs in the queue. + * @type {number} + * @memberof V1QueueStats + */ + queuedCount: number; + /** + * Number of scheduled jobs in the queue. + * @type {number} + * @memberof V1QueueStats + */ + scheduledCount: number; } /** * RBACJob is a job that can have either a limited or a full representation of a job. @@ -8760,18 +8803,18 @@ export interface V1QueueStats { * @interface V1RBACJob */ export interface V1RBACJob { - /** - * Full representation. - * @type {V1Job} - * @memberof V1RBACJob - */ - full?: V1Job; - /** - * Limited representation for lower access levels. - * @type {V1LimitedJob} - * @memberof V1RBACJob - */ - limited?: V1LimitedJob; + /** + * Full representation. + * @type {V1Job} + * @memberof V1RBACJob + */ + full?: V1Job; + /** + * Limited representation for lower access levels. + * @type {V1LimitedJob} + * @memberof V1RBACJob + */ + limited?: V1LimitedJob; } /** * RemoveAssignmentsRequest is the body of the request for the call to remove a user or group from a role. @@ -8779,204 +8822,212 @@ export interface V1RBACJob { * @interface V1RemoveAssignmentsRequest */ export interface V1RemoveAssignmentsRequest { - /** - * the set of groups being removed from a role. - * @type {Array} - * @memberof V1RemoveAssignmentsRequest - */ - groupRoleAssignments?: Array; - /** - * the set of users being removed from a role. - * @type {Array} - * @memberof V1RemoveAssignmentsRequest - */ - userRoleAssignments?: Array; + /** + * the set of groups being removed from a role. + * @type {Array} + * @memberof V1RemoveAssignmentsRequest + */ + groupRoleAssignments?: Array; + /** + * the set of users being removed from a role. + * @type {Array} + * @memberof V1RemoveAssignmentsRequest + */ + userRoleAssignments?: Array; } /** * RemoveAssignmentsResponse is the body of the response for teh call to remove a user or group from a role. * @export * @interface V1RemoveAssignmentsResponse */ -export interface V1RemoveAssignmentsResponse {} +export interface V1RemoveAssignmentsResponse { +} /** * The rendezvous info for the trial to rendezvous with sibling containers. * @export * @interface V1RendezvousInfo */ export interface V1RendezvousInfo { - /** - * The rendezvous addresses of the other containers. - * @type {Array} - * @memberof V1RendezvousInfo - */ - addresses: Array; - /** - * The container rank. - * @type {number} - * @memberof V1RendezvousInfo - */ - rank: number; - /** - * The slots for each address, respectively. - * @type {Array} - * @memberof V1RendezvousInfo - */ - slots: Array; + /** + * The rendezvous addresses of the other containers. + * @type {Array} + * @memberof V1RendezvousInfo + */ + addresses: Array; + /** + * The container rank. + * @type {number} + * @memberof V1RendezvousInfo + */ + rank: number; + /** + * The slots for each address, respectively. + * @type {Array} + * @memberof V1RendezvousInfo + */ + slots: Array; } /** * Response to ReportCheckpointRequest. * @export * @interface V1ReportCheckpointResponse */ -export interface V1ReportCheckpointResponse {} +export interface V1ReportCheckpointResponse { +} /** * Persist the given metrics for the trial. * @export * @interface V1ReportTrialMetricsRequest */ export interface V1ReportTrialMetricsRequest { - /** - * The metrics to persist. - * @type {V1TrialMetrics} - * @memberof V1ReportTrialMetricsRequest - */ - metrics: V1TrialMetrics; - /** - * The type of metrics to persist eg 'training', 'validation', etc. - * @type {string} - * @memberof V1ReportTrialMetricsRequest - */ - group: string; + /** + * The metrics to persist. + * @type {V1TrialMetrics} + * @memberof V1ReportTrialMetricsRequest + */ + metrics: V1TrialMetrics; + /** + * The type of metrics to persist eg 'training', 'validation', etc. + * @type {string} + * @memberof V1ReportTrialMetricsRequest + */ + group: string; } /** - * + * * @export * @interface V1ReportTrialMetricsResponse */ -export interface V1ReportTrialMetricsResponse {} +export interface V1ReportTrialMetricsResponse { +} /** - * + * * @export * @interface V1ReportTrialProgressResponse */ -export interface V1ReportTrialProgressResponse {} +export interface V1ReportTrialProgressResponse { +} /** - * + * * @export * @interface V1ReportTrialSearcherEarlyExitResponse */ -export interface V1ReportTrialSearcherEarlyExitResponse {} +export interface V1ReportTrialSearcherEarlyExitResponse { +} /** - * + * * @export * @interface V1ReportTrialSourceInfoRequest */ export interface V1ReportTrialSourceInfoRequest { - /** - * Type of the TrialSourceInfo - * @type {V1TrialSourceInfo} - * @memberof V1ReportTrialSourceInfoRequest - */ - trialSourceInfo: V1TrialSourceInfo; + /** + * Type of the TrialSourceInfo + * @type {V1TrialSourceInfo} + * @memberof V1ReportTrialSourceInfoRequest + */ + trialSourceInfo: V1TrialSourceInfo; } /** - * + * * @export * @interface V1ReportTrialSourceInfoResponse */ export interface V1ReportTrialSourceInfoResponse { - /** - * Trial ID of the created - * @type {number} - * @memberof V1ReportTrialSourceInfoResponse - */ - trialId: number; - /** - * UUID of the checkpoint. - * @type {string} - * @memberof V1ReportTrialSourceInfoResponse - */ - checkpointUuid: string; + /** + * Trial ID of the created + * @type {number} + * @memberof V1ReportTrialSourceInfoResponse + */ + trialId: number; + /** + * UUID of the checkpoint. + * @type {string} + * @memberof V1ReportTrialSourceInfoResponse + */ + checkpointUuid: string; } /** - * + * * @export * @interface V1ReportTrialTrainingMetricsResponse */ -export interface V1ReportTrialTrainingMetricsResponse {} +export interface V1ReportTrialTrainingMetricsResponse { +} /** - * + * * @export * @interface V1ReportTrialValidationMetricsResponse */ -export interface V1ReportTrialValidationMetricsResponse {} +export interface V1ReportTrialValidationMetricsResponse { +} /** * Response to ResetUserSettingRequest. * @export * @interface V1ResetUserSettingResponse */ -export interface V1ResetUserSettingResponse {} +export interface V1ResetUserSettingResponse { +} /** * One instance of slots in the cluster being allocated to a task during a period (aggregated). * @export * @interface V1ResourceAllocationAggregatedEntry */ export interface V1ResourceAllocationAggregatedEntry { - /** - * The date of this entry. - * @type {string} - * @memberof V1ResourceAllocationAggregatedEntry - */ - periodStart: string; - /** - * The period over which aggregation occurred. - * @type {V1ResourceAllocationAggregationPeriod} - * @memberof V1ResourceAllocationAggregatedEntry - */ - period: V1ResourceAllocationAggregationPeriod; - /** - * The total number of seconds included in this allocation entry. - * @type {number} - * @memberof V1ResourceAllocationAggregatedEntry - */ - seconds: number; - /** - * The seconds in the cluster used by experiments belonging to each user. - * @type {{ [key: string]: number; }} - * @memberof V1ResourceAllocationAggregatedEntry - */ - byUsername: { [key: string]: number }; - /** - * The seconds in the cluster used by experiments labeled with each label. - * @type {{ [key: string]: number; }} - * @memberof V1ResourceAllocationAggregatedEntry - */ - byExperimentLabel: { [key: string]: number }; - /** - * The seconds in the cluster used by experiments assigned to each resource pool. - * @type {{ [key: string]: number; }} - * @memberof V1ResourceAllocationAggregatedEntry - */ - byResourcePool: { [key: string]: number }; - /** - * This field has been deprecated and will be empty. - * @type {{ [key: string]: number; }} - * @memberof V1ResourceAllocationAggregatedEntry - */ - byAgentLabel: { [key: string]: number }; -} -/** - * Response to ResourceAllocationAggregatedRequest. - * @export - * @interface V1ResourceAllocationAggregatedResponse - */ -export interface V1ResourceAllocationAggregatedResponse { - /** - * An entry summarizing one workload. - * @type {Array} - * @memberof V1ResourceAllocationAggregatedResponse - */ - resourceEntries: Array; + /** + * The date of this entry. + * @type {string} + * @memberof V1ResourceAllocationAggregatedEntry + */ + periodStart: string; + /** + * The period over which aggregation occurred. + * @type {V1ResourceAllocationAggregationPeriod} + * @memberof V1ResourceAllocationAggregatedEntry + */ + period: V1ResourceAllocationAggregationPeriod; + /** + * The total number of seconds included in this allocation entry. + * @type {number} + * @memberof V1ResourceAllocationAggregatedEntry + */ + seconds: number; + /** + * The seconds in the cluster used by experiments belonging to each user. + * @type {{ [key: string]: number; }} + * @memberof V1ResourceAllocationAggregatedEntry + */ + byUsername: { [key: string]: number; }; + /** + * The seconds in the cluster used by experiments labeled with each label. + * @type {{ [key: string]: number; }} + * @memberof V1ResourceAllocationAggregatedEntry + */ + byExperimentLabel: { [key: string]: number; }; + /** + * The seconds in the cluster used by experiments assigned to each resource pool. + * @type {{ [key: string]: number; }} + * @memberof V1ResourceAllocationAggregatedEntry + */ + byResourcePool: { [key: string]: number; }; + /** + * This field has been deprecated and will be empty. + * @type {{ [key: string]: number; }} + * @memberof V1ResourceAllocationAggregatedEntry + */ + byAgentLabel: { [key: string]: number; }; +} +/** + * Response to ResourceAllocationAggregatedRequest. + * @export + * @interface V1ResourceAllocationAggregatedResponse + */ +export interface V1ResourceAllocationAggregatedResponse { + /** + * An entry summarizing one workload. + * @type {Array} + * @memberof V1ResourceAllocationAggregatedResponse + */ + resourceEntries: Array; } /** * The period over which to perform aggregation. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_DAILY: Aggregation by day. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_MONTHLY: Aggregation by month. @@ -8984,73 +9035,71 @@ export interface V1ResourceAllocationAggregatedResponse { * @enum {string} */ export const V1ResourceAllocationAggregationPeriod = { - UNSPECIFIED: 'RESOURCE_ALLOCATION_AGGREGATION_PERIOD_UNSPECIFIED', - DAILY: 'RESOURCE_ALLOCATION_AGGREGATION_PERIOD_DAILY', - MONTHLY: 'RESOURCE_ALLOCATION_AGGREGATION_PERIOD_MONTHLY', -} as const; -export type V1ResourceAllocationAggregationPeriod = ValueOf< - typeof V1ResourceAllocationAggregationPeriod ->; + UNSPECIFIED: 'RESOURCE_ALLOCATION_AGGREGATION_PERIOD_UNSPECIFIED', + DAILY: 'RESOURCE_ALLOCATION_AGGREGATION_PERIOD_DAILY', + MONTHLY: 'RESOURCE_ALLOCATION_AGGREGATION_PERIOD_MONTHLY', +} as const +export type V1ResourceAllocationAggregationPeriod = ValueOf /** * One instance of slots in the cluster being allocated to a task. * @export * @interface V1ResourceAllocationRawEntry */ export interface V1ResourceAllocationRawEntry { - /** - * The kind of workload being run during this allocation (training, checkpoint, or validation). - * @type {string} - * @memberof V1ResourceAllocationRawEntry - */ - kind?: string; - /** - * The time at which the allocation began. - * @type {Date | DateString} - * @memberof V1ResourceAllocationRawEntry - */ - startTime?: Date | DateString; - /** - * The time at which the allocation ended. - * @type {Date | DateString} - * @memberof V1ResourceAllocationRawEntry - */ - endTime?: Date | DateString; - /** - * The ID of the experiment the allocation is a part of. - * @type {number} - * @memberof V1ResourceAllocationRawEntry - */ - experimentId?: number; - /** - * The username of the user who ran the experiment. - * @type {string} - * @memberof V1ResourceAllocationRawEntry - */ - username?: string; - /** - * The username of the user who ran the experiment. - * @type {number} - * @memberof V1ResourceAllocationRawEntry - */ - userId?: number; - /** - * The labels assigned to the experiment. - * @type {Array} - * @memberof V1ResourceAllocationRawEntry - */ - labels?: Array; - /** - * The number of seconds for which the allocation was active during the requested period. - * @type {number} - * @memberof V1ResourceAllocationRawEntry - */ - seconds?: number; - /** - * The number of slots used by the allocation. - * @type {number} - * @memberof V1ResourceAllocationRawEntry - */ - slots?: number; + /** + * The kind of workload being run during this allocation (training, checkpoint, or validation). + * @type {string} + * @memberof V1ResourceAllocationRawEntry + */ + kind?: string; + /** + * The time at which the allocation began. + * @type {Date | DateString} + * @memberof V1ResourceAllocationRawEntry + */ + startTime?: Date | DateString; + /** + * The time at which the allocation ended. + * @type {Date | DateString} + * @memberof V1ResourceAllocationRawEntry + */ + endTime?: Date | DateString; + /** + * The ID of the experiment the allocation is a part of. + * @type {number} + * @memberof V1ResourceAllocationRawEntry + */ + experimentId?: number; + /** + * The username of the user who ran the experiment. + * @type {string} + * @memberof V1ResourceAllocationRawEntry + */ + username?: string; + /** + * The username of the user who ran the experiment. + * @type {number} + * @memberof V1ResourceAllocationRawEntry + */ + userId?: number; + /** + * The labels assigned to the experiment. + * @type {Array} + * @memberof V1ResourceAllocationRawEntry + */ + labels?: Array; + /** + * The number of seconds for which the allocation was active during the requested period. + * @type {number} + * @memberof V1ResourceAllocationRawEntry + */ + seconds?: number; + /** + * The number of slots used by the allocation. + * @type {number} + * @memberof V1ResourceAllocationRawEntry + */ + slots?: number; } /** * Response to ResourceAllocationRawRequest. @@ -9058,12 +9107,12 @@ export interface V1ResourceAllocationRawEntry { * @interface V1ResourceAllocationRawResponse */ export interface V1ResourceAllocationRawResponse { - /** - * An entry summarizing one workload. - * @type {Array} - * @memberof V1ResourceAllocationRawResponse - */ - resourceEntries?: Array; + /** + * An entry summarizing one workload. + * @type {Array} + * @memberof V1ResourceAllocationRawResponse + */ + resourceEntries?: Array; } /** * A Resource Pool is a pool of resources where containers are run. @@ -9071,496 +9120,496 @@ export interface V1ResourceAllocationRawResponse { * @interface V1ResourcePool */ export interface V1ResourcePool { - /** - * The unique name of the resource pool. - * @type {string} - * @memberof V1ResourcePool - */ - name: string; - /** - * The description of the resource pool - * @type {string} - * @memberof V1ResourcePool - */ - description: string; - /** - * The type of the resource pool (AWS/GCP/STATIC) - * @type {V1ResourcePoolType} - * @memberof V1ResourcePool - */ - type: V1ResourcePoolType; - /** - * The number of agents running in the resource pool - * @type {number} - * @memberof V1ResourcePool - */ - numAgents: number; - /** - * The total number of slots that exist in the resource pool - * @type {number} - * @memberof V1ResourcePool - */ - slotsAvailable: number; - /** - * The number of slots that are actively running workloads - * @type {number} - * @memberof V1ResourcePool - */ - slotsUsed: number; - /** - * Slot device type: cpu, gpu, ... - * @type {Devicev1Type} - * @memberof V1ResourcePool - */ - slotType: Devicev1Type; - /** - * The max number of aux containers that can run in this resource pool - * @type {number} - * @memberof V1ResourcePool - */ - auxContainerCapacity: number; - /** - * The current number of aux containers running in this resource pool - * @type {number} - * @memberof V1ResourcePool - */ - auxContainersRunning: number; - /** - * Is this resource pool the default compute pool? - * @type {boolean} - * @memberof V1ResourcePool - */ - defaultComputePool: boolean; - /** - * Is this resource pool the default auxiliary pool? - * @type {boolean} - * @memberof V1ResourcePool - */ - defaultAuxPool: boolean; - /** - * Is this resource pool using preemptible/spot instances? Only meaningful in an AWS or GCP resource pool. - * @type {boolean} - * @memberof V1ResourcePool - */ - preemptible: boolean; - /** - * When using dynamic agents, the minimum number of agents that can exist in the resource pool. - * @type {number} - * @memberof V1ResourcePool - */ - minAgents: number; - /** - * When using dynamic agents, the maximum number of agents that can exist in the resource pool. - * @type {number} - * @memberof V1ResourcePool - */ - maxAgents: number; - /** - * The number of slots that exists on an dynamic agent. - * @type {number} - * @memberof V1ResourcePool - */ - slotsPerAgent?: number; - /** - * The maximum number of auxiliary containers that can run on an individual agent - * @type {number} - * @memberof V1ResourcePool - */ - auxContainerCapacityPerAgent: number; - /** - * The type of the scheduler. Either 'FAIR_SHARE', 'PRIORITY', or 'ROUND_ROBIN' - * @type {V1SchedulerType} - * @memberof V1ResourcePool - */ - schedulerType: V1SchedulerType; - /** - * The fitting policy of the scheduler. - * @type {V1FittingPolicy} - * @memberof V1ResourcePool - */ - schedulerFittingPolicy: V1FittingPolicy; - /** - * The location of the resource pool. For AWS this returns the region and for GCP this return the zone. - * @type {string} - * @memberof V1ResourcePool - */ - location: string; - /** - * The VM image used for the agents when using dynamic agents. - * @type {string} - * @memberof V1ResourcePool - */ - imageId: string; - /** - * The instance type of the agents when using dynamic agents. For AWS this is the Instance Type. For GCP this is the machine type combined with the number and types of GPUs. To work with this data programattically, we recommend working with the ResourcePool.details.aws.instanceType and ResourcePool.details.gcp.machineType/gpuType/gpuNum. - * @type {string} - * @memberof V1ResourcePool - */ - instanceType: string; - /** - * The url of the Determined master - * @type {string} - * @memberof V1ResourcePool - */ - masterUrl: string; - /** - * A hostname for which the master’s TLS certificate is valid, if the host specified by the master_url option is an IP address or is not contained in the certificate - * @type {string} - * @memberof V1ResourcePool - */ - masterCertName: string; - /** - * The startup script for the agent. This runs on the node the agent runs on. - * @type {string} - * @memberof V1ResourcePool - */ - startupScript: string; - /** - * The startup script for the agent's container. This runs in the container determined-agent runs in. - * @type {string} - * @memberof V1ResourcePool - */ - containerStartupScript: string; - /** - * The Docker network to use for the agent when using dynamic agents. - * @type {string} - * @memberof V1ResourcePool - */ - agentDockerNetwork: string; - /** - * The docker runtime to use for the agent when using dynamic agents - * @type {string} - * @memberof V1ResourcePool - */ - agentDockerRuntime: string; - /** - * The docker image to use for the agent when using dynamic agents - * @type {string} - * @memberof V1ResourcePool - */ - agentDockerImage: string; - /** - * the Fluent docker image to use - * @type {string} - * @memberof V1ResourcePool - */ - agentFluentImage: string; - /** - * The maximum idle period of agents in seconds. The master waits for this period of time before shutting down idle agents. - * @type {number} - * @memberof V1ResourcePool - */ - maxIdleAgentPeriod: number; - /** - * The maximum starting period of agents in seconds. The master waits for this period of time for starting agents before retrying. - * @type {number} - * @memberof V1ResourcePool - */ - maxAgentStartingPeriod: number; - /** - * GCP, AWS and Priority Scheduler details - * @type {V1ResourcePoolDetail} - * @memberof V1ResourcePool - */ - details: V1ResourcePoolDetail; - /** - * GCP, AWS accelerator information - * @type {string} - * @memberof V1ResourcePool - */ - accelerator?: string; - /** - * Job queue stats - * @type {V1QueueStats} - * @memberof V1ResourcePool - */ - stats?: V1QueueStats; - /** - * Resource manager name. - * @type {string} - * @memberof V1ResourcePool - */ - resourceManagerName: string; - /** - * Resource manager's metadata. - * @type {{ [key: string]: string; }} - * @memberof V1ResourcePool - */ - resourceManagerMetadata: { [key: string]: string }; + /** + * The unique name of the resource pool. + * @type {string} + * @memberof V1ResourcePool + */ + name: string; + /** + * The description of the resource pool + * @type {string} + * @memberof V1ResourcePool + */ + description: string; + /** + * The type of the resource pool (AWS/GCP/STATIC) + * @type {V1ResourcePoolType} + * @memberof V1ResourcePool + */ + type: V1ResourcePoolType; + /** + * The number of agents running in the resource pool + * @type {number} + * @memberof V1ResourcePool + */ + numAgents: number; + /** + * The total number of slots that exist in the resource pool + * @type {number} + * @memberof V1ResourcePool + */ + slotsAvailable: number; + /** + * The number of slots that are actively running workloads + * @type {number} + * @memberof V1ResourcePool + */ + slotsUsed: number; + /** + * Slot device type: cpu, gpu, ... + * @type {Devicev1Type} + * @memberof V1ResourcePool + */ + slotType: Devicev1Type; + /** + * The max number of aux containers that can run in this resource pool + * @type {number} + * @memberof V1ResourcePool + */ + auxContainerCapacity: number; + /** + * The current number of aux containers running in this resource pool + * @type {number} + * @memberof V1ResourcePool + */ + auxContainersRunning: number; + /** + * Is this resource pool the default compute pool? + * @type {boolean} + * @memberof V1ResourcePool + */ + defaultComputePool: boolean; + /** + * Is this resource pool the default auxiliary pool? + * @type {boolean} + * @memberof V1ResourcePool + */ + defaultAuxPool: boolean; + /** + * Is this resource pool using preemptible/spot instances? Only meaningful in an AWS or GCP resource pool. + * @type {boolean} + * @memberof V1ResourcePool + */ + preemptible: boolean; + /** + * When using dynamic agents, the minimum number of agents that can exist in the resource pool. + * @type {number} + * @memberof V1ResourcePool + */ + minAgents: number; + /** + * When using dynamic agents, the maximum number of agents that can exist in the resource pool. + * @type {number} + * @memberof V1ResourcePool + */ + maxAgents: number; + /** + * The number of slots that exists on an dynamic agent. + * @type {number} + * @memberof V1ResourcePool + */ + slotsPerAgent?: number; + /** + * The maximum number of auxiliary containers that can run on an individual agent + * @type {number} + * @memberof V1ResourcePool + */ + auxContainerCapacityPerAgent: number; + /** + * The type of the scheduler. Either 'FAIR_SHARE', 'PRIORITY', or 'ROUND_ROBIN' + * @type {V1SchedulerType} + * @memberof V1ResourcePool + */ + schedulerType: V1SchedulerType; + /** + * The fitting policy of the scheduler. + * @type {V1FittingPolicy} + * @memberof V1ResourcePool + */ + schedulerFittingPolicy: V1FittingPolicy; + /** + * The location of the resource pool. For AWS this returns the region and for GCP this return the zone. + * @type {string} + * @memberof V1ResourcePool + */ + location: string; + /** + * The VM image used for the agents when using dynamic agents. + * @type {string} + * @memberof V1ResourcePool + */ + imageId: string; + /** + * The instance type of the agents when using dynamic agents. For AWS this is the Instance Type. For GCP this is the machine type combined with the number and types of GPUs. To work with this data programattically, we recommend working with the ResourcePool.details.aws.instanceType and ResourcePool.details.gcp.machineType/gpuType/gpuNum. + * @type {string} + * @memberof V1ResourcePool + */ + instanceType: string; + /** + * The url of the Determined master + * @type {string} + * @memberof V1ResourcePool + */ + masterUrl: string; + /** + * A hostname for which the master’s TLS certificate is valid, if the host specified by the master_url option is an IP address or is not contained in the certificate + * @type {string} + * @memberof V1ResourcePool + */ + masterCertName: string; + /** + * The startup script for the agent. This runs on the node the agent runs on. + * @type {string} + * @memberof V1ResourcePool + */ + startupScript: string; + /** + * The startup script for the agent's container. This runs in the container determined-agent runs in. + * @type {string} + * @memberof V1ResourcePool + */ + containerStartupScript: string; + /** + * The Docker network to use for the agent when using dynamic agents. + * @type {string} + * @memberof V1ResourcePool + */ + agentDockerNetwork: string; + /** + * The docker runtime to use for the agent when using dynamic agents + * @type {string} + * @memberof V1ResourcePool + */ + agentDockerRuntime: string; + /** + * The docker image to use for the agent when using dynamic agents + * @type {string} + * @memberof V1ResourcePool + */ + agentDockerImage: string; + /** + * the Fluent docker image to use + * @type {string} + * @memberof V1ResourcePool + */ + agentFluentImage: string; + /** + * The maximum idle period of agents in seconds. The master waits for this period of time before shutting down idle agents. + * @type {number} + * @memberof V1ResourcePool + */ + maxIdleAgentPeriod: number; + /** + * The maximum starting period of agents in seconds. The master waits for this period of time for starting agents before retrying. + * @type {number} + * @memberof V1ResourcePool + */ + maxAgentStartingPeriod: number; + /** + * GCP, AWS and Priority Scheduler details + * @type {V1ResourcePoolDetail} + * @memberof V1ResourcePool + */ + details: V1ResourcePoolDetail; + /** + * GCP, AWS accelerator information + * @type {string} + * @memberof V1ResourcePool + */ + accelerator?: string; + /** + * Job queue stats + * @type {V1QueueStats} + * @memberof V1ResourcePool + */ + stats?: V1QueueStats; + /** + * Resource manager name. + * @type {string} + * @memberof V1ResourcePool + */ + resourceManagerName: string; + /** + * Resource manager's metadata. + * @type {{ [key: string]: string; }} + * @memberof V1ResourcePool + */ + resourceManagerMetadata: { [key: string]: string; }; } /** - * + * * @export * @interface V1ResourcePoolAwsDetail */ export interface V1ResourcePoolAwsDetail { - /** - * The region the resource pool exists in - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - region: string; - /** - * Size of the root volume of the Determined agent in GB - * @type {number} - * @memberof V1ResourcePoolAwsDetail - */ - rootVolumeSize: number; - /** - * The AMI ID of the Determined agent - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - imageId: string; - /** - * Key for tagging the Determined agent instances - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - tagKey: string; - /** - * Value for tagging the Determined agent instances - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - tagValue: string; - /** - * Name to set for the Determined agent instances - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - instanceName: string; - /** - * The name of the SSH key registered with AWS for SSH key access to the agent instances - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - sshKeyName: string; - /** - * Whether to use public IP addresses for the Determined agent - * @type {boolean} - * @memberof V1ResourcePoolAwsDetail - */ - publicIp: boolean; - /** - * The ID of the subnet to run the Determined agents in - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - subnetId?: string; - /** - * The ID of the security group to run the Determined agents as - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - securityGroupId: string; - /** - * The Amazon Resource Name (ARN) of the IAM instance profile to attach to the agent instances. - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - iamInstanceProfileArn: string; - /** - * AWS instance type to use for dynamic agents - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - instanceType?: string; - /** - * The log group - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - logGroup?: string; - /** - * The log stream - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - logStream?: string; - /** - * Whether to use spot instances - * @type {boolean} - * @memberof V1ResourcePoolAwsDetail - */ - spotEnabled: boolean; - /** - * The maximum price per hour to pay for a spot instance - * @type {string} - * @memberof V1ResourcePoolAwsDetail - */ - spotMaxPrice?: string; - /** - * List of arbitrary user-defined tags that are added to the Determined agent instances - * @type {Array} - * @memberof V1ResourcePoolAwsDetail - */ - customTags?: Array; + /** + * The region the resource pool exists in + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + region: string; + /** + * Size of the root volume of the Determined agent in GB + * @type {number} + * @memberof V1ResourcePoolAwsDetail + */ + rootVolumeSize: number; + /** + * The AMI ID of the Determined agent + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + imageId: string; + /** + * Key for tagging the Determined agent instances + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + tagKey: string; + /** + * Value for tagging the Determined agent instances + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + tagValue: string; + /** + * Name to set for the Determined agent instances + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + instanceName: string; + /** + * The name of the SSH key registered with AWS for SSH key access to the agent instances + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + sshKeyName: string; + /** + * Whether to use public IP addresses for the Determined agent + * @type {boolean} + * @memberof V1ResourcePoolAwsDetail + */ + publicIp: boolean; + /** + * The ID of the subnet to run the Determined agents in + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + subnetId?: string; + /** + * The ID of the security group to run the Determined agents as + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + securityGroupId: string; + /** + * The Amazon Resource Name (ARN) of the IAM instance profile to attach to the agent instances. + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + iamInstanceProfileArn: string; + /** + * AWS instance type to use for dynamic agents + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + instanceType?: string; + /** + * The log group + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + logGroup?: string; + /** + * The log stream + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + logStream?: string; + /** + * Whether to use spot instances + * @type {boolean} + * @memberof V1ResourcePoolAwsDetail + */ + spotEnabled: boolean; + /** + * The maximum price per hour to pay for a spot instance + * @type {string} + * @memberof V1ResourcePoolAwsDetail + */ + spotMaxPrice?: string; + /** + * List of arbitrary user-defined tags that are added to the Determined agent instances + * @type {Array} + * @memberof V1ResourcePoolAwsDetail + */ + customTags?: Array; } /** - * + * * @export * @interface V1ResourcePoolDetail */ export interface V1ResourcePoolDetail { - /** - * AWS-specific details - * @type {V1ResourcePoolAwsDetail} - * @memberof V1ResourcePoolDetail - */ - aws?: V1ResourcePoolAwsDetail; - /** - * GCP-specific details - * @type {V1ResourcePoolGcpDetail} - * @memberof V1ResourcePoolDetail - */ - gcp?: V1ResourcePoolGcpDetail; - /** - * Priority scheduler-specific details - * @type {V1ResourcePoolPrioritySchedulerDetail} - * @memberof V1ResourcePoolDetail - */ - priorityScheduler?: V1ResourcePoolPrioritySchedulerDetail; + /** + * AWS-specific details + * @type {V1ResourcePoolAwsDetail} + * @memberof V1ResourcePoolDetail + */ + aws?: V1ResourcePoolAwsDetail; + /** + * GCP-specific details + * @type {V1ResourcePoolGcpDetail} + * @memberof V1ResourcePoolDetail + */ + gcp?: V1ResourcePoolGcpDetail; + /** + * Priority scheduler-specific details + * @type {V1ResourcePoolPrioritySchedulerDetail} + * @memberof V1ResourcePoolDetail + */ + priorityScheduler?: V1ResourcePoolPrioritySchedulerDetail; } /** - * + * * @export * @interface V1ResourcePoolGcpDetail */ export interface V1ResourcePoolGcpDetail { - /** - * The project ID of the GCP resources used by Determined - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - project: string; - /** - * The zone of the GCP resources used by Determined - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - zone: string; - /** - * Size of the root volume of the Determined agent in GB - * @type {number} - * @memberof V1ResourcePoolGcpDetail - */ - bootDiskSize: number; - /** - * The boot disk source image of the Determined agent - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - bootDiskSourceImage: string; - /** - * Key for labeling the Determined agent instances. - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - labelKey: string; - /** - * Value for labeling the Determined agent instances - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - labelValue: string; - /** - * Name prefix to set for the Determined agent instances - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - namePrefix: string; - /** - * Network resource for the Determined agent instances - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - network: string; - /** - * Subnetwork resource for the Determined agent instances - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - subnetwork?: string; - /** - * Whether to use external IP addresses for the Determined agent instances - * @type {boolean} - * @memberof V1ResourcePoolGcpDetail - */ - externalIp: boolean; - /** - * The network tags to set firewalls for the Determined agent instances - * @type {Array} - * @memberof V1ResourcePoolGcpDetail - */ - networkTags?: Array; - /** - * Email of the service account for the Determined agent instances. - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - serviceAccountEmail: string; - /** - * List of scopes authorized for the Determined agent instances - * @type {Array} - * @memberof V1ResourcePoolGcpDetail - */ - serviceAccountScopes: Array; - /** - * Type of machine for the Determined agents - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - machineType: string; - /** - * Type of GPU for the Determined agents - * @type {string} - * @memberof V1ResourcePoolGcpDetail - */ - gpuType: string; - /** - * Number of GPUs for the Determined agents - * @type {number} - * @memberof V1ResourcePoolGcpDetail - */ - gpuNum: number; - /** - * Whether to use preemptible instances - * @type {boolean} - * @memberof V1ResourcePoolGcpDetail - */ - preemptible: boolean; - /** - * The timeout period for tracking a GCP operation in seconds - * @type {number} - * @memberof V1ResourcePoolGcpDetail - */ - operationTimeoutPeriod: number; + /** + * The project ID of the GCP resources used by Determined + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + project: string; + /** + * The zone of the GCP resources used by Determined + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + zone: string; + /** + * Size of the root volume of the Determined agent in GB + * @type {number} + * @memberof V1ResourcePoolGcpDetail + */ + bootDiskSize: number; + /** + * The boot disk source image of the Determined agent + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + bootDiskSourceImage: string; + /** + * Key for labeling the Determined agent instances. + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + labelKey: string; + /** + * Value for labeling the Determined agent instances + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + labelValue: string; + /** + * Name prefix to set for the Determined agent instances + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + namePrefix: string; + /** + * Network resource for the Determined agent instances + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + network: string; + /** + * Subnetwork resource for the Determined agent instances + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + subnetwork?: string; + /** + * Whether to use external IP addresses for the Determined agent instances + * @type {boolean} + * @memberof V1ResourcePoolGcpDetail + */ + externalIp: boolean; + /** + * The network tags to set firewalls for the Determined agent instances + * @type {Array} + * @memberof V1ResourcePoolGcpDetail + */ + networkTags?: Array; + /** + * Email of the service account for the Determined agent instances. + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + serviceAccountEmail: string; + /** + * List of scopes authorized for the Determined agent instances + * @type {Array} + * @memberof V1ResourcePoolGcpDetail + */ + serviceAccountScopes: Array; + /** + * Type of machine for the Determined agents + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + machineType: string; + /** + * Type of GPU for the Determined agents + * @type {string} + * @memberof V1ResourcePoolGcpDetail + */ + gpuType: string; + /** + * Number of GPUs for the Determined agents + * @type {number} + * @memberof V1ResourcePoolGcpDetail + */ + gpuNum: number; + /** + * Whether to use preemptible instances + * @type {boolean} + * @memberof V1ResourcePoolGcpDetail + */ + preemptible: boolean; + /** + * The timeout period for tracking a GCP operation in seconds + * @type {number} + * @memberof V1ResourcePoolGcpDetail + */ + operationTimeoutPeriod: number; } /** - * + * * @export * @interface V1ResourcePoolPrioritySchedulerDetail */ export interface V1ResourcePoolPrioritySchedulerDetail { - /** - * Whether lower priority tasks should be preempted to schedule higher priority tasks - * @type {boolean} - * @memberof V1ResourcePoolPrioritySchedulerDetail - */ - preemption: boolean; - /** - * The priority that is assigned to tasks that do not explicitly specify a priority. - * @type {number} - * @memberof V1ResourcePoolPrioritySchedulerDetail - */ - defaultPriority: number; - /** - * List of available priorities for K8 (if applicable). - * @type {Array} - * @memberof V1ResourcePoolPrioritySchedulerDetail - */ - k8Priorities?: Array; + /** + * Whether lower priority tasks should be preempted to schedule higher priority tasks + * @type {boolean} + * @memberof V1ResourcePoolPrioritySchedulerDetail + */ + preemption: boolean; + /** + * The priority that is assigned to tasks that do not explicitly specify a priority. + * @type {number} + * @memberof V1ResourcePoolPrioritySchedulerDetail + */ + defaultPriority: number; + /** + * List of available priorities for K8 (if applicable). + * @type {Array} + * @memberof V1ResourcePoolPrioritySchedulerDetail + */ + k8Priorities?: Array; } /** * The type of the ResourcePool. - RESOURCE_POOL_TYPE_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - RESOURCE_POOL_TYPE_AWS: An AWS resource pool. - RESOURCE_POOL_TYPE_GCP: A GCP resource pool. - RESOURCE_POOL_TYPE_STATIC: A static resource pool. - RESOURCE_POOL_TYPE_K8S: The kubernetes resource pool. @@ -9568,37 +9617,37 @@ export interface V1ResourcePoolPrioritySchedulerDetail { * @enum {string} */ export const V1ResourcePoolType = { - UNSPECIFIED: 'RESOURCE_POOL_TYPE_UNSPECIFIED', - AWS: 'RESOURCE_POOL_TYPE_AWS', - GCP: 'RESOURCE_POOL_TYPE_GCP', - STATIC: 'RESOURCE_POOL_TYPE_STATIC', - K8S: 'RESOURCE_POOL_TYPE_K8S', -} as const; -export type V1ResourcePoolType = ValueOf; + UNSPECIFIED: 'RESOURCE_POOL_TYPE_UNSPECIFIED', + AWS: 'RESOURCE_POOL_TYPE_AWS', + GCP: 'RESOURCE_POOL_TYPE_GCP', + STATIC: 'RESOURCE_POOL_TYPE_STATIC', + K8S: 'RESOURCE_POOL_TYPE_K8S', +} as const +export type V1ResourcePoolType = ValueOf /** * ResourcesFailure contains information about restored resources' failure. * @export * @interface V1ResourcesFailure */ export interface V1ResourcesFailure { - /** - * FailureType denotes the type of failure that resulted in the container stopping. - * @type {V1FailureType} - * @memberof V1ResourcesFailure - */ - failureType?: V1FailureType; - /** - * The error message of the failure. - * @type {string} - * @memberof V1ResourcesFailure - */ - errMsg?: string; - /** - * The exit code of the failure. - * @type {number} - * @memberof V1ResourcesFailure - */ - exitCode?: number; + /** + * FailureType denotes the type of failure that resulted in the container stopping. + * @type {V1FailureType} + * @memberof V1ResourcesFailure + */ + failureType?: V1FailureType; + /** + * The error message of the failure. + * @type {string} + * @memberof V1ResourcesFailure + */ + errMsg?: string; + /** + * The exit code of the failure. + * @type {number} + * @memberof V1ResourcesFailure + */ + exitCode?: number; } /** * ResourcesStarted contains the information needed by tasks from container started. @@ -9606,18 +9655,18 @@ export interface V1ResourcesFailure { * @interface V1ResourcesStarted */ export interface V1ResourcesStarted { - /** - * Addresses represents the exposed ports on a container. - * @type {Array} - * @memberof V1ResourcesStarted - */ - addresses?: Array; - /** - * NativeResourcesID is the native Docker hex container ID of the Determined container. - * @type {string} - * @memberof V1ResourcesStarted - */ - nativeResourcesId?: string; + /** + * Addresses represents the exposed ports on a container. + * @type {Array} + * @memberof V1ResourcesStarted + */ + addresses?: Array; + /** + * NativeResourcesID is the native Docker hex container ID of the Determined container. + * @type {string} + * @memberof V1ResourcesStarted + */ + nativeResourcesId?: string; } /** * ResourcesStopped contains the information needed by tasks from container stopped. @@ -9625,12 +9674,12 @@ export interface V1ResourcesStarted { * @interface V1ResourcesStopped */ export interface V1ResourcesStopped { - /** - * ResourcesFailure contains information about restored resources' failure. - * @type {V1ResourcesFailure} - * @memberof V1ResourcesStopped - */ - failure?: V1ResourcesFailure; + /** + * ResourcesFailure contains information about restored resources' failure. + * @type {V1ResourcesFailure} + * @memberof V1ResourcesStopped + */ + failure?: V1ResourcesFailure; } /** * ResourcesSummary provides a summary of the resources comprising what we know at the time the allocation is granted, but for k8s it is granted before being scheduled so it isn't really much and `agent_devices` are missing for k8s. @@ -9638,48 +9687,48 @@ export interface V1ResourcesStopped { * @interface V1ResourcesSummary */ export interface V1ResourcesSummary { - /** - * ResourcesID is the ID of some set of resources. - * @type {string} - * @memberof V1ResourcesSummary - */ - resourcesId?: string; - /** - * ResourcesType is the type of some set of resources. This should be purely informational. - * @type {string} - * @memberof V1ResourcesSummary - */ - resourcesType?: string; - /** - * AllocationID is the ID of an allocation of a task. - * @type {string} - * @memberof V1ResourcesSummary - */ - allocationId?: string; - /** - * ID, an identifier for an agent, maps to the associated devices. - * @type {{ [key: string]: ResourcesSummaryDevices; }} - * @memberof V1ResourcesSummary - */ - agentDevices?: { [key: string]: ResourcesSummaryDevices }; - /** - * Available if the RM can give information on the container level. - * @type {string} - * @memberof V1ResourcesSummary - */ - containerId?: string; - /** - * Available if the RM knows the resource is already started / exited. - * @type {V1ResourcesStarted} - * @memberof V1ResourcesSummary - */ - started?: V1ResourcesStarted; - /** - * ResourcesStopped contains the information needed by tasks from container stopped. - * @type {V1ResourcesStopped} - * @memberof V1ResourcesSummary - */ - exited?: V1ResourcesStopped; + /** + * ResourcesID is the ID of some set of resources. + * @type {string} + * @memberof V1ResourcesSummary + */ + resourcesId?: string; + /** + * ResourcesType is the type of some set of resources. This should be purely informational. + * @type {string} + * @memberof V1ResourcesSummary + */ + resourcesType?: string; + /** + * AllocationID is the ID of an allocation of a task. + * @type {string} + * @memberof V1ResourcesSummary + */ + allocationId?: string; + /** + * ID, an identifier for an agent, maps to the associated devices. + * @type {{ [key: string]: ResourcesSummaryDevices; }} + * @memberof V1ResourcesSummary + */ + agentDevices?: { [key: string]: ResourcesSummaryDevices; }; + /** + * Available if the RM can give information on the container level. + * @type {string} + * @memberof V1ResourcesSummary + */ + containerId?: string; + /** + * Available if the RM knows the resource is already started / exited. + * @type {V1ResourcesStarted} + * @memberof V1ResourcesSummary + */ + started?: V1ResourcesStarted; + /** + * ResourcesStopped contains the information needed by tasks from container stopped. + * @type {V1ResourcesStopped} + * @memberof V1ResourcesSummary + */ + exited?: V1ResourcesStopped; } /** * Request to unpause the experiment associated witha run. @@ -9687,24 +9736,24 @@ export interface V1ResourcesSummary { * @interface V1ResumeRunsRequest */ export interface V1ResumeRunsRequest { - /** - * The ids of the runs being moved. - * @type {Array} - * @memberof V1ResumeRunsRequest - */ - runIds: Array; - /** - * The id of the project of the runs being unpaused. - * @type {number} - * @memberof V1ResumeRunsRequest - */ - projectId: number; - /** - * Filter expression - * @type {string} - * @memberof V1ResumeRunsRequest - */ - filter?: string; + /** + * The ids of the runs being moved. + * @type {Array} + * @memberof V1ResumeRunsRequest + */ + runIds: Array; + /** + * The id of the project of the runs being unpaused. + * @type {number} + * @memberof V1ResumeRunsRequest + */ + projectId: number; + /** + * Filter expression + * @type {string} + * @memberof V1ResumeRunsRequest + */ + filter?: string; } /** * Response to ResumeRunsRequest. @@ -9712,43 +9761,43 @@ export interface V1ResumeRunsRequest { * @interface V1ResumeRunsResponse */ export interface V1ResumeRunsResponse { - /** - * Details on success or error for each run. - * @type {Array} - * @memberof V1ResumeRunsResponse - */ - results: Array; + /** + * Details on success or error for each run. + * @type {Array} + * @memberof V1ResumeRunsResponse + */ + results: Array; } /** - * + * * @export * @interface V1Role */ export interface V1Role { - /** - * The id of the role being detailed - * @type {number} - * @memberof V1Role - */ - roleId: number; - /** - * The string of the role being detailed - * @type {string} - * @memberof V1Role - */ - name?: string; - /** - * The permissions granted to the role - * @type {Array} - * @memberof V1Role - */ - permissions?: Array; - /** - * Allowed scope types. - * @type {V1ScopeTypeMask} - * @memberof V1Role - */ - scopeTypeMask?: V1ScopeTypeMask; + /** + * The id of the role being detailed + * @type {number} + * @memberof V1Role + */ + roleId: number; + /** + * The string of the role being detailed + * @type {string} + * @memberof V1Role + */ + name?: string; + /** + * The permissions granted to the role + * @type {Array} + * @memberof V1Role + */ + permissions?: Array; + /** + * Allowed scope types. + * @type {V1ScopeTypeMask} + * @memberof V1Role + */ + scopeTypeMask?: V1ScopeTypeMask; } /** * RoleAssignment contains information about the scope of the role. @@ -9756,24 +9805,24 @@ export interface V1Role { * @interface V1RoleAssignment */ export interface V1RoleAssignment { - /** - * The role of the assignment. - * @type {V1Role} - * @memberof V1RoleAssignment - */ - role: V1Role; - /** - * The id of the workspace the role belongs to. Empty for cluster-wide scope. - * @type {number} - * @memberof V1RoleAssignment - */ - scopeWorkspaceId?: number; - /** - * Whether the role is assigned cluster-wide. - * @type {boolean} - * @memberof V1RoleAssignment - */ - scopeCluster?: boolean; + /** + * The role of the assignment. + * @type {V1Role} + * @memberof V1RoleAssignment + */ + role: V1Role; + /** + * The id of the workspace the role belongs to. Empty for cluster-wide scope. + * @type {number} + * @memberof V1RoleAssignment + */ + scopeWorkspaceId?: number; + /** + * Whether the role is assigned cluster-wide. + * @type {boolean} + * @memberof V1RoleAssignment + */ + scopeCluster?: boolean; } /** * RoleAssignmentSummary is used to describe permissions a user has. @@ -9781,24 +9830,24 @@ export interface V1RoleAssignment { * @interface V1RoleAssignmentSummary */ export interface V1RoleAssignmentSummary { - /** - * The id of the role being detailed - * @type {number} - * @memberof V1RoleAssignmentSummary - */ - roleId: number; - /** - * List of workspace IDs to apply the role. - * @type {Array} - * @memberof V1RoleAssignmentSummary - */ - scopeWorkspaceIds?: Array; - /** - * Whether the role is assigned cluster-wide. - * @type {boolean} - * @memberof V1RoleAssignmentSummary - */ - scopeCluster?: boolean; + /** + * The id of the role being detailed + * @type {number} + * @memberof V1RoleAssignmentSummary + */ + roleId: number; + /** + * List of workspace IDs to apply the role. + * @type {Array} + * @memberof V1RoleAssignmentSummary + */ + scopeWorkspaceIds?: Array; + /** + * Whether the role is assigned cluster-wide. + * @type {boolean} + * @memberof V1RoleAssignmentSummary + */ + scopeCluster?: boolean; } /** * RoleWithAssignments contains a detailed description of a role and the groups and users belonging to it. @@ -9806,24 +9855,24 @@ export interface V1RoleAssignmentSummary { * @interface V1RoleWithAssignments */ export interface V1RoleWithAssignments { - /** - * The embedded Role. - * @type {V1Role} - * @memberof V1RoleWithAssignments - */ - role?: V1Role; - /** - * The embedded GroupRoleAssignment. - * @type {Array} - * @memberof V1RoleWithAssignments - */ - groupRoleAssignments?: Array; - /** - * The embedded UserRoleAssignment. - * @type {Array} - * @memberof V1RoleWithAssignments - */ - userRoleAssignments?: Array; + /** + * The embedded Role. + * @type {V1Role} + * @memberof V1RoleWithAssignments + */ + role?: V1Role; + /** + * The embedded GroupRoleAssignment. + * @type {Array} + * @memberof V1RoleWithAssignments + */ + groupRoleAssignments?: Array; + /** + * The embedded UserRoleAssignment. + * @type {Array} + * @memberof V1RoleWithAssignments + */ + userRoleAssignments?: Array; } /** * Job stats for a resource pool. @@ -9831,24 +9880,24 @@ export interface V1RoleWithAssignments { * @interface V1RPQueueStat */ export interface V1RPQueueStat { - /** - * Job queue stats. - * @type {V1QueueStats} - * @memberof V1RPQueueStat - */ - stats: V1QueueStats; - /** - * Resource pool. - * @type {string} - * @memberof V1RPQueueStat - */ - resourcePool: string; - /** - * Aggregate stats. - * @type {Array} - * @memberof V1RPQueueStat - */ - aggregates?: Array; + /** + * Job queue stats. + * @type {V1QueueStats} + * @memberof V1RPQueueStat + */ + stats: V1QueueStats; + /** + * Resource pool. + * @type {string} + * @memberof V1RPQueueStat + */ + resourcePool: string; + /** + * Aggregate stats. + * @type {Array} + * @memberof V1RPQueueStat + */ + aggregates?: Array; } /** * Message for results of individual runs in a multi-run action. @@ -9856,18 +9905,18 @@ export interface V1RPQueueStat { * @interface V1RunActionResult */ export interface V1RunActionResult { - /** - * Optional error message. - * @type {string} - * @memberof V1RunActionResult - */ - error: string; - /** - * run ID. - * @type {number} - * @memberof V1RunActionResult - */ - id: number; + /** + * Optional error message. + * @type {string} + * @memberof V1RunActionResult + */ + error: string; + /** + * run ID. + * @type {number} + * @memberof V1RunActionResult + */ + id: number; } /** * RunnableOperation represents a single runnable operation emitted by a searcher. @@ -9875,18 +9924,18 @@ export interface V1RunActionResult { * @interface V1RunnableOperation */ export interface V1RunnableOperation { - /** - * This is the type of the operation. - * @type {V1RunnableType} - * @memberof V1RunnableOperation - */ - type?: V1RunnableType; - /** - * If the type == WORKLOAD_KIND_TRAIN, this is the number of units - * @type {string} - * @memberof V1RunnableOperation - */ - length?: string; + /** + * This is the type of the operation. + * @type {V1RunnableType} + * @memberof V1RunnableOperation + */ + type?: V1RunnableType; + /** + * If the type == WORKLOAD_KIND_TRAIN, this is the number of units + * @type {string} + * @memberof V1RunnableOperation + */ + length?: string; } /** * RunnableType defines the type of operation that should be executed by trial runners. - RUNNABLE_TYPE_UNSPECIFIED: Denotes an unknown runnable type. - RUNNABLE_TYPE_TRAIN: Signals to a trial runner that it should run a train. - RUNNABLE_TYPE_VALIDATE: Signals to a trial runner it should compute validation metrics. @@ -9894,29 +9943,29 @@ export interface V1RunnableOperation { * @enum {string} */ export const V1RunnableType = { - UNSPECIFIED: 'RUNNABLE_TYPE_UNSPECIFIED', - TRAIN: 'RUNNABLE_TYPE_TRAIN', - VALIDATE: 'RUNNABLE_TYPE_VALIDATE', -} as const; -export type V1RunnableType = ValueOf; + UNSPECIFIED: 'RUNNABLE_TYPE_UNSPECIFIED', + TRAIN: 'RUNNABLE_TYPE_TRAIN', + VALIDATE: 'RUNNABLE_TYPE_VALIDATE', +} as const +export type V1RunnableType = ValueOf /** * Request to prepare to start reporting to a run. * @export * @interface V1RunPrepareForReportingRequest */ export interface V1RunPrepareForReportingRequest { - /** - * RunID to sync to. - * @type {number} - * @memberof V1RunPrepareForReportingRequest - */ - runId: number; - /** - * Checkpoint storage config. - * @type {any} - * @memberof V1RunPrepareForReportingRequest - */ - checkpointStorage?: any; + /** + * RunID to sync to. + * @type {number} + * @memberof V1RunPrepareForReportingRequest + */ + runId: number; + /** + * Checkpoint storage config. + * @type {any} + * @memberof V1RunPrepareForReportingRequest + */ + checkpointStorage?: any; } /** * Response to prepare to start reporting to a run. @@ -9924,12 +9973,12 @@ export interface V1RunPrepareForReportingRequest { * @interface V1RunPrepareForReportingResponse */ export interface V1RunPrepareForReportingResponse { - /** - * The storage_id to be used when creating new checkpoints. This will be returned always when checkpoint storage is set in the request. - * @type {number} - * @memberof V1RunPrepareForReportingResponse - */ - storageId?: number; + /** + * The storage_id to be used when creating new checkpoints. This will be returned always when checkpoint storage is set in the request. + * @type {number} + * @memberof V1RunPrepareForReportingResponse + */ + storageId?: number; } /** * The type of the Scheduler. - SCHEDULER_TYPE_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - SCHEDULER_TYPE_PRIORITY: The priority scheduler. - SCHEDULER_TYPE_FAIR_SHARE: The fair share scheduler. - SCHEDULER_TYPE_ROUND_ROBIN: The round robin scheduler - SCHEDULER_TYPE_KUBERNETES: The kubernetes scheduler. - SCHEDULER_TYPE_SLURM: A slurm placeholder. When running on slurm, all scheduling behavior is delegated. - SCHEDULER_TYPE_PBS: A PBS placeholder. When running on PBS, all scheduling behavior is delegated. @@ -9937,33 +9986,33 @@ export interface V1RunPrepareForReportingResponse { * @enum {string} */ export const V1SchedulerType = { - UNSPECIFIED: 'SCHEDULER_TYPE_UNSPECIFIED', - PRIORITY: 'SCHEDULER_TYPE_PRIORITY', - FAIRSHARE: 'SCHEDULER_TYPE_FAIR_SHARE', - ROUNDROBIN: 'SCHEDULER_TYPE_ROUND_ROBIN', - KUBERNETES: 'SCHEDULER_TYPE_KUBERNETES', - SLURM: 'SCHEDULER_TYPE_SLURM', - PBS: 'SCHEDULER_TYPE_PBS', -} as const; -export type V1SchedulerType = ValueOf; -/** - * + UNSPECIFIED: 'SCHEDULER_TYPE_UNSPECIFIED', + PRIORITY: 'SCHEDULER_TYPE_PRIORITY', + FAIRSHARE: 'SCHEDULER_TYPE_FAIR_SHARE', + ROUNDROBIN: 'SCHEDULER_TYPE_ROUND_ROBIN', + KUBERNETES: 'SCHEDULER_TYPE_KUBERNETES', + SLURM: 'SCHEDULER_TYPE_SLURM', + PBS: 'SCHEDULER_TYPE_PBS', +} as const +export type V1SchedulerType = ValueOf +/** + * * @export * @interface V1ScopeTypeMask */ export interface V1ScopeTypeMask { - /** - * Whether this permission or role can be assigned globally, i.e. cluster-wide. Currently, all permissions can be assigned globally, so this is always true. - * @type {boolean} - * @memberof V1ScopeTypeMask - */ - cluster?: boolean; - /** - * Whether this permission or role can be assigned on a particular workspace. For example, `ADMINISTRATE_USER` permission will have this field set to false, since user creation can only be done at a cluster level, and it doesn't make sense for a single workspace. - * @type {boolean} - * @memberof V1ScopeTypeMask - */ - workspace?: boolean; + /** + * Whether this permission or role can be assigned globally, i.e. cluster-wide. Currently, all permissions can be assigned globally, so this is always true. + * @type {boolean} + * @memberof V1ScopeTypeMask + */ + cluster?: boolean; + /** + * Whether this permission or role can be assigned on a particular workspace. For example, `ADMINISTRATE_USER` permission will have this field set to false, since user creation can only be done at a cluster level, and it doesn't make sense for a single workspace. + * @type {boolean} + * @memberof V1ScopeTypeMask + */ + workspace?: boolean; } /** * SearcherEvent is a message from master to a client-driven custom searcher informing it of relevant changes in the state of an experiment. @@ -9971,54 +10020,54 @@ export interface V1ScopeTypeMask { * @interface V1SearcherEvent */ export interface V1SearcherEvent { - /** - * Incremental ID of the event. - * @type {number} - * @memberof V1SearcherEvent - */ - id: number; - /** - * An experiment has just been created. - * @type {V1InitialOperations} - * @memberof V1SearcherEvent - */ - initialOperations?: V1InitialOperations; - /** - * A trial has been created. - * @type {V1TrialCreated} - * @memberof V1SearcherEvent - */ - trialCreated?: V1TrialCreated; - /** - * Validation has completed. - * @type {V1ValidationCompleted} - * @memberof V1SearcherEvent - */ - validationCompleted?: V1ValidationCompleted; - /** - * Trial has finished. - * @type {V1TrialClosed} - * @memberof V1SearcherEvent - */ - trialClosed?: V1TrialClosed; - /** - * Trial exited early. - * @type {V1TrialExitedEarly} - * @memberof V1SearcherEvent - */ - trialExitedEarly?: V1TrialExitedEarly; - /** - * Trial progress. - * @type {V1TrialProgress} - * @memberof V1SearcherEvent - */ - trialProgress?: V1TrialProgress; - /** - * Experiment is inactive. - * @type {V1ExperimentInactive} - * @memberof V1SearcherEvent - */ - experimentInactive?: V1ExperimentInactive; + /** + * Incremental ID of the event. + * @type {number} + * @memberof V1SearcherEvent + */ + id: number; + /** + * An experiment has just been created. + * @type {V1InitialOperations} + * @memberof V1SearcherEvent + */ + initialOperations?: V1InitialOperations; + /** + * A trial has been created. + * @type {V1TrialCreated} + * @memberof V1SearcherEvent + */ + trialCreated?: V1TrialCreated; + /** + * Validation has completed. + * @type {V1ValidationCompleted} + * @memberof V1SearcherEvent + */ + validationCompleted?: V1ValidationCompleted; + /** + * Trial has finished. + * @type {V1TrialClosed} + * @memberof V1SearcherEvent + */ + trialClosed?: V1TrialClosed; + /** + * Trial exited early. + * @type {V1TrialExitedEarly} + * @memberof V1SearcherEvent + */ + trialExitedEarly?: V1TrialExitedEarly; + /** + * Trial progress. + * @type {V1TrialProgress} + * @memberof V1SearcherEvent + */ + trialProgress?: V1TrialProgress; + /** + * Experiment is inactive. + * @type {V1ExperimentInactive} + * @memberof V1SearcherEvent + */ + experimentInactive?: V1ExperimentInactive; } /** * SearcherOperation is an operation issued by the custom searcher. @@ -10026,118 +10075,155 @@ export interface V1SearcherEvent { * @interface V1SearcherOperation */ export interface V1SearcherOperation { - /** - * TrialOperation is issued to tell an existing trial to do something. - * @type {V1TrialOperation} - * @memberof V1SearcherOperation - */ - trialOperation?: V1TrialOperation; - /** - * CreateTrialOperation is issued to create a trial. - * @type {V1CreateTrialOperation} - * @memberof V1SearcherOperation - */ - createTrial?: V1CreateTrialOperation; - /** - * CloseTrialOperation is issued to close a trial. - * @type {V1CloseTrialOperation} - * @memberof V1SearcherOperation - */ - closeTrial?: V1CloseTrialOperation; - /** - * ShutDownOperation is issued to shut down the custom search method. - * @type {V1ShutDownOperation} - * @memberof V1SearcherOperation - */ - shutDown?: V1ShutDownOperation; - /** - * SetSearcherProgressOperation is issued to set the progress of the custom search method. - * @type {V1SetSearcherProgressOperation} - * @memberof V1SearcherOperation - */ - setSearcherProgress?: V1SetSearcherProgressOperation; + /** + * TrialOperation is issued to tell an existing trial to do something. + * @type {V1TrialOperation} + * @memberof V1SearcherOperation + */ + trialOperation?: V1TrialOperation; + /** + * CreateTrialOperation is issued to create a trial. + * @type {V1CreateTrialOperation} + * @memberof V1SearcherOperation + */ + createTrial?: V1CreateTrialOperation; + /** + * CloseTrialOperation is issued to close a trial. + * @type {V1CloseTrialOperation} + * @memberof V1SearcherOperation + */ + closeTrial?: V1CloseTrialOperation; + /** + * ShutDownOperation is issued to shut down the custom search method. + * @type {V1ShutDownOperation} + * @memberof V1SearcherOperation + */ + shutDown?: V1ShutDownOperation; + /** + * SetSearcherProgressOperation is issued to set the progress of the custom search method. + * @type {V1SetSearcherProgressOperation} + * @memberof V1SearcherOperation + */ + setSearcherProgress?: V1SetSearcherProgressOperation; } /** - * + * * @export * @interface V1SearchExperimentExperiment */ export interface V1SearchExperimentExperiment { - /** - * The experiment in question - * @type {V1Experiment} - * @memberof V1SearchExperimentExperiment - */ - experiment: V1Experiment; - /** - * The best performing trial associated with the experiment - * @type {Trialv1Trial} - * @memberof V1SearchExperimentExperiment - */ - bestTrial?: Trialv1Trial; + /** + * The experiment in question + * @type {V1Experiment} + * @memberof V1SearchExperimentExperiment + */ + experiment: V1Experiment; + /** + * The best performing trial associated with the experiment + * @type {Trialv1Trial} + * @memberof V1SearchExperimentExperiment + */ + bestTrial?: Trialv1Trial; } /** - * + * * @export * @interface V1SearchExperimentsResponse */ export interface V1SearchExperimentsResponse { - /** - * The list of returned experiments. - * @type {Array} - * @memberof V1SearchExperimentsResponse - */ - experiments: Array; - /** - * Pagination information of the full dataset - * @type {V1Pagination} - * @memberof V1SearchExperimentsResponse - */ - pagination: V1Pagination; + /** + * The list of returned experiments. + * @type {Array} + * @memberof V1SearchExperimentsResponse + */ + experiments: Array; + /** + * Pagination information of the full dataset + * @type {V1Pagination} + * @memberof V1SearchExperimentsResponse + */ + pagination: V1Pagination; } /** - * + * * @export * @interface V1SearchRolesAssignableToScopeRequest */ export interface V1SearchRolesAssignableToScopeRequest { - /** - * The maximum number of results to return - * @type {number} - * @memberof V1SearchRolesAssignableToScopeRequest - */ - limit: number; - /** - * The offset to use with pagination - * @type {number} - * @memberof V1SearchRolesAssignableToScopeRequest - */ - offset?: number; - /** - * The id of the workspace to use if searching for a workspace-assignable role - * @type {number} - * @memberof V1SearchRolesAssignableToScopeRequest - */ - workspaceId?: number; + /** + * The maximum number of results to return + * @type {number} + * @memberof V1SearchRolesAssignableToScopeRequest + */ + limit: number; + /** + * The offset to use with pagination + * @type {number} + * @memberof V1SearchRolesAssignableToScopeRequest + */ + offset?: number; + /** + * The id of the workspace to use if searching for a workspace-assignable role + * @type {number} + * @memberof V1SearchRolesAssignableToScopeRequest + */ + workspaceId?: number; } /** - * + * * @export * @interface V1SearchRolesAssignableToScopeResponse */ export interface V1SearchRolesAssignableToScopeResponse { - /** - * pagination information. - * @type {V1Pagination} - * @memberof V1SearchRolesAssignableToScopeResponse - */ - pagination?: V1Pagination; - /** - * the set of roles and all assignments belonging to it. - * @type {Array} - * @memberof V1SearchRolesAssignableToScopeResponse - */ - roles?: Array; + /** + * pagination information. + * @type {V1Pagination} + * @memberof V1SearchRolesAssignableToScopeResponse + */ + pagination?: V1Pagination; + /** + * the set of roles and all assignments belonging to it. + * @type {Array} + * @memberof V1SearchRolesAssignableToScopeResponse + */ + roles?: Array; +} +/** + * Get a list of runs. + * @export + * @interface V1SearchRunsRequest + */ +export interface V1SearchRunsRequest { + /** + * ID of the project to look at + * @type {number} + * @memberof V1SearchRunsRequest + */ + projectId?: number; + /** + * How many experiments to skip before including in the results + * @type {number} + * @memberof V1SearchRunsRequest + */ + offset?: number; + /** + * How many results to show + * @type {number} + * @memberof V1SearchRunsRequest + */ + limit?: number; + /** + * Sort parameters in the format =(asc|desc),=(asc|desc) + * @type {string} + * @memberof V1SearchRunsRequest + */ + sort?: string; + /** + * Filter expression + * @type {string} + * @memberof V1SearchRunsRequest + */ + filter?: string; } /** * Response to SearchRunsResponse. @@ -10145,18 +10231,18 @@ export interface V1SearchRolesAssignableToScopeResponse { * @interface V1SearchRunsResponse */ export interface V1SearchRunsResponse { - /** - * The list of returned runs. - * @type {Array} - * @memberof V1SearchRunsResponse - */ - runs: Array; - /** - * Pagination information of the full dataset. - * @type {V1Pagination} - * @memberof V1SearchRunsResponse - */ - pagination: V1Pagination; + /** + * The list of returned runs. + * @type {Array} + * @memberof V1SearchRunsResponse + */ + runs: Array; + /** + * Pagination information of the full dataset. + * @type {V1Pagination} + * @memberof V1SearchRunsResponse + */ + pagination: V1Pagination; } /** * Set the cluster-wide message. @@ -10164,55 +10250,56 @@ export interface V1SearchRunsResponse { * @interface V1SetClusterMessageRequest */ export interface V1SetClusterMessageRequest { - /** - * Text content of message. - * @type {string} - * @memberof V1SetClusterMessageRequest - */ - message: string; - /** - * Time to begin showing message. - * @type {Date | DateString} - * @memberof V1SetClusterMessageRequest - */ - startTime: Date | DateString; - /** - * Time to stop showing message. - * @type {Date | DateString} - * @memberof V1SetClusterMessageRequest - */ - endTime?: Date | DateString; - /** - * Duration expressing how long the message should last. Should be a Go-format duration (e.g. 24h, 2w, 5d) - * @type {string} - * @memberof V1SetClusterMessageRequest - */ - duration?: string; + /** + * Text content of message. + * @type {string} + * @memberof V1SetClusterMessageRequest + */ + message: string; + /** + * Time to begin showing message. + * @type {Date | DateString} + * @memberof V1SetClusterMessageRequest + */ + startTime: Date | DateString; + /** + * Time to stop showing message. + * @type {Date | DateString} + * @memberof V1SetClusterMessageRequest + */ + endTime?: Date | DateString; + /** + * Duration expressing how long the message should last. Should be a Go-format duration (e.g. 24h, 2w, 5d) + * @type {string} + * @memberof V1SetClusterMessageRequest + */ + duration?: string; } /** * Response to SetClusterMessageRequest. * @export * @interface V1SetClusterMessageResponse */ -export interface V1SetClusterMessageResponse {} +export interface V1SetClusterMessageResponse { +} /** * Set the priority of the requested command. * @export * @interface V1SetCommandPriorityRequest */ export interface V1SetCommandPriorityRequest { - /** - * The id of the command. - * @type {string} - * @memberof V1SetCommandPriorityRequest - */ - commandId?: string; - /** - * The new priority. - * @type {number} - * @memberof V1SetCommandPriorityRequest - */ - priority?: number; + /** + * The id of the command. + * @type {string} + * @memberof V1SetCommandPriorityRequest + */ + commandId?: string; + /** + * The new priority. + * @type {number} + * @memberof V1SetCommandPriorityRequest + */ + priority?: number; } /** * Response to SetCommandPriorityRequest. @@ -10220,12 +10307,12 @@ export interface V1SetCommandPriorityRequest { * @interface V1SetCommandPriorityResponse */ export interface V1SetCommandPriorityResponse { - /** - * The requested command. - * @type {V1Command} - * @memberof V1SetCommandPriorityResponse - */ - command?: V1Command; + /** + * The requested command. + * @type {V1Command} + * @memberof V1SetCommandPriorityResponse + */ + command?: V1Command; } /** * Set the priority of the requested notebook. @@ -10233,18 +10320,18 @@ export interface V1SetCommandPriorityResponse { * @interface V1SetNotebookPriorityRequest */ export interface V1SetNotebookPriorityRequest { - /** - * The id of the notebook. - * @type {string} - * @memberof V1SetNotebookPriorityRequest - */ - notebookId?: string; - /** - * The new priority. - * @type {number} - * @memberof V1SetNotebookPriorityRequest - */ - priority?: number; + /** + * The id of the notebook. + * @type {string} + * @memberof V1SetNotebookPriorityRequest + */ + notebookId?: string; + /** + * The new priority. + * @type {number} + * @memberof V1SetNotebookPriorityRequest + */ + priority?: number; } /** * Response to SetNotebookPriorityRequest. @@ -10252,12 +10339,12 @@ export interface V1SetNotebookPriorityRequest { * @interface V1SetNotebookPriorityResponse */ export interface V1SetNotebookPriorityResponse { - /** - * The requested notebook. - * @type {V1Notebook} - * @memberof V1SetNotebookPriorityResponse - */ - notebook?: V1Notebook; + /** + * The requested notebook. + * @type {V1Notebook} + * @memberof V1SetNotebookPriorityResponse + */ + notebook?: V1Notebook; } /** * SetSearcherProgressOperation informs the master of the progress of the custom searcher. @@ -10265,12 +10352,12 @@ export interface V1SetNotebookPriorityResponse { * @interface V1SetSearcherProgressOperation */ export interface V1SetSearcherProgressOperation { - /** - * Experiment progress as a float between 0.0 and 1.0. - * @type {number} - * @memberof V1SetSearcherProgressOperation - */ - progress?: number; + /** + * Experiment progress as a float between 0.0 and 1.0. + * @type {number} + * @memberof V1SetSearcherProgressOperation + */ + progress?: number; } /** * Set the priority of the requested shell. @@ -10278,18 +10365,18 @@ export interface V1SetSearcherProgressOperation { * @interface V1SetShellPriorityRequest */ export interface V1SetShellPriorityRequest { - /** - * The id of the shell. - * @type {string} - * @memberof V1SetShellPriorityRequest - */ - shellId?: string; - /** - * The new priority. - * @type {number} - * @memberof V1SetShellPriorityRequest - */ - priority?: number; + /** + * The id of the shell. + * @type {string} + * @memberof V1SetShellPriorityRequest + */ + shellId?: string; + /** + * The new priority. + * @type {number} + * @memberof V1SetShellPriorityRequest + */ + priority?: number; } /** * Response to SetShellPriorityRequest. @@ -10297,12 +10384,12 @@ export interface V1SetShellPriorityRequest { * @interface V1SetShellPriorityResponse */ export interface V1SetShellPriorityResponse { - /** - * The requested shell. - * @type {V1Shell} - * @memberof V1SetShellPriorityResponse - */ - shell?: V1Shell; + /** + * The requested shell. + * @type {V1Shell} + * @memberof V1SetShellPriorityResponse + */ + shell?: V1Shell; } /** * Set the priority of the requested TensorBoard. @@ -10310,18 +10397,18 @@ export interface V1SetShellPriorityResponse { * @interface V1SetTensorboardPriorityRequest */ export interface V1SetTensorboardPriorityRequest { - /** - * The id of the TensorBoard. - * @type {string} - * @memberof V1SetTensorboardPriorityRequest - */ - tensorboardId?: string; - /** - * The new priority. - * @type {number} - * @memberof V1SetTensorboardPriorityRequest - */ - priority?: number; + /** + * The id of the TensorBoard. + * @type {string} + * @memberof V1SetTensorboardPriorityRequest + */ + tensorboardId?: string; + /** + * The new priority. + * @type {number} + * @memberof V1SetTensorboardPriorityRequest + */ + priority?: number; } /** * Response to SetTensorboardPriorityRequest. @@ -10329,12 +10416,12 @@ export interface V1SetTensorboardPriorityRequest { * @interface V1SetTensorboardPriorityResponse */ export interface V1SetTensorboardPriorityResponse { - /** - * The requested Tensorboard. - * @type {V1Tensorboard} - * @memberof V1SetTensorboardPriorityResponse - */ - tensorboard?: V1Tensorboard; + /** + * The requested Tensorboard. + * @type {V1Tensorboard} + * @memberof V1SetTensorboardPriorityResponse + */ + tensorboard?: V1Tensorboard; } /** * Response to SetUserPasswordRequest. @@ -10342,12 +10429,12 @@ export interface V1SetTensorboardPriorityResponse { * @interface V1SetUserPasswordResponse */ export interface V1SetUserPasswordResponse { - /** - * The updated user. - * @type {V1User} - * @memberof V1SetUserPasswordResponse - */ - user?: V1User; + /** + * The updated user. + * @type {V1User} + * @memberof V1SetUserPasswordResponse + */ + user?: V1User; } /** * Shell is an ssh server in a containerized environment. @@ -10355,102 +10442,102 @@ export interface V1SetUserPasswordResponse { * @interface V1Shell */ export interface V1Shell { - /** - * The id of the shell. - * @type {string} - * @memberof V1Shell - */ - id: string; - /** - * The description of the shell. - * @type {string} - * @memberof V1Shell - */ - description: string; - /** - * The state of the shell. - * @type {Taskv1State} - * @memberof V1Shell - */ - state: Taskv1State; - /** - * The time the shell was started. - * @type {Date | DateString} - * @memberof V1Shell - */ - startTime: Date | DateString; - /** - * The container running the shell. - * @type {V1Container} - * @memberof V1Shell - */ - container?: V1Container; - /** - * The private key for this shell. - * @type {string} - * @memberof V1Shell - */ - privateKey?: string; - /** - * The public key for this shell. - * @type {string} - * @memberof V1Shell - */ - publicKey?: string; - /** - * The display name of the user that created the shell. - * @type {string} - * @memberof V1Shell - */ - displayName?: string; - /** - * The id of the user that created the shell. - * @type {number} - * @memberof V1Shell - */ - userId?: number; - /** - * The username of the user that created the shell. - * @type {string} - * @memberof V1Shell - */ - username: string; - /** - * The name of the resource pool the Shell was created in - * @type {string} - * @memberof V1Shell - */ - resourcePool: string; - /** - * The exit status; - * @type {string} - * @memberof V1Shell - */ - exitStatus?: string; - /** - * The addresses; - * @type {Array} - * @memberof V1Shell - */ - addresses?: Array; - /** - * The agent user group; - * @type {any} - * @memberof V1Shell - */ - agentUserGroup?: any; - /** - * The associated job id. - * @type {string} - * @memberof V1Shell - */ - jobId: string; - /** - * The workspace id. - * @type {number} - * @memberof V1Shell - */ - workspaceId: number; + /** + * The id of the shell. + * @type {string} + * @memberof V1Shell + */ + id: string; + /** + * The description of the shell. + * @type {string} + * @memberof V1Shell + */ + description: string; + /** + * The state of the shell. + * @type {Taskv1State} + * @memberof V1Shell + */ + state: Taskv1State; + /** + * The time the shell was started. + * @type {Date | DateString} + * @memberof V1Shell + */ + startTime: Date | DateString; + /** + * The container running the shell. + * @type {V1Container} + * @memberof V1Shell + */ + container?: V1Container; + /** + * The private key for this shell. + * @type {string} + * @memberof V1Shell + */ + privateKey?: string; + /** + * The public key for this shell. + * @type {string} + * @memberof V1Shell + */ + publicKey?: string; + /** + * The display name of the user that created the shell. + * @type {string} + * @memberof V1Shell + */ + displayName?: string; + /** + * The id of the user that created the shell. + * @type {number} + * @memberof V1Shell + */ + userId?: number; + /** + * The username of the user that created the shell. + * @type {string} + * @memberof V1Shell + */ + username: string; + /** + * The name of the resource pool the Shell was created in + * @type {string} + * @memberof V1Shell + */ + resourcePool: string; + /** + * The exit status; + * @type {string} + * @memberof V1Shell + */ + exitStatus?: string; + /** + * The addresses; + * @type {Array} + * @memberof V1Shell + */ + addresses?: Array; + /** + * The agent user group; + * @type {any} + * @memberof V1Shell + */ + agentUserGroup?: any; + /** + * The associated job id. + * @type {string} + * @memberof V1Shell + */ + jobId: string; + /** + * The workspace id. + * @type {number} + * @memberof V1Shell + */ + workspaceId: number; } /** * Shut down custom searcher method. @@ -10458,18 +10545,18 @@ export interface V1Shell { * @interface V1ShutDownOperation */ export interface V1ShutDownOperation { - /** - * Defines whether the Searcher was cancelled - * @type {boolean} - * @memberof V1ShutDownOperation - */ - cancel?: boolean; - /** - * Defines whether the Searcher failed - * @type {boolean} - * @memberof V1ShutDownOperation - */ - failure?: boolean; + /** + * Defines whether the Searcher was cancelled + * @type {boolean} + * @memberof V1ShutDownOperation + */ + cancel?: boolean; + /** + * Defines whether the Searcher failed + * @type {boolean} + * @memberof V1ShutDownOperation + */ + failure?: boolean; } /** * Slot wraps a single device on the agent. @@ -10477,36 +10564,36 @@ export interface V1ShutDownOperation { * @interface V1Slot */ export interface V1Slot { - /** - * The unqiue id of the slot for a given agent. - * @type {string} - * @memberof V1Slot - */ - id?: string; - /** - * The individual resource this slot wraps. - * @type {V1Device} - * @memberof V1Slot - */ - device?: V1Device; - /** - * Flag notifying if containers can be scheduled on this slot. - * @type {boolean} - * @memberof V1Slot - */ - enabled?: boolean; - /** - * Container that is currently running on this agent. It is unset if there is no container currently running on this slot. - * @type {V1Container} - * @memberof V1Slot - */ - container?: V1Container; - /** - * Flag notifying if this slot is in the draining mode: current containers will be allowed to finish but no new ones will be scheduled. - * @type {boolean} - * @memberof V1Slot - */ - draining?: boolean; + /** + * The unqiue id of the slot for a given agent. + * @type {string} + * @memberof V1Slot + */ + id?: string; + /** + * The individual resource this slot wraps. + * @type {V1Device} + * @memberof V1Slot + */ + device?: V1Device; + /** + * Flag notifying if containers can be scheduled on this slot. + * @type {boolean} + * @memberof V1Slot + */ + enabled?: boolean; + /** + * Container that is currently running on this agent. It is unset if there is no container currently running on this slot. + * @type {V1Container} + * @memberof V1Slot + */ + container?: V1Container; + /** + * Flag notifying if this slot is in the draining mode: current containers will be allowed to finish but no new ones will be scheduled. + * @type {boolean} + * @memberof V1Slot + */ + draining?: boolean; } /** * SlotStats contains statistics about a set of slots. @@ -10514,18 +10601,18 @@ export interface V1Slot { * @interface V1SlotStats */ export interface V1SlotStats { - /** - * Map of device type to device stats. - * @type {{ [key: string]: V1DeviceStats; }} - * @memberof V1SlotStats - */ - typeStats: { [key: string]: V1DeviceStats }; - /** - * Map of device brands to device stats. - * @type {{ [key: string]: V1DeviceStats; }} - * @memberof V1SlotStats - */ - brandStats: { [key: string]: V1DeviceStats }; + /** + * Map of device type to device stats. + * @type {{ [key: string]: V1DeviceStats; }} + * @memberof V1SlotStats + */ + typeStats: { [key: string]: V1DeviceStats; }; + /** + * Map of device brands to device stats. + * @type {{ [key: string]: V1DeviceStats; }} + * @memberof V1SlotStats + */ + brandStats: { [key: string]: V1DeviceStats; }; } /** * Describe one SSO provider. @@ -10533,24 +10620,24 @@ export interface V1SlotStats { * @interface V1SSOProvider */ export interface V1SSOProvider { - /** - * A descriptive name for this provider. - * @type {string} - * @memberof V1SSOProvider - */ - name: string; - /** - * The URL to use for SSO with this provider. - * @type {string} - * @memberof V1SSOProvider - */ - ssoUrl: string; - /** - * The type of SSO (such as SAML, OIDC). - * @type {string} - * @memberof V1SSOProvider - */ - type: string; + /** + * A descriptive name for this provider. + * @type {string} + * @memberof V1SSOProvider + */ + name: string; + /** + * The URL to use for SSO with this provider. + * @type {string} + * @memberof V1SSOProvider + */ + ssoUrl: string; + /** + * The type of SSO (such as SAML, OIDC). + * @type {string} + * @memberof V1SSOProvider + */ + type: string; } /** * Start a trial. @@ -10558,18 +10645,18 @@ export interface V1SSOProvider { * @interface V1StartTrialRequest */ export interface V1StartTrialRequest { - /** - * Trial id. - * @type {number} - * @memberof V1StartTrialRequest - */ - trialId: number; - /** - * Whether resume is allowed. - * @type {boolean} - * @memberof V1StartTrialRequest - */ - resume?: boolean; + /** + * Trial id. + * @type {number} + * @memberof V1StartTrialRequest + */ + trialId: number; + /** + * Whether resume is allowed. + * @type {boolean} + * @memberof V1StartTrialRequest + */ + resume?: boolean; } /** * Response to StartTrialRequest. @@ -10577,24 +10664,24 @@ export interface V1StartTrialRequest { * @interface V1StartTrialResponse */ export interface V1StartTrialResponse { - /** - * Trial run id. - * @type {number} - * @memberof V1StartTrialResponse - */ - trialRunId: number; - /** - * Latest checkpoint. - * @type {string} - * @memberof V1StartTrialResponse - */ - latestCheckpoint?: string; - /** - * Steps completed. - * @type {number} - * @memberof V1StartTrialResponse - */ - stepsCompleted: number; + /** + * Trial run id. + * @type {number} + * @memberof V1StartTrialResponse + */ + trialRunId: number; + /** + * Latest checkpoint. + * @type {string} + * @memberof V1StartTrialResponse + */ + latestCheckpoint?: string; + /** + * Steps completed. + * @type {number} + * @memberof V1StartTrialResponse + */ + stepsCompleted: number; } /** * Project Table type. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. @@ -10602,150 +10689,150 @@ export interface V1StartTrialResponse { * @enum {string} */ export const V1TableType = { - UNSPECIFIED: 'TABLE_TYPE_UNSPECIFIED', - EXPERIMENT: 'TABLE_TYPE_EXPERIMENT', - RUN: 'TABLE_TYPE_RUN', -} as const; -export type V1TableType = ValueOf; + UNSPECIFIED: 'TABLE_TYPE_UNSPECIFIED', + EXPERIMENT: 'TABLE_TYPE_EXPERIMENT', + RUN: 'TABLE_TYPE_RUN', +} as const +export type V1TableType = ValueOf /** * Task is the model for a task in the database. * @export * @interface V1Task */ export interface V1Task { - /** - * Unique ID of task. - * @type {string} - * @memberof V1Task - */ - taskId: string; - /** - * Type of Task. - * @type {V1TaskType} - * @memberof V1Task - */ - taskType: V1TaskType; - /** - * List of Allocations. - * @type {Array} - * @memberof V1Task - */ - allocations: Array; - /** - * Start timestamp. - * @type {Date | DateString} - * @memberof V1Task - */ - startTime: Date | DateString; - /** - * End timestamp if completed. - * @type {Date | DateString} - * @memberof V1Task - */ - endTime?: Date | DateString; - /** - * The configuration of the task. - * @type {string} - * @memberof V1Task - */ - config?: string; - /** - * ID of parent task (empty if root task). - * @type {string} - * @memberof V1Task - */ - parentId?: string; - /** - * State of task execution. - * @type {V1GenericTaskState} - * @memberof V1Task - */ - taskState?: V1GenericTaskState; - /** - * ID of task this is forked from (If task is a forked task) - * @type {string} - * @memberof V1Task - */ - forkedFrom?: string; - /** - * Flag for whether task can be paused or not. - * @type {boolean} - * @memberof V1Task - */ - noPause?: boolean; + /** + * Unique ID of task. + * @type {string} + * @memberof V1Task + */ + taskId: string; + /** + * Type of Task. + * @type {V1TaskType} + * @memberof V1Task + */ + taskType: V1TaskType; + /** + * List of Allocations. + * @type {Array} + * @memberof V1Task + */ + allocations: Array; + /** + * Start timestamp. + * @type {Date | DateString} + * @memberof V1Task + */ + startTime: Date | DateString; + /** + * End timestamp if completed. + * @type {Date | DateString} + * @memberof V1Task + */ + endTime?: Date | DateString; + /** + * The configuration of the task. + * @type {string} + * @memberof V1Task + */ + config?: string; + /** + * ID of parent task (empty if root task). + * @type {string} + * @memberof V1Task + */ + parentId?: string; + /** + * State of task execution. + * @type {V1GenericTaskState} + * @memberof V1Task + */ + taskState?: V1GenericTaskState; + /** + * ID of task this is forked from (If task is a forked task) + * @type {string} + * @memberof V1Task + */ + forkedFrom?: string; + /** + * Flag for whether task can be paused or not. + * @type {boolean} + * @memberof V1Task + */ + noPause?: boolean; } /** - * + * * @export * @interface V1TaskLog */ export interface V1TaskLog { - /** - * The ID of the log. - * @type {number} - * @memberof V1TaskLog - */ - id?: number; - /** - * The ID of the task. - * @type {string} - * @memberof V1TaskLog - */ - taskId: string; - /** - * The ID of the allocation. - * @type {string} - * @memberof V1TaskLog - */ - allocationId?: string; - /** - * The agent the logs came from. - * @type {string} - * @memberof V1TaskLog - */ - agentId?: string; - /** - * The ID of the container or, in the case of k8s, the pod name. - * @type {string} - * @memberof V1TaskLog - */ - containerId?: string; - /** - * The rank ID. - * @type {number} - * @memberof V1TaskLog - */ - rankId?: number; - /** - * The timestamp of the log. - * @type {Date | DateString} - * @memberof V1TaskLog - */ - timestamp?: Date | DateString; - /** - * The level of this log. - * @type {V1LogLevel} - * @memberof V1TaskLog - */ - level?: V1LogLevel; - /** - * The text of the log entry. - * @type {string} - * @memberof V1TaskLog - */ - log: string; - /** - * The source of the log entry. - * @type {string} - * @memberof V1TaskLog - */ - source?: string; - /** - * The output stream (e.g. stdout, stderr). - * @type {string} - * @memberof V1TaskLog - */ - stdtype?: string; + /** + * The ID of the log. + * @type {number} + * @memberof V1TaskLog + */ + id?: number; + /** + * The ID of the task. + * @type {string} + * @memberof V1TaskLog + */ + taskId: string; + /** + * The ID of the allocation. + * @type {string} + * @memberof V1TaskLog + */ + allocationId?: string; + /** + * The agent the logs came from. + * @type {string} + * @memberof V1TaskLog + */ + agentId?: string; + /** + * The ID of the container or, in the case of k8s, the pod name. + * @type {string} + * @memberof V1TaskLog + */ + containerId?: string; + /** + * The rank ID. + * @type {number} + * @memberof V1TaskLog + */ + rankId?: number; + /** + * The timestamp of the log. + * @type {Date | DateString} + * @memberof V1TaskLog + */ + timestamp?: Date | DateString; + /** + * The level of this log. + * @type {V1LogLevel} + * @memberof V1TaskLog + */ + level?: V1LogLevel; + /** + * The text of the log entry. + * @type {string} + * @memberof V1TaskLog + */ + log: string; + /** + * The source of the log entry. + * @type {string} + * @memberof V1TaskLog + */ + source?: string; + /** + * The output stream (e.g. stdout, stderr). + * @type {string} + * @memberof V1TaskLog + */ + stdtype?: string; } /** * Response to TaskLogsFieldsRequest. @@ -10753,42 +10840,42 @@ export interface V1TaskLog { * @interface V1TaskLogsFieldsResponse */ export interface V1TaskLogsFieldsResponse { - /** - * The distint allocation IDs present in the logs. - * @type {Array} - * @memberof V1TaskLogsFieldsResponse - */ - allocationIds?: Array; - /** - * The distinct agent IDs present in the logs. - * @type {Array} - * @memberof V1TaskLogsFieldsResponse - */ - agentIds?: Array; - /** - * The distinct container IDs present in the logs. - * @type {Array} - * @memberof V1TaskLogsFieldsResponse - */ - containerIds?: Array; - /** - * The distinct rank IDs present in the logs. - * @type {Array} - * @memberof V1TaskLogsFieldsResponse - */ - rankIds?: Array; - /** - * The distinct stdtypes present in the logs. - * @type {Array} - * @memberof V1TaskLogsFieldsResponse - */ - stdtypes?: Array; - /** - * The distinct sources present in the logs. - * @type {Array} - * @memberof V1TaskLogsFieldsResponse - */ - sources?: Array; + /** + * The distint allocation IDs present in the logs. + * @type {Array} + * @memberof V1TaskLogsFieldsResponse + */ + allocationIds?: Array; + /** + * The distinct agent IDs present in the logs. + * @type {Array} + * @memberof V1TaskLogsFieldsResponse + */ + agentIds?: Array; + /** + * The distinct container IDs present in the logs. + * @type {Array} + * @memberof V1TaskLogsFieldsResponse + */ + containerIds?: Array; + /** + * The distinct rank IDs present in the logs. + * @type {Array} + * @memberof V1TaskLogsFieldsResponse + */ + rankIds?: Array; + /** + * The distinct stdtypes present in the logs. + * @type {Array} + * @memberof V1TaskLogsFieldsResponse + */ + stdtypes?: Array; + /** + * The distinct sources present in the logs. + * @type {Array} + * @memberof V1TaskLogsFieldsResponse + */ + sources?: Array; } /** * Response to TaskLogsRequest. @@ -10796,78 +10883,78 @@ export interface V1TaskLogsFieldsResponse { * @interface V1TaskLogsResponse */ export interface V1TaskLogsResponse { - /** - * The ID of the log. - * @type {string} - * @memberof V1TaskLogsResponse - */ - id: string; - /** - * The timestamp of the log. - * @type {Date | DateString} - * @memberof V1TaskLogsResponse - */ - timestamp: Date | DateString; - /** - * The flat version of the log that UIs have shown historically. - * @type {string} - * @memberof V1TaskLogsResponse - */ - message: string; - /** - * The level of the log. - * @type {V1LogLevel} - * @memberof V1TaskLogsResponse - */ - level: V1LogLevel; - /** - * The ID of the task. - * @type {string} - * @memberof V1TaskLogsResponse - */ - taskId: string; - /** - * The ID of the allocation. - * @type {string} - * @memberof V1TaskLogsResponse - */ - allocationId?: string; - /** - * The agent the logs came from. - * @type {string} - * @memberof V1TaskLogsResponse - */ - agentId?: string; - /** - * The ID of the container or, in the case of k8s, the pod name. - * @type {string} - * @memberof V1TaskLogsResponse - */ - containerId?: string; - /** - * The rank ID. - * @type {number} - * @memberof V1TaskLogsResponse - */ - rankId?: number; - /** - * The text of the log entry. - * @type {string} - * @memberof V1TaskLogsResponse - */ - log: string; - /** - * The source of the log entry. - * @type {string} - * @memberof V1TaskLogsResponse - */ - source?: string; - /** - * The output stream (e.g. stdout, stderr). - * @type {string} - * @memberof V1TaskLogsResponse - */ - stdtype?: string; + /** + * The ID of the log. + * @type {string} + * @memberof V1TaskLogsResponse + */ + id: string; + /** + * The timestamp of the log. + * @type {Date | DateString} + * @memberof V1TaskLogsResponse + */ + timestamp: Date | DateString; + /** + * The flat version of the log that UIs have shown historically. + * @type {string} + * @memberof V1TaskLogsResponse + */ + message: string; + /** + * The level of the log. + * @type {V1LogLevel} + * @memberof V1TaskLogsResponse + */ + level: V1LogLevel; + /** + * The ID of the task. + * @type {string} + * @memberof V1TaskLogsResponse + */ + taskId: string; + /** + * The ID of the allocation. + * @type {string} + * @memberof V1TaskLogsResponse + */ + allocationId?: string; + /** + * The agent the logs came from. + * @type {string} + * @memberof V1TaskLogsResponse + */ + agentId?: string; + /** + * The ID of the container or, in the case of k8s, the pod name. + * @type {string} + * @memberof V1TaskLogsResponse + */ + containerId?: string; + /** + * The rank ID. + * @type {number} + * @memberof V1TaskLogsResponse + */ + rankId?: number; + /** + * The text of the log entry. + * @type {string} + * @memberof V1TaskLogsResponse + */ + log: string; + /** + * The source of the log entry. + * @type {string} + * @memberof V1TaskLogsResponse + */ + source?: string; + /** + * The output stream (e.g. stdout, stderr). + * @type {string} + * @memberof V1TaskLogsResponse + */ + stdtype?: string; } /** * Type of the task - TASK_TYPE_UNSPECIFIED: The task type is unknown - TASK_TYPE_TRIAL: "TRIAL" task type for the enum public.task_type in Postgres. - TASK_TYPE_NOTEBOOK: "NOTEBOOK" task type for the enum public.task_type in Postgres. - TASK_TYPE_SHELL: "SHELL" task type for the enum public.task_type in Postgres. - TASK_TYPE_COMMAND: "COMMAND" task type for the enum public.task_type in Postgres. - TASK_TYPE_TENSORBOARD: "TENSORBOARD" task type for the enum public.task_type in Postgres. - TASK_TYPE_CHECKPOINT_GC: "CHECKPOINT_GC" task type for the enum public.task_type in Postgres. - TASK_TYPE_GENERIC: "GENERIC" task type for the enum public.task_type in Postgres. @@ -10875,40 +10962,40 @@ export interface V1TaskLogsResponse { * @enum {string} */ export const V1TaskType = { - UNSPECIFIED: 'TASK_TYPE_UNSPECIFIED', - TRIAL: 'TASK_TYPE_TRIAL', - NOTEBOOK: 'TASK_TYPE_NOTEBOOK', - SHELL: 'TASK_TYPE_SHELL', - COMMAND: 'TASK_TYPE_COMMAND', - TENSORBOARD: 'TASK_TYPE_TENSORBOARD', - CHECKPOINTGC: 'TASK_TYPE_CHECKPOINT_GC', - GENERIC: 'TASK_TYPE_GENERIC', -} as const; -export type V1TaskType = ValueOf; + UNSPECIFIED: 'TASK_TYPE_UNSPECIFIED', + TRIAL: 'TASK_TYPE_TRIAL', + NOTEBOOK: 'TASK_TYPE_NOTEBOOK', + SHELL: 'TASK_TYPE_SHELL', + COMMAND: 'TASK_TYPE_COMMAND', + TENSORBOARD: 'TASK_TYPE_TENSORBOARD', + CHECKPOINTGC: 'TASK_TYPE_CHECKPOINT_GC', + GENERIC: 'TASK_TYPE_GENERIC', +} as const +export type V1TaskType = ValueOf /** * Templates move settings that are shared by many experiments into a single YAML file. * @export * @interface V1Template */ export interface V1Template { - /** - * The name of the template. - * @type {string} - * @memberof V1Template - */ - name: string; - /** - * The template value. - * @type {any} - * @memberof V1Template - */ - config: any; - /** - * The id of the workspace associated with this model. - * @type {number} - * @memberof V1Template - */ - workspaceId: number; + /** + * The name of the template. + * @type {string} + * @memberof V1Template + */ + name: string; + /** + * The template value. + * @type {any} + * @memberof V1Template + */ + config: any; + /** + * The id of the workspace associated with this model. + * @type {number} + * @memberof V1Template + */ + workspaceId: number; } /** * Tensorboard is a tensorboard instance in a containerized environment. @@ -10916,96 +11003,96 @@ export interface V1Template { * @interface V1Tensorboard */ export interface V1Tensorboard { - /** - * The id of the tensorboard. - * @type {string} - * @memberof V1Tensorboard - */ - id: string; - /** - * The description of the tensorboard. - * @type {string} - * @memberof V1Tensorboard - */ - description: string; - /** - * The state of the tensorboard. - * @type {Taskv1State} - * @memberof V1Tensorboard - */ - state: Taskv1State; - /** - * The time the tensorboard was started. - * @type {Date | DateString} - * @memberof V1Tensorboard - */ - startTime: Date | DateString; - /** - * The container running the tensorboard. - * @type {V1Container} - * @memberof V1Tensorboard - */ - container?: V1Container; - /** - * The experiment ids loaded into this tensorboard instance. - * @type {Array} - * @memberof V1Tensorboard - */ - experimentIds?: Array; - /** - * The trial ids loaded into this tensorboard instance. - * @type {Array} - * @memberof V1Tensorboard - */ - trialIds?: Array; - /** - * The display name of the user that created the tensorboard. - * @type {string} - * @memberof V1Tensorboard - */ - displayName?: string; - /** - * The id of the user that created the tensorboard. - * @type {number} - * @memberof V1Tensorboard - */ - userId?: number; - /** - * The username of the user that created the tensorboard. - * @type {string} - * @memberof V1Tensorboard - */ - username: string; - /** - * The service address. - * @type {string} - * @memberof V1Tensorboard - */ - serviceAddress?: string; - /** - * The name of the resource pool the command was created in - * @type {string} - * @memberof V1Tensorboard - */ - resourcePool: string; - /** - * The exit status; - * @type {string} - * @memberof V1Tensorboard - */ - exitStatus?: string; - /** - * The associated job id. - * @type {string} - * @memberof V1Tensorboard - */ - jobId: string; - /** - * The workspace id. - * @type {number} - * @memberof V1Tensorboard - */ - workspaceId: number; + /** + * The id of the tensorboard. + * @type {string} + * @memberof V1Tensorboard + */ + id: string; + /** + * The description of the tensorboard. + * @type {string} + * @memberof V1Tensorboard + */ + description: string; + /** + * The state of the tensorboard. + * @type {Taskv1State} + * @memberof V1Tensorboard + */ + state: Taskv1State; + /** + * The time the tensorboard was started. + * @type {Date | DateString} + * @memberof V1Tensorboard + */ + startTime: Date | DateString; + /** + * The container running the tensorboard. + * @type {V1Container} + * @memberof V1Tensorboard + */ + container?: V1Container; + /** + * The experiment ids loaded into this tensorboard instance. + * @type {Array} + * @memberof V1Tensorboard + */ + experimentIds?: Array; + /** + * The trial ids loaded into this tensorboard instance. + * @type {Array} + * @memberof V1Tensorboard + */ + trialIds?: Array; + /** + * The display name of the user that created the tensorboard. + * @type {string} + * @memberof V1Tensorboard + */ + displayName?: string; + /** + * The id of the user that created the tensorboard. + * @type {number} + * @memberof V1Tensorboard + */ + userId?: number; + /** + * The username of the user that created the tensorboard. + * @type {string} + * @memberof V1Tensorboard + */ + username: string; + /** + * The service address. + * @type {string} + * @memberof V1Tensorboard + */ + serviceAddress?: string; + /** + * The name of the resource pool the command was created in + * @type {string} + * @memberof V1Tensorboard + */ + resourcePool: string; + /** + * The exit status; + * @type {string} + * @memberof V1Tensorboard + */ + exitStatus?: string; + /** + * The associated job id. + * @type {string} + * @memberof V1Tensorboard + */ + jobId: string; + /** + * The workspace id. + * @type {number} + * @memberof V1Tensorboard + */ + workspaceId: number; } /** * Response to TestWebhookRequest. @@ -11013,12 +11100,12 @@ export interface V1Tensorboard { * @interface V1TestWebhookResponse */ export interface V1TestWebhookResponse { - /** - * Status of test. - * @type {boolean} - * @memberof V1TestWebhookResponse - */ - completed: boolean; + /** + * Status of test. + * @type {boolean} + * @memberof V1TestWebhookResponse + */ + completed: boolean; } /** * Timestamp filters. @@ -11026,30 +11113,30 @@ export interface V1TestWebhookResponse { * @interface V1TimestampFieldFilter */ export interface V1TimestampFieldFilter { - /** - * Less than. - * @type {Date | DateString} - * @memberof V1TimestampFieldFilter - */ - lt?: Date | DateString; - /** - * Less than or equal. - * @type {Date | DateString} - * @memberof V1TimestampFieldFilter - */ - lte?: Date | DateString; - /** - * Greater than. - * @type {Date | DateString} - * @memberof V1TimestampFieldFilter - */ - gt?: Date | DateString; - /** - * Greater than or equal. - * @type {Date | DateString} - * @memberof V1TimestampFieldFilter - */ - gte?: Date | DateString; + /** + * Less than. + * @type {Date | DateString} + * @memberof V1TimestampFieldFilter + */ + lt?: Date | DateString; + /** + * Less than or equal. + * @type {Date | DateString} + * @memberof V1TimestampFieldFilter + */ + lte?: Date | DateString; + /** + * Greater than. + * @type {Date | DateString} + * @memberof V1TimestampFieldFilter + */ + gt?: Date | DateString; + /** + * Greater than or equal. + * @type {Date | DateString} + * @memberof V1TimestampFieldFilter + */ + gte?: Date | DateString; } /** * TrialClosed is a searcher event triggered when a trial has successfully finished. @@ -11057,12 +11144,12 @@ export interface V1TimestampFieldFilter { * @interface V1TrialClosed */ export interface V1TrialClosed { - /** - * UUID identifying the trial to the searcher. - * @type {string} - * @memberof V1TrialClosed - */ - requestId: string; + /** + * UUID identifying the trial to the searcher. + * @type {string} + * @memberof V1TrialClosed + */ + requestId: string; } /** * TrialCreated is a searcher event signaling the creation of a trial. @@ -11070,12 +11157,12 @@ export interface V1TrialClosed { * @interface V1TrialCreated */ export interface V1TrialCreated { - /** - * UUID identifying the trial to the searcher. - * @type {string} - * @memberof V1TrialCreated - */ - requestId: string; + /** + * UUID identifying the trial to the searcher. + * @type {string} + * @memberof V1TrialCreated + */ + requestId: string; } /** * Signals to the experiment the trial early exited. @@ -11083,12 +11170,12 @@ export interface V1TrialCreated { * @interface V1TrialEarlyExit */ export interface V1TrialEarlyExit { - /** - * The reason for the exit. - * @type {V1TrialEarlyExitExitedReason} - * @memberof V1TrialEarlyExit - */ - reason: V1TrialEarlyExitExitedReason; + /** + * The reason for the exit. + * @type {V1TrialEarlyExitExitedReason} + * @memberof V1TrialEarlyExit + */ + reason: V1TrialEarlyExitExitedReason; } /** * The reason for an early exit. - EXITED_REASON_UNSPECIFIED: Zero-value (not allowed). - EXITED_REASON_INVALID_HP: Indicates the trial exited due to an invalid hyperparameter. - EXITED_REASON_INIT_INVALID_HP: Indicates the trial exited due to an invalid hyperparameter in the trial init. @@ -11096,29 +11183,29 @@ export interface V1TrialEarlyExit { * @enum {string} */ export const V1TrialEarlyExitExitedReason = { - UNSPECIFIED: 'EXITED_REASON_UNSPECIFIED', - INVALIDHP: 'EXITED_REASON_INVALID_HP', - INITINVALIDHP: 'EXITED_REASON_INIT_INVALID_HP', -} as const; -export type V1TrialEarlyExitExitedReason = ValueOf; + UNSPECIFIED: 'EXITED_REASON_UNSPECIFIED', + INVALIDHP: 'EXITED_REASON_INVALID_HP', + INITINVALIDHP: 'EXITED_REASON_INIT_INVALID_HP', +} as const +export type V1TrialEarlyExitExitedReason = ValueOf /** * TrialExitedEarly is a searcher event triggered when a trial exited prematurely. * @export * @interface V1TrialExitedEarly */ export interface V1TrialExitedEarly { - /** - * UUID identifying the trial to the searcher. - * @type {string} - * @memberof V1TrialExitedEarly - */ - requestId: string; - /** - * The reason for the exit. - * @type {V1TrialExitedEarlyExitedReason} - * @memberof V1TrialExitedEarly - */ - exitedReason: V1TrialExitedEarlyExitedReason; + /** + * UUID identifying the trial to the searcher. + * @type {string} + * @memberof V1TrialExitedEarly + */ + requestId: string; + /** + * The reason for the exit. + * @type {V1TrialExitedEarlyExitedReason} + * @memberof V1TrialExitedEarly + */ + exitedReason: V1TrialExitedEarlyExitedReason; } /** * The reason for an early exit. - EXITED_REASON_UNSPECIFIED: Zero-value (not allowed). - EXITED_REASON_INVALID_HP: Indicates the trial exited due to an invalid hyperparameter. - EXITED_REASON_USER_REQUESTED_STOP: Indicates the trial exited due to a user requested stop, from code. - EXITED_REASON_USER_CANCELED: Indicates the trial exited due to a user requested stop, from the CLI or UI. @@ -11126,48 +11213,48 @@ export interface V1TrialExitedEarly { * @enum {string} */ export const V1TrialExitedEarlyExitedReason = { - UNSPECIFIED: 'EXITED_REASON_UNSPECIFIED', - INVALIDHP: 'EXITED_REASON_INVALID_HP', - USERREQUESTEDSTOP: 'EXITED_REASON_USER_REQUESTED_STOP', - USERCANCELED: 'EXITED_REASON_USER_CANCELED', -} as const; -export type V1TrialExitedEarlyExitedReason = ValueOf; + UNSPECIFIED: 'EXITED_REASON_UNSPECIFIED', + INVALIDHP: 'EXITED_REASON_INVALID_HP', + USERREQUESTEDSTOP: 'EXITED_REASON_USER_REQUESTED_STOP', + USERCANCELED: 'EXITED_REASON_USER_CANCELED', +} as const +export type V1TrialExitedEarlyExitedReason = ValueOf /** * Response to TrialLogFieldsRequest. * @export * @interface V1TrialLogsFieldsResponse */ export interface V1TrialLogsFieldsResponse { - /** - * The distinct agent IDs present in the logs. - * @type {Array} - * @memberof V1TrialLogsFieldsResponse - */ - agentIds?: Array; - /** - * The distinct container IDs present in the logs. - * @type {Array} - * @memberof V1TrialLogsFieldsResponse - */ - containerIds?: Array; - /** - * The distinct rank IDs present in the logs. - * @type {Array} - * @memberof V1TrialLogsFieldsResponse - */ - rankIds?: Array; - /** - * The distinct stdtypes present in the logs. - * @type {Array} - * @memberof V1TrialLogsFieldsResponse - */ - stdtypes?: Array; - /** - * The distinct sources present in the logs. - * @type {Array} - * @memberof V1TrialLogsFieldsResponse - */ - sources?: Array; + /** + * The distinct agent IDs present in the logs. + * @type {Array} + * @memberof V1TrialLogsFieldsResponse + */ + agentIds?: Array; + /** + * The distinct container IDs present in the logs. + * @type {Array} + * @memberof V1TrialLogsFieldsResponse + */ + containerIds?: Array; + /** + * The distinct rank IDs present in the logs. + * @type {Array} + * @memberof V1TrialLogsFieldsResponse + */ + rankIds?: Array; + /** + * The distinct stdtypes present in the logs. + * @type {Array} + * @memberof V1TrialLogsFieldsResponse + */ + stdtypes?: Array; + /** + * The distinct sources present in the logs. + * @type {Array} + * @memberof V1TrialLogsFieldsResponse + */ + sources?: Array; } /** * Response to TrialLogsRequest. @@ -11175,72 +11262,72 @@ export interface V1TrialLogsFieldsResponse { * @interface V1TrialLogsResponse */ export interface V1TrialLogsResponse { - /** - * The ID of the trial log. - * @type {string} - * @memberof V1TrialLogsResponse - */ - id: string; - /** - * The timestamp of the log. - * @type {Date | DateString} - * @memberof V1TrialLogsResponse - */ - timestamp: Date | DateString; - /** - * The flat version of the log that UIs have shown historically. - * @type {string} - * @memberof V1TrialLogsResponse - */ - message: string; - /** - * The level of the log. - * @type {V1LogLevel} - * @memberof V1TrialLogsResponse - */ - level: V1LogLevel; - /** - * The ID of the trial associated with this log entry. - * @type {number} - * @memberof V1TrialLogsResponse - */ - trialId: number; - /** - * The ID of the agent that logged this. - * @type {string} - * @memberof V1TrialLogsResponse - */ - agentId?: string; - /** - * The ID of the container or, in the case of k8s, the pod name. - * @type {string} - * @memberof V1TrialLogsResponse - */ - containerId?: string; - /** - * The rank ID. - * @type {number} - * @memberof V1TrialLogsResponse - */ - rankId?: number; - /** - * The text of the log entry. - * @type {string} - * @memberof V1TrialLogsResponse - */ - log?: string; - /** - * The source of the log entry. - * @type {string} - * @memberof V1TrialLogsResponse - */ - source?: string; - /** - * The output stream (e.g. stdout, stderr). - * @type {string} - * @memberof V1TrialLogsResponse - */ - stdtype?: string; + /** + * The ID of the trial log. + * @type {string} + * @memberof V1TrialLogsResponse + */ + id: string; + /** + * The timestamp of the log. + * @type {Date | DateString} + * @memberof V1TrialLogsResponse + */ + timestamp: Date | DateString; + /** + * The flat version of the log that UIs have shown historically. + * @type {string} + * @memberof V1TrialLogsResponse + */ + message: string; + /** + * The level of the log. + * @type {V1LogLevel} + * @memberof V1TrialLogsResponse + */ + level: V1LogLevel; + /** + * The ID of the trial associated with this log entry. + * @type {number} + * @memberof V1TrialLogsResponse + */ + trialId: number; + /** + * The ID of the agent that logged this. + * @type {string} + * @memberof V1TrialLogsResponse + */ + agentId?: string; + /** + * The ID of the container or, in the case of k8s, the pod name. + * @type {string} + * @memberof V1TrialLogsResponse + */ + containerId?: string; + /** + * The rank ID. + * @type {number} + * @memberof V1TrialLogsResponse + */ + rankId?: number; + /** + * The text of the log entry. + * @type {string} + * @memberof V1TrialLogsResponse + */ + log?: string; + /** + * The source of the log entry. + * @type {string} + * @memberof V1TrialLogsResponse + */ + source?: string; + /** + * The output stream (e.g. stdout, stderr). + * @type {string} + * @memberof V1TrialLogsResponse + */ + stdtype?: string; } /** * Metrics from the trial some duration of training. @@ -11248,36 +11335,36 @@ export interface V1TrialLogsResponse { * @interface V1TrialMetrics */ export interface V1TrialMetrics { - /** - * The trial associated with these metrics. - * @type {number} - * @memberof V1TrialMetrics - */ - trialId: number; - /** - * The trial run associated with these metrics. - * @type {number} - * @memberof V1TrialMetrics - */ - trialRunId: number; - /** - * The number of batches trained on when these metrics were reported. - * @type {number} - * @memberof V1TrialMetrics - */ - stepsCompleted?: number; - /** - * The client-reported time associated with these metrics. - * @type {Date | DateString} - * @memberof V1TrialMetrics - */ - reportTime?: Date | DateString; - /** - * The metrics for this bit of training, including: - avg_metrics: metrics reduced over the reporting period). - batch_metrics: (optional) per-batch metrics. - * @type {V1Metrics} - * @memberof V1TrialMetrics - */ - metrics: V1Metrics; + /** + * The trial associated with these metrics. + * @type {number} + * @memberof V1TrialMetrics + */ + trialId: number; + /** + * The trial run associated with these metrics. + * @type {number} + * @memberof V1TrialMetrics + */ + trialRunId: number; + /** + * The number of batches trained on when these metrics were reported. + * @type {number} + * @memberof V1TrialMetrics + */ + stepsCompleted?: number; + /** + * The client-reported time associated with these metrics. + * @type {Date | DateString} + * @memberof V1TrialMetrics + */ + reportTime?: Date | DateString; + /** + * The metrics for this bit of training, including: - avg_metrics: metrics reduced over the reporting period). - batch_metrics: (optional) per-batch metrics. + * @type {V1Metrics} + * @memberof V1TrialMetrics + */ + metrics: V1Metrics; } /** * TrialOperation is any operation that a trial can perform while it is active. @@ -11285,49 +11372,49 @@ export interface V1TrialMetrics { * @interface V1TrialOperation */ export interface V1TrialOperation { - /** - * ValidateAfter means a trial is currently training and will later validate. - * @type {V1ValidateAfterOperation} - * @memberof V1TrialOperation - */ - validateAfter?: V1ValidateAfterOperation; + /** + * ValidateAfter means a trial is currently training and will later validate. + * @type {V1ValidateAfterOperation} + * @memberof V1TrialOperation + */ + validateAfter?: V1ValidateAfterOperation; } /** - * + * * @export * @interface V1TrialProfilerMetricLabels */ export interface V1TrialProfilerMetricLabels { - /** - * The ID of the trial. - * @type {number} - * @memberof V1TrialProfilerMetricLabels - */ - trialId: number; - /** - * The name of the metric. - * @type {string} - * @memberof V1TrialProfilerMetricLabels - */ - name: string; - /** - * The agent ID associated with the metric. - * @type {string} - * @memberof V1TrialProfilerMetricLabels - */ - agentId?: string; - /** - * The GPU UUID associated with the metric. - * @type {string} - * @memberof V1TrialProfilerMetricLabels - */ - gpuUuid?: string; - /** - * The type of the metric. - * @type {TrialProfilerMetricLabelsProfilerMetricType} - * @memberof V1TrialProfilerMetricLabels - */ - metricType?: TrialProfilerMetricLabelsProfilerMetricType; + /** + * The ID of the trial. + * @type {number} + * @memberof V1TrialProfilerMetricLabels + */ + trialId: number; + /** + * The name of the metric. + * @type {string} + * @memberof V1TrialProfilerMetricLabels + */ + name: string; + /** + * The agent ID associated with the metric. + * @type {string} + * @memberof V1TrialProfilerMetricLabels + */ + agentId?: string; + /** + * The GPU UUID associated with the metric. + * @type {string} + * @memberof V1TrialProfilerMetricLabels + */ + gpuUuid?: string; + /** + * The type of the metric. + * @type {TrialProfilerMetricLabelsProfilerMetricType} + * @memberof V1TrialProfilerMetricLabels + */ + metricType?: TrialProfilerMetricLabelsProfilerMetricType; } /** * TrialProfilerMetricsBatch is a batch of trial profiler metrics. A batch will contain metrics pertaining to a single series. The fields values, batches and timestamps will be equal length arrays with each index corresponding to a reading. @@ -11335,30 +11422,30 @@ export interface V1TrialProfilerMetricLabels { * @interface V1TrialProfilerMetricsBatch */ export interface V1TrialProfilerMetricsBatch { - /** - * The measurement for a reading, repeated for the batch of metrics. - * @type {Array} - * @memberof V1TrialProfilerMetricsBatch - */ - values: Array; - /** - * The batch at which a reading occurred, repeated for the batch of metrics. - * @type {Array} - * @memberof V1TrialProfilerMetricsBatch - */ - batches: Array; - /** - * The timestamp at which a reading occurred, repeated for the batch of metrics. - * @type {Array} - * @memberof V1TrialProfilerMetricsBatch - */ - timestamps: Array; - /** - * The labels for this series. - * @type {V1TrialProfilerMetricLabels} - * @memberof V1TrialProfilerMetricsBatch - */ - labels: V1TrialProfilerMetricLabels; + /** + * The measurement for a reading, repeated for the batch of metrics. + * @type {Array} + * @memberof V1TrialProfilerMetricsBatch + */ + values: Array; + /** + * The batch at which a reading occurred, repeated for the batch of metrics. + * @type {Array} + * @memberof V1TrialProfilerMetricsBatch + */ + batches: Array; + /** + * The timestamp at which a reading occurred, repeated for the batch of metrics. + * @type {Array} + * @memberof V1TrialProfilerMetricsBatch + */ + timestamps: Array; + /** + * The labels for this series. + * @type {V1TrialProfilerMetricLabels} + * @memberof V1TrialProfilerMetricsBatch + */ + labels: V1TrialProfilerMetricLabels; } /** * TrialProgress is a searcher event that tells you the number of batches completed in the trial. @@ -11366,18 +11453,18 @@ export interface V1TrialProfilerMetricsBatch { * @interface V1TrialProgress */ export interface V1TrialProgress { - /** - * UUID identifying the trial to the searcher. - * @type {string} - * @memberof V1TrialProgress - */ - requestId: string; - /** - * partial_units represent partial epochs, batches or records where the Unit is implied. - * @type {number} - * @memberof V1TrialProgress - */ - partialUnits: number; + /** + * UUID identifying the trial to the searcher. + * @type {string} + * @memberof V1TrialProgress + */ + requestId: string; + /** + * partial_units represent partial epochs, batches or records where the Unit is implied. + * @type {number} + * @memberof V1TrialProgress + */ + partialUnits: number; } /** * The metadata pertaining to the current running task for a trial. @@ -11385,12 +11472,12 @@ export interface V1TrialProgress { * @interface V1TrialRunnerMetadata */ export interface V1TrialRunnerMetadata { - /** - * The state of the trial runner. - * @type {string} - * @memberof V1TrialRunnerMetadata - */ - state: string; + /** + * The state of the trial runner. + * @type {string} + * @memberof V1TrialRunnerMetadata + */ + state: string; } /** * TrialSimulation is a specific sequence of workloads that were run before the trial was completed. @@ -11398,55 +11485,55 @@ export interface V1TrialRunnerMetadata { * @interface V1TrialSimulation */ export interface V1TrialSimulation { - /** - * The list of operations that were run before the trial was completed. - * @type {Array} - * @memberof V1TrialSimulation - */ - operations?: Array; - /** - * The number of times that this trial configuration has occurred during the simulation. - * @type {number} - * @memberof V1TrialSimulation - */ - occurrences?: number; + /** + * The list of operations that were run before the trial was completed. + * @type {Array} + * @memberof V1TrialSimulation + */ + operations?: Array; + /** + * The number of times that this trial configuration has occurred during the simulation. + * @type {number} + * @memberof V1TrialSimulation + */ + occurrences?: number; } /** - * + * * @export * @interface V1TrialSourceInfo */ export interface V1TrialSourceInfo { - /** - * ID of the trial. - * @type {number} - * @memberof V1TrialSourceInfo - */ - trialId: number; - /** - * UUID of the checkpoint. - * @type {string} - * @memberof V1TrialSourceInfo - */ - checkpointUuid: string; - /** - * Source `id`` for the model which generated the checkpoint (if applicable) - * @type {number} - * @memberof V1TrialSourceInfo - */ - modelId?: number; - /** - * Source `version` in the model_version version field which generated the checkpoint (if applicable) - * @type {number} - * @memberof V1TrialSourceInfo - */ - modelVersion?: number; - /** - * Type for this trial_source_info - * @type {V1TrialSourceInfoType} - * @memberof V1TrialSourceInfo - */ - trialSourceInfoType: V1TrialSourceInfoType; + /** + * ID of the trial. + * @type {number} + * @memberof V1TrialSourceInfo + */ + trialId: number; + /** + * UUID of the checkpoint. + * @type {string} + * @memberof V1TrialSourceInfo + */ + checkpointUuid: string; + /** + * Source `id`` for the model which generated the checkpoint (if applicable) + * @type {number} + * @memberof V1TrialSourceInfo + */ + modelId?: number; + /** + * Source `version` in the model_version version field which generated the checkpoint (if applicable) + * @type {number} + * @memberof V1TrialSourceInfo + */ + modelVersion?: number; + /** + * Type for this trial_source_info + * @type {V1TrialSourceInfoType} + * @memberof V1TrialSourceInfo + */ + trialSourceInfoType: V1TrialSourceInfoType; } /** * TrialSourceInfoType is the type of the TrialSourceInfo, which serves as a link between a trial and a checkpoint or model version - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub @@ -11454,35 +11541,35 @@ export interface V1TrialSourceInfo { * @enum {string} */ export const V1TrialSourceInfoType = { - UNSPECIFIED: 'TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED', - INFERENCE: 'TRIAL_SOURCE_INFO_TYPE_INFERENCE', - FINETUNING: 'TRIAL_SOURCE_INFO_TYPE_FINE_TUNING', -} as const; -export type V1TrialSourceInfoType = ValueOf; + UNSPECIFIED: 'TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED', + INFERENCE: 'TRIAL_SOURCE_INFO_TYPE_INFERENCE', + FINETUNING: 'TRIAL_SOURCE_INFO_TYPE_FINE_TUNING', +} as const +export type V1TrialSourceInfoType = ValueOf /** - * + * * @export * @interface V1TrialsSampleResponse */ export interface V1TrialsSampleResponse { - /** - * A historical or incremental series of data points for the trials. - * @type {Array} - * @memberof V1TrialsSampleResponse - */ - trials: Array; - /** - * IDs of trials that are newly included in the data. - * @type {Array} - * @memberof V1TrialsSampleResponse - */ - promotedTrials: Array; - /** - * IDs of trials that are no longer included in the top N trials. - * @type {Array} - * @memberof V1TrialsSampleResponse - */ - demotedTrials: Array; + /** + * A historical or incremental series of data points for the trials. + * @type {Array} + * @memberof V1TrialsSampleResponse + */ + trials: Array; + /** + * IDs of trials that are newly included in the data. + * @type {Array} + * @memberof V1TrialsSampleResponse + */ + promotedTrials: Array; + /** + * IDs of trials that are no longer included in the top N trials. + * @type {Array} + * @memberof V1TrialsSampleResponse + */ + demotedTrials: Array; } /** * Metadata and metrics stream from a trial. @@ -11490,37 +11577,37 @@ export interface V1TrialsSampleResponse { * @interface V1TrialsSampleResponseTrial */ export interface V1TrialsSampleResponseTrial { - /** - * The id of the trial. - * @type {number} - * @memberof V1TrialsSampleResponseTrial - */ - trialId: number; - /** - * Hyperparamters values for this specific trial. - * @type {any} - * @memberof V1TrialsSampleResponseTrial - */ - hparams: any; - /** - * A possibly down-sampled series of metric readings through the progress of the trial. - * @type {Array} - * @memberof V1TrialsSampleResponseTrial - */ - data: Array; + /** + * The id of the trial. + * @type {number} + * @memberof V1TrialsSampleResponseTrial + */ + trialId: number; + /** + * Hyperparamters values for this specific trial. + * @type {any} + * @memberof V1TrialsSampleResponseTrial + */ + hparams: any; + /** + * A possibly down-sampled series of metric readings through the progress of the trial. + * @type {Array} + * @memberof V1TrialsSampleResponseTrial + */ + data: Array; } /** - * + * * @export * @interface V1TrialsSnapshotResponse */ export interface V1TrialsSnapshotResponse { - /** - * A list of trials. - * @type {Array} - * @memberof V1TrialsSnapshotResponse - */ - trials: Array; + /** + * A list of trials. + * @type {Array} + * @memberof V1TrialsSnapshotResponse + */ + trials: Array; } /** * Metric value and metadata for a trial that has progress this far. @@ -11528,61 +11615,61 @@ export interface V1TrialsSnapshotResponse { * @interface V1TrialsSnapshotResponseTrial */ export interface V1TrialsSnapshotResponseTrial { - /** - * The id of the trial. - * @type {number} - * @memberof V1TrialsSnapshotResponseTrial - */ - trialId: number; - /** - * A dictionary of hyperparameter values for this trial. - * @type {any} - * @memberof V1TrialsSnapshotResponseTrial - */ - hparams: any; - /** - * The value of the metric in this trial at this point. - * @type {number} - * @memberof V1TrialsSnapshotResponseTrial - */ - metric: number; - /** - * The number of batches processed for this particular datapoint. - * @type {number} - * @memberof V1TrialsSnapshotResponseTrial - */ - batchesProcessed: number; + /** + * The id of the trial. + * @type {number} + * @memberof V1TrialsSnapshotResponseTrial + */ + trialId: number; + /** + * A dictionary of hyperparameter values for this trial. + * @type {any} + * @memberof V1TrialsSnapshotResponseTrial + */ + hparams: any; + /** + * The value of the metric in this trial at this point. + * @type {number} + * @memberof V1TrialsSnapshotResponseTrial + */ + metric: number; + /** + * The number of batches processed for this particular datapoint. + * @type {number} + * @memberof V1TrialsSnapshotResponseTrial + */ + batchesProcessed: number; } /** - * + * * @export * @interface V1Trigger */ export interface V1Trigger { - /** - * The id of the trigger. - * @type {number} - * @memberof V1Trigger - */ - id?: number; - /** - * The type of the trigger. - * @type {V1TriggerType} - * @memberof V1Trigger - */ - triggerType?: V1TriggerType; - /** - * The trigger condition. For TRIGGER_TYPE_TASK_LOG needs {"regex": "abcd"} - * @type {any} - * @memberof V1Trigger - */ - condition?: any; - /** - * The parent webhook of the trigger. - * @type {number} - * @memberof V1Trigger - */ - webhookId?: number; + /** + * The id of the trigger. + * @type {number} + * @memberof V1Trigger + */ + id?: number; + /** + * The type of the trigger. + * @type {V1TriggerType} + * @memberof V1Trigger + */ + triggerType?: V1TriggerType; + /** + * The trigger condition. For TRIGGER_TYPE_TASK_LOG needs {"regex": "abcd"} + * @type {any} + * @memberof V1Trigger + */ + condition?: any; + /** + * The parent webhook of the trigger. + * @type {number} + * @memberof V1Trigger + */ + webhookId?: number; } /** * Enum values for expected trigger types. - TRIGGER_TYPE_UNSPECIFIED: Default value - TRIGGER_TYPE_EXPERIMENT_STATE_CHANGE: For an experiment changing state - TRIGGER_TYPE_METRIC_THRESHOLD_EXCEEDED: For metrics emitted during training. - TRIGGER_TYPE_TASK_LOG: For task logs. @@ -11590,42 +11677,43 @@ export interface V1Trigger { * @enum {string} */ export const V1TriggerType = { - UNSPECIFIED: 'TRIGGER_TYPE_UNSPECIFIED', - EXPERIMENTSTATECHANGE: 'TRIGGER_TYPE_EXPERIMENT_STATE_CHANGE', - METRICTHRESHOLDEXCEEDED: 'TRIGGER_TYPE_METRIC_THRESHOLD_EXCEEDED', - TASKLOG: 'TRIGGER_TYPE_TASK_LOG', -} as const; -export type V1TriggerType = ValueOf; + UNSPECIFIED: 'TRIGGER_TYPE_UNSPECIFIED', + EXPERIMENTSTATECHANGE: 'TRIGGER_TYPE_EXPERIMENT_STATE_CHANGE', + METRICTHRESHOLDEXCEEDED: 'TRIGGER_TYPE_METRIC_THRESHOLD_EXCEEDED', + TASKLOG: 'TRIGGER_TYPE_TASK_LOG', +} as const +export type V1TriggerType = ValueOf /** * Response to UnarchiveExperimentRequest. * @export * @interface V1UnarchiveExperimentResponse */ -export interface V1UnarchiveExperimentResponse {} +export interface V1UnarchiveExperimentResponse { +} /** * Unarchive multiple experiments. * @export * @interface V1UnarchiveExperimentsRequest */ export interface V1UnarchiveExperimentsRequest { - /** - * Selecting experiments by id. - * @type {Array} - * @memberof V1UnarchiveExperimentsRequest - */ - experimentIds: Array; - /** - * Targets all experiments matching filters. - * @type {V1BulkExperimentFilters} - * @memberof V1UnarchiveExperimentsRequest - */ - filters?: V1BulkExperimentFilters; - /** - * Project id that the experiments belong to. - * @type {number} - * @memberof V1UnarchiveExperimentsRequest - */ - projectId: number; + /** + * Selecting experiments by id. + * @type {Array} + * @memberof V1UnarchiveExperimentsRequest + */ + experimentIds: Array; + /** + * Targets all experiments matching filters. + * @type {V1BulkExperimentFilters} + * @memberof V1UnarchiveExperimentsRequest + */ + filters?: V1BulkExperimentFilters; + /** + * Project id that the experiments belong to. + * @type {number} + * @memberof V1UnarchiveExperimentsRequest + */ + projectId: number; } /** * Response to UnarchiveExperimentsRequest. @@ -11633,49 +11721,51 @@ export interface V1UnarchiveExperimentsRequest { * @interface V1UnarchiveExperimentsResponse */ export interface V1UnarchiveExperimentsResponse { - /** - * Details on success or error for each experiment. - * @type {Array} - * @memberof V1UnarchiveExperimentsResponse - */ - results: Array; + /** + * Details on success or error for each experiment. + * @type {Array} + * @memberof V1UnarchiveExperimentsResponse + */ + results: Array; } /** - * + * * @export * @interface V1UnarchiveModelResponse */ -export interface V1UnarchiveModelResponse {} +export interface V1UnarchiveModelResponse { +} /** * Response to UnarchiveProjectRequest. * @export * @interface V1UnarchiveProjectResponse */ -export interface V1UnarchiveProjectResponse {} +export interface V1UnarchiveProjectResponse { +} /** - * + * * @export * @interface V1UnarchiveRunsRequest */ export interface V1UnarchiveRunsRequest { - /** - * The ids of the runs being unarchived. - * @type {Array} - * @memberof V1UnarchiveRunsRequest - */ - runIds: Array; - /** - * The id of the current parent project. - * @type {number} - * @memberof V1UnarchiveRunsRequest - */ - projectId: number; - /** - * Filter expression - * @type {string} - * @memberof V1UnarchiveRunsRequest - */ - filter?: string; + /** + * The ids of the runs being unarchived. + * @type {Array} + * @memberof V1UnarchiveRunsRequest + */ + runIds: Array; + /** + * The id of the current parent project. + * @type {number} + * @memberof V1UnarchiveRunsRequest + */ + projectId: number; + /** + * Filter expression + * @type {string} + * @memberof V1UnarchiveRunsRequest + */ + filter?: string; } /** * Response to UnarchiveRunsRequest. @@ -11683,92 +11773,96 @@ export interface V1UnarchiveRunsRequest { * @interface V1UnarchiveRunsResponse */ export interface V1UnarchiveRunsResponse { - /** - * Details on success or error for each run. - * @type {Array} - * @memberof V1UnarchiveRunsResponse - */ - results: Array; + /** + * Details on success or error for each run. + * @type {Array} + * @memberof V1UnarchiveRunsResponse + */ + results: Array; } /** * Response to UnarchiveWorkspaceRequest. * @export * @interface V1UnarchiveWorkspaceResponse */ -export interface V1UnarchiveWorkspaceResponse {} +export interface V1UnarchiveWorkspaceResponse { +} /** * Unbind a resource pool to workspaces. * @export * @interface V1UnbindRPFromWorkspaceRequest */ export interface V1UnbindRPFromWorkspaceRequest { - /** - * The resource pool name. - * @type {string} - * @memberof V1UnbindRPFromWorkspaceRequest - */ - resourcePoolName: string; - /** - * The workspace IDs to be unbound. - * @type {Array} - * @memberof V1UnbindRPFromWorkspaceRequest - */ - workspaceIds?: Array; - /** - * The workspace names to be unbound. - * @type {Array} - * @memberof V1UnbindRPFromWorkspaceRequest - */ - workspaceNames?: Array; + /** + * The resource pool name. + * @type {string} + * @memberof V1UnbindRPFromWorkspaceRequest + */ + resourcePoolName: string; + /** + * The workspace IDs to be unbound. + * @type {Array} + * @memberof V1UnbindRPFromWorkspaceRequest + */ + workspaceIds?: Array; + /** + * The workspace names to be unbound. + * @type {Array} + * @memberof V1UnbindRPFromWorkspaceRequest + */ + workspaceNames?: Array; } /** * Unbind a resource pool to workspaces response. * @export * @interface V1UnbindRPFromWorkspaceResponse */ -export interface V1UnbindRPFromWorkspaceResponse {} +export interface V1UnbindRPFromWorkspaceResponse { +} /** - * + * * @export * @interface V1UnpauseGenericTaskResponse */ -export interface V1UnpauseGenericTaskResponse {} +export interface V1UnpauseGenericTaskResponse { +} /** * Response to UnpinWorkspaceRequest. * @export * @interface V1UnpinWorkspaceResponse */ -export interface V1UnpinWorkspaceResponse {} +export interface V1UnpinWorkspaceResponse { +} /** * UpdateGroupRequest is the body of the request for the call to update a group and its members. * @export * @interface V1UpdateGroupRequest */ export interface V1UpdateGroupRequest { - /** - * The id of the group - * @type {number} - * @memberof V1UpdateGroupRequest - */ - groupId: number; - /** - * The name of the group - * @type {string} - * @memberof V1UpdateGroupRequest - */ - name?: string; - /** - * The user ids of users to add to the group - * @type {Array} - * @memberof V1UpdateGroupRequest - */ - addUsers?: Array; - /** - * The user ids of users to delete from the group - * @type {Array} - * @memberof V1UpdateGroupRequest - */ - removeUsers?: Array; + /** + * The id of the group + * @type {number} + * @memberof V1UpdateGroupRequest + */ + groupId: number; + /** + * The name of the group + * @type {string} + * @memberof V1UpdateGroupRequest + */ + name?: string; + /** + * The user ids of users to add to the group + * @type {Array} + * @memberof V1UpdateGroupRequest + */ + addUsers?: Array; + /** + * The user ids of users to delete from the group + * @type {Array} + * @memberof V1UpdateGroupRequest + */ + removeUsers?: Array; } /** * UpdateGroupResponse is the body of the response for the call to update a group and its members. @@ -11776,12 +11870,12 @@ export interface V1UpdateGroupRequest { * @interface V1UpdateGroupResponse */ export interface V1UpdateGroupResponse { - /** - * Info about the group after the update succeeded. - * @type {V1GroupDetails} - * @memberof V1UpdateGroupResponse - */ - group: V1GroupDetails; + /** + * Info about the group after the update succeeded. + * @type {V1GroupDetails} + * @memberof V1UpdateGroupResponse + */ + group: V1GroupDetails; } /** * Request to update the job queue. @@ -11789,117 +11883,118 @@ export interface V1UpdateGroupResponse { * @interface V1UpdateJobQueueRequest */ export interface V1UpdateJobQueueRequest { - /** - * List of job queue control requests. - * @type {Array} - * @memberof V1UpdateJobQueueRequest - */ - updates: Array; + /** + * List of job queue control requests. + * @type {Array} + * @memberof V1UpdateJobQueueRequest + */ + updates: Array; } /** * Response to UpdateJobQueueRequest. * @export * @interface V1UpdateJobQueueResponse */ -export interface V1UpdateJobQueueResponse {} +export interface V1UpdateJobQueueResponse { +} /** * User is an account in the determined cluster. * @export * @interface V1User */ export interface V1User { - /** - * The user ID. - * @type {number} - * @memberof V1User - */ - id?: number; - /** - * The user login name of the user. - * @type {string} - * @memberof V1User - */ - username: string; - /** - * Bool denoting whether the account is an admin account. - * @type {boolean} - * @memberof V1User - */ - admin: boolean; - /** - * Bool denoting whether the account is active. - * @type {boolean} - * @memberof V1User - */ - active: boolean; - /** - * The user and group on the agent host machine. - * @type {V1AgentUserGroup} - * @memberof V1User - */ - agentUserGroup?: V1AgentUserGroup; - /** - * Name to display in the web UI. - * @type {string} - * @memberof V1User - */ - displayName?: string; - /** - * The version of the user object for caching purposes. - * @type {Date | DateString} - * @memberof V1User - */ - modifiedAt?: Date | DateString; - /** - * Bool denoting whether the user should be able to login with or change a password. - * @type {boolean} - * @memberof V1User - */ - remote?: boolean; - /** - * when the user last authenticated - * @type {Date | DateString} - * @memberof V1User - */ - lastAuthAt?: Date | DateString; -} -/** - * Message for results of individual users in a multi-user action. - * @export - * @interface V1UserActionResult - */ -export interface V1UserActionResult { - /** - * Optional error message. - * @type {string} - * @memberof V1UserActionResult - */ - error: string; - /** - * User ID. - * @type {number} - * @memberof V1UserActionResult - */ - id: number; -} -/** - * Options to filter a subset of users. - * @export - * @interface V1UserFilters - */ -export interface V1UserFilters { - /** - * Case-insensitive partial match of string to username or display name. - * @type {string} - * @memberof V1UserFilters - */ - name?: string; - /** - * Matches users with or without an admin flag. - * @type {boolean} - * @memberof V1UserFilters - */ - admin?: boolean; + /** + * The user ID. + * @type {number} + * @memberof V1User + */ + id?: number; + /** + * The user login name of the user. + * @type {string} + * @memberof V1User + */ + username: string; + /** + * Bool denoting whether the account is an admin account. + * @type {boolean} + * @memberof V1User + */ + admin: boolean; + /** + * Bool denoting whether the account is active. + * @type {boolean} + * @memberof V1User + */ + active: boolean; + /** + * The user and group on the agent host machine. + * @type {V1AgentUserGroup} + * @memberof V1User + */ + agentUserGroup?: V1AgentUserGroup; + /** + * Name to display in the web UI. + * @type {string} + * @memberof V1User + */ + displayName?: string; + /** + * The version of the user object for caching purposes. + * @type {Date | DateString} + * @memberof V1User + */ + modifiedAt?: Date | DateString; + /** + * Bool denoting whether the user should be able to login with or change a password. + * @type {boolean} + * @memberof V1User + */ + remote?: boolean; + /** + * when the user last authenticated + * @type {Date | DateString} + * @memberof V1User + */ + lastAuthAt?: Date | DateString; +} +/** + * Message for results of individual users in a multi-user action. + * @export + * @interface V1UserActionResult + */ +export interface V1UserActionResult { + /** + * Optional error message. + * @type {string} + * @memberof V1UserActionResult + */ + error: string; + /** + * User ID. + * @type {number} + * @memberof V1UserActionResult + */ + id: number; +} +/** + * Options to filter a subset of users. + * @export + * @interface V1UserFilters + */ +export interface V1UserFilters { + /** + * Case-insensitive partial match of string to username or display name. + * @type {string} + * @memberof V1UserFilters + */ + name?: string; + /** + * Matches users with or without an admin flag. + * @type {boolean} + * @memberof V1UserFilters + */ + admin?: boolean; } /** * UserRoleAssignment contains information about the users belonging to a role. @@ -11907,18 +12002,18 @@ export interface V1UserFilters { * @interface V1UserRoleAssignment */ export interface V1UserRoleAssignment { - /** - * the user id of the role assignment - * @type {number} - * @memberof V1UserRoleAssignment - */ - userId: number; - /** - * the role and scope of the assignment - * @type {V1RoleAssignment} - * @memberof V1UserRoleAssignment - */ - roleAssignment: V1RoleAssignment; + /** + * the user id of the role assignment + * @type {number} + * @memberof V1UserRoleAssignment + */ + userId: number; + /** + * the role and scope of the assignment + * @type {V1RoleAssignment} + * @memberof V1UserRoleAssignment + */ + roleAssignment: V1RoleAssignment; } /** * UserWebSetting represents user web setting. @@ -11926,24 +12021,24 @@ export interface V1UserRoleAssignment { * @interface V1UserWebSetting */ export interface V1UserWebSetting { - /** - * The key of setting. - * @type {string} - * @memberof V1UserWebSetting - */ - key: string; - /** - * The storage path of setting. - * @type {string} - * @memberof V1UserWebSetting - */ - storagePath?: string; - /** - * The value of setting. - * @type {string} - * @memberof V1UserWebSetting - */ - value?: string; + /** + * The key of setting. + * @type {string} + * @memberof V1UserWebSetting + */ + key: string; + /** + * The storage path of setting. + * @type {string} + * @memberof V1UserWebSetting + */ + storagePath?: string; + /** + * The value of setting. + * @type {string} + * @memberof V1UserWebSetting + */ + value?: string; } /** * ValidateAfterOperation means the trial should train and validate after training the given length. @@ -11951,18 +12046,18 @@ export interface V1UserWebSetting { * @interface V1ValidateAfterOperation */ export interface V1ValidateAfterOperation { - /** - * The ID of the trial that should train. - * @type {string} - * @memberof V1ValidateAfterOperation - */ - requestId?: string; - /** - * The length to train before reporting a validation. - * @type {string} - * @memberof V1ValidateAfterOperation - */ - length?: string; + /** + * The ID of the trial that should train. + * @type {string} + * @memberof V1ValidateAfterOperation + */ + requestId?: string; + /** + * The length to train before reporting a validation. + * @type {string} + * @memberof V1ValidateAfterOperation + */ + length?: string; } /** * ValidationCompleted is a searcher event triggered when a validation has been completed. @@ -11970,24 +12065,24 @@ export interface V1ValidateAfterOperation { * @interface V1ValidationCompleted */ export interface V1ValidationCompleted { - /** - * UUID identifying the trial to the searcher. - * @type {string} - * @memberof V1ValidationCompleted - */ - requestId: string; - /** - * Value of the validation metric used to direct the search. - * @type {any} - * @memberof V1ValidationCompleted - */ - metric: any; - /** - * Length from ValidateAfterOperation. - * @type {string} - * @memberof V1ValidationCompleted - */ - validateAfterLength: string; + /** + * UUID identifying the trial to the searcher. + * @type {string} + * @memberof V1ValidationCompleted + */ + requestId: string; + /** + * Value of the validation metric used to direct the search. + * @type {any} + * @memberof V1ValidationCompleted + */ + metric: any; + /** + * Length from ValidateAfterOperation. + * @type {string} + * @memberof V1ValidationCompleted + */ + validateAfterLength: string; } /** * ValidationHistoryEntry is a single entry for a validation history for an experiment. @@ -11995,55 +12090,55 @@ export interface V1ValidationCompleted { * @interface V1ValidationHistoryEntry */ export interface V1ValidationHistoryEntry { - /** - * The id for the trial associated with this validation entry. - * @type {number} - * @memberof V1ValidationHistoryEntry - */ - trialId: number; - /** - * The time at which the completed validation was reported. - * @type {Date | DateString} - * @memberof V1ValidationHistoryEntry - */ - endTime: Date | DateString; - /** - * The value of the `searcher.metric`, indicated by the experiment config, for the validation. - * @type {number} - * @memberof V1ValidationHistoryEntry - */ - searcherMetric: number; + /** + * The id for the trial associated with this validation entry. + * @type {number} + * @memberof V1ValidationHistoryEntry + */ + trialId: number; + /** + * The time at which the completed validation was reported. + * @type {Date | DateString} + * @memberof V1ValidationHistoryEntry + */ + endTime: Date | DateString; + /** + * The value of the `searcher.metric`, indicated by the experiment config, for the validation. + * @type {number} + * @memberof V1ValidationHistoryEntry + */ + searcherMetric: number; } /** - * + * * @export * @interface V1Webhook */ export interface V1Webhook { - /** - * The id of the webhook. - * @type {number} - * @memberof V1Webhook - */ - id?: number; - /** - * The url of the webhook. - * @type {string} - * @memberof V1Webhook - */ - url: string; - /** - * The triggers of the webhook. - * @type {Array} - * @memberof V1Webhook - */ - triggers?: Array; - /** - * The type of the webhook. - * @type {V1WebhookType} - * @memberof V1Webhook - */ - webhookType: V1WebhookType; + /** + * The id of the webhook. + * @type {number} + * @memberof V1Webhook + */ + id?: number; + /** + * The url of the webhook. + * @type {string} + * @memberof V1Webhook + */ + url: string; + /** + * The triggers of the webhook. + * @type {Array} + * @memberof V1Webhook + */ + triggers?: Array; + /** + * The type of the webhook. + * @type {V1WebhookType} + * @memberof V1Webhook + */ + webhookType: V1WebhookType; } /** * Enum values for expected webhook types. - WEBHOOK_TYPE_UNSPECIFIED: Default value - WEBHOOK_TYPE_DEFAULT: For a default webhook - WEBHOOK_TYPE_SLACK: For a slack webhook. @@ -12051,35 +12146,35 @@ export interface V1Webhook { * @enum {string} */ export const V1WebhookType = { - UNSPECIFIED: 'WEBHOOK_TYPE_UNSPECIFIED', - DEFAULT: 'WEBHOOK_TYPE_DEFAULT', - SLACK: 'WEBHOOK_TYPE_SLACK', -} as const; -export type V1WebhookType = ValueOf; + UNSPECIFIED: 'WEBHOOK_TYPE_UNSPECIFIED', + DEFAULT: 'WEBHOOK_TYPE_DEFAULT', + SLACK: 'WEBHOOK_TYPE_SLACK', +} as const +export type V1WebhookType = ValueOf /** * WorkloadContainer is a wrapper for Determined workloads to allow repeated oneof types. * @export * @interface V1WorkloadContainer */ export interface V1WorkloadContainer { - /** - * Training workload. - * @type {V1MetricsWorkload} - * @memberof V1WorkloadContainer - */ - training?: V1MetricsWorkload; - /** - * Validation workload. - * @type {V1MetricsWorkload} - * @memberof V1WorkloadContainer - */ - validation?: V1MetricsWorkload; - /** - * Checkpoint workload. - * @type {V1CheckpointWorkload} - * @memberof V1WorkloadContainer - */ - checkpoint?: V1CheckpointWorkload; + /** + * Training workload. + * @type {V1MetricsWorkload} + * @memberof V1WorkloadContainer + */ + training?: V1MetricsWorkload; + /** + * Validation workload. + * @type {V1MetricsWorkload} + * @memberof V1WorkloadContainer + */ + validation?: V1MetricsWorkload; + /** + * Checkpoint workload. + * @type {V1CheckpointWorkload} + * @memberof V1WorkloadContainer + */ + checkpoint?: V1CheckpointWorkload; } /** * Workspace is a named collection of projects. @@ -12087,102 +12182,102 @@ export interface V1WorkloadContainer { * @interface V1Workspace */ export interface V1Workspace { - /** - * The unique id of the workspace. - * @type {number} - * @memberof V1Workspace - */ - id: number; - /** - * The unique name of the workspace. - * @type {string} - * @memberof V1Workspace - */ - name: string; - /** - * Whether this workspace is archived or not. - * @type {boolean} - * @memberof V1Workspace - */ - archived: boolean; - /** - * User who created this workspace. - * @type {string} - * @memberof V1Workspace - */ - username: string; - /** - * Whether this workspace is immutable (default uncategorized workspace). - * @type {boolean} - * @memberof V1Workspace - */ - immutable: boolean; - /** - * Number of projects associated with this workspace. - * @type {number} - * @memberof V1Workspace - */ - numProjects: number; - /** - * Pin status of this workspace for the current user. - * @type {boolean} - * @memberof V1Workspace - */ - pinned: boolean; - /** - * ID of the user who created this project. - * @type {number} - * @memberof V1Workspace - */ - userId: number; - /** - * Number of experiments associated with this workspace. - * @type {number} - * @memberof V1Workspace - */ - numExperiments: number; - /** - * State of workspace during deletion. - * @type {V1WorkspaceState} - * @memberof V1Workspace - */ - state: V1WorkspaceState; - /** - * Message stored from errors on async-deleting a workspace. - * @type {string} - * @memberof V1Workspace - */ - errorMessage: string; - /** - * Optional agent host uid and gid override. - * @type {V1AgentUserGroup} - * @memberof V1Workspace - */ - agentUserGroup?: V1AgentUserGroup; - /** - * Optional checkpoint storage config. Expects same format as experiment config's checkpoint storage. - * @type {any} - * @memberof V1Workspace - */ - checkpointStorageConfig?: any; - /** - * Optional date when workspace was pinned. - * @type {Date | DateString} - * @memberof V1Workspace - */ - pinnedAt?: Date | DateString; - /** - * Name of the default compute pool. - * @type {string} - * @memberof V1Workspace - */ - defaultComputePool?: string; - /** - * Name of the default aux pool. - * @type {string} - * @memberof V1Workspace - */ - defaultAuxPool?: string; + /** + * The unique id of the workspace. + * @type {number} + * @memberof V1Workspace + */ + id: number; + /** + * The unique name of the workspace. + * @type {string} + * @memberof V1Workspace + */ + name: string; + /** + * Whether this workspace is archived or not. + * @type {boolean} + * @memberof V1Workspace + */ + archived: boolean; + /** + * User who created this workspace. + * @type {string} + * @memberof V1Workspace + */ + username: string; + /** + * Whether this workspace is immutable (default uncategorized workspace). + * @type {boolean} + * @memberof V1Workspace + */ + immutable: boolean; + /** + * Number of projects associated with this workspace. + * @type {number} + * @memberof V1Workspace + */ + numProjects: number; + /** + * Pin status of this workspace for the current user. + * @type {boolean} + * @memberof V1Workspace + */ + pinned: boolean; + /** + * ID of the user who created this project. + * @type {number} + * @memberof V1Workspace + */ + userId: number; + /** + * Number of experiments associated with this workspace. + * @type {number} + * @memberof V1Workspace + */ + numExperiments: number; + /** + * State of workspace during deletion. + * @type {V1WorkspaceState} + * @memberof V1Workspace + */ + state: V1WorkspaceState; + /** + * Message stored from errors on async-deleting a workspace. + * @type {string} + * @memberof V1Workspace + */ + errorMessage: string; + /** + * Optional agent host uid and gid override. + * @type {V1AgentUserGroup} + * @memberof V1Workspace + */ + agentUserGroup?: V1AgentUserGroup; + /** + * Optional checkpoint storage config. Expects same format as experiment config's checkpoint storage. + * @type {any} + * @memberof V1Workspace + */ + checkpointStorageConfig?: any; + /** + * Optional date when workspace was pinned. + * @type {Date | DateString} + * @memberof V1Workspace + */ + pinnedAt?: Date | DateString; + /** + * Name of the default compute pool. + * @type {string} + * @memberof V1Workspace + */ + defaultComputePool?: string; + /** + * Name of the default aux pool. + * @type {string} + * @memberof V1Workspace + */ + defaultAuxPool?: string; } /** * WorkspaceState is used to track progress during a deletion. - WORKSPACE_STATE_UNSPECIFIED: Object deletion is not in progress. - WORKSPACE_STATE_DELETING: The object is being deleted. - WORKSPACE_STATE_DELETE_FAILED: The object failed to delete. - WORKSPACE_STATE_DELETED: The object finished deleting. @@ -12190,114 +12285,109 @@ export interface V1Workspace { * @enum {string} */ export const V1WorkspaceState = { - UNSPECIFIED: 'WORKSPACE_STATE_UNSPECIFIED', - DELETING: 'WORKSPACE_STATE_DELETING', - DELETEFAILED: 'WORKSPACE_STATE_DELETE_FAILED', - DELETED: 'WORKSPACE_STATE_DELETED', -} as const; -export type V1WorkspaceState = ValueOf; + UNSPECIFIED: 'WORKSPACE_STATE_UNSPECIFIED', + DELETING: 'WORKSPACE_STATE_DELETING', + DELETEFAILED: 'WORKSPACE_STATE_DELETE_FAILED', + DELETED: 'WORKSPACE_STATE_DELETED', +} as const +export type V1WorkspaceState = ValueOf /** * AuthenticationApi - fetch parameter creator * @export */ export const AuthenticationApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Get the current user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - currentUser(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/auth/user`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Login the user. - * @param {V1LoginRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - login(body: V1LoginRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling login.', - ); - } - const localVarPath = `/api/v1/auth/login`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Logout the user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - logout(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/auth/logout`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; + return { + /** + * + * @summary Get the current user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + currentUser(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/auth/user`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Login the user. + * @param {V1LoginRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + login(body: V1LoginRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling login.'); + } + const localVarPath = `/api/v1/auth/login`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logout the user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logout(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/auth/logout`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } }; /** @@ -12305,901 +12395,1878 @@ export const AuthenticationApiFetchParamCreator = function (configuration?: Conf * @export */ export const AuthenticationApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Get the current user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - currentUser( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = - AuthenticationApiFetchParamCreator(configuration).currentUser(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Login the user. - * @param {V1LoginRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - login( - body: V1LoginRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = AuthenticationApiFetchParamCreator(configuration).login( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Logout the user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - logout(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = AuthenticationApiFetchParamCreator(configuration).logout(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; + return { + /** + * + * @summary Get the current user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + currentUser(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = AuthenticationApiFetchParamCreator(configuration).currentUser(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Login the user. + * @param {V1LoginRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + login(body: V1LoginRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = AuthenticationApiFetchParamCreator(configuration).login(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Logout the user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logout(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = AuthenticationApiFetchParamCreator(configuration).logout(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } }; /** * AuthenticationApi - factory interface * @export */ -export const AuthenticationApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { +export const AuthenticationApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Get the current user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + currentUser(options?: any) { + return AuthenticationApiFp(configuration).currentUser(options)(fetch, basePath); + }, + /** + * + * @summary Login the user. + * @param {V1LoginRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + login(body: V1LoginRequest, options?: any) { + return AuthenticationApiFp(configuration).login(body, options)(fetch, basePath); + }, + /** + * + * @summary Logout the user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logout(options?: any) { + return AuthenticationApiFp(configuration).logout(options)(fetch, basePath); + }, + } +}; + +/** + * AuthenticationApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class AuthenticationApi extends BaseAPI { /** - * + * * @summary Get the current user. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof AuthenticationApi */ - currentUser(options?: any) { - return AuthenticationApiFp(configuration).currentUser(options)(fetch, basePath); - }, + public currentUser(options?: any) { + return AuthenticationApiFp(this.configuration).currentUser(options)(this.fetch, this.basePath) + } + /** - * + * * @summary Login the user. * @param {V1LoginRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof AuthenticationApi */ - login(body: V1LoginRequest, options?: any) { - return AuthenticationApiFp(configuration).login(body, options)(fetch, basePath); - }, + public login(body: V1LoginRequest, options?: any) { + return AuthenticationApiFp(this.configuration).login(body, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Logout the user. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof AuthenticationApi */ - logout(options?: any) { - return AuthenticationApiFp(configuration).logout(options)(fetch, basePath); - }, - }; -}; + public logout(options?: any) { + return AuthenticationApiFp(this.configuration).logout(options)(this.fetch, this.basePath) + } + +} /** - * AuthenticationApi - object-oriented interface + * CheckpointsApi - fetch parameter creator * @export - * @class - * @extends {BaseAPI} */ -export class AuthenticationApi extends BaseAPI { - /** - * - * @summary Get the current user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AuthenticationApi - */ - public currentUser(options?: any) { - return AuthenticationApiFp(this.configuration).currentUser(options)(this.fetch, this.basePath); - } +export const CheckpointsApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Remove files from checkpoints. + * @param {V1CheckpointsRemoveFilesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + checkpointsRemoveFiles(body: V1CheckpointsRemoveFilesRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling checkpointsRemoveFiles.'); + } + const localVarPath = `/api/v1/checkpoints/rm`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Delete Checkpoints. + * @param {V1DeleteCheckpointsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteCheckpoints(body: V1DeleteCheckpointsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling deleteCheckpoints.'); + } + const localVarPath = `/api/v1/checkpoints`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested checkpoint. + * @param {string} checkpointUuid The uuid for the requested checkpoint. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCheckpoint(checkpointUuid: string, options: any = {}): FetchArgs { + // verify required parameter 'checkpointUuid' is not null or undefined + if (checkpointUuid === null || checkpointUuid === undefined) { + throw new RequiredError('checkpointUuid','Required parameter checkpointUuid was null or undefined when calling getCheckpoint.'); + } + const localVarPath = `/api/v1/checkpoints/{checkpointUuid}` + .replace(`{${"checkpointUuid"}}`, encodeURIComponent(String(checkpointUuid))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update checkpoint metadata. + * @param {string} checkpointUuid UUID of the checkpoint. + * @param {V1PostCheckpointMetadataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postCheckpointMetadata(checkpointUuid: string, body: V1PostCheckpointMetadataRequest, options: any = {}): FetchArgs { + // verify required parameter 'checkpointUuid' is not null or undefined + if (checkpointUuid === null || checkpointUuid === undefined) { + throw new RequiredError('checkpointUuid','Required parameter checkpointUuid was null or undefined when calling postCheckpointMetadata.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postCheckpointMetadata.'); + } + const localVarPath = `/api/v1/checkpoints/{checkpointUuid}/metadata` + .replace(`{${"checkpointUuid"}}`, encodeURIComponent(String(checkpointUuid))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; - /** - * - * @summary Login the user. - * @param {V1LoginRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AuthenticationApi - */ - public login(body: V1LoginRequest, options?: any) { - return AuthenticationApiFp(this.configuration).login(body, options)(this.fetch, this.basePath); - } +/** + * CheckpointsApi - functional programming interface + * @export + */ +export const CheckpointsApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Remove files from checkpoints. + * @param {V1CheckpointsRemoveFilesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + checkpointsRemoveFiles(body: V1CheckpointsRemoveFilesRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CheckpointsApiFetchParamCreator(configuration).checkpointsRemoveFiles(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Delete Checkpoints. + * @param {V1DeleteCheckpointsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteCheckpoints(body: V1DeleteCheckpointsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CheckpointsApiFetchParamCreator(configuration).deleteCheckpoints(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested checkpoint. + * @param {string} checkpointUuid The uuid for the requested checkpoint. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCheckpoint(checkpointUuid: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CheckpointsApiFetchParamCreator(configuration).getCheckpoint(checkpointUuid, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Update checkpoint metadata. + * @param {string} checkpointUuid UUID of the checkpoint. + * @param {V1PostCheckpointMetadataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postCheckpointMetadata(checkpointUuid: string, body: V1PostCheckpointMetadataRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CheckpointsApiFetchParamCreator(configuration).postCheckpointMetadata(checkpointUuid, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; - /** - * - * @summary Logout the user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof AuthenticationApi - */ - public logout(options?: any) { - return AuthenticationApiFp(this.configuration).logout(options)(this.fetch, this.basePath); - } -} +/** + * CheckpointsApi - factory interface + * @export + */ +export const CheckpointsApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Remove files from checkpoints. + * @param {V1CheckpointsRemoveFilesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + checkpointsRemoveFiles(body: V1CheckpointsRemoveFilesRequest, options?: any) { + return CheckpointsApiFp(configuration).checkpointsRemoveFiles(body, options)(fetch, basePath); + }, + /** + * + * @summary Delete Checkpoints. + * @param {V1DeleteCheckpointsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteCheckpoints(body: V1DeleteCheckpointsRequest, options?: any) { + return CheckpointsApiFp(configuration).deleteCheckpoints(body, options)(fetch, basePath); + }, + /** + * + * @summary Get the requested checkpoint. + * @param {string} checkpointUuid The uuid for the requested checkpoint. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCheckpoint(checkpointUuid: string, options?: any) { + return CheckpointsApiFp(configuration).getCheckpoint(checkpointUuid, options)(fetch, basePath); + }, + /** + * + * @summary Update checkpoint metadata. + * @param {string} checkpointUuid UUID of the checkpoint. + * @param {V1PostCheckpointMetadataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postCheckpointMetadata(checkpointUuid: string, body: V1PostCheckpointMetadataRequest, options?: any) { + return CheckpointsApiFp(configuration).postCheckpointMetadata(checkpointUuid, body, options)(fetch, basePath); + }, + } +}; /** - * CheckpointsApi - fetch parameter creator + * CheckpointsApi - object-oriented interface * @export + * @class + * @extends {BaseAPI} */ -export const CheckpointsApiFetchParamCreator = function (configuration?: Configuration) { - return { +export class CheckpointsApi extends BaseAPI { /** - * + * * @summary Remove files from checkpoints. * @param {V1CheckpointsRemoveFilesRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof CheckpointsApi */ - checkpointsRemoveFiles(body: V1CheckpointsRemoveFilesRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling checkpointsRemoveFiles.', - ); - } - const localVarPath = `/api/v1/checkpoints/rm`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public checkpointsRemoveFiles(body: V1CheckpointsRemoveFilesRequest, options?: any) { + return CheckpointsApiFp(this.configuration).checkpointsRemoveFiles(body, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Delete Checkpoints. * @param {V1DeleteCheckpointsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof CheckpointsApi */ - deleteCheckpoints(body: V1DeleteCheckpointsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling deleteCheckpoints.', - ); - } - const localVarPath = `/api/v1/checkpoints`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public deleteCheckpoints(body: V1DeleteCheckpointsRequest, options?: any) { + return CheckpointsApiFp(this.configuration).deleteCheckpoints(body, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get the requested checkpoint. * @param {string} checkpointUuid The uuid for the requested checkpoint. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof CheckpointsApi */ - getCheckpoint(checkpointUuid: string, options: any = {}): FetchArgs { - // verify required parameter 'checkpointUuid' is not null or undefined - if (checkpointUuid === null || checkpointUuid === undefined) { - throw new RequiredError( - 'checkpointUuid', - 'Required parameter checkpointUuid was null or undefined when calling getCheckpoint.', - ); - } - const localVarPath = `/api/v1/checkpoints/{checkpointUuid}`.replace( - `{${'checkpointUuid'}}`, - encodeURIComponent(String(checkpointUuid)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getCheckpoint(checkpointUuid: string, options?: any) { + return CheckpointsApiFp(this.configuration).getCheckpoint(checkpointUuid, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Update checkpoint metadata. * @param {string} checkpointUuid UUID of the checkpoint. * @param {V1PostCheckpointMetadataRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof CheckpointsApi */ - postCheckpointMetadata( - checkpointUuid: string, - body: V1PostCheckpointMetadataRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'checkpointUuid' is not null or undefined - if (checkpointUuid === null || checkpointUuid === undefined) { - throw new RequiredError( - 'checkpointUuid', - 'Required parameter checkpointUuid was null or undefined when calling postCheckpointMetadata.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postCheckpointMetadata.', - ); - } - const localVarPath = `/api/v1/checkpoints/{checkpointUuid}/metadata`.replace( - `{${'checkpointUuid'}}`, - encodeURIComponent(String(checkpointUuid)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } + public postCheckpointMetadata(checkpointUuid: string, body: V1PostCheckpointMetadataRequest, options?: any) { + return CheckpointsApiFp(this.configuration).postCheckpointMetadata(checkpointUuid, body, options)(this.fetch, this.basePath) + } + +} - localVarHeaderParameter['Content-Type'] = 'application/json'; +/** + * ClusterApi - fetch parameter creator + * @export + */ +export const ClusterApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Clear the cluster-wide message shown to all users. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteClusterMessage(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/master/cluster_message`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Disable the agent. + * @param {string} agentId The id of the agent. + * @param {V1DisableAgentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + disableAgent(agentId: string, body: V1DisableAgentRequest, options: any = {}): FetchArgs { + // verify required parameter 'agentId' is not null or undefined + if (agentId === null || agentId === undefined) { + throw new RequiredError('agentId','Required parameter agentId was null or undefined when calling disableAgent.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling disableAgent.'); + } + const localVarPath = `/api/v1/agents/{agentId}/disable` + .replace(`{${"agentId"}}`, encodeURIComponent(String(agentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Disable the slot. + * @param {string} agentId The id of the agent. + * @param {string} slotId The id of the slot. + * @param {V1DisableSlotRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + disableSlot(agentId: string, slotId: string, body: V1DisableSlotRequest, options: any = {}): FetchArgs { + // verify required parameter 'agentId' is not null or undefined + if (agentId === null || agentId === undefined) { + throw new RequiredError('agentId','Required parameter agentId was null or undefined when calling disableSlot.'); + } + // verify required parameter 'slotId' is not null or undefined + if (slotId === null || slotId === undefined) { + throw new RequiredError('slotId','Required parameter slotId was null or undefined when calling disableSlot.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling disableSlot.'); + } + const localVarPath = `/api/v1/agents/{agentId}/slots/{slotId}/disable` + .replace(`{${"agentId"}}`, encodeURIComponent(String(agentId))) + .replace(`{${"slotId"}}`, encodeURIComponent(String(slotId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Enable the agent. + * @param {string} agentId The id of the agent. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + enableAgent(agentId: string, options: any = {}): FetchArgs { + // verify required parameter 'agentId' is not null or undefined + if (agentId === null || agentId === undefined) { + throw new RequiredError('agentId','Required parameter agentId was null or undefined when calling enableAgent.'); + } + const localVarPath = `/api/v1/agents/{agentId}/enable` + .replace(`{${"agentId"}}`, encodeURIComponent(String(agentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Enable the slot. + * @param {string} agentId The id of the agent. + * @param {string} slotId The id of the slot. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + enableSlot(agentId: string, slotId: string, options: any = {}): FetchArgs { + // verify required parameter 'agentId' is not null or undefined + if (agentId === null || agentId === undefined) { + throw new RequiredError('agentId','Required parameter agentId was null or undefined when calling enableSlot.'); + } + // verify required parameter 'slotId' is not null or undefined + if (slotId === null || slotId === undefined) { + throw new RequiredError('slotId','Required parameter slotId was null or undefined when calling enableSlot.'); + } + const localVarPath = `/api/v1/agents/{agentId}/slots/{slotId}/enable` + .replace(`{${"agentId"}}`, encodeURIComponent(String(agentId))) + .replace(`{${"slotId"}}`, encodeURIComponent(String(slotId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested agent. + * @param {string} agentId The id of the agent. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAgent(agentId: string, options: any = {}): FetchArgs { + // verify required parameter 'agentId' is not null or undefined + if (agentId === null || agentId === undefined) { + throw new RequiredError('agentId','Required parameter agentId was null or undefined when calling getAgent.'); + } + const localVarPath = `/api/v1/agents/{agentId}` + .replace(`{${"agentId"}}`, encodeURIComponent(String(agentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a set of agents from the cluster. + * @param {V1GetAgentsRequestSortBy} [sortBy] Sort agents by the given field. - SORT_BY_UNSPECIFIED: Returns agents in an unsorted list. - SORT_BY_ID: Returns agents sorted by id. - SORT_BY_TIME: Returns agents sorted by time. + * @param {V1OrderBy} [orderBy] Order agents in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of agents before returning results. Negative values denote number of agents to skip from the end before returning results. + * @param {number} [limit] Limit the number of agents. A value of 0 denotes no limit. + * @param {string} [label] This field has been deprecated and will be ignored. + * @param {boolean} [excludeSlots] exclude slots. + * @param {boolean} [excludeContainers] exclude containers. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAgents(sortBy?: V1GetAgentsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, label?: string, excludeSlots?: boolean, excludeContainers?: boolean, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/agents`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (label !== undefined) { + localVarQueryParameter['label'] = label + } + + if (excludeSlots !== undefined) { + localVarQueryParameter['excludeSlots'] = excludeSlots + } + + if (excludeContainers !== undefined) { + localVarQueryParameter['excludeContainers'] = excludeContainers + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the currently configured cluster-wide message. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getClusterMessage(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/master/cluster_message`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get master information. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMaster(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/master`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get master config. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMasterConfig(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/master/config`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested slot for an agent. + * @param {string} agentId The id of the agent. + * @param {string} slotId The id of the slot. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSlot(agentId: string, slotId: string, options: any = {}): FetchArgs { + // verify required parameter 'agentId' is not null or undefined + if (agentId === null || agentId === undefined) { + throw new RequiredError('agentId','Required parameter agentId was null or undefined when calling getSlot.'); + } + // verify required parameter 'slotId' is not null or undefined + if (slotId === null || slotId === undefined) { + throw new RequiredError('slotId','Required parameter slotId was null or undefined when calling getSlot.'); + } + const localVarPath = `/api/v1/agents/{agentId}/slots/{slotId}` + .replace(`{${"agentId"}}`, encodeURIComponent(String(agentId))) + .replace(`{${"slotId"}}`, encodeURIComponent(String(slotId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get all the slots for an agent. + * @param {string} agentId The id of the agent. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSlots(agentId: string, options: any = {}): FetchArgs { + // verify required parameter 'agentId' is not null or undefined + if (agentId === null || agentId === undefined) { + throw new RequiredError('agentId','Required parameter agentId was null or undefined when calling getSlots.'); + } + const localVarPath = `/api/v1/agents/{agentId}/slots` + .replace(`{${"agentId"}}`, encodeURIComponent(String(agentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get health of Determined and the dependencies. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + health(options: any = {}): FetchArgs { + const localVarPath = `/health`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream master logs. + * @param {number} [offset] Skip the number of master logs before returning results. Negative values denote number of master logs to skip from the end before returning results. + * @param {number} [limit] Limit the number of master logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the master stops or the limit is reached. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + masterLogs(offset?: number, limit?: number, follow?: boolean, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/master/logs`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Patch master config. + * @param {V1PatchMasterConfigRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchMasterConfig(body: V1PatchMasterConfigRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchMasterConfig.'); + } + const localVarPath = `/api/v1/master/config`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get an aggregated view of resource allocation during the given time period. + * @param {string} startDate The first day to consider (the exact time is midnight UTC at the beginning of the day). + * @param {string} endDate The last day to consider (the exact time is midnight UTC at the end of the day). + * @param {V1ResourceAllocationAggregationPeriod} period The period over which to perform aggregation. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_DAILY: Aggregation by day. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_MONTHLY: Aggregation by month. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resourceAllocationAggregated(startDate: string, endDate: string, period: V1ResourceAllocationAggregationPeriod, options: any = {}): FetchArgs { + // verify required parameter 'startDate' is not null or undefined + if (startDate === null || startDate === undefined) { + throw new RequiredError('startDate','Required parameter startDate was null or undefined when calling resourceAllocationAggregated.'); + } + // verify required parameter 'endDate' is not null or undefined + if (endDate === null || endDate === undefined) { + throw new RequiredError('endDate','Required parameter endDate was null or undefined when calling resourceAllocationAggregated.'); + } + // verify required parameter 'period' is not null or undefined + if (period === null || period === undefined) { + throw new RequiredError('period','Required parameter period was null or undefined when calling resourceAllocationAggregated.'); + } + const localVarPath = `/api/v1/resources/allocation/aggregated`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (startDate !== undefined) { + localVarQueryParameter['startDate'] = startDate + } + + if (endDate !== undefined) { + localVarQueryParameter['endDate'] = endDate + } + + if (period !== undefined) { + localVarQueryParameter['period'] = period + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a detailed view of resource allocation during the given time period. + * @param {Date | DateString} timestampAfter The start of the period to consider. + * @param {Date | DateString} timestampBefore The end of the period to consider. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resourceAllocationRaw(timestampAfter: Date | DateString, timestampBefore: Date | DateString, options: any = {}): FetchArgs { + // verify required parameter 'timestampAfter' is not null or undefined + if (timestampAfter === null || timestampAfter === undefined) { + throw new RequiredError('timestampAfter','Required parameter timestampAfter was null or undefined when calling resourceAllocationRaw.'); + } + // verify required parameter 'timestampBefore' is not null or undefined + if (timestampBefore === null || timestampBefore === undefined) { + throw new RequiredError('timestampBefore','Required parameter timestampBefore was null or undefined when calling resourceAllocationRaw.'); + } + const localVarPath = `/api/v1/resources/allocation/raw`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (timestampAfter) { + localVarQueryParameter['timestampAfter'] = typeof timestampAfter === "string" ? timestampAfter : timestampAfter.toISOString() + } + + if (timestampBefore) { + localVarQueryParameter['timestampBefore'] = typeof timestampBefore === "string" ? timestampBefore : timestampBefore.toISOString() + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. + * @param {V1SetClusterMessageRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setClusterMessage(body: V1SetClusterMessageRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling setClusterMessage.'); + } + const localVarPath = `/api/v1/master/cluster_message`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); +/** + * ClusterApi - functional programming interface + * @export + */ +export const ClusterApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Clear the cluster-wide message shown to all users. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteClusterMessage(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).deleteClusterMessage(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Disable the agent. + * @param {string} agentId The id of the agent. + * @param {V1DisableAgentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + disableAgent(agentId: string, body: V1DisableAgentRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).disableAgent(agentId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Disable the slot. + * @param {string} agentId The id of the agent. + * @param {string} slotId The id of the slot. + * @param {V1DisableSlotRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + disableSlot(agentId: string, slotId: string, body: V1DisableSlotRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).disableSlot(agentId, slotId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Enable the agent. + * @param {string} agentId The id of the agent. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + enableAgent(agentId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).enableAgent(agentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Enable the slot. + * @param {string} agentId The id of the agent. + * @param {string} slotId The id of the slot. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + enableSlot(agentId: string, slotId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).enableSlot(agentId, slotId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested agent. + * @param {string} agentId The id of the agent. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAgent(agentId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getAgent(agentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a set of agents from the cluster. + * @param {V1GetAgentsRequestSortBy} [sortBy] Sort agents by the given field. - SORT_BY_UNSPECIFIED: Returns agents in an unsorted list. - SORT_BY_ID: Returns agents sorted by id. - SORT_BY_TIME: Returns agents sorted by time. + * @param {V1OrderBy} [orderBy] Order agents in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of agents before returning results. Negative values denote number of agents to skip from the end before returning results. + * @param {number} [limit] Limit the number of agents. A value of 0 denotes no limit. + * @param {string} [label] This field has been deprecated and will be ignored. + * @param {boolean} [excludeSlots] exclude slots. + * @param {boolean} [excludeContainers] exclude containers. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAgents(sortBy?: V1GetAgentsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, label?: string, excludeSlots?: boolean, excludeContainers?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getAgents(sortBy, orderBy, offset, limit, label, excludeSlots, excludeContainers, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the currently configured cluster-wide message. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getClusterMessage(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getClusterMessage(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get master information. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMaster(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getMaster(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get master config. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMasterConfig(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getMasterConfig(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested slot for an agent. + * @param {string} agentId The id of the agent. + * @param {string} slotId The id of the slot. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSlot(agentId: string, slotId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getSlot(agentId, slotId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get all the slots for an agent. + * @param {string} agentId The id of the agent. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSlots(agentId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getSlots(agentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get health of Determined and the dependencies. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + health(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).health(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream master logs. + * @param {number} [offset] Skip the number of master logs before returning results. Negative values denote number of master logs to skip from the end before returning results. + * @param {number} [limit] Limit the number of master logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the master stops or the limit is reached. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + masterLogs(offset?: number, limit?: number, follow?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).masterLogs(offset, limit, follow, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Patch master config. + * @param {V1PatchMasterConfigRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchMasterConfig(body: V1PatchMasterConfigRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).patchMasterConfig(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get an aggregated view of resource allocation during the given time period. + * @param {string} startDate The first day to consider (the exact time is midnight UTC at the beginning of the day). + * @param {string} endDate The last day to consider (the exact time is midnight UTC at the end of the day). + * @param {V1ResourceAllocationAggregationPeriod} period The period over which to perform aggregation. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_DAILY: Aggregation by day. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_MONTHLY: Aggregation by month. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resourceAllocationAggregated(startDate: string, endDate: string, period: V1ResourceAllocationAggregationPeriod, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).resourceAllocationAggregated(startDate, endDate, period, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a detailed view of resource allocation during the given time period. + * @param {Date | DateString} timestampAfter The start of the period to consider. + * @param {Date | DateString} timestampBefore The end of the period to consider. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resourceAllocationRaw(timestampAfter: Date | DateString, timestampBefore: Date | DateString, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).resourceAllocationRaw(timestampAfter, timestampBefore, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. + * @param {V1SetClusterMessageRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setClusterMessage(body: V1SetClusterMessageRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).setClusterMessage(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; +/** + * ClusterApi - factory interface + * @export + */ +export const ClusterApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Clear the cluster-wide message shown to all users. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteClusterMessage(options?: any) { + return ClusterApiFp(configuration).deleteClusterMessage(options)(fetch, basePath); + }, + /** + * + * @summary Disable the agent. + * @param {string} agentId The id of the agent. + * @param {V1DisableAgentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + disableAgent(agentId: string, body: V1DisableAgentRequest, options?: any) { + return ClusterApiFp(configuration).disableAgent(agentId, body, options)(fetch, basePath); + }, + /** + * + * @summary Disable the slot. + * @param {string} agentId The id of the agent. + * @param {string} slotId The id of the slot. + * @param {V1DisableSlotRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + disableSlot(agentId: string, slotId: string, body: V1DisableSlotRequest, options?: any) { + return ClusterApiFp(configuration).disableSlot(agentId, slotId, body, options)(fetch, basePath); + }, + /** + * + * @summary Enable the agent. + * @param {string} agentId The id of the agent. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + enableAgent(agentId: string, options?: any) { + return ClusterApiFp(configuration).enableAgent(agentId, options)(fetch, basePath); + }, + /** + * + * @summary Enable the slot. + * @param {string} agentId The id of the agent. + * @param {string} slotId The id of the slot. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + enableSlot(agentId: string, slotId: string, options?: any) { + return ClusterApiFp(configuration).enableSlot(agentId, slotId, options)(fetch, basePath); + }, + /** + * + * @summary Get the requested agent. + * @param {string} agentId The id of the agent. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAgent(agentId: string, options?: any) { + return ClusterApiFp(configuration).getAgent(agentId, options)(fetch, basePath); + }, + /** + * + * @summary Get a set of agents from the cluster. + * @param {V1GetAgentsRequestSortBy} [sortBy] Sort agents by the given field. - SORT_BY_UNSPECIFIED: Returns agents in an unsorted list. - SORT_BY_ID: Returns agents sorted by id. - SORT_BY_TIME: Returns agents sorted by time. + * @param {V1OrderBy} [orderBy] Order agents in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of agents before returning results. Negative values denote number of agents to skip from the end before returning results. + * @param {number} [limit] Limit the number of agents. A value of 0 denotes no limit. + * @param {string} [label] This field has been deprecated and will be ignored. + * @param {boolean} [excludeSlots] exclude slots. + * @param {boolean} [excludeContainers] exclude containers. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAgents(sortBy?: V1GetAgentsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, label?: string, excludeSlots?: boolean, excludeContainers?: boolean, options?: any) { + return ClusterApiFp(configuration).getAgents(sortBy, orderBy, offset, limit, label, excludeSlots, excludeContainers, options)(fetch, basePath); + }, + /** + * + * @summary Get the currently configured cluster-wide message. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getClusterMessage(options?: any) { + return ClusterApiFp(configuration).getClusterMessage(options)(fetch, basePath); + }, + /** + * + * @summary Get master information. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMaster(options?: any) { + return ClusterApiFp(configuration).getMaster(options)(fetch, basePath); + }, + /** + * + * @summary Get master config. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMasterConfig(options?: any) { + return ClusterApiFp(configuration).getMasterConfig(options)(fetch, basePath); + }, + /** + * + * @summary Get the requested slot for an agent. + * @param {string} agentId The id of the agent. + * @param {string} slotId The id of the slot. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSlot(agentId: string, slotId: string, options?: any) { + return ClusterApiFp(configuration).getSlot(agentId, slotId, options)(fetch, basePath); + }, + /** + * + * @summary Get all the slots for an agent. + * @param {string} agentId The id of the agent. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSlots(agentId: string, options?: any) { + return ClusterApiFp(configuration).getSlots(agentId, options)(fetch, basePath); + }, + /** + * + * @summary Get health of Determined and the dependencies. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + health(options?: any) { + return ClusterApiFp(configuration).health(options)(fetch, basePath); + }, + /** + * + * @summary Stream master logs. + * @param {number} [offset] Skip the number of master logs before returning results. Negative values denote number of master logs to skip from the end before returning results. + * @param {number} [limit] Limit the number of master logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the master stops or the limit is reached. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + masterLogs(offset?: number, limit?: number, follow?: boolean, options?: any) { + return ClusterApiFp(configuration).masterLogs(offset, limit, follow, options)(fetch, basePath); + }, + /** + * + * @summary Patch master config. + * @param {V1PatchMasterConfigRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchMasterConfig(body: V1PatchMasterConfigRequest, options?: any) { + return ClusterApiFp(configuration).patchMasterConfig(body, options)(fetch, basePath); + }, + /** + * + * @summary Get an aggregated view of resource allocation during the given time period. + * @param {string} startDate The first day to consider (the exact time is midnight UTC at the beginning of the day). + * @param {string} endDate The last day to consider (the exact time is midnight UTC at the end of the day). + * @param {V1ResourceAllocationAggregationPeriod} period The period over which to perform aggregation. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_DAILY: Aggregation by day. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_MONTHLY: Aggregation by month. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resourceAllocationAggregated(startDate: string, endDate: string, period: V1ResourceAllocationAggregationPeriod, options?: any) { + return ClusterApiFp(configuration).resourceAllocationAggregated(startDate, endDate, period, options)(fetch, basePath); + }, + /** + * + * @summary Get a detailed view of resource allocation during the given time period. + * @param {Date | DateString} timestampAfter The start of the period to consider. + * @param {Date | DateString} timestampBefore The end of the period to consider. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resourceAllocationRaw(timestampAfter: Date | DateString, timestampBefore: Date | DateString, options?: any) { + return ClusterApiFp(configuration).resourceAllocationRaw(timestampAfter, timestampBefore, options)(fetch, basePath); + }, + /** + * + * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. + * @param {V1SetClusterMessageRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setClusterMessage(body: V1SetClusterMessageRequest, options?: any) { + return ClusterApiFp(configuration).setClusterMessage(body, options)(fetch, basePath); + }, + } }; /** - * CheckpointsApi - functional programming interface + * ClusterApi - object-oriented interface * @export + * @class + * @extends {BaseAPI} */ -export const CheckpointsApiFp = function (configuration?: Configuration) { - return { +export class ClusterApi extends BaseAPI { /** - * - * @summary Remove files from checkpoints. - * @param {V1CheckpointsRemoveFilesRequest} body + * + * @summary Clear the cluster-wide message shown to all users. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - checkpointsRemoveFiles( - body: V1CheckpointsRemoveFilesRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CheckpointsApiFetchParamCreator( - configuration, - ).checkpointsRemoveFiles(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Delete Checkpoints. - * @param {V1DeleteCheckpointsRequest} body + public deleteClusterMessage(options?: any) { + return ClusterApiFp(this.configuration).deleteClusterMessage(options)(this.fetch, this.basePath) + } + + /** + * + * @summary Disable the agent. + * @param {string} agentId The id of the agent. + * @param {V1DisableAgentRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - deleteCheckpoints( - body: V1DeleteCheckpointsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CheckpointsApiFetchParamCreator(configuration).deleteCheckpoints( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the requested checkpoint. - * @param {string} checkpointUuid The uuid for the requested checkpoint. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getCheckpoint( - checkpointUuid: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CheckpointsApiFetchParamCreator(configuration).getCheckpoint( - checkpointUuid, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Update checkpoint metadata. - * @param {string} checkpointUuid UUID of the checkpoint. - * @param {V1PostCheckpointMetadataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postCheckpointMetadata( - checkpointUuid: string, - body: V1PostCheckpointMetadataRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CheckpointsApiFetchParamCreator( - configuration, - ).postCheckpointMetadata(checkpointUuid, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * CheckpointsApi - factory interface - * @export - */ -export const CheckpointsApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Remove files from checkpoints. - * @param {V1CheckpointsRemoveFilesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - checkpointsRemoveFiles(body: V1CheckpointsRemoveFilesRequest, options?: any) { - return CheckpointsApiFp(configuration).checkpointsRemoveFiles(body, options)(fetch, basePath); - }, - /** - * - * @summary Delete Checkpoints. - * @param {V1DeleteCheckpointsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteCheckpoints(body: V1DeleteCheckpointsRequest, options?: any) { - return CheckpointsApiFp(configuration).deleteCheckpoints(body, options)(fetch, basePath); - }, - /** - * - * @summary Get the requested checkpoint. - * @param {string} checkpointUuid The uuid for the requested checkpoint. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getCheckpoint(checkpointUuid: string, options?: any) { - return CheckpointsApiFp(configuration).getCheckpoint(checkpointUuid, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Update checkpoint metadata. - * @param {string} checkpointUuid UUID of the checkpoint. - * @param {V1PostCheckpointMetadataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postCheckpointMetadata( - checkpointUuid: string, - body: V1PostCheckpointMetadataRequest, - options?: any, - ) { - return CheckpointsApiFp(configuration).postCheckpointMetadata( - checkpointUuid, - body, - options, - )(fetch, basePath); - }, - }; -}; - -/** - * CheckpointsApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class CheckpointsApi extends BaseAPI { - /** - * - * @summary Remove files from checkpoints. - * @param {V1CheckpointsRemoveFilesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CheckpointsApi - */ - public checkpointsRemoveFiles(body: V1CheckpointsRemoveFilesRequest, options?: any) { - return CheckpointsApiFp(this.configuration).checkpointsRemoveFiles(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Delete Checkpoints. - * @param {V1DeleteCheckpointsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CheckpointsApi - */ - public deleteCheckpoints(body: V1DeleteCheckpointsRequest, options?: any) { - return CheckpointsApiFp(this.configuration).deleteCheckpoints(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get the requested checkpoint. - * @param {string} checkpointUuid The uuid for the requested checkpoint. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CheckpointsApi - */ - public getCheckpoint(checkpointUuid: string, options?: any) { - return CheckpointsApiFp(this.configuration).getCheckpoint(checkpointUuid, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Update checkpoint metadata. - * @param {string} checkpointUuid UUID of the checkpoint. - * @param {V1PostCheckpointMetadataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CheckpointsApi - */ - public postCheckpointMetadata( - checkpointUuid: string, - body: V1PostCheckpointMetadataRequest, - options?: any, - ) { - return CheckpointsApiFp(this.configuration).postCheckpointMetadata( - checkpointUuid, - body, - options, - )(this.fetch, this.basePath); - } -} - -/** - * ClusterApi - fetch parameter creator - * @export - */ -export const ClusterApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Clear the cluster-wide message shown to all users. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteClusterMessage(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/master/cluster_message`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Disable the agent. - * @param {string} agentId The id of the agent. - * @param {V1DisableAgentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - disableAgent(agentId: string, body: V1DisableAgentRequest, options: any = {}): FetchArgs { - // verify required parameter 'agentId' is not null or undefined - if (agentId === null || agentId === undefined) { - throw new RequiredError( - 'agentId', - 'Required parameter agentId was null or undefined when calling disableAgent.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling disableAgent.', - ); - } - const localVarPath = `/api/v1/agents/{agentId}/disable`.replace( - `{${'agentId'}}`, - encodeURIComponent(String(agentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public disableAgent(agentId: string, body: V1DisableAgentRequest, options?: any) { + return ClusterApiFp(this.configuration).disableAgent(agentId, body, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Disable the slot. * @param {string} agentId The id of the agent. * @param {string} slotId The id of the slot. * @param {V1DisableSlotRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - disableSlot( - agentId: string, - slotId: string, - body: V1DisableSlotRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'agentId' is not null or undefined - if (agentId === null || agentId === undefined) { - throw new RequiredError( - 'agentId', - 'Required parameter agentId was null or undefined when calling disableSlot.', - ); - } - // verify required parameter 'slotId' is not null or undefined - if (slotId === null || slotId === undefined) { - throw new RequiredError( - 'slotId', - 'Required parameter slotId was null or undefined when calling disableSlot.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling disableSlot.', - ); - } - const localVarPath = `/api/v1/agents/{agentId}/slots/{slotId}/disable` - .replace(`{${'agentId'}}`, encodeURIComponent(String(agentId))) - .replace(`{${'slotId'}}`, encodeURIComponent(String(slotId))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public disableSlot(agentId: string, slotId: string, body: V1DisableSlotRequest, options?: any) { + return ClusterApiFp(this.configuration).disableSlot(agentId, slotId, body, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Enable the agent. * @param {string} agentId The id of the agent. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - enableAgent(agentId: string, options: any = {}): FetchArgs { - // verify required parameter 'agentId' is not null or undefined - if (agentId === null || agentId === undefined) { - throw new RequiredError( - 'agentId', - 'Required parameter agentId was null or undefined when calling enableAgent.', - ); - } - const localVarPath = `/api/v1/agents/{agentId}/enable`.replace( - `{${'agentId'}}`, - encodeURIComponent(String(agentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public enableAgent(agentId: string, options?: any) { + return ClusterApiFp(this.configuration).enableAgent(agentId, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Enable the slot. * @param {string} agentId The id of the agent. * @param {string} slotId The id of the slot. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - enableSlot(agentId: string, slotId: string, options: any = {}): FetchArgs { - // verify required parameter 'agentId' is not null or undefined - if (agentId === null || agentId === undefined) { - throw new RequiredError( - 'agentId', - 'Required parameter agentId was null or undefined when calling enableSlot.', - ); - } - // verify required parameter 'slotId' is not null or undefined - if (slotId === null || slotId === undefined) { - throw new RequiredError( - 'slotId', - 'Required parameter slotId was null or undefined when calling enableSlot.', - ); - } - const localVarPath = `/api/v1/agents/{agentId}/slots/{slotId}/enable` - .replace(`{${'agentId'}}`, encodeURIComponent(String(agentId))) - .replace(`{${'slotId'}}`, encodeURIComponent(String(slotId))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public enableSlot(agentId: string, slotId: string, options?: any) { + return ClusterApiFp(this.configuration).enableSlot(agentId, slotId, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get the requested agent. * @param {string} agentId The id of the agent. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - getAgent(agentId: string, options: any = {}): FetchArgs { - // verify required parameter 'agentId' is not null or undefined - if (agentId === null || agentId === undefined) { - throw new RequiredError( - 'agentId', - 'Required parameter agentId was null or undefined when calling getAgent.', - ); - } - const localVarPath = `/api/v1/agents/{agentId}`.replace( - `{${'agentId'}}`, - encodeURIComponent(String(agentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getAgent(agentId: string, options?: any) { + return ClusterApiFp(this.configuration).getAgent(agentId, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get a set of agents from the cluster. * @param {V1GetAgentsRequestSortBy} [sortBy] Sort agents by the given field. - SORT_BY_UNSPECIFIED: Returns agents in an unsorted list. - SORT_BY_ID: Returns agents sorted by id. - SORT_BY_TIME: Returns agents sorted by time. * @param {V1OrderBy} [orderBy] Order agents in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. @@ -13210,5881 +14277,11977 @@ export const ClusterApiFetchParamCreator = function (configuration?: Configurati * @param {boolean} [excludeContainers] exclude containers. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - getAgents( - sortBy?: V1GetAgentsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - label?: string, - excludeSlots?: boolean, - excludeContainers?: boolean, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/agents`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (label !== undefined) { - localVarQueryParameter['label'] = label; - } - - if (excludeSlots !== undefined) { - localVarQueryParameter['excludeSlots'] = excludeSlots; - } - - if (excludeContainers !== undefined) { - localVarQueryParameter['excludeContainers'] = excludeContainers; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getAgents(sortBy?: V1GetAgentsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, label?: string, excludeSlots?: boolean, excludeContainers?: boolean, options?: any) { + return ClusterApiFp(this.configuration).getAgents(sortBy, orderBy, offset, limit, label, excludeSlots, excludeContainers, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get the currently configured cluster-wide message. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - getClusterMessage(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/master/cluster_message`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getClusterMessage(options?: any) { + return ClusterApiFp(this.configuration).getClusterMessage(options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get master information. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - getMaster(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/master`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getMaster(options?: any) { + return ClusterApiFp(this.configuration).getMaster(options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get master config. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - getMasterConfig(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/master/config`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getMasterConfig(options?: any) { + return ClusterApiFp(this.configuration).getMasterConfig(options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get the requested slot for an agent. * @param {string} agentId The id of the agent. * @param {string} slotId The id of the slot. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - getSlot(agentId: string, slotId: string, options: any = {}): FetchArgs { - // verify required parameter 'agentId' is not null or undefined - if (agentId === null || agentId === undefined) { - throw new RequiredError( - 'agentId', - 'Required parameter agentId was null or undefined when calling getSlot.', - ); - } - // verify required parameter 'slotId' is not null or undefined - if (slotId === null || slotId === undefined) { - throw new RequiredError( - 'slotId', - 'Required parameter slotId was null or undefined when calling getSlot.', - ); - } - const localVarPath = `/api/v1/agents/{agentId}/slots/{slotId}` - .replace(`{${'agentId'}}`, encodeURIComponent(String(agentId))) - .replace(`{${'slotId'}}`, encodeURIComponent(String(slotId))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getSlot(agentId: string, slotId: string, options?: any) { + return ClusterApiFp(this.configuration).getSlot(agentId, slotId, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get all the slots for an agent. * @param {string} agentId The id of the agent. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - getSlots(agentId: string, options: any = {}): FetchArgs { - // verify required parameter 'agentId' is not null or undefined - if (agentId === null || agentId === undefined) { - throw new RequiredError( - 'agentId', - 'Required parameter agentId was null or undefined when calling getSlots.', - ); - } - const localVarPath = `/api/v1/agents/{agentId}/slots`.replace( - `{${'agentId'}}`, - encodeURIComponent(String(agentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getSlots(agentId: string, options?: any) { + return ClusterApiFp(this.configuration).getSlots(agentId, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get health of Determined and the dependencies. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - health(options: any = {}): FetchArgs { - const localVarPath = `/health`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public health(options?: any) { + return ClusterApiFp(this.configuration).health(options)(this.fetch, this.basePath) + } + /** - * + * * @summary Stream master logs. * @param {number} [offset] Skip the number of master logs before returning results. Negative values denote number of master logs to skip from the end before returning results. * @param {number} [limit] Limit the number of master logs. A value of 0 denotes no limit. * @param {boolean} [follow] Continue following logs until the master stops or the limit is reached. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - masterLogs(offset?: number, limit?: number, follow?: boolean, options: any = {}): FetchArgs { - const localVarPath = `/api/v1/master/logs`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public masterLogs(offset?: number, limit?: number, follow?: boolean, options?: any) { + return ClusterApiFp(this.configuration).masterLogs(offset, limit, follow, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Patch master config. * @param {V1PatchMasterConfigRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - patchMasterConfig(body: V1PatchMasterConfigRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchMasterConfig.', - ); - } - const localVarPath = `/api/v1/master/config`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public patchMasterConfig(body: V1PatchMasterConfigRequest, options?: any) { + return ClusterApiFp(this.configuration).patchMasterConfig(body, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get an aggregated view of resource allocation during the given time period. * @param {string} startDate The first day to consider (the exact time is midnight UTC at the beginning of the day). * @param {string} endDate The last day to consider (the exact time is midnight UTC at the end of the day). * @param {V1ResourceAllocationAggregationPeriod} period The period over which to perform aggregation. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_DAILY: Aggregation by day. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_MONTHLY: Aggregation by month. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - resourceAllocationAggregated( - startDate: string, - endDate: string, - period: V1ResourceAllocationAggregationPeriod, - options: any = {}, - ): FetchArgs { - // verify required parameter 'startDate' is not null or undefined - if (startDate === null || startDate === undefined) { - throw new RequiredError( - 'startDate', - 'Required parameter startDate was null or undefined when calling resourceAllocationAggregated.', - ); - } - // verify required parameter 'endDate' is not null or undefined - if (endDate === null || endDate === undefined) { - throw new RequiredError( - 'endDate', - 'Required parameter endDate was null or undefined when calling resourceAllocationAggregated.', - ); - } - // verify required parameter 'period' is not null or undefined - if (period === null || period === undefined) { - throw new RequiredError( - 'period', - 'Required parameter period was null or undefined when calling resourceAllocationAggregated.', - ); - } - const localVarPath = `/api/v1/resources/allocation/aggregated`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (startDate !== undefined) { - localVarQueryParameter['startDate'] = startDate; - } - - if (endDate !== undefined) { - localVarQueryParameter['endDate'] = endDate; - } - - if (period !== undefined) { - localVarQueryParameter['period'] = period; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public resourceAllocationAggregated(startDate: string, endDate: string, period: V1ResourceAllocationAggregationPeriod, options?: any) { + return ClusterApiFp(this.configuration).resourceAllocationAggregated(startDate, endDate, period, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get a detailed view of resource allocation during the given time period. * @param {Date | DateString} timestampAfter The start of the period to consider. * @param {Date | DateString} timestampBefore The end of the period to consider. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - resourceAllocationRaw( - timestampAfter: Date | DateString, - timestampBefore: Date | DateString, - options: any = {}, - ): FetchArgs { - // verify required parameter 'timestampAfter' is not null or undefined - if (timestampAfter === null || timestampAfter === undefined) { - throw new RequiredError( - 'timestampAfter', - 'Required parameter timestampAfter was null or undefined when calling resourceAllocationRaw.', - ); - } - // verify required parameter 'timestampBefore' is not null or undefined - if (timestampBefore === null || timestampBefore === undefined) { - throw new RequiredError( - 'timestampBefore', - 'Required parameter timestampBefore was null or undefined when calling resourceAllocationRaw.', - ); - } - const localVarPath = `/api/v1/resources/allocation/raw`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (timestampAfter) { - localVarQueryParameter['timestampAfter'] = - typeof timestampAfter === 'string' ? timestampAfter : timestampAfter.toISOString(); - } - - if (timestampBefore) { - localVarQueryParameter['timestampBefore'] = - typeof timestampBefore === 'string' ? timestampBefore : timestampBefore.toISOString(); - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public resourceAllocationRaw(timestampAfter: Date | DateString, timestampBefore: Date | DateString, options?: any) { + return ClusterApiFp(this.configuration).resourceAllocationRaw(timestampAfter, timestampBefore, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. * @param {V1SetClusterMessageRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ClusterApi */ - setClusterMessage(body: V1SetClusterMessageRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling setClusterMessage.', - ); - } - const localVarPath = `/api/v1/master/cluster_message`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } + public setClusterMessage(body: V1SetClusterMessageRequest, options?: any) { + return ClusterApiFp(this.configuration).setClusterMessage(body, options)(this.fetch, this.basePath) + } + +} - localVarHeaderParameter['Content-Type'] = 'application/json'; +/** + * CommandsApi - fetch parameter creator + * @export + */ +export const CommandsApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the requested command. + * @param {string} commandId The id of the command. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCommand(commandId: string, options: any = {}): FetchArgs { + // verify required parameter 'commandId' is not null or undefined + if (commandId === null || commandId === undefined) { + throw new RequiredError('commandId','Required parameter commandId was null or undefined when calling getCommand.'); + } + const localVarPath = `/api/v1/commands/{commandId}` + .replace(`{${"commandId"}}`, encodeURIComponent(String(commandId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of commands. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort commands by the given field. - SORT_BY_UNSPECIFIED: Returns commands in an unsorted list. - SORT_BY_ID: Returns commands sorted by id. - SORT_BY_DESCRIPTION: Returns commands sorted by description. - SORT_BY_START_TIME: Return commands sorted by start time. - SORT_BY_WORKSPACE_ID: Return commands sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order commands in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of commands before returning results. Negative values denote number of commands to skip from the end before returning results. + * @param {number} [limit] Limit the number of commands. A value of 0 denotes no limit. + * @param {Array} [users] Limit commands to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit commands to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit commands to those within a specific workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCommands(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/commands`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (users) { + localVarQueryParameter['users'] = users + } + + if (userIds) { + localVarQueryParameter['userIds'] = userIds + } + + if (workspaceId !== undefined) { + localVarQueryParameter['workspaceId'] = workspaceId + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Kill the requested command. + * @param {string} commandId The id of the command. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killCommand(commandId: string, options: any = {}): FetchArgs { + // verify required parameter 'commandId' is not null or undefined + if (commandId === null || commandId === undefined) { + throw new RequiredError('commandId','Required parameter commandId was null or undefined when calling killCommand.'); + } + const localVarPath = `/api/v1/commands/{commandId}/kill` + .replace(`{${"commandId"}}`, encodeURIComponent(String(commandId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Launch a command. + * @param {V1LaunchCommandRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchCommand(body: V1LaunchCommandRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling launchCommand.'); + } + const localVarPath = `/api/v1/commands`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Set the priority of the requested command. + * @param {string} commandId The id of the command. + * @param {V1SetCommandPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setCommandPriority(commandId: string, body: V1SetCommandPriorityRequest, options: any = {}): FetchArgs { + // verify required parameter 'commandId' is not null or undefined + if (commandId === null || commandId === undefined) { + throw new RequiredError('commandId','Required parameter commandId was null or undefined when calling setCommandPriority.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling setCommandPriority.'); + } + const localVarPath = `/api/v1/commands/{commandId}/set_priority` + .replace(`{${"commandId"}}`, encodeURIComponent(String(commandId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); +/** + * CommandsApi - functional programming interface + * @export + */ +export const CommandsApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the requested command. + * @param {string} commandId The id of the command. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCommand(commandId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CommandsApiFetchParamCreator(configuration).getCommand(commandId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of commands. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort commands by the given field. - SORT_BY_UNSPECIFIED: Returns commands in an unsorted list. - SORT_BY_ID: Returns commands sorted by id. - SORT_BY_DESCRIPTION: Returns commands sorted by description. - SORT_BY_START_TIME: Return commands sorted by start time. - SORT_BY_WORKSPACE_ID: Return commands sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order commands in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of commands before returning results. Negative values denote number of commands to skip from the end before returning results. + * @param {number} [limit] Limit the number of commands. A value of 0 denotes no limit. + * @param {Array} [users] Limit commands to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit commands to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit commands to those within a specific workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCommands(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CommandsApiFetchParamCreator(configuration).getCommands(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Kill the requested command. + * @param {string} commandId The id of the command. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killCommand(commandId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CommandsApiFetchParamCreator(configuration).killCommand(commandId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Launch a command. + * @param {V1LaunchCommandRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchCommand(body: V1LaunchCommandRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CommandsApiFetchParamCreator(configuration).launchCommand(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Set the priority of the requested command. + * @param {string} commandId The id of the command. + * @param {V1SetCommandPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setCommandPriority(commandId: string, body: V1SetCommandPriorityRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = CommandsApiFetchParamCreator(configuration).setCommandPriority(commandId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; +/** + * CommandsApi - factory interface + * @export + */ +export const CommandsApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Get the requested command. + * @param {string} commandId The id of the command. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCommand(commandId: string, options?: any) { + return CommandsApiFp(configuration).getCommand(commandId, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of commands. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort commands by the given field. - SORT_BY_UNSPECIFIED: Returns commands in an unsorted list. - SORT_BY_ID: Returns commands sorted by id. - SORT_BY_DESCRIPTION: Returns commands sorted by description. - SORT_BY_START_TIME: Return commands sorted by start time. - SORT_BY_WORKSPACE_ID: Return commands sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order commands in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of commands before returning results. Negative values denote number of commands to skip from the end before returning results. + * @param {number} [limit] Limit the number of commands. A value of 0 denotes no limit. + * @param {Array} [users] Limit commands to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit commands to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit commands to those within a specific workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCommands(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any) { + return CommandsApiFp(configuration).getCommands(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options)(fetch, basePath); + }, + /** + * + * @summary Kill the requested command. + * @param {string} commandId The id of the command. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killCommand(commandId: string, options?: any) { + return CommandsApiFp(configuration).killCommand(commandId, options)(fetch, basePath); + }, + /** + * + * @summary Launch a command. + * @param {V1LaunchCommandRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchCommand(body: V1LaunchCommandRequest, options?: any) { + return CommandsApiFp(configuration).launchCommand(body, options)(fetch, basePath); + }, + /** + * + * @summary Set the priority of the requested command. + * @param {string} commandId The id of the command. + * @param {V1SetCommandPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setCommandPriority(commandId: string, body: V1SetCommandPriorityRequest, options?: any) { + return CommandsApiFp(configuration).setCommandPriority(commandId, body, options)(fetch, basePath); + }, + } }; /** - * ClusterApi - functional programming interface + * CommandsApi - object-oriented interface * @export + * @class + * @extends {BaseAPI} */ -export const ClusterApiFp = function (configuration?: Configuration) { - return { +export class CommandsApi extends BaseAPI { /** - * - * @summary Clear the cluster-wide message shown to all users. + * + * @summary Get the requested command. + * @param {string} commandId The id of the command. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof CommandsApi */ - deleteClusterMessage( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = - ClusterApiFetchParamCreator(configuration).deleteClusterMessage(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public getCommand(commandId: string, options?: any) { + return CommandsApiFp(this.configuration).getCommand(commandId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Disable the agent. - * @param {string} agentId The id of the agent. - * @param {V1DisableAgentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - disableAgent( - agentId: string, - body: V1DisableAgentRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).disableAgent( - agentId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Disable the slot. - * @param {string} agentId The id of the agent. - * @param {string} slotId The id of the slot. - * @param {V1DisableSlotRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - disableSlot( - agentId: string, - slotId: string, - body: V1DisableSlotRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).disableSlot( - agentId, - slotId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Enable the agent. - * @param {string} agentId The id of the agent. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - enableAgent( - agentId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).enableAgent( - agentId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Enable the slot. - * @param {string} agentId The id of the agent. - * @param {string} slotId The id of the slot. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - enableSlot( - agentId: string, - slotId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).enableSlot( - agentId, - slotId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the requested agent. - * @param {string} agentId The id of the agent. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAgent( - agentId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getAgent( - agentId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a set of agents from the cluster. - * @param {V1GetAgentsRequestSortBy} [sortBy] Sort agents by the given field. - SORT_BY_UNSPECIFIED: Returns agents in an unsorted list. - SORT_BY_ID: Returns agents sorted by id. - SORT_BY_TIME: Returns agents sorted by time. - * @param {V1OrderBy} [orderBy] Order agents in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of agents before returning results. Negative values denote number of agents to skip from the end before returning results. - * @param {number} [limit] Limit the number of agents. A value of 0 denotes no limit. - * @param {string} [label] This field has been deprecated and will be ignored. - * @param {boolean} [excludeSlots] exclude slots. - * @param {boolean} [excludeContainers] exclude containers. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAgents( - sortBy?: V1GetAgentsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - label?: string, - excludeSlots?: boolean, - excludeContainers?: boolean, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getAgents( - sortBy, - orderBy, - offset, - limit, - label, - excludeSlots, - excludeContainers, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the currently configured cluster-wide message. + * + * @summary Get a list of commands. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort commands by the given field. - SORT_BY_UNSPECIFIED: Returns commands in an unsorted list. - SORT_BY_ID: Returns commands sorted by id. - SORT_BY_DESCRIPTION: Returns commands sorted by description. - SORT_BY_START_TIME: Return commands sorted by start time. - SORT_BY_WORKSPACE_ID: Return commands sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order commands in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of commands before returning results. Negative values denote number of commands to skip from the end before returning results. + * @param {number} [limit] Limit the number of commands. A value of 0 denotes no limit. + * @param {Array} [users] Limit commands to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit commands to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit commands to those within a specific workspace, or 0 for all accessible workspaces. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof CommandsApi */ - getClusterMessage( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = - ClusterApiFetchParamCreator(configuration).getClusterMessage(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public getCommands(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any) { + return CommandsApiFp(this.configuration).getCommands(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get master information. + * + * @summary Kill the requested command. + * @param {string} commandId The id of the command. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof CommandsApi */ - getMaster( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getMaster(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public killCommand(commandId: string, options?: any) { + return CommandsApiFp(this.configuration).killCommand(commandId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get master config. + * + * @summary Launch a command. + * @param {V1LaunchCommandRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof CommandsApi */ - getMasterConfig( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getMasterConfig(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public launchCommand(body: V1LaunchCommandRequest, options?: any) { + return CommandsApiFp(this.configuration).launchCommand(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested slot for an agent. - * @param {string} agentId The id of the agent. - * @param {string} slotId The id of the slot. + * + * @summary Set the priority of the requested command. + * @param {string} commandId The id of the command. + * @param {V1SetCommandPriorityRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof CommandsApi */ - getSlot( - agentId: string, - slotId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getSlot( - agentId, - slotId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get all the slots for an agent. - * @param {string} agentId The id of the agent. - * @param {*} [options] Override http request option. + public setCommandPriority(commandId: string, body: V1SetCommandPriorityRequest, options?: any) { + return CommandsApiFp(this.configuration).setCommandPriority(commandId, body, options)(this.fetch, this.basePath) + } + +} + +/** + * ExperimentsApi - fetch parameter creator + * @export + */ +export const ExperimentsApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Activate an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + activateExperiment(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling activateExperiment.'); + } + const localVarPath = `/api/v1/experiments/{id}/activate` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Activate multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1ActivateExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + activateExperiments(projectId: number, body: V1ActivateExperimentsRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling activateExperiments.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling activateExperiments.'); + } + const localVarPath = `/api/v1/projects/{projectId}/experiments/activate` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Archive an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveExperiment(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling archiveExperiment.'); + } + const localVarPath = `/api/v1/experiments/{id}/archive` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Archive multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1ArchiveExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveExperiments(projectId: number, body: V1ArchiveExperimentsRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling archiveExperiments.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling archiveExperiments.'); + } + const localVarPath = `/api/v1/projects/{projectId}/experiments/archive` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Cancel an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelExperiment(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling cancelExperiment.'); + } + const localVarPath = `/api/v1/experiments/{id}/cancel` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Cancel multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1CancelExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelExperiments(projectId: number, body: V1CancelExperimentsRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling cancelExperiments.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling cancelExperiments.'); + } + const localVarPath = `/api/v1/projects/{projectId}/experiments/cancel` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Return a downsampled time series of metrics from multiple trials to compare them side-by-side. + * @param {Array} [trialIds] The requested trial ids. + * @param {number} [maxDatapoints] The maximum number of data points to return after downsampling. + * @param {Array} [metricNames] The names of selected metrics. + * @param {number} [startBatches] Sample from metrics after this batch number. + * @param {number} [endBatches] Sample from metrics before this batch number. + * @param {V1MetricType} [metricType] Metric group. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {Array} [metricIds] metric ids for the query. must be in the form group.metric_name. + * @param {string} [timeSeriesFilterName] metric or column name for the filter. + * @param {number} [timeSeriesFilterDoubleRangeLt] Less than. + * @param {number} [timeSeriesFilterDoubleRangeLte] Less than or equal. + * @param {number} [timeSeriesFilterDoubleRangeGt] Greater than. + * @param {number} [timeSeriesFilterDoubleRangeGte] Greater than or equal. + * @param {number} [timeSeriesFilterIntegerRangeLt] Less than. + * @param {number} [timeSeriesFilterIntegerRangeLte] Less than or equal. + * @param {number} [timeSeriesFilterIntegerRangeGt] Greater than. + * @param {number} [timeSeriesFilterIntegerRangeGte] Greater than or equal. + * @param {Array} [timeSeriesFilterIntegerRangeIncl] In a set. `in` is a reserved word in python. + * @param {Array} [timeSeriesFilterIntegerRangeNotIn] Not in a set. + * @param {Date | DateString} [timeSeriesFilterTimeRangeLt] Less than. + * @param {Date | DateString} [timeSeriesFilterTimeRangeLte] Less than or equal. + * @param {Date | DateString} [timeSeriesFilterTimeRangeGt] Greater than. + * @param {Date | DateString} [timeSeriesFilterTimeRangeGte] Greater than or equal. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + compareTrials(trialIds?: Array, maxDatapoints?: number, metricNames?: Array, startBatches?: number, endBatches?: number, metricType?: V1MetricType, group?: string, metricIds?: Array, timeSeriesFilterName?: string, timeSeriesFilterDoubleRangeLt?: number, timeSeriesFilterDoubleRangeLte?: number, timeSeriesFilterDoubleRangeGt?: number, timeSeriesFilterDoubleRangeGte?: number, timeSeriesFilterIntegerRangeLt?: number, timeSeriesFilterIntegerRangeLte?: number, timeSeriesFilterIntegerRangeGt?: number, timeSeriesFilterIntegerRangeGte?: number, timeSeriesFilterIntegerRangeIncl?: Array, timeSeriesFilterIntegerRangeNotIn?: Array, timeSeriesFilterTimeRangeLt?: Date | DateString, timeSeriesFilterTimeRangeLte?: Date | DateString, timeSeriesFilterTimeRangeGt?: Date | DateString, timeSeriesFilterTimeRangeGte?: Date | DateString, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/trials/time-series`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (trialIds) { + localVarQueryParameter['trialIds'] = trialIds + } + + if (maxDatapoints !== undefined) { + localVarQueryParameter['maxDatapoints'] = maxDatapoints + } + + if (metricNames) { + localVarQueryParameter['metricNames'] = metricNames + } + + if (startBatches !== undefined) { + localVarQueryParameter['startBatches'] = startBatches + } + + if (endBatches !== undefined) { + localVarQueryParameter['endBatches'] = endBatches + } + + if (metricType !== undefined) { + localVarQueryParameter['metricType'] = metricType + } + + if (group !== undefined) { + localVarQueryParameter['group'] = group + } + + if (metricIds) { + localVarQueryParameter['metricIds'] = metricIds + } + + if (timeSeriesFilterName !== undefined) { + localVarQueryParameter['timeSeriesFilter.name'] = timeSeriesFilterName + } + + if (timeSeriesFilterDoubleRangeLt !== undefined) { + localVarQueryParameter['timeSeriesFilter.doubleRange.lt'] = timeSeriesFilterDoubleRangeLt + } + + if (timeSeriesFilterDoubleRangeLte !== undefined) { + localVarQueryParameter['timeSeriesFilter.doubleRange.lte'] = timeSeriesFilterDoubleRangeLte + } + + if (timeSeriesFilterDoubleRangeGt !== undefined) { + localVarQueryParameter['timeSeriesFilter.doubleRange.gt'] = timeSeriesFilterDoubleRangeGt + } + + if (timeSeriesFilterDoubleRangeGte !== undefined) { + localVarQueryParameter['timeSeriesFilter.doubleRange.gte'] = timeSeriesFilterDoubleRangeGte + } + + if (timeSeriesFilterIntegerRangeLt !== undefined) { + localVarQueryParameter['timeSeriesFilter.integerRange.lt'] = timeSeriesFilterIntegerRangeLt + } + + if (timeSeriesFilterIntegerRangeLte !== undefined) { + localVarQueryParameter['timeSeriesFilter.integerRange.lte'] = timeSeriesFilterIntegerRangeLte + } + + if (timeSeriesFilterIntegerRangeGt !== undefined) { + localVarQueryParameter['timeSeriesFilter.integerRange.gt'] = timeSeriesFilterIntegerRangeGt + } + + if (timeSeriesFilterIntegerRangeGte !== undefined) { + localVarQueryParameter['timeSeriesFilter.integerRange.gte'] = timeSeriesFilterIntegerRangeGte + } + + if (timeSeriesFilterIntegerRangeIncl) { + localVarQueryParameter['timeSeriesFilter.integerRange.incl'] = timeSeriesFilterIntegerRangeIncl + } + + if (timeSeriesFilterIntegerRangeNotIn) { + localVarQueryParameter['timeSeriesFilter.integerRange.notIn'] = timeSeriesFilterIntegerRangeNotIn + } + + if (timeSeriesFilterTimeRangeLt) { + localVarQueryParameter['timeSeriesFilter.timeRange.lt'] = typeof timeSeriesFilterTimeRangeLt === "string" ? timeSeriesFilterTimeRangeLt : timeSeriesFilterTimeRangeLt.toISOString() + } + + if (timeSeriesFilterTimeRangeLte) { + localVarQueryParameter['timeSeriesFilter.timeRange.lte'] = typeof timeSeriesFilterTimeRangeLte === "string" ? timeSeriesFilterTimeRangeLte : timeSeriesFilterTimeRangeLte.toISOString() + } + + if (timeSeriesFilterTimeRangeGt) { + localVarQueryParameter['timeSeriesFilter.timeRange.gt'] = typeof timeSeriesFilterTimeRangeGt === "string" ? timeSeriesFilterTimeRangeGt : timeSeriesFilterTimeRangeGt.toISOString() + } + + if (timeSeriesFilterTimeRangeGte) { + localVarQueryParameter['timeSeriesFilter.timeRange.gte'] = typeof timeSeriesFilterTimeRangeGte === "string" ? timeSeriesFilterTimeRangeGte : timeSeriesFilterTimeRangeGte.toISOString() + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Delete the requested experiment. + * @param {number} experimentId The ID of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteExperiment(experimentId: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling deleteExperiment.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Delete a label from the experiment. + * @param {number} experimentId The ID of the experiment. + * @param {string} label The label to delete. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteExperimentLabel(experimentId: number, label: string, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling deleteExperimentLabel.'); + } + // verify required parameter 'label' is not null or undefined + if (label === null || label === undefined) { + throw new RequiredError('label','Required parameter label was null or undefined when calling deleteExperimentLabel.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/labels/{label}` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))) + .replace(`{${"label"}}`, encodeURIComponent(String(label))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Delete multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1DeleteExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteExperiments(projectId: number, body: V1DeleteExperimentsRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling deleteExperiments.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling deleteExperiments.'); + } + const localVarPath = `/api/v1/projects/{projectId}/experiments/delete` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Delete tensorboard files. + * @param {number} experimentId ID of experiment that the tensorboard files are linked to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteTensorboardFiles(experimentId: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling deleteTensorboardFiles.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/tensorboard-files` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperiment(experimentId: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling getExperiment.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of checkpoints for an experiment. + * @param {number} id The experiment id. + * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. + * @param {string} [sortByMetric] Sort by custom validation metric name. + * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. + * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. + * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentCheckpoints(id: number, sortByAttr?: Checkpointv1SortBy, sortByMetric?: string, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling getExperimentCheckpoints.'); + } + const localVarPath = `/api/v1/experiments/{id}/checkpoints` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortByAttr !== undefined) { + localVarQueryParameter['sortByAttr'] = sortByAttr + } + + if (sortByMetric !== undefined) { + localVarQueryParameter['sortByMetric'] = sortByMetric + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (states) { + localVarQueryParameter['states'] = states + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of unique experiment labels (sorted by popularity). + * @param {number} [projectId] Filter experiments by project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentLabels(projectId?: number, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/experiment/labels`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (projectId !== undefined) { + localVarQueryParameter['projectId'] = projectId + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of experiments. + * @param {V1GetExperimentsRequestSortBy} [sortBy] Sort experiments by the given field. - SORT_BY_UNSPECIFIED: Returns experiments in an unsorted list. - SORT_BY_ID: Returns experiments sorted by id. - SORT_BY_DESCRIPTION: Returns experiments sorted by description. - SORT_BY_START_TIME: Return experiments sorted by start time. - SORT_BY_END_TIME: Return experiments sorted by end time. Experiments without end_time are returned after the ones with end_time. - SORT_BY_STATE: Return experiments sorted by state. - SORT_BY_NUM_TRIALS: Return experiments sorted by number of trials. - SORT_BY_PROGRESS: Return experiments sorted by progress. - SORT_BY_USER: Return experiments sorted by user. - SORT_BY_NAME: Returns experiments sorted by name. - SORT_BY_FORKED_FROM: Returns experiments sorted by originating model. - SORT_BY_RESOURCE_POOL: Returns experiments sorted by resource pool. - SORT_BY_PROJECT_ID: Returns experiments sorted by project. - SORT_BY_CHECKPOINT_SIZE: Returns experiments sorted by checkpoint size. - SORT_BY_CHECKPOINT_COUNT: Returns experiments sorted by checkpoint count. - SORT_BY_SEARCHER_METRIC_VAL: Returns experiments sorted by searcher metric value.. + * @param {V1OrderBy} [orderBy] Order experiments in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of experiments before returning results. Negative values denote number of experiments to skip from the end before returning results. + * @param {number} [limit] Limit the number of experiments. 0 or Unspecified - returns a default of 100. -1 - returns everything. -2 - returns pagination info but no experiments. + * @param {string} [description] Limit experiments to those that match the description. + * @param {string} [name] Limit experiments to those that match the name. + * @param {Array} [labels] Limit experiments to those that match the provided labels. + * @param {boolean} [archived] Limit experiments to those that are archived. + * @param {Array} [states] Limit experiments to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * @param {Array} [users] Limit experiments to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit experiments to those that are owned by users with the specified userIds. + * @param {number} [projectId] Limit experiments to those within a specified project, or 0 for all projects. + * @param {number} [experimentIdFilterLt] Less than. + * @param {number} [experimentIdFilterLte] Less than or equal. + * @param {number} [experimentIdFilterGt] Greater than. + * @param {number} [experimentIdFilterGte] Greater than or equal. + * @param {Array} [experimentIdFilterIncl] In a set. `in` is a reserved word in python. + * @param {Array} [experimentIdFilterNotIn] Not in a set. + * @param {boolean} [showTrialData] whether to surface trial specific data from the best trial. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperiments(sortBy?: V1GetExperimentsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, description?: string, name?: string, labels?: Array, archived?: boolean, states?: Array, users?: Array, userIds?: Array, projectId?: number, experimentIdFilterLt?: number, experimentIdFilterLte?: number, experimentIdFilterGt?: number, experimentIdFilterGte?: number, experimentIdFilterIncl?: Array, experimentIdFilterNotIn?: Array, showTrialData?: boolean, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/experiments`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (description !== undefined) { + localVarQueryParameter['description'] = description + } + + if (name !== undefined) { + localVarQueryParameter['name'] = name + } + + if (labels) { + localVarQueryParameter['labels'] = labels + } + + if (archived !== undefined) { + localVarQueryParameter['archived'] = archived + } + + if (states) { + localVarQueryParameter['states'] = states + } + + if (users) { + localVarQueryParameter['users'] = users + } + + if (userIds) { + localVarQueryParameter['userIds'] = userIds + } + + if (projectId !== undefined) { + localVarQueryParameter['projectId'] = projectId + } + + if (experimentIdFilterLt !== undefined) { + localVarQueryParameter['experimentIdFilter.lt'] = experimentIdFilterLt + } + + if (experimentIdFilterLte !== undefined) { + localVarQueryParameter['experimentIdFilter.lte'] = experimentIdFilterLte + } + + if (experimentIdFilterGt !== undefined) { + localVarQueryParameter['experimentIdFilter.gt'] = experimentIdFilterGt + } + + if (experimentIdFilterGte !== undefined) { + localVarQueryParameter['experimentIdFilter.gte'] = experimentIdFilterGte + } + + if (experimentIdFilterIncl) { + localVarQueryParameter['experimentIdFilter.incl'] = experimentIdFilterIncl + } + + if (experimentIdFilterNotIn) { + localVarQueryParameter['experimentIdFilter.notIn'] = experimentIdFilterNotIn + } + + if (showTrialData !== undefined) { + localVarQueryParameter['showTrialData'] = showTrialData + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the list of trials for an experiment. + * @param {number} experimentId Limit trials to those that are owned by the specified experiments. + * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. + * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. + * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. + * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentTrials(experimentId: number, sortBy?: V1GetExperimentTrialsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling getExperimentTrials.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/trials` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (states) { + localVarQueryParameter['states'] = states + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the validation history for an experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentValidationHistory(experimentId: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling getExperimentValidationHistory.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/validation-history` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the model definition of an experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelDef(experimentId: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling getModelDef.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/model_def` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get one file content of model definition of an experiment. + * @param {number} experimentId The id of the experiment. + * @param {V1GetModelDefFileRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelDefFile(experimentId: number, body: V1GetModelDefFileRequest, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling getModelDefFile.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling getModelDefFile.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/file` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the model definition file tree of an experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelDefTree(experimentId: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling getModelDefTree.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/file_tree` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the list of custom searcher events with long polling. + * @param {number} experimentId The ID of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSearcherEvents(experimentId: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling getSearcherEvents.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/searcher_events` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a single trial. + * @param {number} trialId The requested trial's id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrial(trialId: number, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling getTrial.'); + } + const localVarPath = `/api/v1/trials/{trialId}` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of checkpoints for a trial. + * @param {number} id The trial id. + * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. + * @param {string} [sortByMetric] Sort by custom validation metric name. + * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. + * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. + * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialCheckpoints(id: number, sortByAttr?: Checkpointv1SortBy, sortByMetric?: string, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling getTrialCheckpoints.'); + } + const localVarPath = `/api/v1/trials/{id}/checkpoints` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortByAttr !== undefined) { + localVarQueryParameter['sortByAttr'] = sortByAttr + } + + if (sortByMetric !== undefined) { + localVarQueryParameter['sortByMetric'] = sortByMetric + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (states) { + localVarQueryParameter['states'] = states + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Kill an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killExperiment(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling killExperiment.'); + } + const localVarPath = `/api/v1/experiments/{id}/kill` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Kill multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1KillExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killExperiments(projectId: number, body: V1KillExperimentsRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling killExperiments.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling killExperiments.'); + } + const localVarPath = `/api/v1/projects/{projectId}/experiments/kill` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Kill a trial. + * @param {number} id The trial id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killTrial(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling killTrial.'); + } + const localVarPath = `/api/v1/trials/{id}/kill` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Move an experiment into a project. + * @param {number} experimentId The id of the experiment being moved. + * @param {V1MoveExperimentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveExperiment(experimentId: number, body: V1MoveExperimentRequest, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling moveExperiment.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling moveExperiment.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/move` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Move multiple experiments into a project. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1MoveExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveExperiments(projectId: number, body: V1MoveExperimentsRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling moveExperiments.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling moveExperiments.'); + } + const localVarPath = `/api/v1/projects/{projectId}/experiments/move` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Patch an experiment's fields. + * @param {number} experimentId The id of the experiment. + * @param {V1PatchExperiment} body Patched experiment attributes. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchExperiment(experimentId: number, body: V1PatchExperiment, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling patchExperiment.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchExperiment.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Pause an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseExperiment(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling pauseExperiment.'); + } + const localVarPath = `/api/v1/experiments/{id}/pause` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Pause multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1PauseExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseExperiments(projectId: number, body: V1PauseExperimentsRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling pauseExperiments.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling pauseExperiments.'); + } + const localVarPath = `/api/v1/projects/{projectId}/experiments/pause` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Submit operations to a custom searcher. + * @param {number} experimentId The experiment ID. + * @param {V1PostSearcherOperationsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postSearcherOperations(experimentId: number, body: V1PostSearcherOperationsRequest, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling postSearcherOperations.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postSearcherOperations.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/searcher_operations` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Preview hyperparameter search. + * @param {V1PreviewHPSearchRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + previewHPSearch(body: V1PreviewHPSearchRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling previewHPSearch.'); + } + const localVarPath = `/api/v1/preview-hp-search`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Put a new label on the experiment. + * @param {number} experimentId The ID of the experiment. + * @param {string} label The label to add. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperimentLabel(experimentId: number, label: string, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling putExperimentLabel.'); + } + // verify required parameter 'label' is not null or undefined + if (label === null || label === undefined) { + throw new RequiredError('label','Required parameter label was null or undefined when calling putExperimentLabel.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/labels/{label}` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))) + .replace(`{${"label"}}`, encodeURIComponent(String(label))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Retain logs for an experiment. + * @param {number} experimentId The ID of the experiment. + * @param {V1PutExperimentRetainLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperimentRetainLogs(experimentId: number, body: V1PutExperimentRetainLogsRequest, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling putExperimentRetainLogs.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling putExperimentRetainLogs.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/retain_logs` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Retain logs for an experiment. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1PutExperimentsRetainLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperimentsRetainLogs(projectId: number, body: V1PutExperimentsRetainLogsRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling putExperimentsRetainLogs.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling putExperimentsRetainLogs.'); + } + const localVarPath = `/api/v1/projects/{projectId}/experiments/retain_logs` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get experiments with grouping and search syntax + * @param {number} [projectId] ID of the project to look at. + * @param {number} [offset] How many experiments to skip before including in the results. + * @param {number} [limit] How many results to show. + * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). + * @param {string} [filter] Filter expression. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchExperiments(projectId?: number, offset?: number, limit?: number, sort?: string, filter?: string, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/experiments-search`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (projectId !== undefined) { + localVarQueryParameter['projectId'] = projectId + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (sort !== undefined) { + localVarQueryParameter['sort'] = sort + } + + if (filter !== undefined) { + localVarQueryParameter['filter'] = filter + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream trial logs. + * @param {number} trialId The id of the trial. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogs(trialId: number, limit?: number, follow?: boolean, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling trialLogs.'); + } + const localVarPath = `/api/v1/trials/{trialId}/logs` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + if (agentIds) { + localVarQueryParameter['agentIds'] = agentIds + } + + if (containerIds) { + localVarQueryParameter['containerIds'] = containerIds + } + + if (rankIds) { + localVarQueryParameter['rankIds'] = rankIds + } + + if (levels) { + localVarQueryParameter['levels'] = levels + } + + if (stdtypes) { + localVarQueryParameter['stdtypes'] = stdtypes + } + + if (sources) { + localVarQueryParameter['sources'] = sources + } + + if (timestampBefore) { + localVarQueryParameter['timestampBefore'] = typeof timestampBefore === "string" ? timestampBefore : timestampBefore.toISOString() + } + + if (timestampAfter) { + localVarQueryParameter['timestampAfter'] = typeof timestampAfter === "string" ? timestampAfter : timestampAfter.toISOString() + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (searchText !== undefined) { + localVarQueryParameter['searchText'] = searchText + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream trial log fields. + * @param {number} trialId The ID of the trial. + * @param {boolean} [follow] Continue following fields until the trial stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogsFields(trialId: number, follow?: boolean, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling trialLogsFields.'); + } + const localVarPath = `/api/v1/trials/{trialId}/logs/fields` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Unarchive an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveExperiment(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling unarchiveExperiment.'); + } + const localVarPath = `/api/v1/experiments/{id}/unarchive` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Unarchive multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1UnarchiveExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveExperiments(projectId: number, body: V1UnarchiveExperimentsRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling unarchiveExperiments.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling unarchiveExperiments.'); + } + const localVarPath = `/api/v1/projects/{projectId}/experiments/unarchive` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ExperimentsApi - functional programming interface + * @export + */ +export const ExperimentsApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Activate an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + activateExperiment(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).activateExperiment(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Activate multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1ActivateExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + activateExperiments(projectId: number, body: V1ActivateExperimentsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).activateExperiments(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Archive an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveExperiment(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).archiveExperiment(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Archive multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1ArchiveExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveExperiments(projectId: number, body: V1ArchiveExperimentsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).archiveExperiments(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Cancel an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelExperiment(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).cancelExperiment(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Cancel multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1CancelExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelExperiments(projectId: number, body: V1CancelExperimentsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).cancelExperiments(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Return a downsampled time series of metrics from multiple trials to compare them side-by-side. + * @param {Array} [trialIds] The requested trial ids. + * @param {number} [maxDatapoints] The maximum number of data points to return after downsampling. + * @param {Array} [metricNames] The names of selected metrics. + * @param {number} [startBatches] Sample from metrics after this batch number. + * @param {number} [endBatches] Sample from metrics before this batch number. + * @param {V1MetricType} [metricType] Metric group. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {Array} [metricIds] metric ids for the query. must be in the form group.metric_name. + * @param {string} [timeSeriesFilterName] metric or column name for the filter. + * @param {number} [timeSeriesFilterDoubleRangeLt] Less than. + * @param {number} [timeSeriesFilterDoubleRangeLte] Less than or equal. + * @param {number} [timeSeriesFilterDoubleRangeGt] Greater than. + * @param {number} [timeSeriesFilterDoubleRangeGte] Greater than or equal. + * @param {number} [timeSeriesFilterIntegerRangeLt] Less than. + * @param {number} [timeSeriesFilterIntegerRangeLte] Less than or equal. + * @param {number} [timeSeriesFilterIntegerRangeGt] Greater than. + * @param {number} [timeSeriesFilterIntegerRangeGte] Greater than or equal. + * @param {Array} [timeSeriesFilterIntegerRangeIncl] In a set. `in` is a reserved word in python. + * @param {Array} [timeSeriesFilterIntegerRangeNotIn] Not in a set. + * @param {Date | DateString} [timeSeriesFilterTimeRangeLt] Less than. + * @param {Date | DateString} [timeSeriesFilterTimeRangeLte] Less than or equal. + * @param {Date | DateString} [timeSeriesFilterTimeRangeGt] Greater than. + * @param {Date | DateString} [timeSeriesFilterTimeRangeGte] Greater than or equal. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + compareTrials(trialIds?: Array, maxDatapoints?: number, metricNames?: Array, startBatches?: number, endBatches?: number, metricType?: V1MetricType, group?: string, metricIds?: Array, timeSeriesFilterName?: string, timeSeriesFilterDoubleRangeLt?: number, timeSeriesFilterDoubleRangeLte?: number, timeSeriesFilterDoubleRangeGt?: number, timeSeriesFilterDoubleRangeGte?: number, timeSeriesFilterIntegerRangeLt?: number, timeSeriesFilterIntegerRangeLte?: number, timeSeriesFilterIntegerRangeGt?: number, timeSeriesFilterIntegerRangeGte?: number, timeSeriesFilterIntegerRangeIncl?: Array, timeSeriesFilterIntegerRangeNotIn?: Array, timeSeriesFilterTimeRangeLt?: Date | DateString, timeSeriesFilterTimeRangeLte?: Date | DateString, timeSeriesFilterTimeRangeGt?: Date | DateString, timeSeriesFilterTimeRangeGte?: Date | DateString, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).compareTrials(trialIds, maxDatapoints, metricNames, startBatches, endBatches, metricType, group, metricIds, timeSeriesFilterName, timeSeriesFilterDoubleRangeLt, timeSeriesFilterDoubleRangeLte, timeSeriesFilterDoubleRangeGt, timeSeriesFilterDoubleRangeGte, timeSeriesFilterIntegerRangeLt, timeSeriesFilterIntegerRangeLte, timeSeriesFilterIntegerRangeGt, timeSeriesFilterIntegerRangeGte, timeSeriesFilterIntegerRangeIncl, timeSeriesFilterIntegerRangeNotIn, timeSeriesFilterTimeRangeLt, timeSeriesFilterTimeRangeLte, timeSeriesFilterTimeRangeGt, timeSeriesFilterTimeRangeGte, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Delete the requested experiment. + * @param {number} experimentId The ID of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteExperiment(experimentId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).deleteExperiment(experimentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Delete a label from the experiment. + * @param {number} experimentId The ID of the experiment. + * @param {string} label The label to delete. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteExperimentLabel(experimentId: number, label: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).deleteExperimentLabel(experimentId, label, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Delete multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1DeleteExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteExperiments(projectId: number, body: V1DeleteExperimentsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).deleteExperiments(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Delete tensorboard files. + * @param {number} experimentId ID of experiment that the tensorboard files are linked to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteTensorboardFiles(experimentId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).deleteTensorboardFiles(experimentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperiment(experimentId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getExperiment(experimentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of checkpoints for an experiment. + * @param {number} id The experiment id. + * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. + * @param {string} [sortByMetric] Sort by custom validation metric name. + * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. + * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. + * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentCheckpoints(id: number, sortByAttr?: Checkpointv1SortBy, sortByMetric?: string, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getExperimentCheckpoints(id, sortByAttr, sortByMetric, orderBy, offset, limit, states, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of unique experiment labels (sorted by popularity). + * @param {number} [projectId] Filter experiments by project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentLabels(projectId?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getExperimentLabels(projectId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of experiments. + * @param {V1GetExperimentsRequestSortBy} [sortBy] Sort experiments by the given field. - SORT_BY_UNSPECIFIED: Returns experiments in an unsorted list. - SORT_BY_ID: Returns experiments sorted by id. - SORT_BY_DESCRIPTION: Returns experiments sorted by description. - SORT_BY_START_TIME: Return experiments sorted by start time. - SORT_BY_END_TIME: Return experiments sorted by end time. Experiments without end_time are returned after the ones with end_time. - SORT_BY_STATE: Return experiments sorted by state. - SORT_BY_NUM_TRIALS: Return experiments sorted by number of trials. - SORT_BY_PROGRESS: Return experiments sorted by progress. - SORT_BY_USER: Return experiments sorted by user. - SORT_BY_NAME: Returns experiments sorted by name. - SORT_BY_FORKED_FROM: Returns experiments sorted by originating model. - SORT_BY_RESOURCE_POOL: Returns experiments sorted by resource pool. - SORT_BY_PROJECT_ID: Returns experiments sorted by project. - SORT_BY_CHECKPOINT_SIZE: Returns experiments sorted by checkpoint size. - SORT_BY_CHECKPOINT_COUNT: Returns experiments sorted by checkpoint count. - SORT_BY_SEARCHER_METRIC_VAL: Returns experiments sorted by searcher metric value.. + * @param {V1OrderBy} [orderBy] Order experiments in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of experiments before returning results. Negative values denote number of experiments to skip from the end before returning results. + * @param {number} [limit] Limit the number of experiments. 0 or Unspecified - returns a default of 100. -1 - returns everything. -2 - returns pagination info but no experiments. + * @param {string} [description] Limit experiments to those that match the description. + * @param {string} [name] Limit experiments to those that match the name. + * @param {Array} [labels] Limit experiments to those that match the provided labels. + * @param {boolean} [archived] Limit experiments to those that are archived. + * @param {Array} [states] Limit experiments to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * @param {Array} [users] Limit experiments to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit experiments to those that are owned by users with the specified userIds. + * @param {number} [projectId] Limit experiments to those within a specified project, or 0 for all projects. + * @param {number} [experimentIdFilterLt] Less than. + * @param {number} [experimentIdFilterLte] Less than or equal. + * @param {number} [experimentIdFilterGt] Greater than. + * @param {number} [experimentIdFilterGte] Greater than or equal. + * @param {Array} [experimentIdFilterIncl] In a set. `in` is a reserved word in python. + * @param {Array} [experimentIdFilterNotIn] Not in a set. + * @param {boolean} [showTrialData] whether to surface trial specific data from the best trial. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperiments(sortBy?: V1GetExperimentsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, description?: string, name?: string, labels?: Array, archived?: boolean, states?: Array, users?: Array, userIds?: Array, projectId?: number, experimentIdFilterLt?: number, experimentIdFilterLte?: number, experimentIdFilterGt?: number, experimentIdFilterGte?: number, experimentIdFilterIncl?: Array, experimentIdFilterNotIn?: Array, showTrialData?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getExperiments(sortBy, orderBy, offset, limit, description, name, labels, archived, states, users, userIds, projectId, experimentIdFilterLt, experimentIdFilterLte, experimentIdFilterGt, experimentIdFilterGte, experimentIdFilterIncl, experimentIdFilterNotIn, showTrialData, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the list of trials for an experiment. + * @param {number} experimentId Limit trials to those that are owned by the specified experiments. + * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. + * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. + * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. + * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentTrials(experimentId: number, sortBy?: V1GetExperimentTrialsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getExperimentTrials(experimentId, sortBy, orderBy, offset, limit, states, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the validation history for an experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentValidationHistory(experimentId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getExperimentValidationHistory(experimentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the model definition of an experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelDef(experimentId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getModelDef(experimentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get one file content of model definition of an experiment. + * @param {number} experimentId The id of the experiment. + * @param {V1GetModelDefFileRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelDefFile(experimentId: number, body: V1GetModelDefFileRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getModelDefFile(experimentId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the model definition file tree of an experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelDefTree(experimentId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getModelDefTree(experimentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the list of custom searcher events with long polling. + * @param {number} experimentId The ID of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSearcherEvents(experimentId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getSearcherEvents(experimentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a single trial. + * @param {number} trialId The requested trial's id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrial(trialId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getTrial(trialId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of checkpoints for a trial. + * @param {number} id The trial id. + * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. + * @param {string} [sortByMetric] Sort by custom validation metric name. + * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. + * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. + * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialCheckpoints(id: number, sortByAttr?: Checkpointv1SortBy, sortByMetric?: string, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getTrialCheckpoints(id, sortByAttr, sortByMetric, orderBy, offset, limit, states, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Kill an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killExperiment(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).killExperiment(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Kill multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1KillExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killExperiments(projectId: number, body: V1KillExperimentsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).killExperiments(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Kill a trial. + * @param {number} id The trial id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killTrial(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).killTrial(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Move an experiment into a project. + * @param {number} experimentId The id of the experiment being moved. + * @param {V1MoveExperimentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveExperiment(experimentId: number, body: V1MoveExperimentRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).moveExperiment(experimentId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Move multiple experiments into a project. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1MoveExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveExperiments(projectId: number, body: V1MoveExperimentsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).moveExperiments(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Patch an experiment's fields. + * @param {number} experimentId The id of the experiment. + * @param {V1PatchExperiment} body Patched experiment attributes. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchExperiment(experimentId: number, body: V1PatchExperiment, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).patchExperiment(experimentId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Pause an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseExperiment(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).pauseExperiment(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Pause multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1PauseExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseExperiments(projectId: number, body: V1PauseExperimentsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).pauseExperiments(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Submit operations to a custom searcher. + * @param {number} experimentId The experiment ID. + * @param {V1PostSearcherOperationsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postSearcherOperations(experimentId: number, body: V1PostSearcherOperationsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).postSearcherOperations(experimentId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Preview hyperparameter search. + * @param {V1PreviewHPSearchRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + previewHPSearch(body: V1PreviewHPSearchRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).previewHPSearch(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Put a new label on the experiment. + * @param {number} experimentId The ID of the experiment. + * @param {string} label The label to add. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperimentLabel(experimentId: number, label: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).putExperimentLabel(experimentId, label, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Retain logs for an experiment. + * @param {number} experimentId The ID of the experiment. + * @param {V1PutExperimentRetainLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperimentRetainLogs(experimentId: number, body: V1PutExperimentRetainLogsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).putExperimentRetainLogs(experimentId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Retain logs for an experiment. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1PutExperimentsRetainLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperimentsRetainLogs(projectId: number, body: V1PutExperimentsRetainLogsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).putExperimentsRetainLogs(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get experiments with grouping and search syntax + * @param {number} [projectId] ID of the project to look at. + * @param {number} [offset] How many experiments to skip before including in the results. + * @param {number} [limit] How many results to show. + * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). + * @param {string} [filter] Filter expression. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchExperiments(projectId?: number, offset?: number, limit?: number, sort?: string, filter?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).searchExperiments(projectId, offset, limit, sort, filter, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream trial logs. + * @param {number} trialId The id of the trial. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogs(trialId: number, limit?: number, follow?: boolean, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).trialLogs(trialId, limit, follow, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream trial log fields. + * @param {number} trialId The ID of the trial. + * @param {boolean} [follow] Continue following fields until the trial stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogsFields(trialId: number, follow?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).trialLogsFields(trialId, follow, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Unarchive an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveExperiment(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).unarchiveExperiment(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Unarchive multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1UnarchiveExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveExperiments(projectId: number, body: V1UnarchiveExperimentsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).unarchiveExperiments(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * ExperimentsApi - factory interface + * @export + */ +export const ExperimentsApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Activate an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + activateExperiment(id: number, options?: any) { + return ExperimentsApiFp(configuration).activateExperiment(id, options)(fetch, basePath); + }, + /** + * + * @summary Activate multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1ActivateExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + activateExperiments(projectId: number, body: V1ActivateExperimentsRequest, options?: any) { + return ExperimentsApiFp(configuration).activateExperiments(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Archive an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveExperiment(id: number, options?: any) { + return ExperimentsApiFp(configuration).archiveExperiment(id, options)(fetch, basePath); + }, + /** + * + * @summary Archive multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1ArchiveExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveExperiments(projectId: number, body: V1ArchiveExperimentsRequest, options?: any) { + return ExperimentsApiFp(configuration).archiveExperiments(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Cancel an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelExperiment(id: number, options?: any) { + return ExperimentsApiFp(configuration).cancelExperiment(id, options)(fetch, basePath); + }, + /** + * + * @summary Cancel multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1CancelExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cancelExperiments(projectId: number, body: V1CancelExperimentsRequest, options?: any) { + return ExperimentsApiFp(configuration).cancelExperiments(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Return a downsampled time series of metrics from multiple trials to compare them side-by-side. + * @param {Array} [trialIds] The requested trial ids. + * @param {number} [maxDatapoints] The maximum number of data points to return after downsampling. + * @param {Array} [metricNames] The names of selected metrics. + * @param {number} [startBatches] Sample from metrics after this batch number. + * @param {number} [endBatches] Sample from metrics before this batch number. + * @param {V1MetricType} [metricType] Metric group. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {Array} [metricIds] metric ids for the query. must be in the form group.metric_name. + * @param {string} [timeSeriesFilterName] metric or column name for the filter. + * @param {number} [timeSeriesFilterDoubleRangeLt] Less than. + * @param {number} [timeSeriesFilterDoubleRangeLte] Less than or equal. + * @param {number} [timeSeriesFilterDoubleRangeGt] Greater than. + * @param {number} [timeSeriesFilterDoubleRangeGte] Greater than or equal. + * @param {number} [timeSeriesFilterIntegerRangeLt] Less than. + * @param {number} [timeSeriesFilterIntegerRangeLte] Less than or equal. + * @param {number} [timeSeriesFilterIntegerRangeGt] Greater than. + * @param {number} [timeSeriesFilterIntegerRangeGte] Greater than or equal. + * @param {Array} [timeSeriesFilterIntegerRangeIncl] In a set. `in` is a reserved word in python. + * @param {Array} [timeSeriesFilterIntegerRangeNotIn] Not in a set. + * @param {Date | DateString} [timeSeriesFilterTimeRangeLt] Less than. + * @param {Date | DateString} [timeSeriesFilterTimeRangeLte] Less than or equal. + * @param {Date | DateString} [timeSeriesFilterTimeRangeGt] Greater than. + * @param {Date | DateString} [timeSeriesFilterTimeRangeGte] Greater than or equal. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + compareTrials(trialIds?: Array, maxDatapoints?: number, metricNames?: Array, startBatches?: number, endBatches?: number, metricType?: V1MetricType, group?: string, metricIds?: Array, timeSeriesFilterName?: string, timeSeriesFilterDoubleRangeLt?: number, timeSeriesFilterDoubleRangeLte?: number, timeSeriesFilterDoubleRangeGt?: number, timeSeriesFilterDoubleRangeGte?: number, timeSeriesFilterIntegerRangeLt?: number, timeSeriesFilterIntegerRangeLte?: number, timeSeriesFilterIntegerRangeGt?: number, timeSeriesFilterIntegerRangeGte?: number, timeSeriesFilterIntegerRangeIncl?: Array, timeSeriesFilterIntegerRangeNotIn?: Array, timeSeriesFilterTimeRangeLt?: Date | DateString, timeSeriesFilterTimeRangeLte?: Date | DateString, timeSeriesFilterTimeRangeGt?: Date | DateString, timeSeriesFilterTimeRangeGte?: Date | DateString, options?: any) { + return ExperimentsApiFp(configuration).compareTrials(trialIds, maxDatapoints, metricNames, startBatches, endBatches, metricType, group, metricIds, timeSeriesFilterName, timeSeriesFilterDoubleRangeLt, timeSeriesFilterDoubleRangeLte, timeSeriesFilterDoubleRangeGt, timeSeriesFilterDoubleRangeGte, timeSeriesFilterIntegerRangeLt, timeSeriesFilterIntegerRangeLte, timeSeriesFilterIntegerRangeGt, timeSeriesFilterIntegerRangeGte, timeSeriesFilterIntegerRangeIncl, timeSeriesFilterIntegerRangeNotIn, timeSeriesFilterTimeRangeLt, timeSeriesFilterTimeRangeLte, timeSeriesFilterTimeRangeGt, timeSeriesFilterTimeRangeGte, options)(fetch, basePath); + }, + /** + * + * @summary Delete the requested experiment. + * @param {number} experimentId The ID of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteExperiment(experimentId: number, options?: any) { + return ExperimentsApiFp(configuration).deleteExperiment(experimentId, options)(fetch, basePath); + }, + /** + * + * @summary Delete a label from the experiment. + * @param {number} experimentId The ID of the experiment. + * @param {string} label The label to delete. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteExperimentLabel(experimentId: number, label: string, options?: any) { + return ExperimentsApiFp(configuration).deleteExperimentLabel(experimentId, label, options)(fetch, basePath); + }, + /** + * + * @summary Delete multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1DeleteExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteExperiments(projectId: number, body: V1DeleteExperimentsRequest, options?: any) { + return ExperimentsApiFp(configuration).deleteExperiments(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Delete tensorboard files. + * @param {number} experimentId ID of experiment that the tensorboard files are linked to. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteTensorboardFiles(experimentId: number, options?: any) { + return ExperimentsApiFp(configuration).deleteTensorboardFiles(experimentId, options)(fetch, basePath); + }, + /** + * + * @summary Get the requested experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperiment(experimentId: number, options?: any) { + return ExperimentsApiFp(configuration).getExperiment(experimentId, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of checkpoints for an experiment. + * @param {number} id The experiment id. + * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. + * @param {string} [sortByMetric] Sort by custom validation metric name. + * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. + * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. + * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentCheckpoints(id: number, sortByAttr?: Checkpointv1SortBy, sortByMetric?: string, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any) { + return ExperimentsApiFp(configuration).getExperimentCheckpoints(id, sortByAttr, sortByMetric, orderBy, offset, limit, states, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of unique experiment labels (sorted by popularity). + * @param {number} [projectId] Filter experiments by project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentLabels(projectId?: number, options?: any) { + return ExperimentsApiFp(configuration).getExperimentLabels(projectId, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of experiments. + * @param {V1GetExperimentsRequestSortBy} [sortBy] Sort experiments by the given field. - SORT_BY_UNSPECIFIED: Returns experiments in an unsorted list. - SORT_BY_ID: Returns experiments sorted by id. - SORT_BY_DESCRIPTION: Returns experiments sorted by description. - SORT_BY_START_TIME: Return experiments sorted by start time. - SORT_BY_END_TIME: Return experiments sorted by end time. Experiments without end_time are returned after the ones with end_time. - SORT_BY_STATE: Return experiments sorted by state. - SORT_BY_NUM_TRIALS: Return experiments sorted by number of trials. - SORT_BY_PROGRESS: Return experiments sorted by progress. - SORT_BY_USER: Return experiments sorted by user. - SORT_BY_NAME: Returns experiments sorted by name. - SORT_BY_FORKED_FROM: Returns experiments sorted by originating model. - SORT_BY_RESOURCE_POOL: Returns experiments sorted by resource pool. - SORT_BY_PROJECT_ID: Returns experiments sorted by project. - SORT_BY_CHECKPOINT_SIZE: Returns experiments sorted by checkpoint size. - SORT_BY_CHECKPOINT_COUNT: Returns experiments sorted by checkpoint count. - SORT_BY_SEARCHER_METRIC_VAL: Returns experiments sorted by searcher metric value.. + * @param {V1OrderBy} [orderBy] Order experiments in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of experiments before returning results. Negative values denote number of experiments to skip from the end before returning results. + * @param {number} [limit] Limit the number of experiments. 0 or Unspecified - returns a default of 100. -1 - returns everything. -2 - returns pagination info but no experiments. + * @param {string} [description] Limit experiments to those that match the description. + * @param {string} [name] Limit experiments to those that match the name. + * @param {Array} [labels] Limit experiments to those that match the provided labels. + * @param {boolean} [archived] Limit experiments to those that are archived. + * @param {Array} [states] Limit experiments to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * @param {Array} [users] Limit experiments to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit experiments to those that are owned by users with the specified userIds. + * @param {number} [projectId] Limit experiments to those within a specified project, or 0 for all projects. + * @param {number} [experimentIdFilterLt] Less than. + * @param {number} [experimentIdFilterLte] Less than or equal. + * @param {number} [experimentIdFilterGt] Greater than. + * @param {number} [experimentIdFilterGte] Greater than or equal. + * @param {Array} [experimentIdFilterIncl] In a set. `in` is a reserved word in python. + * @param {Array} [experimentIdFilterNotIn] Not in a set. + * @param {boolean} [showTrialData] whether to surface trial specific data from the best trial. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperiments(sortBy?: V1GetExperimentsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, description?: string, name?: string, labels?: Array, archived?: boolean, states?: Array, users?: Array, userIds?: Array, projectId?: number, experimentIdFilterLt?: number, experimentIdFilterLte?: number, experimentIdFilterGt?: number, experimentIdFilterGte?: number, experimentIdFilterIncl?: Array, experimentIdFilterNotIn?: Array, showTrialData?: boolean, options?: any) { + return ExperimentsApiFp(configuration).getExperiments(sortBy, orderBy, offset, limit, description, name, labels, archived, states, users, userIds, projectId, experimentIdFilterLt, experimentIdFilterLte, experimentIdFilterGt, experimentIdFilterGte, experimentIdFilterIncl, experimentIdFilterNotIn, showTrialData, options)(fetch, basePath); + }, + /** + * + * @summary Get the list of trials for an experiment. + * @param {number} experimentId Limit trials to those that are owned by the specified experiments. + * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. + * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. + * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. + * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentTrials(experimentId: number, sortBy?: V1GetExperimentTrialsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any) { + return ExperimentsApiFp(configuration).getExperimentTrials(experimentId, sortBy, orderBy, offset, limit, states, options)(fetch, basePath); + }, + /** + * + * @summary Get the validation history for an experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentValidationHistory(experimentId: number, options?: any) { + return ExperimentsApiFp(configuration).getExperimentValidationHistory(experimentId, options)(fetch, basePath); + }, + /** + * + * @summary Get the model definition of an experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelDef(experimentId: number, options?: any) { + return ExperimentsApiFp(configuration).getModelDef(experimentId, options)(fetch, basePath); + }, + /** + * + * @summary Get one file content of model definition of an experiment. + * @param {number} experimentId The id of the experiment. + * @param {V1GetModelDefFileRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelDefFile(experimentId: number, body: V1GetModelDefFileRequest, options?: any) { + return ExperimentsApiFp(configuration).getModelDefFile(experimentId, body, options)(fetch, basePath); + }, + /** + * + * @summary Get the model definition file tree of an experiment. + * @param {number} experimentId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelDefTree(experimentId: number, options?: any) { + return ExperimentsApiFp(configuration).getModelDefTree(experimentId, options)(fetch, basePath); + }, + /** + * + * @summary Get the list of custom searcher events with long polling. + * @param {number} experimentId The ID of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSearcherEvents(experimentId: number, options?: any) { + return ExperimentsApiFp(configuration).getSearcherEvents(experimentId, options)(fetch, basePath); + }, + /** + * + * @summary Get a single trial. + * @param {number} trialId The requested trial's id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrial(trialId: number, options?: any) { + return ExperimentsApiFp(configuration).getTrial(trialId, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of checkpoints for a trial. + * @param {number} id The trial id. + * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. + * @param {string} [sortByMetric] Sort by custom validation metric name. + * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. + * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. + * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialCheckpoints(id: number, sortByAttr?: Checkpointv1SortBy, sortByMetric?: string, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any) { + return ExperimentsApiFp(configuration).getTrialCheckpoints(id, sortByAttr, sortByMetric, orderBy, offset, limit, states, options)(fetch, basePath); + }, + /** + * + * @summary Kill an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killExperiment(id: number, options?: any) { + return ExperimentsApiFp(configuration).killExperiment(id, options)(fetch, basePath); + }, + /** + * + * @summary Kill multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1KillExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killExperiments(projectId: number, body: V1KillExperimentsRequest, options?: any) { + return ExperimentsApiFp(configuration).killExperiments(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Kill a trial. + * @param {number} id The trial id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killTrial(id: number, options?: any) { + return ExperimentsApiFp(configuration).killTrial(id, options)(fetch, basePath); + }, + /** + * + * @summary Move an experiment into a project. + * @param {number} experimentId The id of the experiment being moved. + * @param {V1MoveExperimentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveExperiment(experimentId: number, body: V1MoveExperimentRequest, options?: any) { + return ExperimentsApiFp(configuration).moveExperiment(experimentId, body, options)(fetch, basePath); + }, + /** + * + * @summary Move multiple experiments into a project. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1MoveExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveExperiments(projectId: number, body: V1MoveExperimentsRequest, options?: any) { + return ExperimentsApiFp(configuration).moveExperiments(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Patch an experiment's fields. + * @param {number} experimentId The id of the experiment. + * @param {V1PatchExperiment} body Patched experiment attributes. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchExperiment(experimentId: number, body: V1PatchExperiment, options?: any) { + return ExperimentsApiFp(configuration).patchExperiment(experimentId, body, options)(fetch, basePath); + }, + /** + * + * @summary Pause an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseExperiment(id: number, options?: any) { + return ExperimentsApiFp(configuration).pauseExperiment(id, options)(fetch, basePath); + }, + /** + * + * @summary Pause multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1PauseExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseExperiments(projectId: number, body: V1PauseExperimentsRequest, options?: any) { + return ExperimentsApiFp(configuration).pauseExperiments(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Submit operations to a custom searcher. + * @param {number} experimentId The experiment ID. + * @param {V1PostSearcherOperationsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postSearcherOperations(experimentId: number, body: V1PostSearcherOperationsRequest, options?: any) { + return ExperimentsApiFp(configuration).postSearcherOperations(experimentId, body, options)(fetch, basePath); + }, + /** + * + * @summary Preview hyperparameter search. + * @param {V1PreviewHPSearchRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + previewHPSearch(body: V1PreviewHPSearchRequest, options?: any) { + return ExperimentsApiFp(configuration).previewHPSearch(body, options)(fetch, basePath); + }, + /** + * + * @summary Put a new label on the experiment. + * @param {number} experimentId The ID of the experiment. + * @param {string} label The label to add. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperimentLabel(experimentId: number, label: string, options?: any) { + return ExperimentsApiFp(configuration).putExperimentLabel(experimentId, label, options)(fetch, basePath); + }, + /** + * + * @summary Retain logs for an experiment. + * @param {number} experimentId The ID of the experiment. + * @param {V1PutExperimentRetainLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperimentRetainLogs(experimentId: number, body: V1PutExperimentRetainLogsRequest, options?: any) { + return ExperimentsApiFp(configuration).putExperimentRetainLogs(experimentId, body, options)(fetch, basePath); + }, + /** + * + * @summary Retain logs for an experiment. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1PutExperimentsRetainLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperimentsRetainLogs(projectId: number, body: V1PutExperimentsRetainLogsRequest, options?: any) { + return ExperimentsApiFp(configuration).putExperimentsRetainLogs(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Get experiments with grouping and search syntax + * @param {number} [projectId] ID of the project to look at. + * @param {number} [offset] How many experiments to skip before including in the results. + * @param {number} [limit] How many results to show. + * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). + * @param {string} [filter] Filter expression. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchExperiments(projectId?: number, offset?: number, limit?: number, sort?: string, filter?: string, options?: any) { + return ExperimentsApiFp(configuration).searchExperiments(projectId, offset, limit, sort, filter, options)(fetch, basePath); + }, + /** + * + * @summary Stream trial logs. + * @param {number} trialId The id of the trial. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogs(trialId: number, limit?: number, follow?: boolean, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any) { + return ExperimentsApiFp(configuration).trialLogs(trialId, limit, follow, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options)(fetch, basePath); + }, + /** + * + * @summary Stream trial log fields. + * @param {number} trialId The ID of the trial. + * @param {boolean} [follow] Continue following fields until the trial stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogsFields(trialId: number, follow?: boolean, options?: any) { + return ExperimentsApiFp(configuration).trialLogsFields(trialId, follow, options)(fetch, basePath); + }, + /** + * + * @summary Unarchive an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveExperiment(id: number, options?: any) { + return ExperimentsApiFp(configuration).unarchiveExperiment(id, options)(fetch, basePath); + }, + /** + * + * @summary Unarchive multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1UnarchiveExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveExperiments(projectId: number, body: V1UnarchiveExperimentsRequest, options?: any) { + return ExperimentsApiFp(configuration).unarchiveExperiments(projectId, body, options)(fetch, basePath); + }, + } +}; + +/** + * ExperimentsApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class ExperimentsApi extends BaseAPI { + /** + * + * @summary Activate an experiment. + * @param {number} id The experiment id. + * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getSlots( - agentId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).getSlots( - agentId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get health of Determined and the dependencies. + public activateExperiment(id: number, options?: any) { + return ExperimentsApiFp(this.configuration).activateExperiment(id, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Activate multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1ActivateExperimentsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - health(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).health(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public activateExperiments(projectId: number, body: V1ActivateExperimentsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).activateExperiments(projectId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Stream master logs. - * @param {number} [offset] Skip the number of master logs before returning results. Negative values denote number of master logs to skip from the end before returning results. - * @param {number} [limit] Limit the number of master logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the master stops or the limit is reached. + * + * @summary Archive an experiment. + * @param {number} id The experiment id. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - masterLogs( - offset?: number, - limit?: number, - follow?: boolean, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).masterLogs( - offset, - limit, - follow, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Patch master config. - * @param {V1PatchMasterConfigRequest} body + public archiveExperiment(id: number, options?: any) { + return ExperimentsApiFp(this.configuration).archiveExperiment(id, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Archive multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1ArchiveExperimentsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - patchMasterConfig( - body: V1PatchMasterConfigRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).patchMasterConfig( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get an aggregated view of resource allocation during the given time period. - * @param {string} startDate The first day to consider (the exact time is midnight UTC at the beginning of the day). - * @param {string} endDate The last day to consider (the exact time is midnight UTC at the end of the day). - * @param {V1ResourceAllocationAggregationPeriod} period The period over which to perform aggregation. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_DAILY: Aggregation by day. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_MONTHLY: Aggregation by month. + public archiveExperiments(projectId: number, body: V1ArchiveExperimentsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).archiveExperiments(projectId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Cancel an experiment. + * @param {number} id The experiment id. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - resourceAllocationAggregated( - startDate: string, - endDate: string, - period: V1ResourceAllocationAggregationPeriod, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator( - configuration, - ).resourceAllocationAggregated(startDate, endDate, period, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a detailed view of resource allocation during the given time period. - * @param {Date | DateString} timestampAfter The start of the period to consider. - * @param {Date | DateString} timestampBefore The end of the period to consider. + public cancelExperiment(id: number, options?: any) { + return ExperimentsApiFp(this.configuration).cancelExperiment(id, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Cancel multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1CancelExperimentsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - resourceAllocationRaw( - timestampAfter: Date | DateString, - timestampBefore: Date | DateString, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).resourceAllocationRaw( - timestampAfter, - timestampBefore, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. - * @param {V1SetClusterMessageRequest} body + public cancelExperiments(projectId: number, body: V1CancelExperimentsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).cancelExperiments(projectId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Return a downsampled time series of metrics from multiple trials to compare them side-by-side. + * @param {Array} [trialIds] The requested trial ids. + * @param {number} [maxDatapoints] The maximum number of data points to return after downsampling. + * @param {Array} [metricNames] The names of selected metrics. + * @param {number} [startBatches] Sample from metrics after this batch number. + * @param {number} [endBatches] Sample from metrics before this batch number. + * @param {V1MetricType} [metricType] Metric group. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {Array} [metricIds] metric ids for the query. must be in the form group.metric_name. + * @param {string} [timeSeriesFilterName] metric or column name for the filter. + * @param {number} [timeSeriesFilterDoubleRangeLt] Less than. + * @param {number} [timeSeriesFilterDoubleRangeLte] Less than or equal. + * @param {number} [timeSeriesFilterDoubleRangeGt] Greater than. + * @param {number} [timeSeriesFilterDoubleRangeGte] Greater than or equal. + * @param {number} [timeSeriesFilterIntegerRangeLt] Less than. + * @param {number} [timeSeriesFilterIntegerRangeLte] Less than or equal. + * @param {number} [timeSeriesFilterIntegerRangeGt] Greater than. + * @param {number} [timeSeriesFilterIntegerRangeGte] Greater than or equal. + * @param {Array} [timeSeriesFilterIntegerRangeIncl] In a set. `in` is a reserved word in python. + * @param {Array} [timeSeriesFilterIntegerRangeNotIn] Not in a set. + * @param {Date | DateString} [timeSeriesFilterTimeRangeLt] Less than. + * @param {Date | DateString} [timeSeriesFilterTimeRangeLte] Less than or equal. + * @param {Date | DateString} [timeSeriesFilterTimeRangeGt] Greater than. + * @param {Date | DateString} [timeSeriesFilterTimeRangeGte] Greater than or equal. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - setClusterMessage( - body: V1SetClusterMessageRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ClusterApiFetchParamCreator(configuration).setClusterMessage( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * ClusterApi - factory interface - * @export - */ -export const ClusterApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { + public compareTrials(trialIds?: Array, maxDatapoints?: number, metricNames?: Array, startBatches?: number, endBatches?: number, metricType?: V1MetricType, group?: string, metricIds?: Array, timeSeriesFilterName?: string, timeSeriesFilterDoubleRangeLt?: number, timeSeriesFilterDoubleRangeLte?: number, timeSeriesFilterDoubleRangeGt?: number, timeSeriesFilterDoubleRangeGte?: number, timeSeriesFilterIntegerRangeLt?: number, timeSeriesFilterIntegerRangeLte?: number, timeSeriesFilterIntegerRangeGt?: number, timeSeriesFilterIntegerRangeGte?: number, timeSeriesFilterIntegerRangeIncl?: Array, timeSeriesFilterIntegerRangeNotIn?: Array, timeSeriesFilterTimeRangeLt?: Date | DateString, timeSeriesFilterTimeRangeLte?: Date | DateString, timeSeriesFilterTimeRangeGt?: Date | DateString, timeSeriesFilterTimeRangeGte?: Date | DateString, options?: any) { + return ExperimentsApiFp(this.configuration).compareTrials(trialIds, maxDatapoints, metricNames, startBatches, endBatches, metricType, group, metricIds, timeSeriesFilterName, timeSeriesFilterDoubleRangeLt, timeSeriesFilterDoubleRangeLte, timeSeriesFilterDoubleRangeGt, timeSeriesFilterDoubleRangeGte, timeSeriesFilterIntegerRangeLt, timeSeriesFilterIntegerRangeLte, timeSeriesFilterIntegerRangeGt, timeSeriesFilterIntegerRangeGte, timeSeriesFilterIntegerRangeIncl, timeSeriesFilterIntegerRangeNotIn, timeSeriesFilterTimeRangeLt, timeSeriesFilterTimeRangeLte, timeSeriesFilterTimeRangeGt, timeSeriesFilterTimeRangeGte, options)(this.fetch, this.basePath) + } + /** - * - * @summary Clear the cluster-wide message shown to all users. + * + * @summary Delete the requested experiment. + * @param {number} experimentId The ID of the experiment. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - deleteClusterMessage(options?: any) { - return ClusterApiFp(configuration).deleteClusterMessage(options)(fetch, basePath); - }, + public deleteExperiment(experimentId: number, options?: any) { + return ExperimentsApiFp(this.configuration).deleteExperiment(experimentId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Disable the agent. - * @param {string} agentId The id of the agent. - * @param {V1DisableAgentRequest} body + * + * @summary Delete a label from the experiment. + * @param {number} experimentId The ID of the experiment. + * @param {string} label The label to delete. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - disableAgent(agentId: string, body: V1DisableAgentRequest, options?: any) { - return ClusterApiFp(configuration).disableAgent(agentId, body, options)(fetch, basePath); - }, + public deleteExperimentLabel(experimentId: number, label: string, options?: any) { + return ExperimentsApiFp(this.configuration).deleteExperimentLabel(experimentId, label, options)(this.fetch, this.basePath) + } + /** - * - * @summary Disable the slot. - * @param {string} agentId The id of the agent. - * @param {string} slotId The id of the slot. - * @param {V1DisableSlotRequest} body + * + * @summary Delete multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1DeleteExperimentsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - disableSlot(agentId: string, slotId: string, body: V1DisableSlotRequest, options?: any) { - return ClusterApiFp(configuration).disableSlot( - agentId, - slotId, - body, - options, - )(fetch, basePath); - }, + public deleteExperiments(projectId: number, body: V1DeleteExperimentsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).deleteExperiments(projectId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Enable the agent. - * @param {string} agentId The id of the agent. + * + * @summary Delete tensorboard files. + * @param {number} experimentId ID of experiment that the tensorboard files are linked to. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - enableAgent(agentId: string, options?: any) { - return ClusterApiFp(configuration).enableAgent(agentId, options)(fetch, basePath); - }, + public deleteTensorboardFiles(experimentId: number, options?: any) { + return ExperimentsApiFp(this.configuration).deleteTensorboardFiles(experimentId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Enable the slot. - * @param {string} agentId The id of the agent. - * @param {string} slotId The id of the slot. + * + * @summary Get the requested experiment. + * @param {number} experimentId The id of the experiment. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - enableSlot(agentId: string, slotId: string, options?: any) { - return ClusterApiFp(configuration).enableSlot(agentId, slotId, options)(fetch, basePath); - }, + public getExperiment(experimentId: number, options?: any) { + return ExperimentsApiFp(this.configuration).getExperiment(experimentId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested agent. - * @param {string} agentId The id of the agent. + * + * @summary Get a list of checkpoints for an experiment. + * @param {number} id The experiment id. + * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. + * @param {string} [sortByMetric] Sort by custom validation metric name. + * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. + * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. + * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getAgent(agentId: string, options?: any) { - return ClusterApiFp(configuration).getAgent(agentId, options)(fetch, basePath); - }, + public getExperimentCheckpoints(id: number, sortByAttr?: Checkpointv1SortBy, sortByMetric?: string, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any) { + return ExperimentsApiFp(this.configuration).getExperimentCheckpoints(id, sortByAttr, sortByMetric, orderBy, offset, limit, states, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a set of agents from the cluster. - * @param {V1GetAgentsRequestSortBy} [sortBy] Sort agents by the given field. - SORT_BY_UNSPECIFIED: Returns agents in an unsorted list. - SORT_BY_ID: Returns agents sorted by id. - SORT_BY_TIME: Returns agents sorted by time. - * @param {V1OrderBy} [orderBy] Order agents in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of agents before returning results. Negative values denote number of agents to skip from the end before returning results. - * @param {number} [limit] Limit the number of agents. A value of 0 denotes no limit. - * @param {string} [label] This field has been deprecated and will be ignored. - * @param {boolean} [excludeSlots] exclude slots. - * @param {boolean} [excludeContainers] exclude containers. + * + * @summary Get a list of unique experiment labels (sorted by popularity). + * @param {number} [projectId] Filter experiments by project. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getAgents( - sortBy?: V1GetAgentsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - label?: string, - excludeSlots?: boolean, - excludeContainers?: boolean, - options?: any, - ) { - return ClusterApiFp(configuration).getAgents( - sortBy, - orderBy, - offset, - limit, - label, - excludeSlots, - excludeContainers, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get the currently configured cluster-wide message. + public getExperimentLabels(projectId?: number, options?: any) { + return ExperimentsApiFp(this.configuration).getExperimentLabels(projectId, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Get a list of experiments. + * @param {V1GetExperimentsRequestSortBy} [sortBy] Sort experiments by the given field. - SORT_BY_UNSPECIFIED: Returns experiments in an unsorted list. - SORT_BY_ID: Returns experiments sorted by id. - SORT_BY_DESCRIPTION: Returns experiments sorted by description. - SORT_BY_START_TIME: Return experiments sorted by start time. - SORT_BY_END_TIME: Return experiments sorted by end time. Experiments without end_time are returned after the ones with end_time. - SORT_BY_STATE: Return experiments sorted by state. - SORT_BY_NUM_TRIALS: Return experiments sorted by number of trials. - SORT_BY_PROGRESS: Return experiments sorted by progress. - SORT_BY_USER: Return experiments sorted by user. - SORT_BY_NAME: Returns experiments sorted by name. - SORT_BY_FORKED_FROM: Returns experiments sorted by originating model. - SORT_BY_RESOURCE_POOL: Returns experiments sorted by resource pool. - SORT_BY_PROJECT_ID: Returns experiments sorted by project. - SORT_BY_CHECKPOINT_SIZE: Returns experiments sorted by checkpoint size. - SORT_BY_CHECKPOINT_COUNT: Returns experiments sorted by checkpoint count. - SORT_BY_SEARCHER_METRIC_VAL: Returns experiments sorted by searcher metric value.. + * @param {V1OrderBy} [orderBy] Order experiments in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of experiments before returning results. Negative values denote number of experiments to skip from the end before returning results. + * @param {number} [limit] Limit the number of experiments. 0 or Unspecified - returns a default of 100. -1 - returns everything. -2 - returns pagination info but no experiments. + * @param {string} [description] Limit experiments to those that match the description. + * @param {string} [name] Limit experiments to those that match the name. + * @param {Array} [labels] Limit experiments to those that match the provided labels. + * @param {boolean} [archived] Limit experiments to those that are archived. + * @param {Array} [states] Limit experiments to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * @param {Array} [users] Limit experiments to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit experiments to those that are owned by users with the specified userIds. + * @param {number} [projectId] Limit experiments to those within a specified project, or 0 for all projects. + * @param {number} [experimentIdFilterLt] Less than. + * @param {number} [experimentIdFilterLte] Less than or equal. + * @param {number} [experimentIdFilterGt] Greater than. + * @param {number} [experimentIdFilterGte] Greater than or equal. + * @param {Array} [experimentIdFilterIncl] In a set. `in` is a reserved word in python. + * @param {Array} [experimentIdFilterNotIn] Not in a set. + * @param {boolean} [showTrialData] whether to surface trial specific data from the best trial. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getClusterMessage(options?: any) { - return ClusterApiFp(configuration).getClusterMessage(options)(fetch, basePath); - }, + public getExperiments(sortBy?: V1GetExperimentsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, description?: string, name?: string, labels?: Array, archived?: boolean, states?: Array, users?: Array, userIds?: Array, projectId?: number, experimentIdFilterLt?: number, experimentIdFilterLte?: number, experimentIdFilterGt?: number, experimentIdFilterGte?: number, experimentIdFilterIncl?: Array, experimentIdFilterNotIn?: Array, showTrialData?: boolean, options?: any) { + return ExperimentsApiFp(this.configuration).getExperiments(sortBy, orderBy, offset, limit, description, name, labels, archived, states, users, userIds, projectId, experimentIdFilterLt, experimentIdFilterLte, experimentIdFilterGt, experimentIdFilterGte, experimentIdFilterIncl, experimentIdFilterNotIn, showTrialData, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get master information. + * + * @summary Get the list of trials for an experiment. + * @param {number} experimentId Limit trials to those that are owned by the specified experiments. + * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. + * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. + * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. + * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getMaster(options?: any) { - return ClusterApiFp(configuration).getMaster(options)(fetch, basePath); - }, + public getExperimentTrials(experimentId: number, sortBy?: V1GetExperimentTrialsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any) { + return ExperimentsApiFp(this.configuration).getExperimentTrials(experimentId, sortBy, orderBy, offset, limit, states, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get master config. + * + * @summary Get the validation history for an experiment. + * @param {number} experimentId The id of the experiment. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getMasterConfig(options?: any) { - return ClusterApiFp(configuration).getMasterConfig(options)(fetch, basePath); - }, + public getExperimentValidationHistory(experimentId: number, options?: any) { + return ExperimentsApiFp(this.configuration).getExperimentValidationHistory(experimentId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested slot for an agent. - * @param {string} agentId The id of the agent. - * @param {string} slotId The id of the slot. + * + * @summary Get the model definition of an experiment. + * @param {number} experimentId The id of the experiment. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getSlot(agentId: string, slotId: string, options?: any) { - return ClusterApiFp(configuration).getSlot(agentId, slotId, options)(fetch, basePath); - }, + public getModelDef(experimentId: number, options?: any) { + return ExperimentsApiFp(this.configuration).getModelDef(experimentId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get all the slots for an agent. - * @param {string} agentId The id of the agent. + * + * @summary Get one file content of model definition of an experiment. + * @param {number} experimentId The id of the experiment. + * @param {V1GetModelDefFileRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getSlots(agentId: string, options?: any) { - return ClusterApiFp(configuration).getSlots(agentId, options)(fetch, basePath); - }, + public getModelDefFile(experimentId: number, body: V1GetModelDefFileRequest, options?: any) { + return ExperimentsApiFp(this.configuration).getModelDefFile(experimentId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get health of Determined and the dependencies. + * + * @summary Get the model definition file tree of an experiment. + * @param {number} experimentId The id of the experiment. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - health(options?: any) { - return ClusterApiFp(configuration).health(options)(fetch, basePath); - }, + public getModelDefTree(experimentId: number, options?: any) { + return ExperimentsApiFp(this.configuration).getModelDefTree(experimentId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Stream master logs. - * @param {number} [offset] Skip the number of master logs before returning results. Negative values denote number of master logs to skip from the end before returning results. - * @param {number} [limit] Limit the number of master logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the master stops or the limit is reached. + * + * @summary Get the list of custom searcher events with long polling. + * @param {number} experimentId The ID of the experiment. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - masterLogs(offset?: number, limit?: number, follow?: boolean, options?: any) { - return ClusterApiFp(configuration).masterLogs( - offset, - limit, - follow, - options, - )(fetch, basePath); - }, + public getSearcherEvents(experimentId: number, options?: any) { + return ExperimentsApiFp(this.configuration).getSearcherEvents(experimentId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Patch master config. - * @param {V1PatchMasterConfigRequest} body + * + * @summary Get a single trial. + * @param {number} trialId The requested trial's id. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - patchMasterConfig(body: V1PatchMasterConfigRequest, options?: any) { - return ClusterApiFp(configuration).patchMasterConfig(body, options)(fetch, basePath); - }, + public getTrial(trialId: number, options?: any) { + return ExperimentsApiFp(this.configuration).getTrial(trialId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get an aggregated view of resource allocation during the given time period. - * @param {string} startDate The first day to consider (the exact time is midnight UTC at the beginning of the day). - * @param {string} endDate The last day to consider (the exact time is midnight UTC at the end of the day). - * @param {V1ResourceAllocationAggregationPeriod} period The period over which to perform aggregation. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_DAILY: Aggregation by day. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_MONTHLY: Aggregation by month. + * + * @summary Get a list of checkpoints for a trial. + * @param {number} id The trial id. + * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. + * @param {string} [sortByMetric] Sort by custom validation metric name. + * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. + * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. + * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - resourceAllocationAggregated( - startDate: string, - endDate: string, - period: V1ResourceAllocationAggregationPeriod, - options?: any, - ) { - return ClusterApiFp(configuration).resourceAllocationAggregated( - startDate, - endDate, - period, - options, - )(fetch, basePath); - }, + public getTrialCheckpoints(id: number, sortByAttr?: Checkpointv1SortBy, sortByMetric?: string, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any) { + return ExperimentsApiFp(this.configuration).getTrialCheckpoints(id, sortByAttr, sortByMetric, orderBy, offset, limit, states, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a detailed view of resource allocation during the given time period. - * @param {Date | DateString} timestampAfter The start of the period to consider. - * @param {Date | DateString} timestampBefore The end of the period to consider. + * + * @summary Kill an experiment. + * @param {number} id The experiment id. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - resourceAllocationRaw( - timestampAfter: Date | DateString, - timestampBefore: Date | DateString, - options?: any, - ) { - return ClusterApiFp(configuration).resourceAllocationRaw( - timestampAfter, - timestampBefore, - options, - )(fetch, basePath); - }, + public killExperiment(id: number, options?: any) { + return ExperimentsApiFp(this.configuration).killExperiment(id, options)(this.fetch, this.basePath) + } + /** - * - * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. - * @param {V1SetClusterMessageRequest} body + * + * @summary Kill multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1KillExperimentsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - setClusterMessage(body: V1SetClusterMessageRequest, options?: any) { - return ClusterApiFp(configuration).setClusterMessage(body, options)(fetch, basePath); - }, - }; -}; - -/** - * ClusterApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class ClusterApi extends BaseAPI { - /** - * - * @summary Clear the cluster-wide message shown to all users. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public deleteClusterMessage(options?: any) { - return ClusterApiFp(this.configuration).deleteClusterMessage(options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Disable the agent. - * @param {string} agentId The id of the agent. - * @param {V1DisableAgentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public disableAgent(agentId: string, body: V1DisableAgentRequest, options?: any) { - return ClusterApiFp(this.configuration).disableAgent( - agentId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Disable the slot. - * @param {string} agentId The id of the agent. - * @param {string} slotId The id of the slot. - * @param {V1DisableSlotRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public disableSlot(agentId: string, slotId: string, body: V1DisableSlotRequest, options?: any) { - return ClusterApiFp(this.configuration).disableSlot( - agentId, - slotId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Enable the agent. - * @param {string} agentId The id of the agent. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public enableAgent(agentId: string, options?: any) { - return ClusterApiFp(this.configuration).enableAgent(agentId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Enable the slot. - * @param {string} agentId The id of the agent. - * @param {string} slotId The id of the slot. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public enableSlot(agentId: string, slotId: string, options?: any) { - return ClusterApiFp(this.configuration).enableSlot( - agentId, - slotId, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get the requested agent. - * @param {string} agentId The id of the agent. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public getAgent(agentId: string, options?: any) { - return ClusterApiFp(this.configuration).getAgent(agentId, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get a set of agents from the cluster. - * @param {V1GetAgentsRequestSortBy} [sortBy] Sort agents by the given field. - SORT_BY_UNSPECIFIED: Returns agents in an unsorted list. - SORT_BY_ID: Returns agents sorted by id. - SORT_BY_TIME: Returns agents sorted by time. - * @param {V1OrderBy} [orderBy] Order agents in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of agents before returning results. Negative values denote number of agents to skip from the end before returning results. - * @param {number} [limit] Limit the number of agents. A value of 0 denotes no limit. - * @param {string} [label] This field has been deprecated and will be ignored. - * @param {boolean} [excludeSlots] exclude slots. - * @param {boolean} [excludeContainers] exclude containers. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public getAgents( - sortBy?: V1GetAgentsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - label?: string, - excludeSlots?: boolean, - excludeContainers?: boolean, - options?: any, - ) { - return ClusterApiFp(this.configuration).getAgents( - sortBy, - orderBy, - offset, - limit, - label, - excludeSlots, - excludeContainers, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get the currently configured cluster-wide message. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public getClusterMessage(options?: any) { - return ClusterApiFp(this.configuration).getClusterMessage(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get master information. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public getMaster(options?: any) { - return ClusterApiFp(this.configuration).getMaster(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get master config. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public getMasterConfig(options?: any) { - return ClusterApiFp(this.configuration).getMasterConfig(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get the requested slot for an agent. - * @param {string} agentId The id of the agent. - * @param {string} slotId The id of the slot. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public getSlot(agentId: string, slotId: string, options?: any) { - return ClusterApiFp(this.configuration).getSlot( - agentId, - slotId, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get all the slots for an agent. - * @param {string} agentId The id of the agent. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public getSlots(agentId: string, options?: any) { - return ClusterApiFp(this.configuration).getSlots(agentId, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get health of Determined and the dependencies. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public health(options?: any) { - return ClusterApiFp(this.configuration).health(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Stream master logs. - * @param {number} [offset] Skip the number of master logs before returning results. Negative values denote number of master logs to skip from the end before returning results. - * @param {number} [limit] Limit the number of master logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the master stops or the limit is reached. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public masterLogs(offset?: number, limit?: number, follow?: boolean, options?: any) { - return ClusterApiFp(this.configuration).masterLogs( - offset, - limit, - follow, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Patch master config. - * @param {V1PatchMasterConfigRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public patchMasterConfig(body: V1PatchMasterConfigRequest, options?: any) { - return ClusterApiFp(this.configuration).patchMasterConfig(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get an aggregated view of resource allocation during the given time period. - * @param {string} startDate The first day to consider (the exact time is midnight UTC at the beginning of the day). - * @param {string} endDate The last day to consider (the exact time is midnight UTC at the end of the day). - * @param {V1ResourceAllocationAggregationPeriod} period The period over which to perform aggregation. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_UNSPECIFIED: Unspecified. This value will never actually be returned by the API, it is just an artifact of using protobuf. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_DAILY: Aggregation by day. - RESOURCE_ALLOCATION_AGGREGATION_PERIOD_MONTHLY: Aggregation by month. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public resourceAllocationAggregated( - startDate: string, - endDate: string, - period: V1ResourceAllocationAggregationPeriod, - options?: any, - ) { - return ClusterApiFp(this.configuration).resourceAllocationAggregated( - startDate, - endDate, - period, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a detailed view of resource allocation during the given time period. - * @param {Date | DateString} timestampAfter The start of the period to consider. - * @param {Date | DateString} timestampBefore The end of the period to consider. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public resourceAllocationRaw( - timestampAfter: Date | DateString, - timestampBefore: Date | DateString, - options?: any, - ) { - return ClusterApiFp(this.configuration).resourceAllocationRaw( - timestampAfter, - timestampBefore, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Set the cluster-wide message shown to users. Only one can be set at at time, so any existing message will be disabled. - * @param {V1SetClusterMessageRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ClusterApi - */ - public setClusterMessage(body: V1SetClusterMessageRequest, options?: any) { - return ClusterApiFp(this.configuration).setClusterMessage(body, options)( - this.fetch, - this.basePath, - ); - } -} - -/** - * CommandsApi - fetch parameter creator - * @export - */ -export const CommandsApiFetchParamCreator = function (configuration?: Configuration) { - return { + public killExperiments(projectId: number, body: V1KillExperimentsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).killExperiments(projectId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested command. - * @param {string} commandId The id of the command. + * + * @summary Kill a trial. + * @param {number} id The trial id * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getCommand(commandId: string, options: any = {}): FetchArgs { - // verify required parameter 'commandId' is not null or undefined - if (commandId === null || commandId === undefined) { - throw new RequiredError( - 'commandId', - 'Required parameter commandId was null or undefined when calling getCommand.', - ); - } - const localVarPath = `/api/v1/commands/{commandId}`.replace( - `{${'commandId'}}`, - encodeURIComponent(String(commandId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public killTrial(id: number, options?: any) { + return ExperimentsApiFp(this.configuration).killTrial(id, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a list of commands. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort commands by the given field. - SORT_BY_UNSPECIFIED: Returns commands in an unsorted list. - SORT_BY_ID: Returns commands sorted by id. - SORT_BY_DESCRIPTION: Returns commands sorted by description. - SORT_BY_START_TIME: Return commands sorted by start time. - SORT_BY_WORKSPACE_ID: Return commands sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order commands in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of commands before returning results. Negative values denote number of commands to skip from the end before returning results. - * @param {number} [limit] Limit the number of commands. A value of 0 denotes no limit. - * @param {Array} [users] Limit commands to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit commands to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit commands to those within a specific workspace, or 0 for all accessible workspaces. + * + * @summary Move an experiment into a project. + * @param {number} experimentId The id of the experiment being moved. + * @param {V1MoveExperimentRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getCommands( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/commands`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (users) { - localVarQueryParameter['users'] = users; - } - - if (userIds) { - localVarQueryParameter['userIds'] = userIds; - } - - if (workspaceId !== undefined) { - localVarQueryParameter['workspaceId'] = workspaceId; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public moveExperiment(experimentId: number, body: V1MoveExperimentRequest, options?: any) { + return ExperimentsApiFp(this.configuration).moveExperiment(experimentId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Kill the requested command. - * @param {string} commandId The id of the command. + * + * @summary Move multiple experiments into a project. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1MoveExperimentsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - killCommand(commandId: string, options: any = {}): FetchArgs { - // verify required parameter 'commandId' is not null or undefined - if (commandId === null || commandId === undefined) { - throw new RequiredError( - 'commandId', - 'Required parameter commandId was null or undefined when calling killCommand.', - ); - } - const localVarPath = `/api/v1/commands/{commandId}/kill`.replace( - `{${'commandId'}}`, - encodeURIComponent(String(commandId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public moveExperiments(projectId: number, body: V1MoveExperimentsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).moveExperiments(projectId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Launch a command. - * @param {V1LaunchCommandRequest} body + * + * @summary Patch an experiment's fields. + * @param {number} experimentId The id of the experiment. + * @param {V1PatchExperiment} body Patched experiment attributes. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - launchCommand(body: V1LaunchCommandRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling launchCommand.', - ); - } - const localVarPath = `/api/v1/commands`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public patchExperiment(experimentId: number, body: V1PatchExperiment, options?: any) { + return ExperimentsApiFp(this.configuration).patchExperiment(experimentId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Set the priority of the requested command. - * @param {string} commandId The id of the command. - * @param {V1SetCommandPriorityRequest} body + * + * @summary Pause an experiment. + * @param {number} id The experiment id. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - setCommandPriority( - commandId: string, - body: V1SetCommandPriorityRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'commandId' is not null or undefined - if (commandId === null || commandId === undefined) { - throw new RequiredError( - 'commandId', - 'Required parameter commandId was null or undefined when calling setCommandPriority.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling setCommandPriority.', - ); - } - const localVarPath = `/api/v1/commands/{commandId}/set_priority`.replace( - `{${'commandId'}}`, - encodeURIComponent(String(commandId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * CommandsApi - functional programming interface - * @export - */ -export const CommandsApiFp = function (configuration?: Configuration) { - return { + public pauseExperiment(id: number, options?: any) { + return ExperimentsApiFp(this.configuration).pauseExperiment(id, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested command. - * @param {string} commandId The id of the command. + * + * @summary Pause multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1PauseExperimentsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getCommand( - commandId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CommandsApiFetchParamCreator(configuration).getCommand( - commandId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of commands. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort commands by the given field. - SORT_BY_UNSPECIFIED: Returns commands in an unsorted list. - SORT_BY_ID: Returns commands sorted by id. - SORT_BY_DESCRIPTION: Returns commands sorted by description. - SORT_BY_START_TIME: Return commands sorted by start time. - SORT_BY_WORKSPACE_ID: Return commands sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order commands in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of commands before returning results. Negative values denote number of commands to skip from the end before returning results. - * @param {number} [limit] Limit the number of commands. A value of 0 denotes no limit. - * @param {Array} [users] Limit commands to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit commands to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit commands to those within a specific workspace, or 0 for all accessible workspaces. + public pauseExperiments(projectId: number, body: V1PauseExperimentsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).pauseExperiments(projectId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Submit operations to a custom searcher. + * @param {number} experimentId The experiment ID. + * @param {V1PostSearcherOperationsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getCommands( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CommandsApiFetchParamCreator(configuration).getCommands( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Kill the requested command. - * @param {string} commandId The id of the command. + public postSearcherOperations(experimentId: number, body: V1PostSearcherOperationsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).postSearcherOperations(experimentId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Preview hyperparameter search. + * @param {V1PreviewHPSearchRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - killCommand( - commandId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CommandsApiFetchParamCreator(configuration).killCommand( - commandId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Launch a command. - * @param {V1LaunchCommandRequest} body + public previewHPSearch(body: V1PreviewHPSearchRequest, options?: any) { + return ExperimentsApiFp(this.configuration).previewHPSearch(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Put a new label on the experiment. + * @param {number} experimentId The ID of the experiment. + * @param {string} label The label to add. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - launchCommand( - body: V1LaunchCommandRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CommandsApiFetchParamCreator(configuration).launchCommand( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Set the priority of the requested command. - * @param {string} commandId The id of the command. - * @param {V1SetCommandPriorityRequest} body + public putExperimentLabel(experimentId: number, label: string, options?: any) { + return ExperimentsApiFp(this.configuration).putExperimentLabel(experimentId, label, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Retain logs for an experiment. + * @param {number} experimentId The ID of the experiment. + * @param {V1PutExperimentRetainLogsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - setCommandPriority( - commandId: string, - body: V1SetCommandPriorityRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = CommandsApiFetchParamCreator(configuration).setCommandPriority( - commandId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * CommandsApi - factory interface - * @export - */ -export const CommandsApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { + public putExperimentRetainLogs(experimentId: number, body: V1PutExperimentRetainLogsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).putExperimentRetainLogs(experimentId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested command. - * @param {string} commandId The id of the command. + * + * @summary Retain logs for an experiment. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1PutExperimentsRetainLogsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getCommand(commandId: string, options?: any) { - return CommandsApiFp(configuration).getCommand(commandId, options)(fetch, basePath); - }, + public putExperimentsRetainLogs(projectId: number, body: V1PutExperimentsRetainLogsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).putExperimentsRetainLogs(projectId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a list of commands. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort commands by the given field. - SORT_BY_UNSPECIFIED: Returns commands in an unsorted list. - SORT_BY_ID: Returns commands sorted by id. - SORT_BY_DESCRIPTION: Returns commands sorted by description. - SORT_BY_START_TIME: Return commands sorted by start time. - SORT_BY_WORKSPACE_ID: Return commands sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order commands in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of commands before returning results. Negative values denote number of commands to skip from the end before returning results. - * @param {number} [limit] Limit the number of commands. A value of 0 denotes no limit. - * @param {Array} [users] Limit commands to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit commands to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit commands to those within a specific workspace, or 0 for all accessible workspaces. + * + * @summary Get experiments with grouping and search syntax + * @param {number} [projectId] ID of the project to look at. + * @param {number} [offset] How many experiments to skip before including in the results. + * @param {number} [limit] How many results to show. + * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). + * @param {string} [filter] Filter expression. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - getCommands( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ) { - return CommandsApiFp(configuration).getCommands( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - )(fetch, basePath); - }, - /** - * - * @summary Kill the requested command. - * @param {string} commandId The id of the command. + public searchExperiments(projectId?: number, offset?: number, limit?: number, sort?: string, filter?: string, options?: any) { + return ExperimentsApiFp(this.configuration).searchExperiments(projectId, offset, limit, sort, filter, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Stream trial logs. + * @param {number} trialId The id of the trial. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - killCommand(commandId: string, options?: any) { - return CommandsApiFp(configuration).killCommand(commandId, options)(fetch, basePath); - }, + public trialLogs(trialId: number, limit?: number, follow?: boolean, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any) { + return ExperimentsApiFp(this.configuration).trialLogs(trialId, limit, follow, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options)(this.fetch, this.basePath) + } + /** - * - * @summary Launch a command. - * @param {V1LaunchCommandRequest} body + * + * @summary Stream trial log fields. + * @param {number} trialId The ID of the trial. + * @param {boolean} [follow] Continue following fields until the trial stops. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - launchCommand(body: V1LaunchCommandRequest, options?: any) { - return CommandsApiFp(configuration).launchCommand(body, options)(fetch, basePath); - }, + public trialLogsFields(trialId: number, follow?: boolean, options?: any) { + return ExperimentsApiFp(this.configuration).trialLogsFields(trialId, follow, options)(this.fetch, this.basePath) + } + /** - * - * @summary Set the priority of the requested command. - * @param {string} commandId The id of the command. - * @param {V1SetCommandPriorityRequest} body + * + * @summary Unarchive an experiment. + * @param {number} id The experiment id. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ExperimentsApi */ - setCommandPriority(commandId: string, body: V1SetCommandPriorityRequest, options?: any) { - return CommandsApiFp(configuration).setCommandPriority( - commandId, - body, - options, - )(fetch, basePath); - }, - }; -}; + public unarchiveExperiment(id: number, options?: any) { + return ExperimentsApiFp(this.configuration).unarchiveExperiment(id, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Unarchive multiple experiments. + * @param {number} projectId Project id that the experiments belong to. + * @param {V1UnarchiveExperimentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ExperimentsApi + */ + public unarchiveExperiments(projectId: number, body: V1UnarchiveExperimentsRequest, options?: any) { + return ExperimentsApiFp(this.configuration).unarchiveExperiments(projectId, body, options)(this.fetch, this.basePath) + } + +} /** - * CommandsApi - object-oriented interface + * InternalApi - fetch parameter creator * @export - * @class - * @extends {BaseAPI} */ -export class CommandsApi extends BaseAPI { - /** - * - * @summary Get the requested command. - * @param {string} commandId The id of the command. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CommandsApi - */ - public getCommand(commandId: string, options?: any) { - return CommandsApiFp(this.configuration).getCommand(commandId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of commands. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort commands by the given field. - SORT_BY_UNSPECIFIED: Returns commands in an unsorted list. - SORT_BY_ID: Returns commands sorted by id. - SORT_BY_DESCRIPTION: Returns commands sorted by description. - SORT_BY_START_TIME: Return commands sorted by start time. - SORT_BY_WORKSPACE_ID: Return commands sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order commands in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of commands before returning results. Negative values denote number of commands to skip from the end before returning results. - * @param {number} [limit] Limit the number of commands. A value of 0 denotes no limit. - * @param {Array} [users] Limit commands to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit commands to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit commands to those within a specific workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CommandsApi - */ - public getCommands( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ) { - return CommandsApiFp(this.configuration).getCommands( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Kill the requested command. - * @param {string} commandId The id of the command. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CommandsApi - */ - public killCommand(commandId: string, options?: any) { - return CommandsApiFp(this.configuration).killCommand(commandId, options)( - this.fetch, - this.basePath, - ); - } +export const InternalApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Acknowledge the receipt of a signal to stop the given allocation early. This is used indicate and exit 0 isn't final; specifically, it is used for HP search directed early stops and preemption signals (not necessarily just scheduler preemption). + * @param {string} allocationId The allocation that is acknowledging the request. + * @param {V1AckAllocationPreemptionSignalRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + ackAllocationPreemptionSignal(allocationId: string, body: V1AckAllocationPreemptionSignalRequest, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling ackAllocationPreemptionSignal.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling ackAllocationPreemptionSignal.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/signals/ack_preemption` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary AllocationAllGather performs an all gather through the master. An allocation can only perform once all gather at a time. + * @param {string} allocationId The ID of the allocation. + * @param {V1AllocationAllGatherRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationAllGather(allocationId: string, body: V1AllocationAllGatherRequest, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling allocationAllGather.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling allocationAllGather.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/all_gather` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Report the receipt of a signal to stop the given allocation early. This is used to communicate back from a SLURM job that it has been notified of a pending preememption. Upon a call to this API the RM should then trigger a checkpoint and immediate exit. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationPendingPreemptionSignalRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationPendingPreemptionSignal(allocationId: string, body: V1AllocationPendingPreemptionSignalRequest, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling allocationPendingPreemptionSignal.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling allocationPendingPreemptionSignal.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/signals/pending_preemption` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Long poll preemption signals for the given allocation. If the allocation has been preempted when called, it will return so immediately. Otherwise, the connection will be kept open until the timeout is reached or the allocation is preempted. + * @param {string} allocationId The id of the allocation. + * @param {number} [timeoutSeconds] The timeout in seconds. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationPreemptionSignal(allocationId: string, timeoutSeconds?: number, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling allocationPreemptionSignal.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/signals/preemption` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (timeoutSeconds !== undefined) { + localVarQueryParameter['timeoutSeconds'] = timeoutSeconds + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Set allocation to ready state. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationReadyRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationReady(allocationId: string, body: V1AllocationReadyRequest, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling allocationReady.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling allocationReady.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/ready` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Gather an allocation's rendezvous info. Blocks until all trial containers connect to gather their rendezvous information and responds to them all at once. + * @param {string} allocationId The id of the allocation. + * @param {string} resourcesId The id of the clump of resources. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationRendezvousInfo(allocationId: string, resourcesId: string, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling allocationRendezvousInfo.'); + } + // verify required parameter 'resourcesId' is not null or undefined + if (resourcesId === null || resourcesId === undefined) { + throw new RequiredError('resourcesId','Required parameter resourcesId was null or undefined when calling allocationRendezvousInfo.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/resources/{resourcesId}/rendezvous` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))) + .replace(`{${"resourcesId"}}`, encodeURIComponent(String(resourcesId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Set allocation to waiting state. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationWaitingRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationWaiting(allocationId: string, body: V1AllocationWaitingRequest, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling allocationWaiting.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling allocationWaiting.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/waiting` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Archive runs. + * @param {V1ArchiveRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveRuns(body: V1ArchiveRunsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling archiveRuns.'); + } + const localVarPath = `/api/v1/runs/archive`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Assign multiple users to multiple groups. + * @param {V1AssignMultipleGroupsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assignMultipleGroups(body: V1AssignMultipleGroupsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling assignMultipleGroups.'); + } + const localVarPath = `/api/v1/users/assignments`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Bind resource pool to workspace + * @param {string} resourcePoolName The resource pool name. + * @param {V1BindRPToWorkspaceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + bindRPToWorkspace(resourcePoolName: string, body: V1BindRPToWorkspaceRequest, options: any = {}): FetchArgs { + // verify required parameter 'resourcePoolName' is not null or undefined + if (resourcePoolName === null || resourcePoolName === undefined) { + throw new RequiredError('resourcePoolName','Required parameter resourcePoolName was null or undefined when calling bindRPToWorkspace.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling bindRPToWorkspace.'); + } + const localVarPath = `/api/v1/resource-pools/{resourcePoolName}/workspace-bindings` + .replace(`{${"resourcePoolName"}}`, encodeURIComponent(String(resourcePoolName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Cleanup task logs according to the retention policy. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cleanupLogs(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/cleanup_logs`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Reports to the searcher that the trial has completed the given searcher operation. + * @param {number} trialId The id of the trial. + * @param {V1CompleteValidateAfterOperation} body The completed operation. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + completeTrialSearcherValidation(trialId: number, body: V1CompleteValidateAfterOperation, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling completeTrialSearcherValidation.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling completeTrialSearcherValidation.'); + } + const localVarPath = `/api/v1/trials/{trialId}/searcher/completed_operation` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Continues an experiment either to make the existing experiment train longer or to retry it. + * @param {V1ContinueExperimentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + continueExperiment(body: V1ContinueExperimentRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling continueExperiment.'); + } + const localVarPath = `/api/v1/experiments/continue`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create an experiment. + * @param {V1CreateExperimentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createExperiment(body: V1CreateExperimentRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createExperiment.'); + } + const localVarPath = `/api/v1/experiments`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create an experiment. + * @param {V1CreateGenericTaskRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createGenericTask(body: V1CreateGenericTaskRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createGenericTask.'); + } + const localVarPath = `/api/v1/generic-tasks`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create a group with optional members on creation. + * @param {V1CreateGroupRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createGroup(body: V1CreateGroupRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createGroup.'); + } + const localVarPath = `/api/v1/groups`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create unmanaged trial. + * @param {V1CreateTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createTrial(body: V1CreateTrialRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling createTrial.'); + } + const localVarPath = `/api/v1/trials`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Remove a group. + * @param {number} groupId The id of the group that should be deleted. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteGroup(groupId: number, options: any = {}): FetchArgs { + // verify required parameter 'groupId' is not null or undefined + if (groupId === null || groupId === undefined) { + throw new RequiredError('groupId','Required parameter groupId was null or undefined when calling deleteGroup.'); + } + const localVarPath = `/api/v1/groups/{groupId}` + .replace(`{${"groupId"}}`, encodeURIComponent(String(groupId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Delete a list of runs. + * @param {V1DeleteRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteRuns(body: V1DeleteRunsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling deleteRuns.'); + } + const localVarPath = `/api/v1/runs/delete`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the set of metric names recorded for a list of experiments. + * @param {Array} ids The ids for the experiments. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + expMetricNames(ids: Array, periodSeconds?: number, options: any = {}): FetchArgs { + // verify required parameter 'ids' is not null or undefined + if (ids === null || ids === undefined) { + throw new RequiredError('ids','Required parameter ids was null or undefined when calling expMetricNames.'); + } + const localVarPath = `/api/v1/experiments/metrics-stream/metric-names`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (ids) { + localVarQueryParameter['ids'] = ids + } + + if (periodSeconds !== undefined) { + localVarQueryParameter['periodSeconds'] = periodSeconds + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get details about an Allocation. + * @param {string} allocationId The id of the allocation. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAllocation(allocationId: string, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling getAllocation.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the best searcher validation for an experiment by the given metric. + * @param {number} experimentId The ID of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getBestSearcherValidationMetric(experimentId: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling getBestSearcherValidationMetric.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/searcher/best_searcher_validation_metric` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the current searcher operation. + * @param {number} trialId The id of the trial. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCurrentTrialSearcherOperation(trialId: number, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling getCurrentTrialSearcherOperation.'); + } + const localVarPath = `/api/v1/trials/{trialId}/searcher/operation` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get task config + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGenericTaskConfig(taskId: string, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling getGenericTaskConfig.'); + } + const localVarPath = `/api/v1/tasks/{taskId}/config` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a group by id. + * @param {number} groupId The id of the group to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGroup(groupId: number, options: any = {}): FetchArgs { + // verify required parameter 'groupId' is not null or undefined + if (groupId === null || groupId === undefined) { + throw new RequiredError('groupId','Required parameter groupId was null or undefined when calling getGroup.'); + } + const localVarPath = `/api/v1/groups/{groupId}` + .replace(`{${"groupId"}}`, encodeURIComponent(String(groupId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Search for groups with optional filters. + * @param {V1GetGroupsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGroups(body: V1GetGroupsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling getGroups.'); + } + const localVarPath = `/api/v1/groups/search`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get job queue stats for a resource pool. + * @param {Array} [resourcePools] Filter the results based on a set of resource pools. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getJobQueueStats(resourcePools?: Array, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/job-queues/stats`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (resourcePools) { + localVarQueryParameter['resourcePools'] = resourcePools + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of jobs in queue. + * @param {number} [offset] Pagination offset. + * @param {number} [limit] Pagination limit. + * @param {string} [resourcePool] The target resource-pool for agent resource manager. + * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getJobs(offset?: number, limit?: number, resourcePool?: string, orderBy?: V1OrderBy, states?: Array, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/job-queues`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (resourcePool !== undefined) { + localVarQueryParameter['resourcePool'] = resourcePool + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (states) { + localVarQueryParameter['states'] = states + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of jobs in queue. + * @param {number} [offset] Pagination offset. + * @param {number} [limit] Pagination limit. + * @param {string} [resourcePool] The target resource-pool for agent resource manager. + * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getJobsV2(offset?: number, limit?: number, resourcePool?: string, orderBy?: V1OrderBy, states?: Array, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/job-queues-v2`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (resourcePool !== undefined) { + localVarQueryParameter['resourcePool'] = resourcePool + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (states) { + localVarQueryParameter['states'] = states + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of columns for experiment list table. + * @param {number} id The id of the project. + * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectColumns(id: number, tableType?: V1TableType, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling getProjectColumns.'); + } + const localVarPath = `/api/v1/projects/{id}/columns` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (tableType !== undefined) { + localVarQueryParameter['tableType'] = tableType + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get metrics range for a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectNumericMetricsRange(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling getProjectNumericMetricsRange.'); + } + const localVarPath = `/api/v1/projects/{id}/experiments/metric-ranges` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of all resource pools from the cluster. + * @param {number} [offset] Skip the number of resource pools before returning results. Negative values denote number of resource pools to skip from the end before returning results. + * @param {number} [limit] Limit the number of resource pools. A value of 0 denotes no limit. + * @param {boolean} [unbound] Indicate whether or not to return unbound pools only. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getResourcePools(offset?: number, limit?: number, unbound?: boolean, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/resource-pools`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (unbound !== undefined) { + localVarQueryParameter['unbound'] = unbound + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get run metadata. + * @param {number} runId The ID of the run to get metadata for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRunMetadata(runId: number, options: any = {}): FetchArgs { + // verify required parameter 'runId' is not null or undefined + if (runId === null || runId === undefined) { + throw new RequiredError('runId','Required parameter runId was null or undefined when calling getRunMetadata.'); + } + const localVarPath = `/api/v1/runs/{runId}/metadata` + .replace(`{${"runId"}}`, encodeURIComponent(String(runId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTaskAcceleratorData(taskId: string, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling getTaskAcceleratorData.'); + } + const localVarPath = `/api/v1/tasks/{taskId}/acceleratorData` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get telemetry information. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTelemetry(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/master/telemetry`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a single trial by external id. + * @param {string} externalExperimentId External experiment id. + * @param {string} externalTrialId External trial id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialByExternalID(externalExperimentId: string, externalTrialId: string, options: any = {}): FetchArgs { + // verify required parameter 'externalExperimentId' is not null or undefined + if (externalExperimentId === null || externalExperimentId === undefined) { + throw new RequiredError('externalExperimentId','Required parameter externalExperimentId was null or undefined when calling getTrialByExternalID.'); + } + // verify required parameter 'externalTrialId' is not null or undefined + if (externalTrialId === null || externalTrialId === undefined) { + throw new RequiredError('externalTrialId','Required parameter externalTrialId was null or undefined when calling getTrialByExternalID.'); + } + const localVarPath = `/api/v1/trials/by-external-id/{externalExperimentId}/{externalTrialId}` + .replace(`{${"externalExperimentId"}}`, encodeURIComponent(String(externalExperimentId))) + .replace(`{${"externalTrialId"}}`, encodeURIComponent(String(externalTrialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Gets the metrics for all trials associated with this checkpoint + * @param {string} checkpointUuid UUID of the checkpoint. + * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub + * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialMetricsByCheckpoint(checkpointUuid: string, trialSourceInfoType?: V1TrialSourceInfoType, metricGroup?: string, options: any = {}): FetchArgs { + // verify required parameter 'checkpointUuid' is not null or undefined + if (checkpointUuid === null || checkpointUuid === undefined) { + throw new RequiredError('checkpointUuid','Required parameter checkpointUuid was null or undefined when calling getTrialMetricsByCheckpoint.'); + } + const localVarPath = `/api/v1/checkpoints/{checkpointUuid}/metrics` + .replace(`{${"checkpointUuid"}}`, encodeURIComponent(String(checkpointUuid))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (trialSourceInfoType !== undefined) { + localVarQueryParameter['trialSourceInfoType'] = trialSourceInfoType + } + + if (metricGroup !== undefined) { + localVarQueryParameter['metricGroup'] = metricGroup + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Gets the metrics for all trials associated with this model version + * @param {string} modelName The name of the model associated with the model version. + * @param {number} modelVersionNum Sequential model version number. + * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub + * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialMetricsByModelVersion(modelName: string, modelVersionNum: number, trialSourceInfoType?: V1TrialSourceInfoType, metricGroup?: string, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling getTrialMetricsByModelVersion.'); + } + // verify required parameter 'modelVersionNum' is not null or undefined + if (modelVersionNum === null || modelVersionNum === undefined) { + throw new RequiredError('modelVersionNum','Required parameter modelVersionNum was null or undefined when calling getTrialMetricsByModelVersion.'); + } + const localVarPath = `/api/v1/models/{modelName}/versions/{modelVersionNum}/metrics` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))) + .replace(`{${"modelVersionNum"}}`, encodeURIComponent(String(modelVersionNum))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (trialSourceInfoType !== undefined) { + localVarQueryParameter['trialSourceInfoType'] = trialSourceInfoType + } + + if (metricGroup !== undefined) { + localVarQueryParameter['metricGroup'] = metricGroup + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the list of trials for an experiment. + * @param {number} id The trial id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialRemainingLogRetentionDays(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling getTrialRemainingLogRetentionDays.'); + } + const localVarPath = `/api/v1/trials/{id}/remaining_log_retention_days` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the list of workloads for a trial. + * @param {number} trialId Limit workloads to those that are owned by the specified trial. + * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. + * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. + * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. + * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. + * @param {boolean} [includeBatchMetrics] Include per-batch metrics. + * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialWorkloads(trialId: number, orderBy?: V1OrderBy, offset?: number, limit?: number, sortKey?: string, filter?: GetTrialWorkloadsRequestFilterOption, includeBatchMetrics?: boolean, metricType?: V1MetricType, group?: string, removeDeletedCheckpoints?: boolean, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling getTrialWorkloads.'); + } + const localVarPath = `/api/v1/trials/{trialId}/workloads` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (sortKey !== undefined) { + localVarQueryParameter['sortKey'] = sortKey + } + + if (filter !== undefined) { + localVarQueryParameter['filter'] = filter + } + + if (includeBatchMetrics !== undefined) { + localVarQueryParameter['includeBatchMetrics'] = includeBatchMetrics + } + + if (metricType !== undefined) { + localVarQueryParameter['metricType'] = metricType + } + + if (group !== undefined) { + localVarQueryParameter['group'] = group + } + + if (removeDeletedCheckpoints !== undefined) { + localVarQueryParameter['removeDeletedCheckpoints'] = removeDeletedCheckpoints + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Send notebook idle data to master + * @param {string} notebookId The id of the notebook. + * @param {V1IdleNotebookRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + idleNotebook(notebookId: string, body: V1IdleNotebookRequest, options: any = {}): FetchArgs { + // verify required parameter 'notebookId' is not null or undefined + if (notebookId === null || notebookId === undefined) { + throw new RequiredError('notebookId','Required parameter notebookId was null or undefined when calling idleNotebook.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling idleNotebook.'); + } + const localVarPath = `/api/v1/notebooks/{notebookId}/report_idle` + .replace(`{${"notebookId"}}`, encodeURIComponent(String(notebookId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Kill generic task + * @param {string} taskId The id of the task. + * @param {V1KillGenericTaskRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killGenericTask(taskId: string, body: V1KillGenericTaskRequest, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling killGenericTask.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling killGenericTask.'); + } + const localVarPath = `/api/v1/tasks/{taskId}/kill` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of runs. + * @param {V1KillRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killRuns(body: V1KillRunsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling killRuns.'); + } + const localVarPath = `/api/v1/runs/kill`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary List all resource pools, bound and unbound, available to a specific workspace + * @param {number} workspaceId Workspace ID. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRPsBoundToWorkspace(workspaceId: number, offset?: number, limit?: number, options: any = {}): FetchArgs { + // verify required parameter 'workspaceId' is not null or undefined + if (workspaceId === null || workspaceId === undefined) { + throw new RequiredError('workspaceId','Required parameter workspaceId was null or undefined when calling listRPsBoundToWorkspace.'); + } + const localVarPath = `/api/v1/workspaces/{workspaceId}/available-resource-pools` + .replace(`{${"workspaceId"}}`, encodeURIComponent(String(workspaceId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary List all workspaces bound to a specific resource pool + * @param {string} resourcePoolName Resource pool name. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listWorkspacesBoundToRP(resourcePoolName: string, offset?: number, limit?: number, options: any = {}): FetchArgs { + // verify required parameter 'resourcePoolName' is not null or undefined + if (resourcePoolName === null || resourcePoolName === undefined) { + throw new RequiredError('resourcePoolName','Required parameter resourcePoolName was null or undefined when calling listWorkspacesBoundToRP.'); + } + const localVarPath = `/api/v1/resource-pools/{resourcePoolName}/workspace-bindings` + .replace(`{${"resourcePoolName"}}`, encodeURIComponent(String(resourcePoolName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Mark the given reservation (container, pod, etc) within an allocation as a daemon reservation. In the exit of a successful exit, Determined will wait for all resources to exit - unless they are marked as daemon resources, in which case Determined will clean them up regardless of exit status after all non-daemon resources have exited. + * @param {string} allocationId The id of the allocation. + * @param {string} resourcesId The id of the clump of resources to mark as daemon. + * @param {V1MarkAllocationResourcesDaemonRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + markAllocationResourcesDaemon(allocationId: string, resourcesId: string, body: V1MarkAllocationResourcesDaemonRequest, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling markAllocationResourcesDaemon.'); + } + // verify required parameter 'resourcesId' is not null or undefined + if (resourcesId === null || resourcesId === undefined) { + throw new RequiredError('resourcesId','Required parameter resourcesId was null or undefined when calling markAllocationResourcesDaemon.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling markAllocationResourcesDaemon.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/resources/{resourcesId}/daemon` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))) + .replace(`{${"resourcesId"}}`, encodeURIComponent(String(resourcesId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the milestones (in batches processed) at which a metric is recorded by an experiment. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + metricBatches(experimentId: number, metricName: string, metricType?: V1MetricType, group?: string, periodSeconds?: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling metricBatches.'); + } + // verify required parameter 'metricName' is not null or undefined + if (metricName === null || metricName === undefined) { + throw new RequiredError('metricName','Required parameter metricName was null or undefined when calling metricBatches.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/metrics-stream/batches` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (metricName !== undefined) { + localVarQueryParameter['metricName'] = metricName + } + + if (metricType !== undefined) { + localVarQueryParameter['metricType'] = metricType + } + + if (group !== undefined) { + localVarQueryParameter['group'] = group + } + + if (periodSeconds !== undefined) { + localVarQueryParameter['periodSeconds'] = periodSeconds + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Move runs. + * @param {V1MoveRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveRuns(body: V1MoveRunsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling moveRuns.'); + } + const localVarPath = `/api/v1/runs/move`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary NotifyContainterRunning is used to notify the master that the container is running. On HPC, the launcher will report a state of "Running" as soon as Slurm starts the job, but the container may be in the process of getting pulled down from the Internet, so the experiment is not really considered to be in a "Running" state until all the containers that are part of the experiment are running and not being pulled. + * @param {string} allocationId The ID of the allocation. + * @param {V1NotifyContainerRunningRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + notifyContainerRunning(allocationId: string, body: V1NotifyContainerRunningRequest, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling notifyContainerRunning.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling notifyContainerRunning.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/notify_container_running` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Overwrite resource pool - workspace bindings + * @param {string} resourcePoolName The resource pool name. + * @param {V1OverwriteRPWorkspaceBindingsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + overwriteRPWorkspaceBindings(resourcePoolName: string, body: V1OverwriteRPWorkspaceBindingsRequest, options: any = {}): FetchArgs { + // verify required parameter 'resourcePoolName' is not null or undefined + if (resourcePoolName === null || resourcePoolName === undefined) { + throw new RequiredError('resourcePoolName','Required parameter resourcePoolName was null or undefined when calling overwriteRPWorkspaceBindings.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling overwriteRPWorkspaceBindings.'); + } + const localVarPath = `/api/v1/resource-pools/{resourcePoolName}/workspace-bindings` + .replace(`{${"resourcePoolName"}}`, encodeURIComponent(String(resourcePoolName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update checkpoints. Won't modify checkpoint files. + * @param {V1PatchCheckpointsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchCheckpoints(body: V1PatchCheckpointsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchCheckpoints.'); + } + const localVarPath = `/api/v1/checkpoints`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Patch (an unmanaged) trial. + * @param {number} trialId Trial id. + * @param {V1PatchTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchTrial(trialId: number, body: V1PatchTrialRequest, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling patchTrial.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchTrial.'); + } + const localVarPath = `/api/v1/trials/{trialId}` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Patch multiple users' activation status. + * @param {V1PatchUsersRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchUsers(body: V1PatchUsersRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchUsers.'); + } + const localVarPath = `/api/v1/users`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Pause generic task + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseGenericTask(taskId: string, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling pauseGenericTask.'); + } + const localVarPath = `/api/v1/tasks/{taskId}/pause` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Pause experiment associated with provided runs. + * @param {V1PauseRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseRuns(body: V1PauseRunsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling pauseRuns.'); + } + const localVarPath = `/api/v1/runs/pause`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. + * @param {string} allocationId The id of the allocation. + * @param {V1PostAllocationAcceleratorDataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postAllocationAcceleratorData(allocationId: string, body: V1PostAllocationAcceleratorDataRequest, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling postAllocationAcceleratorData.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postAllocationAcceleratorData.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/acceleratorData` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary PostAllocationProxyAddress sets the proxy address to use when proxying to services provided by an allocation. Upon receipt, the master will also register any proxies specified by the task. + * @param {string} allocationId The id of the allocation. + * @param {V1PostAllocationProxyAddressRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postAllocationProxyAddress(allocationId: string, body: V1PostAllocationProxyAddressRequest, options: any = {}): FetchArgs { + // verify required parameter 'allocationId' is not null or undefined + if (allocationId === null || allocationId === undefined) { + throw new RequiredError('allocationId','Required parameter allocationId was null or undefined when calling postAllocationProxyAddress.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postAllocationProxyAddress.'); + } + const localVarPath = `/api/v1/allocations/{allocationId}/proxy_address` + .replace(`{${"allocationId"}}`, encodeURIComponent(String(allocationId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update run metadata. + * @param {number} runId The ID of the run to post metadata for. + * @param {V1PostRunMetadataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options: any = {}): FetchArgs { + // verify required parameter 'runId' is not null or undefined + if (runId === null || runId === undefined) { + throw new RequiredError('runId','Required parameter runId was null or undefined when calling postRunMetadata.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postRunMetadata.'); + } + const localVarPath = `/api/v1/runs/{runId}/metadata` + .replace(`{${"runId"}}`, encodeURIComponent(String(runId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Persist the given task logs. + * @param {V1PostTaskLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTaskLogs(body: V1PostTaskLogsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postTaskLogs.'); + } + const localVarPath = `/api/v1/task/logs`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Persist the given TrialProfilerMetricsBatch. The trial ID is in the labels. + * @param {V1PostTrialProfilerMetricsBatchRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTrialProfilerMetricsBatch(body: V1PostTrialProfilerMetricsBatchRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postTrialProfilerMetricsBatch.'); + } + const localVarPath = `/api/v1/trials/profiler/metrics`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary For bookkeeping, update trial runner metadata (currently just state). + * @param {number} trialId The id of the trial. + * @param {V1TrialRunnerMetadata} body The state for the trial runner. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTrialRunnerMetadata(trialId: number, body: V1TrialRunnerMetadata, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling postTrialRunnerMetadata.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postTrialRunnerMetadata.'); + } + const localVarPath = `/api/v1/trials/{trialId}/runner/metadata` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Put an experiment by external id. + * @param {string} externalExperimentId External experiment id. + * @param {V1CreateExperimentRequest} body CreateExperimentRequest payload. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperiment(externalExperimentId: string, body: V1CreateExperimentRequest, options: any = {}): FetchArgs { + // verify required parameter 'externalExperimentId' is not null or undefined + if (externalExperimentId === null || externalExperimentId === undefined) { + throw new RequiredError('externalExperimentId','Required parameter externalExperimentId was null or undefined when calling putExperiment.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling putExperiment.'); + } + const localVarPath = `/api/v1/experiments/by-external-id/{externalExperimentId}` + .replace(`{${"externalExperimentId"}}`, encodeURIComponent(String(externalExperimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Put a trial. + * @param {V1PutTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putTrial(body: V1PutTrialRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling putTrial.'); + } + const localVarPath = `/api/v1/trials`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Record a checkpoint. + * @param {V1Checkpoint} body The training metrics to persist. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportCheckpoint(body: V1Checkpoint, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling reportCheckpoint.'); + } + const localVarPath = `/api/v1/checkpoints`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Record metrics for specified trial. + * @param {number} metricsTrialId The trial associated with these metrics. + * @param {V1ReportTrialMetricsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialMetrics(metricsTrialId: number, body: V1ReportTrialMetricsRequest, options: any = {}): FetchArgs { + // verify required parameter 'metricsTrialId' is not null or undefined + if (metricsTrialId === null || metricsTrialId === undefined) { + throw new RequiredError('metricsTrialId','Required parameter metricsTrialId was null or undefined when calling reportTrialMetrics.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling reportTrialMetrics.'); + } + const localVarPath = `/api/v1/trials/{metricsTrialId}/metrics` + .replace(`{${"metricsTrialId"}}`, encodeURIComponent(String(metricsTrialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary For bookkeeping, updates the progress towards to current requested searcher training length. + * @param {number} trialId The id of the trial. + * @param {number} body Total units completed by the trial, in terms of the unit used to configure the searcher. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialProgress(trialId: number, body: number, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling reportTrialProgress.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling reportTrialProgress.'); + } + const localVarPath = `/api/v1/trials/{trialId}/progress` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Reports to the searcher that the trial has completed the current requested amount of training with the given searcher validation metric. + * @param {number} trialId The id of the trial. + * @param {V1TrialEarlyExit} body The exit reason. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialSearcherEarlyExit(trialId: number, body: V1TrialEarlyExit, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling reportTrialSearcherEarlyExit.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling reportTrialSearcherEarlyExit.'); + } + const localVarPath = `/api/v1/trials/{trialId}/early_exit` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Reports a TrialSourceInfo entry for tracking inference or fine-tuning runs + * @param {V1ReportTrialSourceInfoRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialSourceInfo(body: V1ReportTrialSourceInfoRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling reportTrialSourceInfo.'); + } + const localVarPath = `/api/v1/trial-source-info`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Record training metrics for specified training. + * @param {number} trainingMetricsTrialId The trial associated with these metrics. + * @param {V1TrialMetrics} body The training metrics to persist. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialTrainingMetrics(trainingMetricsTrialId: number, body: V1TrialMetrics, options: any = {}): FetchArgs { + // verify required parameter 'trainingMetricsTrialId' is not null or undefined + if (trainingMetricsTrialId === null || trainingMetricsTrialId === undefined) { + throw new RequiredError('trainingMetricsTrialId','Required parameter trainingMetricsTrialId was null or undefined when calling reportTrialTrainingMetrics.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling reportTrialTrainingMetrics.'); + } + const localVarPath = `/api/v1/trials/{trainingMetricsTrialId}/training_metrics` + .replace(`{${"trainingMetricsTrialId"}}`, encodeURIComponent(String(trainingMetricsTrialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Record validation metrics. + * @param {number} validationMetricsTrialId The trial associated with these metrics. + * @param {V1TrialMetrics} body The training metrics to persist. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialValidationMetrics(validationMetricsTrialId: number, body: V1TrialMetrics, options: any = {}): FetchArgs { + // verify required parameter 'validationMetricsTrialId' is not null or undefined + if (validationMetricsTrialId === null || validationMetricsTrialId === undefined) { + throw new RequiredError('validationMetricsTrialId','Required parameter validationMetricsTrialId was null or undefined when calling reportTrialValidationMetrics.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling reportTrialValidationMetrics.'); + } + const localVarPath = `/api/v1/trials/{validationMetricsTrialId}/validation_metrics` + .replace(`{${"validationMetricsTrialId"}}`, encodeURIComponent(String(validationMetricsTrialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Unpause experiment associated with provided runs. + * @param {V1ResumeRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resumeRuns(body: V1ResumeRunsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling resumeRuns.'); + } + const localVarPath = `/api/v1/runs/resume`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. + * @param {V1RunPrepareForReportingRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + runPrepareForReporting(body: V1RunPrepareForReportingRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling runPrepareForReporting.'); + } + const localVarPath = `/api/v1/runs/start`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get experiments with grouping and search syntax + * @param {number} [projectId] ID of the project to look at. + * @param {number} [offset] How many experiments to skip before including in the results. + * @param {number} [limit] How many results to show. + * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). + * @param {string} [filter] Filter expression. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchExperiments(projectId?: number, offset?: number, limit?: number, sort?: string, filter?: string, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/experiments-search`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (projectId !== undefined) { + localVarQueryParameter['projectId'] = projectId + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (sort !== undefined) { + localVarQueryParameter['sort'] = sort + } + + if (filter !== undefined) { + localVarQueryParameter['filter'] = filter + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of runs. + * @param {V1SearchRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchRuns(body: V1SearchRunsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling searchRuns.'); + } + const localVarPath = `/api/v1/runs`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Start (an unmanaged) trial. + * @param {number} trialId Trial id. + * @param {V1StartTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + startTrial(trialId: number, body: V1StartTrialRequest, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling startTrial.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling startTrial.'); + } + const localVarPath = `/api/v1/trials/{trialId}/start` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a sample of the metrics over time for a sample of the trials. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [maxTrials] Maximum number of trials to fetch data for. + * @param {number} [maxDatapoints] Maximum number of initial / historical data points. + * @param {number} [startBatches] Beginning of window (inclusive) to fetch data for. + * @param {number} [endBatches] Ending of window (inclusive) to fetch data for. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialsSample(experimentId: number, metricName: string, metricType?: V1MetricType, group?: string, maxTrials?: number, maxDatapoints?: number, startBatches?: number, endBatches?: number, periodSeconds?: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling trialsSample.'); + } + // verify required parameter 'metricName' is not null or undefined + if (metricName === null || metricName === undefined) { + throw new RequiredError('metricName','Required parameter metricName was null or undefined when calling trialsSample.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/metrics-stream/trials-sample` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (metricName !== undefined) { + localVarQueryParameter['metricName'] = metricName + } + + if (metricType !== undefined) { + localVarQueryParameter['metricType'] = metricType + } + + if (group !== undefined) { + localVarQueryParameter['group'] = group + } + + if (maxTrials !== undefined) { + localVarQueryParameter['maxTrials'] = maxTrials + } + + if (maxDatapoints !== undefined) { + localVarQueryParameter['maxDatapoints'] = maxDatapoints + } + + if (startBatches !== undefined) { + localVarQueryParameter['startBatches'] = startBatches + } + + if (endBatches !== undefined) { + localVarQueryParameter['endBatches'] = endBatches + } + + if (periodSeconds !== undefined) { + localVarQueryParameter['periodSeconds'] = periodSeconds + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a snapshot of a metric across all trials at a certain point of progress. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {number} batchesProcessed The point of progress at which to query metrics. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [batchesMargin] A range either side of batches_processed to include near-misses. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialsSnapshot(experimentId: number, metricName: string, batchesProcessed: number, metricType?: V1MetricType, group?: string, batchesMargin?: number, periodSeconds?: number, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling trialsSnapshot.'); + } + // verify required parameter 'metricName' is not null or undefined + if (metricName === null || metricName === undefined) { + throw new RequiredError('metricName','Required parameter metricName was null or undefined when calling trialsSnapshot.'); + } + // verify required parameter 'batchesProcessed' is not null or undefined + if (batchesProcessed === null || batchesProcessed === undefined) { + throw new RequiredError('batchesProcessed','Required parameter batchesProcessed was null or undefined when calling trialsSnapshot.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/metrics-stream/trials-snapshot` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (metricName !== undefined) { + localVarQueryParameter['metricName'] = metricName + } + + if (metricType !== undefined) { + localVarQueryParameter['metricType'] = metricType + } + + if (group !== undefined) { + localVarQueryParameter['group'] = group + } + + if (batchesProcessed !== undefined) { + localVarQueryParameter['batchesProcessed'] = batchesProcessed + } + + if (batchesMargin !== undefined) { + localVarQueryParameter['batchesMargin'] = batchesMargin + } + + if (periodSeconds !== undefined) { + localVarQueryParameter['periodSeconds'] = periodSeconds + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Unarchive runs. + * @param {V1UnarchiveRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveRuns(body: V1UnarchiveRunsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling unarchiveRuns.'); + } + const localVarPath = `/api/v1/runs/unarchive`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Unbind resource pool to workspace + * @param {string} resourcePoolName The resource pool name. + * @param {V1UnbindRPFromWorkspaceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unbindRPFromWorkspace(resourcePoolName: string, body: V1UnbindRPFromWorkspaceRequest, options: any = {}): FetchArgs { + // verify required parameter 'resourcePoolName' is not null or undefined + if (resourcePoolName === null || resourcePoolName === undefined) { + throw new RequiredError('resourcePoolName','Required parameter resourcePoolName was null or undefined when calling unbindRPFromWorkspace.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling unbindRPFromWorkspace.'); + } + const localVarPath = `/api/v1/resource-pools/{resourcePoolName}/workspace-bindings` + .replace(`{${"resourcePoolName"}}`, encodeURIComponent(String(resourcePoolName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Unpause generic task + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unpauseGenericTask(taskId: string, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling unpauseGenericTask.'); + } + const localVarPath = `/api/v1/tasks/{taskId}/unpause` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update group info. + * @param {number} groupId The id of the group + * @param {V1UpdateGroupRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateGroup(groupId: number, body: V1UpdateGroupRequest, options: any = {}): FetchArgs { + // verify required parameter 'groupId' is not null or undefined + if (groupId === null || groupId === undefined) { + throw new RequiredError('groupId','Required parameter groupId was null or undefined when calling updateGroup.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling updateGroup.'); + } + const localVarPath = `/api/v1/groups/{groupId}` + .replace(`{${"groupId"}}`, encodeURIComponent(String(groupId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Control the job queues. + * @param {V1UpdateJobQueueRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateJobQueue(body: V1UpdateJobQueueRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling updateJobQueue.'); + } + const localVarPath = `/api/v1/job-queues`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; - /** - * - * @summary Launch a command. - * @param {V1LaunchCommandRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CommandsApi - */ - public launchCommand(body: V1LaunchCommandRequest, options?: any) { - return CommandsApiFp(this.configuration).launchCommand(body, options)( - this.fetch, - this.basePath, - ); - } +/** + * InternalApi - functional programming interface + * @export + */ +export const InternalApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Acknowledge the receipt of a signal to stop the given allocation early. This is used indicate and exit 0 isn't final; specifically, it is used for HP search directed early stops and preemption signals (not necessarily just scheduler preemption). + * @param {string} allocationId The allocation that is acknowledging the request. + * @param {V1AckAllocationPreemptionSignalRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + ackAllocationPreemptionSignal(allocationId: string, body: V1AckAllocationPreemptionSignalRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).ackAllocationPreemptionSignal(allocationId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary AllocationAllGather performs an all gather through the master. An allocation can only perform once all gather at a time. + * @param {string} allocationId The ID of the allocation. + * @param {V1AllocationAllGatherRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationAllGather(allocationId: string, body: V1AllocationAllGatherRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).allocationAllGather(allocationId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Report the receipt of a signal to stop the given allocation early. This is used to communicate back from a SLURM job that it has been notified of a pending preememption. Upon a call to this API the RM should then trigger a checkpoint and immediate exit. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationPendingPreemptionSignalRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationPendingPreemptionSignal(allocationId: string, body: V1AllocationPendingPreemptionSignalRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).allocationPendingPreemptionSignal(allocationId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Long poll preemption signals for the given allocation. If the allocation has been preempted when called, it will return so immediately. Otherwise, the connection will be kept open until the timeout is reached or the allocation is preempted. + * @param {string} allocationId The id of the allocation. + * @param {number} [timeoutSeconds] The timeout in seconds. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationPreemptionSignal(allocationId: string, timeoutSeconds?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).allocationPreemptionSignal(allocationId, timeoutSeconds, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Set allocation to ready state. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationReadyRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationReady(allocationId: string, body: V1AllocationReadyRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).allocationReady(allocationId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Gather an allocation's rendezvous info. Blocks until all trial containers connect to gather their rendezvous information and responds to them all at once. + * @param {string} allocationId The id of the allocation. + * @param {string} resourcesId The id of the clump of resources. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationRendezvousInfo(allocationId: string, resourcesId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).allocationRendezvousInfo(allocationId, resourcesId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Set allocation to waiting state. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationWaitingRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationWaiting(allocationId: string, body: V1AllocationWaitingRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).allocationWaiting(allocationId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Archive runs. + * @param {V1ArchiveRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveRuns(body: V1ArchiveRunsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).archiveRuns(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Assign multiple users to multiple groups. + * @param {V1AssignMultipleGroupsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assignMultipleGroups(body: V1AssignMultipleGroupsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).assignMultipleGroups(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Bind resource pool to workspace + * @param {string} resourcePoolName The resource pool name. + * @param {V1BindRPToWorkspaceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + bindRPToWorkspace(resourcePoolName: string, body: V1BindRPToWorkspaceRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).bindRPToWorkspace(resourcePoolName, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Cleanup task logs according to the retention policy. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cleanupLogs(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).cleanupLogs(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Reports to the searcher that the trial has completed the given searcher operation. + * @param {number} trialId The id of the trial. + * @param {V1CompleteValidateAfterOperation} body The completed operation. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + completeTrialSearcherValidation(trialId: number, body: V1CompleteValidateAfterOperation, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).completeTrialSearcherValidation(trialId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Continues an experiment either to make the existing experiment train longer or to retry it. + * @param {V1ContinueExperimentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + continueExperiment(body: V1ContinueExperimentRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).continueExperiment(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create an experiment. + * @param {V1CreateExperimentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createExperiment(body: V1CreateExperimentRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).createExperiment(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create an experiment. + * @param {V1CreateGenericTaskRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createGenericTask(body: V1CreateGenericTaskRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).createGenericTask(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create a group with optional members on creation. + * @param {V1CreateGroupRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createGroup(body: V1CreateGroupRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).createGroup(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create unmanaged trial. + * @param {V1CreateTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createTrial(body: V1CreateTrialRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).createTrial(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Remove a group. + * @param {number} groupId The id of the group that should be deleted. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteGroup(groupId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).deleteGroup(groupId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Delete a list of runs. + * @param {V1DeleteRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteRuns(body: V1DeleteRunsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).deleteRuns(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the set of metric names recorded for a list of experiments. + * @param {Array} ids The ids for the experiments. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + expMetricNames(ids: Array, periodSeconds?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).expMetricNames(ids, periodSeconds, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get details about an Allocation. + * @param {string} allocationId The id of the allocation. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAllocation(allocationId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getAllocation(allocationId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the best searcher validation for an experiment by the given metric. + * @param {number} experimentId The ID of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getBestSearcherValidationMetric(experimentId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getBestSearcherValidationMetric(experimentId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the current searcher operation. + * @param {number} trialId The id of the trial. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCurrentTrialSearcherOperation(trialId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getCurrentTrialSearcherOperation(trialId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get task config + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGenericTaskConfig(taskId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getGenericTaskConfig(taskId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a group by id. + * @param {number} groupId The id of the group to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGroup(groupId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getGroup(groupId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Search for groups with optional filters. + * @param {V1GetGroupsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGroups(body: V1GetGroupsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getGroups(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get job queue stats for a resource pool. + * @param {Array} [resourcePools] Filter the results based on a set of resource pools. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getJobQueueStats(resourcePools?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getJobQueueStats(resourcePools, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of jobs in queue. + * @param {number} [offset] Pagination offset. + * @param {number} [limit] Pagination limit. + * @param {string} [resourcePool] The target resource-pool for agent resource manager. + * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getJobs(offset?: number, limit?: number, resourcePool?: string, orderBy?: V1OrderBy, states?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getJobs(offset, limit, resourcePool, orderBy, states, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of jobs in queue. + * @param {number} [offset] Pagination offset. + * @param {number} [limit] Pagination limit. + * @param {string} [resourcePool] The target resource-pool for agent resource manager. + * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getJobsV2(offset?: number, limit?: number, resourcePool?: string, orderBy?: V1OrderBy, states?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getJobsV2(offset, limit, resourcePool, orderBy, states, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of columns for experiment list table. + * @param {number} id The id of the project. + * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectColumns(id: number, tableType?: V1TableType, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getProjectColumns(id, tableType, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get metrics range for a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectNumericMetricsRange(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getProjectNumericMetricsRange(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of all resource pools from the cluster. + * @param {number} [offset] Skip the number of resource pools before returning results. Negative values denote number of resource pools to skip from the end before returning results. + * @param {number} [limit] Limit the number of resource pools. A value of 0 denotes no limit. + * @param {boolean} [unbound] Indicate whether or not to return unbound pools only. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getResourcePools(offset?: number, limit?: number, unbound?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getResourcePools(offset, limit, unbound, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get run metadata. + * @param {number} runId The ID of the run to get metadata for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRunMetadata(runId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getRunMetadata(runId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTaskAcceleratorData(taskId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTaskAcceleratorData(taskId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get telemetry information. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTelemetry(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTelemetry(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a single trial by external id. + * @param {string} externalExperimentId External experiment id. + * @param {string} externalTrialId External trial id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialByExternalID(externalExperimentId: string, externalTrialId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTrialByExternalID(externalExperimentId, externalTrialId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Gets the metrics for all trials associated with this checkpoint + * @param {string} checkpointUuid UUID of the checkpoint. + * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub + * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialMetricsByCheckpoint(checkpointUuid: string, trialSourceInfoType?: V1TrialSourceInfoType, metricGroup?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTrialMetricsByCheckpoint(checkpointUuid, trialSourceInfoType, metricGroup, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Gets the metrics for all trials associated with this model version + * @param {string} modelName The name of the model associated with the model version. + * @param {number} modelVersionNum Sequential model version number. + * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub + * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialMetricsByModelVersion(modelName: string, modelVersionNum: number, trialSourceInfoType?: V1TrialSourceInfoType, metricGroup?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTrialMetricsByModelVersion(modelName, modelVersionNum, trialSourceInfoType, metricGroup, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the list of trials for an experiment. + * @param {number} id The trial id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialRemainingLogRetentionDays(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTrialRemainingLogRetentionDays(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the list of workloads for a trial. + * @param {number} trialId Limit workloads to those that are owned by the specified trial. + * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. + * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. + * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. + * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. + * @param {boolean} [includeBatchMetrics] Include per-batch metrics. + * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialWorkloads(trialId: number, orderBy?: V1OrderBy, offset?: number, limit?: number, sortKey?: string, filter?: GetTrialWorkloadsRequestFilterOption, includeBatchMetrics?: boolean, metricType?: V1MetricType, group?: string, removeDeletedCheckpoints?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTrialWorkloads(trialId, orderBy, offset, limit, sortKey, filter, includeBatchMetrics, metricType, group, removeDeletedCheckpoints, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Send notebook idle data to master + * @param {string} notebookId The id of the notebook. + * @param {V1IdleNotebookRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + idleNotebook(notebookId: string, body: V1IdleNotebookRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).idleNotebook(notebookId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Kill generic task + * @param {string} taskId The id of the task. + * @param {V1KillGenericTaskRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killGenericTask(taskId: string, body: V1KillGenericTaskRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).killGenericTask(taskId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of runs. + * @param {V1KillRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killRuns(body: V1KillRunsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).killRuns(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary List all resource pools, bound and unbound, available to a specific workspace + * @param {number} workspaceId Workspace ID. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRPsBoundToWorkspace(workspaceId: number, offset?: number, limit?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).listRPsBoundToWorkspace(workspaceId, offset, limit, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary List all workspaces bound to a specific resource pool + * @param {string} resourcePoolName Resource pool name. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listWorkspacesBoundToRP(resourcePoolName: string, offset?: number, limit?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).listWorkspacesBoundToRP(resourcePoolName, offset, limit, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Mark the given reservation (container, pod, etc) within an allocation as a daemon reservation. In the exit of a successful exit, Determined will wait for all resources to exit - unless they are marked as daemon resources, in which case Determined will clean them up regardless of exit status after all non-daemon resources have exited. + * @param {string} allocationId The id of the allocation. + * @param {string} resourcesId The id of the clump of resources to mark as daemon. + * @param {V1MarkAllocationResourcesDaemonRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + markAllocationResourcesDaemon(allocationId: string, resourcesId: string, body: V1MarkAllocationResourcesDaemonRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).markAllocationResourcesDaemon(allocationId, resourcesId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the milestones (in batches processed) at which a metric is recorded by an experiment. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + metricBatches(experimentId: number, metricName: string, metricType?: V1MetricType, group?: string, periodSeconds?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).metricBatches(experimentId, metricName, metricType, group, periodSeconds, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Move runs. + * @param {V1MoveRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveRuns(body: V1MoveRunsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).moveRuns(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary NotifyContainterRunning is used to notify the master that the container is running. On HPC, the launcher will report a state of "Running" as soon as Slurm starts the job, but the container may be in the process of getting pulled down from the Internet, so the experiment is not really considered to be in a "Running" state until all the containers that are part of the experiment are running and not being pulled. + * @param {string} allocationId The ID of the allocation. + * @param {V1NotifyContainerRunningRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + notifyContainerRunning(allocationId: string, body: V1NotifyContainerRunningRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).notifyContainerRunning(allocationId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Overwrite resource pool - workspace bindings + * @param {string} resourcePoolName The resource pool name. + * @param {V1OverwriteRPWorkspaceBindingsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + overwriteRPWorkspaceBindings(resourcePoolName: string, body: V1OverwriteRPWorkspaceBindingsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).overwriteRPWorkspaceBindings(resourcePoolName, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Update checkpoints. Won't modify checkpoint files. + * @param {V1PatchCheckpointsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchCheckpoints(body: V1PatchCheckpointsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).patchCheckpoints(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Patch (an unmanaged) trial. + * @param {number} trialId Trial id. + * @param {V1PatchTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchTrial(trialId: number, body: V1PatchTrialRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).patchTrial(trialId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Patch multiple users' activation status. + * @param {V1PatchUsersRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchUsers(body: V1PatchUsersRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).patchUsers(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Pause generic task + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseGenericTask(taskId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).pauseGenericTask(taskId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Pause experiment associated with provided runs. + * @param {V1PauseRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseRuns(body: V1PauseRunsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).pauseRuns(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. + * @param {string} allocationId The id of the allocation. + * @param {V1PostAllocationAcceleratorDataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postAllocationAcceleratorData(allocationId: string, body: V1PostAllocationAcceleratorDataRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).postAllocationAcceleratorData(allocationId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary PostAllocationProxyAddress sets the proxy address to use when proxying to services provided by an allocation. Upon receipt, the master will also register any proxies specified by the task. + * @param {string} allocationId The id of the allocation. + * @param {V1PostAllocationProxyAddressRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postAllocationProxyAddress(allocationId: string, body: V1PostAllocationProxyAddressRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).postAllocationProxyAddress(allocationId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Update run metadata. + * @param {number} runId The ID of the run to post metadata for. + * @param {V1PostRunMetadataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).postRunMetadata(runId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Persist the given task logs. + * @param {V1PostTaskLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTaskLogs(body: V1PostTaskLogsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).postTaskLogs(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Persist the given TrialProfilerMetricsBatch. The trial ID is in the labels. + * @param {V1PostTrialProfilerMetricsBatchRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTrialProfilerMetricsBatch(body: V1PostTrialProfilerMetricsBatchRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).postTrialProfilerMetricsBatch(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary For bookkeeping, update trial runner metadata (currently just state). + * @param {number} trialId The id of the trial. + * @param {V1TrialRunnerMetadata} body The state for the trial runner. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTrialRunnerMetadata(trialId: number, body: V1TrialRunnerMetadata, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).postTrialRunnerMetadata(trialId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Put an experiment by external id. + * @param {string} externalExperimentId External experiment id. + * @param {V1CreateExperimentRequest} body CreateExperimentRequest payload. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperiment(externalExperimentId: string, body: V1CreateExperimentRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).putExperiment(externalExperimentId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Put a trial. + * @param {V1PutTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putTrial(body: V1PutTrialRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).putTrial(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Record a checkpoint. + * @param {V1Checkpoint} body The training metrics to persist. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportCheckpoint(body: V1Checkpoint, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportCheckpoint(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Record metrics for specified trial. + * @param {number} metricsTrialId The trial associated with these metrics. + * @param {V1ReportTrialMetricsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialMetrics(metricsTrialId: number, body: V1ReportTrialMetricsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportTrialMetrics(metricsTrialId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary For bookkeeping, updates the progress towards to current requested searcher training length. + * @param {number} trialId The id of the trial. + * @param {number} body Total units completed by the trial, in terms of the unit used to configure the searcher. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialProgress(trialId: number, body: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportTrialProgress(trialId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Reports to the searcher that the trial has completed the current requested amount of training with the given searcher validation metric. + * @param {number} trialId The id of the trial. + * @param {V1TrialEarlyExit} body The exit reason. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialSearcherEarlyExit(trialId: number, body: V1TrialEarlyExit, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportTrialSearcherEarlyExit(trialId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Reports a TrialSourceInfo entry for tracking inference or fine-tuning runs + * @param {V1ReportTrialSourceInfoRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialSourceInfo(body: V1ReportTrialSourceInfoRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportTrialSourceInfo(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Record training metrics for specified training. + * @param {number} trainingMetricsTrialId The trial associated with these metrics. + * @param {V1TrialMetrics} body The training metrics to persist. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialTrainingMetrics(trainingMetricsTrialId: number, body: V1TrialMetrics, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportTrialTrainingMetrics(trainingMetricsTrialId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Record validation metrics. + * @param {number} validationMetricsTrialId The trial associated with these metrics. + * @param {V1TrialMetrics} body The training metrics to persist. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialValidationMetrics(validationMetricsTrialId: number, body: V1TrialMetrics, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportTrialValidationMetrics(validationMetricsTrialId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Unpause experiment associated with provided runs. + * @param {V1ResumeRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resumeRuns(body: V1ResumeRunsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).resumeRuns(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. + * @param {V1RunPrepareForReportingRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + runPrepareForReporting(body: V1RunPrepareForReportingRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).runPrepareForReporting(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get experiments with grouping and search syntax + * @param {number} [projectId] ID of the project to look at. + * @param {number} [offset] How many experiments to skip before including in the results. + * @param {number} [limit] How many results to show. + * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). + * @param {string} [filter] Filter expression. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchExperiments(projectId?: number, offset?: number, limit?: number, sort?: string, filter?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).searchExperiments(projectId, offset, limit, sort, filter, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of runs. + * @param {V1SearchRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchRuns(body: V1SearchRunsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).searchRuns(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Start (an unmanaged) trial. + * @param {number} trialId Trial id. + * @param {V1StartTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + startTrial(trialId: number, body: V1StartTrialRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).startTrial(trialId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a sample of the metrics over time for a sample of the trials. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [maxTrials] Maximum number of trials to fetch data for. + * @param {number} [maxDatapoints] Maximum number of initial / historical data points. + * @param {number} [startBatches] Beginning of window (inclusive) to fetch data for. + * @param {number} [endBatches] Ending of window (inclusive) to fetch data for. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialsSample(experimentId: number, metricName: string, metricType?: V1MetricType, group?: string, maxTrials?: number, maxDatapoints?: number, startBatches?: number, endBatches?: number, periodSeconds?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).trialsSample(experimentId, metricName, metricType, group, maxTrials, maxDatapoints, startBatches, endBatches, periodSeconds, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a snapshot of a metric across all trials at a certain point of progress. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {number} batchesProcessed The point of progress at which to query metrics. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [batchesMargin] A range either side of batches_processed to include near-misses. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialsSnapshot(experimentId: number, metricName: string, batchesProcessed: number, metricType?: V1MetricType, group?: string, batchesMargin?: number, periodSeconds?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).trialsSnapshot(experimentId, metricName, batchesProcessed, metricType, group, batchesMargin, periodSeconds, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Unarchive runs. + * @param {V1UnarchiveRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveRuns(body: V1UnarchiveRunsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).unarchiveRuns(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Unbind resource pool to workspace + * @param {string} resourcePoolName The resource pool name. + * @param {V1UnbindRPFromWorkspaceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unbindRPFromWorkspace(resourcePoolName: string, body: V1UnbindRPFromWorkspaceRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).unbindRPFromWorkspace(resourcePoolName, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Unpause generic task + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unpauseGenericTask(taskId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).unpauseGenericTask(taskId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Update group info. + * @param {number} groupId The id of the group + * @param {V1UpdateGroupRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateGroup(groupId: number, body: V1UpdateGroupRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).updateGroup(groupId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Control the job queues. + * @param {V1UpdateJobQueueRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateJobQueue(body: V1UpdateJobQueueRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = InternalApiFetchParamCreator(configuration).updateJobQueue(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; - /** - * - * @summary Set the priority of the requested command. - * @param {string} commandId The id of the command. - * @param {V1SetCommandPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof CommandsApi - */ - public setCommandPriority(commandId: string, body: V1SetCommandPriorityRequest, options?: any) { - return CommandsApiFp(this.configuration).setCommandPriority( - commandId, - body, - options, - )(this.fetch, this.basePath); - } -} +/** + * InternalApi - factory interface + * @export + */ +export const InternalApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Acknowledge the receipt of a signal to stop the given allocation early. This is used indicate and exit 0 isn't final; specifically, it is used for HP search directed early stops and preemption signals (not necessarily just scheduler preemption). + * @param {string} allocationId The allocation that is acknowledging the request. + * @param {V1AckAllocationPreemptionSignalRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + ackAllocationPreemptionSignal(allocationId: string, body: V1AckAllocationPreemptionSignalRequest, options?: any) { + return InternalApiFp(configuration).ackAllocationPreemptionSignal(allocationId, body, options)(fetch, basePath); + }, + /** + * + * @summary AllocationAllGather performs an all gather through the master. An allocation can only perform once all gather at a time. + * @param {string} allocationId The ID of the allocation. + * @param {V1AllocationAllGatherRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationAllGather(allocationId: string, body: V1AllocationAllGatherRequest, options?: any) { + return InternalApiFp(configuration).allocationAllGather(allocationId, body, options)(fetch, basePath); + }, + /** + * + * @summary Report the receipt of a signal to stop the given allocation early. This is used to communicate back from a SLURM job that it has been notified of a pending preememption. Upon a call to this API the RM should then trigger a checkpoint and immediate exit. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationPendingPreemptionSignalRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationPendingPreemptionSignal(allocationId: string, body: V1AllocationPendingPreemptionSignalRequest, options?: any) { + return InternalApiFp(configuration).allocationPendingPreemptionSignal(allocationId, body, options)(fetch, basePath); + }, + /** + * + * @summary Long poll preemption signals for the given allocation. If the allocation has been preempted when called, it will return so immediately. Otherwise, the connection will be kept open until the timeout is reached or the allocation is preempted. + * @param {string} allocationId The id of the allocation. + * @param {number} [timeoutSeconds] The timeout in seconds. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationPreemptionSignal(allocationId: string, timeoutSeconds?: number, options?: any) { + return InternalApiFp(configuration).allocationPreemptionSignal(allocationId, timeoutSeconds, options)(fetch, basePath); + }, + /** + * + * @summary Set allocation to ready state. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationReadyRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationReady(allocationId: string, body: V1AllocationReadyRequest, options?: any) { + return InternalApiFp(configuration).allocationReady(allocationId, body, options)(fetch, basePath); + }, + /** + * + * @summary Gather an allocation's rendezvous info. Blocks until all trial containers connect to gather their rendezvous information and responds to them all at once. + * @param {string} allocationId The id of the allocation. + * @param {string} resourcesId The id of the clump of resources. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationRendezvousInfo(allocationId: string, resourcesId: string, options?: any) { + return InternalApiFp(configuration).allocationRendezvousInfo(allocationId, resourcesId, options)(fetch, basePath); + }, + /** + * + * @summary Set allocation to waiting state. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationWaitingRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + allocationWaiting(allocationId: string, body: V1AllocationWaitingRequest, options?: any) { + return InternalApiFp(configuration).allocationWaiting(allocationId, body, options)(fetch, basePath); + }, + /** + * + * @summary Archive runs. + * @param {V1ArchiveRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveRuns(body: V1ArchiveRunsRequest, options?: any) { + return InternalApiFp(configuration).archiveRuns(body, options)(fetch, basePath); + }, + /** + * + * @summary Assign multiple users to multiple groups. + * @param {V1AssignMultipleGroupsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assignMultipleGroups(body: V1AssignMultipleGroupsRequest, options?: any) { + return InternalApiFp(configuration).assignMultipleGroups(body, options)(fetch, basePath); + }, + /** + * + * @summary Bind resource pool to workspace + * @param {string} resourcePoolName The resource pool name. + * @param {V1BindRPToWorkspaceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + bindRPToWorkspace(resourcePoolName: string, body: V1BindRPToWorkspaceRequest, options?: any) { + return InternalApiFp(configuration).bindRPToWorkspace(resourcePoolName, body, options)(fetch, basePath); + }, + /** + * + * @summary Cleanup task logs according to the retention policy. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + cleanupLogs(options?: any) { + return InternalApiFp(configuration).cleanupLogs(options)(fetch, basePath); + }, + /** + * + * @summary Reports to the searcher that the trial has completed the given searcher operation. + * @param {number} trialId The id of the trial. + * @param {V1CompleteValidateAfterOperation} body The completed operation. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + completeTrialSearcherValidation(trialId: number, body: V1CompleteValidateAfterOperation, options?: any) { + return InternalApiFp(configuration).completeTrialSearcherValidation(trialId, body, options)(fetch, basePath); + }, + /** + * + * @summary Continues an experiment either to make the existing experiment train longer or to retry it. + * @param {V1ContinueExperimentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + continueExperiment(body: V1ContinueExperimentRequest, options?: any) { + return InternalApiFp(configuration).continueExperiment(body, options)(fetch, basePath); + }, + /** + * + * @summary Create an experiment. + * @param {V1CreateExperimentRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createExperiment(body: V1CreateExperimentRequest, options?: any) { + return InternalApiFp(configuration).createExperiment(body, options)(fetch, basePath); + }, + /** + * + * @summary Create an experiment. + * @param {V1CreateGenericTaskRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createGenericTask(body: V1CreateGenericTaskRequest, options?: any) { + return InternalApiFp(configuration).createGenericTask(body, options)(fetch, basePath); + }, + /** + * + * @summary Create a group with optional members on creation. + * @param {V1CreateGroupRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createGroup(body: V1CreateGroupRequest, options?: any) { + return InternalApiFp(configuration).createGroup(body, options)(fetch, basePath); + }, + /** + * + * @summary Create unmanaged trial. + * @param {V1CreateTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createTrial(body: V1CreateTrialRequest, options?: any) { + return InternalApiFp(configuration).createTrial(body, options)(fetch, basePath); + }, + /** + * + * @summary Remove a group. + * @param {number} groupId The id of the group that should be deleted. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteGroup(groupId: number, options?: any) { + return InternalApiFp(configuration).deleteGroup(groupId, options)(fetch, basePath); + }, + /** + * + * @summary Delete a list of runs. + * @param {V1DeleteRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteRuns(body: V1DeleteRunsRequest, options?: any) { + return InternalApiFp(configuration).deleteRuns(body, options)(fetch, basePath); + }, + /** + * + * @summary Get the set of metric names recorded for a list of experiments. + * @param {Array} ids The ids for the experiments. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + expMetricNames(ids: Array, periodSeconds?: number, options?: any) { + return InternalApiFp(configuration).expMetricNames(ids, periodSeconds, options)(fetch, basePath); + }, + /** + * + * @summary Get details about an Allocation. + * @param {string} allocationId The id of the allocation. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAllocation(allocationId: string, options?: any) { + return InternalApiFp(configuration).getAllocation(allocationId, options)(fetch, basePath); + }, + /** + * + * @summary Get the best searcher validation for an experiment by the given metric. + * @param {number} experimentId The ID of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getBestSearcherValidationMetric(experimentId: number, options?: any) { + return InternalApiFp(configuration).getBestSearcherValidationMetric(experimentId, options)(fetch, basePath); + }, + /** + * + * @summary Get the current searcher operation. + * @param {number} trialId The id of the trial. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getCurrentTrialSearcherOperation(trialId: number, options?: any) { + return InternalApiFp(configuration).getCurrentTrialSearcherOperation(trialId, options)(fetch, basePath); + }, + /** + * + * @summary Get task config + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGenericTaskConfig(taskId: string, options?: any) { + return InternalApiFp(configuration).getGenericTaskConfig(taskId, options)(fetch, basePath); + }, + /** + * + * @summary Get a group by id. + * @param {number} groupId The id of the group to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGroup(groupId: number, options?: any) { + return InternalApiFp(configuration).getGroup(groupId, options)(fetch, basePath); + }, + /** + * + * @summary Search for groups with optional filters. + * @param {V1GetGroupsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGroups(body: V1GetGroupsRequest, options?: any) { + return InternalApiFp(configuration).getGroups(body, options)(fetch, basePath); + }, + /** + * + * @summary Get job queue stats for a resource pool. + * @param {Array} [resourcePools] Filter the results based on a set of resource pools. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getJobQueueStats(resourcePools?: Array, options?: any) { + return InternalApiFp(configuration).getJobQueueStats(resourcePools, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of jobs in queue. + * @param {number} [offset] Pagination offset. + * @param {number} [limit] Pagination limit. + * @param {string} [resourcePool] The target resource-pool for agent resource manager. + * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getJobs(offset?: number, limit?: number, resourcePool?: string, orderBy?: V1OrderBy, states?: Array, options?: any) { + return InternalApiFp(configuration).getJobs(offset, limit, resourcePool, orderBy, states, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of jobs in queue. + * @param {number} [offset] Pagination offset. + * @param {number} [limit] Pagination limit. + * @param {string} [resourcePool] The target resource-pool for agent resource manager. + * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getJobsV2(offset?: number, limit?: number, resourcePool?: string, orderBy?: V1OrderBy, states?: Array, options?: any) { + return InternalApiFp(configuration).getJobsV2(offset, limit, resourcePool, orderBy, states, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of columns for experiment list table. + * @param {number} id The id of the project. + * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectColumns(id: number, tableType?: V1TableType, options?: any) { + return InternalApiFp(configuration).getProjectColumns(id, tableType, options)(fetch, basePath); + }, + /** + * + * @summary Get metrics range for a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectNumericMetricsRange(id: number, options?: any) { + return InternalApiFp(configuration).getProjectNumericMetricsRange(id, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of all resource pools from the cluster. + * @param {number} [offset] Skip the number of resource pools before returning results. Negative values denote number of resource pools to skip from the end before returning results. + * @param {number} [limit] Limit the number of resource pools. A value of 0 denotes no limit. + * @param {boolean} [unbound] Indicate whether or not to return unbound pools only. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getResourcePools(offset?: number, limit?: number, unbound?: boolean, options?: any) { + return InternalApiFp(configuration).getResourcePools(offset, limit, unbound, options)(fetch, basePath); + }, + /** + * + * @summary Get run metadata. + * @param {number} runId The ID of the run to get metadata for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRunMetadata(runId: number, options?: any) { + return InternalApiFp(configuration).getRunMetadata(runId, options)(fetch, basePath); + }, + /** + * + * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTaskAcceleratorData(taskId: string, options?: any) { + return InternalApiFp(configuration).getTaskAcceleratorData(taskId, options)(fetch, basePath); + }, + /** + * + * @summary Get telemetry information. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTelemetry(options?: any) { + return InternalApiFp(configuration).getTelemetry(options)(fetch, basePath); + }, + /** + * + * @summary Get a single trial by external id. + * @param {string} externalExperimentId External experiment id. + * @param {string} externalTrialId External trial id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialByExternalID(externalExperimentId: string, externalTrialId: string, options?: any) { + return InternalApiFp(configuration).getTrialByExternalID(externalExperimentId, externalTrialId, options)(fetch, basePath); + }, + /** + * + * @summary Gets the metrics for all trials associated with this checkpoint + * @param {string} checkpointUuid UUID of the checkpoint. + * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub + * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialMetricsByCheckpoint(checkpointUuid: string, trialSourceInfoType?: V1TrialSourceInfoType, metricGroup?: string, options?: any) { + return InternalApiFp(configuration).getTrialMetricsByCheckpoint(checkpointUuid, trialSourceInfoType, metricGroup, options)(fetch, basePath); + }, + /** + * + * @summary Gets the metrics for all trials associated with this model version + * @param {string} modelName The name of the model associated with the model version. + * @param {number} modelVersionNum Sequential model version number. + * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub + * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialMetricsByModelVersion(modelName: string, modelVersionNum: number, trialSourceInfoType?: V1TrialSourceInfoType, metricGroup?: string, options?: any) { + return InternalApiFp(configuration).getTrialMetricsByModelVersion(modelName, modelVersionNum, trialSourceInfoType, metricGroup, options)(fetch, basePath); + }, + /** + * + * @summary Get the list of trials for an experiment. + * @param {number} id The trial id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialRemainingLogRetentionDays(id: number, options?: any) { + return InternalApiFp(configuration).getTrialRemainingLogRetentionDays(id, options)(fetch, basePath); + }, + /** + * + * @summary Get the list of workloads for a trial. + * @param {number} trialId Limit workloads to those that are owned by the specified trial. + * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. + * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. + * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. + * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. + * @param {boolean} [includeBatchMetrics] Include per-batch metrics. + * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialWorkloads(trialId: number, orderBy?: V1OrderBy, offset?: number, limit?: number, sortKey?: string, filter?: GetTrialWorkloadsRequestFilterOption, includeBatchMetrics?: boolean, metricType?: V1MetricType, group?: string, removeDeletedCheckpoints?: boolean, options?: any) { + return InternalApiFp(configuration).getTrialWorkloads(trialId, orderBy, offset, limit, sortKey, filter, includeBatchMetrics, metricType, group, removeDeletedCheckpoints, options)(fetch, basePath); + }, + /** + * + * @summary Send notebook idle data to master + * @param {string} notebookId The id of the notebook. + * @param {V1IdleNotebookRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + idleNotebook(notebookId: string, body: V1IdleNotebookRequest, options?: any) { + return InternalApiFp(configuration).idleNotebook(notebookId, body, options)(fetch, basePath); + }, + /** + * + * @summary Kill generic task + * @param {string} taskId The id of the task. + * @param {V1KillGenericTaskRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killGenericTask(taskId: string, body: V1KillGenericTaskRequest, options?: any) { + return InternalApiFp(configuration).killGenericTask(taskId, body, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of runs. + * @param {V1KillRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killRuns(body: V1KillRunsRequest, options?: any) { + return InternalApiFp(configuration).killRuns(body, options)(fetch, basePath); + }, + /** + * + * @summary List all resource pools, bound and unbound, available to a specific workspace + * @param {number} workspaceId Workspace ID. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRPsBoundToWorkspace(workspaceId: number, offset?: number, limit?: number, options?: any) { + return InternalApiFp(configuration).listRPsBoundToWorkspace(workspaceId, offset, limit, options)(fetch, basePath); + }, + /** + * + * @summary List all workspaces bound to a specific resource pool + * @param {string} resourcePoolName Resource pool name. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listWorkspacesBoundToRP(resourcePoolName: string, offset?: number, limit?: number, options?: any) { + return InternalApiFp(configuration).listWorkspacesBoundToRP(resourcePoolName, offset, limit, options)(fetch, basePath); + }, + /** + * + * @summary Mark the given reservation (container, pod, etc) within an allocation as a daemon reservation. In the exit of a successful exit, Determined will wait for all resources to exit - unless they are marked as daemon resources, in which case Determined will clean them up regardless of exit status after all non-daemon resources have exited. + * @param {string} allocationId The id of the allocation. + * @param {string} resourcesId The id of the clump of resources to mark as daemon. + * @param {V1MarkAllocationResourcesDaemonRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + markAllocationResourcesDaemon(allocationId: string, resourcesId: string, body: V1MarkAllocationResourcesDaemonRequest, options?: any) { + return InternalApiFp(configuration).markAllocationResourcesDaemon(allocationId, resourcesId, body, options)(fetch, basePath); + }, + /** + * + * @summary Get the milestones (in batches processed) at which a metric is recorded by an experiment. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + metricBatches(experimentId: number, metricName: string, metricType?: V1MetricType, group?: string, periodSeconds?: number, options?: any) { + return InternalApiFp(configuration).metricBatches(experimentId, metricName, metricType, group, periodSeconds, options)(fetch, basePath); + }, + /** + * + * @summary Move runs. + * @param {V1MoveRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveRuns(body: V1MoveRunsRequest, options?: any) { + return InternalApiFp(configuration).moveRuns(body, options)(fetch, basePath); + }, + /** + * + * @summary NotifyContainterRunning is used to notify the master that the container is running. On HPC, the launcher will report a state of "Running" as soon as Slurm starts the job, but the container may be in the process of getting pulled down from the Internet, so the experiment is not really considered to be in a "Running" state until all the containers that are part of the experiment are running and not being pulled. + * @param {string} allocationId The ID of the allocation. + * @param {V1NotifyContainerRunningRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + notifyContainerRunning(allocationId: string, body: V1NotifyContainerRunningRequest, options?: any) { + return InternalApiFp(configuration).notifyContainerRunning(allocationId, body, options)(fetch, basePath); + }, + /** + * + * @summary Overwrite resource pool - workspace bindings + * @param {string} resourcePoolName The resource pool name. + * @param {V1OverwriteRPWorkspaceBindingsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + overwriteRPWorkspaceBindings(resourcePoolName: string, body: V1OverwriteRPWorkspaceBindingsRequest, options?: any) { + return InternalApiFp(configuration).overwriteRPWorkspaceBindings(resourcePoolName, body, options)(fetch, basePath); + }, + /** + * + * @summary Update checkpoints. Won't modify checkpoint files. + * @param {V1PatchCheckpointsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchCheckpoints(body: V1PatchCheckpointsRequest, options?: any) { + return InternalApiFp(configuration).patchCheckpoints(body, options)(fetch, basePath); + }, + /** + * + * @summary Patch (an unmanaged) trial. + * @param {number} trialId Trial id. + * @param {V1PatchTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchTrial(trialId: number, body: V1PatchTrialRequest, options?: any) { + return InternalApiFp(configuration).patchTrial(trialId, body, options)(fetch, basePath); + }, + /** + * + * @summary Patch multiple users' activation status. + * @param {V1PatchUsersRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchUsers(body: V1PatchUsersRequest, options?: any) { + return InternalApiFp(configuration).patchUsers(body, options)(fetch, basePath); + }, + /** + * + * @summary Pause generic task + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseGenericTask(taskId: string, options?: any) { + return InternalApiFp(configuration).pauseGenericTask(taskId, options)(fetch, basePath); + }, + /** + * + * @summary Pause experiment associated with provided runs. + * @param {V1PauseRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pauseRuns(body: V1PauseRunsRequest, options?: any) { + return InternalApiFp(configuration).pauseRuns(body, options)(fetch, basePath); + }, + /** + * + * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. + * @param {string} allocationId The id of the allocation. + * @param {V1PostAllocationAcceleratorDataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postAllocationAcceleratorData(allocationId: string, body: V1PostAllocationAcceleratorDataRequest, options?: any) { + return InternalApiFp(configuration).postAllocationAcceleratorData(allocationId, body, options)(fetch, basePath); + }, + /** + * + * @summary PostAllocationProxyAddress sets the proxy address to use when proxying to services provided by an allocation. Upon receipt, the master will also register any proxies specified by the task. + * @param {string} allocationId The id of the allocation. + * @param {V1PostAllocationProxyAddressRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postAllocationProxyAddress(allocationId: string, body: V1PostAllocationProxyAddressRequest, options?: any) { + return InternalApiFp(configuration).postAllocationProxyAddress(allocationId, body, options)(fetch, basePath); + }, + /** + * + * @summary Update run metadata. + * @param {number} runId The ID of the run to post metadata for. + * @param {V1PostRunMetadataRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options?: any) { + return InternalApiFp(configuration).postRunMetadata(runId, body, options)(fetch, basePath); + }, + /** + * + * @summary Persist the given task logs. + * @param {V1PostTaskLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTaskLogs(body: V1PostTaskLogsRequest, options?: any) { + return InternalApiFp(configuration).postTaskLogs(body, options)(fetch, basePath); + }, + /** + * + * @summary Persist the given TrialProfilerMetricsBatch. The trial ID is in the labels. + * @param {V1PostTrialProfilerMetricsBatchRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTrialProfilerMetricsBatch(body: V1PostTrialProfilerMetricsBatchRequest, options?: any) { + return InternalApiFp(configuration).postTrialProfilerMetricsBatch(body, options)(fetch, basePath); + }, + /** + * + * @summary For bookkeeping, update trial runner metadata (currently just state). + * @param {number} trialId The id of the trial. + * @param {V1TrialRunnerMetadata} body The state for the trial runner. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTrialRunnerMetadata(trialId: number, body: V1TrialRunnerMetadata, options?: any) { + return InternalApiFp(configuration).postTrialRunnerMetadata(trialId, body, options)(fetch, basePath); + }, + /** + * + * @summary Put an experiment by external id. + * @param {string} externalExperimentId External experiment id. + * @param {V1CreateExperimentRequest} body CreateExperimentRequest payload. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putExperiment(externalExperimentId: string, body: V1CreateExperimentRequest, options?: any) { + return InternalApiFp(configuration).putExperiment(externalExperimentId, body, options)(fetch, basePath); + }, + /** + * + * @summary Put a trial. + * @param {V1PutTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putTrial(body: V1PutTrialRequest, options?: any) { + return InternalApiFp(configuration).putTrial(body, options)(fetch, basePath); + }, + /** + * + * @summary Record a checkpoint. + * @param {V1Checkpoint} body The training metrics to persist. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportCheckpoint(body: V1Checkpoint, options?: any) { + return InternalApiFp(configuration).reportCheckpoint(body, options)(fetch, basePath); + }, + /** + * + * @summary Record metrics for specified trial. + * @param {number} metricsTrialId The trial associated with these metrics. + * @param {V1ReportTrialMetricsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialMetrics(metricsTrialId: number, body: V1ReportTrialMetricsRequest, options?: any) { + return InternalApiFp(configuration).reportTrialMetrics(metricsTrialId, body, options)(fetch, basePath); + }, + /** + * + * @summary For bookkeeping, updates the progress towards to current requested searcher training length. + * @param {number} trialId The id of the trial. + * @param {number} body Total units completed by the trial, in terms of the unit used to configure the searcher. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialProgress(trialId: number, body: number, options?: any) { + return InternalApiFp(configuration).reportTrialProgress(trialId, body, options)(fetch, basePath); + }, + /** + * + * @summary Reports to the searcher that the trial has completed the current requested amount of training with the given searcher validation metric. + * @param {number} trialId The id of the trial. + * @param {V1TrialEarlyExit} body The exit reason. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialSearcherEarlyExit(trialId: number, body: V1TrialEarlyExit, options?: any) { + return InternalApiFp(configuration).reportTrialSearcherEarlyExit(trialId, body, options)(fetch, basePath); + }, + /** + * + * @summary Reports a TrialSourceInfo entry for tracking inference or fine-tuning runs + * @param {V1ReportTrialSourceInfoRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialSourceInfo(body: V1ReportTrialSourceInfoRequest, options?: any) { + return InternalApiFp(configuration).reportTrialSourceInfo(body, options)(fetch, basePath); + }, + /** + * + * @summary Record training metrics for specified training. + * @param {number} trainingMetricsTrialId The trial associated with these metrics. + * @param {V1TrialMetrics} body The training metrics to persist. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialTrainingMetrics(trainingMetricsTrialId: number, body: V1TrialMetrics, options?: any) { + return InternalApiFp(configuration).reportTrialTrainingMetrics(trainingMetricsTrialId, body, options)(fetch, basePath); + }, + /** + * + * @summary Record validation metrics. + * @param {number} validationMetricsTrialId The trial associated with these metrics. + * @param {V1TrialMetrics} body The training metrics to persist. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + reportTrialValidationMetrics(validationMetricsTrialId: number, body: V1TrialMetrics, options?: any) { + return InternalApiFp(configuration).reportTrialValidationMetrics(validationMetricsTrialId, body, options)(fetch, basePath); + }, + /** + * + * @summary Unpause experiment associated with provided runs. + * @param {V1ResumeRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resumeRuns(body: V1ResumeRunsRequest, options?: any) { + return InternalApiFp(configuration).resumeRuns(body, options)(fetch, basePath); + }, + /** + * + * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. + * @param {V1RunPrepareForReportingRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + runPrepareForReporting(body: V1RunPrepareForReportingRequest, options?: any) { + return InternalApiFp(configuration).runPrepareForReporting(body, options)(fetch, basePath); + }, + /** + * + * @summary Get experiments with grouping and search syntax + * @param {number} [projectId] ID of the project to look at. + * @param {number} [offset] How many experiments to skip before including in the results. + * @param {number} [limit] How many results to show. + * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). + * @param {string} [filter] Filter expression. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchExperiments(projectId?: number, offset?: number, limit?: number, sort?: string, filter?: string, options?: any) { + return InternalApiFp(configuration).searchExperiments(projectId, offset, limit, sort, filter, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of runs. + * @param {V1SearchRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchRuns(body: V1SearchRunsRequest, options?: any) { + return InternalApiFp(configuration).searchRuns(body, options)(fetch, basePath); + }, + /** + * + * @summary Start (an unmanaged) trial. + * @param {number} trialId Trial id. + * @param {V1StartTrialRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + startTrial(trialId: number, body: V1StartTrialRequest, options?: any) { + return InternalApiFp(configuration).startTrial(trialId, body, options)(fetch, basePath); + }, + /** + * + * @summary Get a sample of the metrics over time for a sample of the trials. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [maxTrials] Maximum number of trials to fetch data for. + * @param {number} [maxDatapoints] Maximum number of initial / historical data points. + * @param {number} [startBatches] Beginning of window (inclusive) to fetch data for. + * @param {number} [endBatches] Ending of window (inclusive) to fetch data for. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialsSample(experimentId: number, metricName: string, metricType?: V1MetricType, group?: string, maxTrials?: number, maxDatapoints?: number, startBatches?: number, endBatches?: number, periodSeconds?: number, options?: any) { + return InternalApiFp(configuration).trialsSample(experimentId, metricName, metricType, group, maxTrials, maxDatapoints, startBatches, endBatches, periodSeconds, options)(fetch, basePath); + }, + /** + * + * @summary Get a snapshot of a metric across all trials at a certain point of progress. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {number} batchesProcessed The point of progress at which to query metrics. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [batchesMargin] A range either side of batches_processed to include near-misses. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialsSnapshot(experimentId: number, metricName: string, batchesProcessed: number, metricType?: V1MetricType, group?: string, batchesMargin?: number, periodSeconds?: number, options?: any) { + return InternalApiFp(configuration).trialsSnapshot(experimentId, metricName, batchesProcessed, metricType, group, batchesMargin, periodSeconds, options)(fetch, basePath); + }, + /** + * + * @summary Unarchive runs. + * @param {V1UnarchiveRunsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveRuns(body: V1UnarchiveRunsRequest, options?: any) { + return InternalApiFp(configuration).unarchiveRuns(body, options)(fetch, basePath); + }, + /** + * + * @summary Unbind resource pool to workspace + * @param {string} resourcePoolName The resource pool name. + * @param {V1UnbindRPFromWorkspaceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unbindRPFromWorkspace(resourcePoolName: string, body: V1UnbindRPFromWorkspaceRequest, options?: any) { + return InternalApiFp(configuration).unbindRPFromWorkspace(resourcePoolName, body, options)(fetch, basePath); + }, + /** + * + * @summary Unpause generic task + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unpauseGenericTask(taskId: string, options?: any) { + return InternalApiFp(configuration).unpauseGenericTask(taskId, options)(fetch, basePath); + }, + /** + * + * @summary Update group info. + * @param {number} groupId The id of the group + * @param {V1UpdateGroupRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateGroup(groupId: number, body: V1UpdateGroupRequest, options?: any) { + return InternalApiFp(configuration).updateGroup(groupId, body, options)(fetch, basePath); + }, + /** + * + * @summary Control the job queues. + * @param {V1UpdateJobQueueRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateJobQueue(body: V1UpdateJobQueueRequest, options?: any) { + return InternalApiFp(configuration).updateJobQueue(body, options)(fetch, basePath); + }, + } +}; /** - * ExperimentsApi - fetch parameter creator + * InternalApi - object-oriented interface * @export + * @class + * @extends {BaseAPI} */ -export const ExperimentsApiFetchParamCreator = function (configuration?: Configuration) { - return { +export class InternalApi extends BaseAPI { /** - * - * @summary Activate an experiment. - * @param {number} id The experiment id. + * + * @summary Acknowledge the receipt of a signal to stop the given allocation early. This is used indicate and exit 0 isn't final; specifically, it is used for HP search directed early stops and preemption signals (not necessarily just scheduler preemption). + * @param {string} allocationId The allocation that is acknowledging the request. + * @param {V1AckAllocationPreemptionSignalRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - activateExperiment(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling activateExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/{id}/activate`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public ackAllocationPreemptionSignal(allocationId: string, body: V1AckAllocationPreemptionSignalRequest, options?: any) { + return InternalApiFp(this.configuration).ackAllocationPreemptionSignal(allocationId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Activate multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1ActivateExperimentsRequest} body + * + * @summary AllocationAllGather performs an all gather through the master. An allocation can only perform once all gather at a time. + * @param {string} allocationId The ID of the allocation. + * @param {V1AllocationAllGatherRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - activateExperiments( - projectId: number, - body: V1ActivateExperimentsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling activateExperiments.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling activateExperiments.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/experiments/activate`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public allocationAllGather(allocationId: string, body: V1AllocationAllGatherRequest, options?: any) { + return InternalApiFp(this.configuration).allocationAllGather(allocationId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Archive an experiment. - * @param {number} id The experiment id. + * + * @summary Report the receipt of a signal to stop the given allocation early. This is used to communicate back from a SLURM job that it has been notified of a pending preememption. Upon a call to this API the RM should then trigger a checkpoint and immediate exit. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationPendingPreemptionSignalRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - archiveExperiment(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling archiveExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/{id}/archive`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public allocationPendingPreemptionSignal(allocationId: string, body: V1AllocationPendingPreemptionSignalRequest, options?: any) { + return InternalApiFp(this.configuration).allocationPendingPreemptionSignal(allocationId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Archive multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1ArchiveExperimentsRequest} body + * + * @summary Long poll preemption signals for the given allocation. If the allocation has been preempted when called, it will return so immediately. Otherwise, the connection will be kept open until the timeout is reached or the allocation is preempted. + * @param {string} allocationId The id of the allocation. + * @param {number} [timeoutSeconds] The timeout in seconds. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - archiveExperiments( - projectId: number, - body: V1ArchiveExperimentsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling archiveExperiments.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling archiveExperiments.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/experiments/archive`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public allocationPreemptionSignal(allocationId: string, timeoutSeconds?: number, options?: any) { + return InternalApiFp(this.configuration).allocationPreemptionSignal(allocationId, timeoutSeconds, options)(this.fetch, this.basePath) + } + /** - * - * @summary Cancel an experiment. - * @param {number} id The experiment id. + * + * @summary Set allocation to ready state. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationReadyRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - cancelExperiment(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling cancelExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/{id}/cancel`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public allocationReady(allocationId: string, body: V1AllocationReadyRequest, options?: any) { + return InternalApiFp(this.configuration).allocationReady(allocationId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Cancel multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1CancelExperimentsRequest} body + * + * @summary Gather an allocation's rendezvous info. Blocks until all trial containers connect to gather their rendezvous information and responds to them all at once. + * @param {string} allocationId The id of the allocation. + * @param {string} resourcesId The id of the clump of resources. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - cancelExperiments( - projectId: number, - body: V1CancelExperimentsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling cancelExperiments.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling cancelExperiments.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/experiments/cancel`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public allocationRendezvousInfo(allocationId: string, resourcesId: string, options?: any) { + return InternalApiFp(this.configuration).allocationRendezvousInfo(allocationId, resourcesId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Return a downsampled time series of metrics from multiple trials to compare them side-by-side. - * @param {Array} [trialIds] The requested trial ids. - * @param {number} [maxDatapoints] The maximum number of data points to return after downsampling. - * @param {Array} [metricNames] The names of selected metrics. - * @param {number} [startBatches] Sample from metrics after this batch number. - * @param {number} [endBatches] Sample from metrics before this batch number. - * @param {V1MetricType} [metricType] Metric group. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {Array} [metricIds] metric ids for the query. must be in the form group.metric_name. - * @param {string} [timeSeriesFilterName] metric or column name for the filter. - * @param {number} [timeSeriesFilterDoubleRangeLt] Less than. - * @param {number} [timeSeriesFilterDoubleRangeLte] Less than or equal. - * @param {number} [timeSeriesFilterDoubleRangeGt] Greater than. - * @param {number} [timeSeriesFilterDoubleRangeGte] Greater than or equal. - * @param {number} [timeSeriesFilterIntegerRangeLt] Less than. - * @param {number} [timeSeriesFilterIntegerRangeLte] Less than or equal. - * @param {number} [timeSeriesFilterIntegerRangeGt] Greater than. - * @param {number} [timeSeriesFilterIntegerRangeGte] Greater than or equal. - * @param {Array} [timeSeriesFilterIntegerRangeIncl] In a set. `in` is a reserved word in python. - * @param {Array} [timeSeriesFilterIntegerRangeNotIn] Not in a set. - * @param {Date | DateString} [timeSeriesFilterTimeRangeLt] Less than. - * @param {Date | DateString} [timeSeriesFilterTimeRangeLte] Less than or equal. - * @param {Date | DateString} [timeSeriesFilterTimeRangeGt] Greater than. - * @param {Date | DateString} [timeSeriesFilterTimeRangeGte] Greater than or equal. + * + * @summary Set allocation to waiting state. + * @param {string} allocationId The id of the allocation. + * @param {V1AllocationWaitingRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - compareTrials( - trialIds?: Array, - maxDatapoints?: number, - metricNames?: Array, - startBatches?: number, - endBatches?: number, - metricType?: V1MetricType, - group?: string, - metricIds?: Array, - timeSeriesFilterName?: string, - timeSeriesFilterDoubleRangeLt?: number, - timeSeriesFilterDoubleRangeLte?: number, - timeSeriesFilterDoubleRangeGt?: number, - timeSeriesFilterDoubleRangeGte?: number, - timeSeriesFilterIntegerRangeLt?: number, - timeSeriesFilterIntegerRangeLte?: number, - timeSeriesFilterIntegerRangeGt?: number, - timeSeriesFilterIntegerRangeGte?: number, - timeSeriesFilterIntegerRangeIncl?: Array, - timeSeriesFilterIntegerRangeNotIn?: Array, - timeSeriesFilterTimeRangeLt?: Date | DateString, - timeSeriesFilterTimeRangeLte?: Date | DateString, - timeSeriesFilterTimeRangeGt?: Date | DateString, - timeSeriesFilterTimeRangeGte?: Date | DateString, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/trials/time-series`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (trialIds) { - localVarQueryParameter['trialIds'] = trialIds; - } - - if (maxDatapoints !== undefined) { - localVarQueryParameter['maxDatapoints'] = maxDatapoints; - } - - if (metricNames) { - localVarQueryParameter['metricNames'] = metricNames; - } - - if (startBatches !== undefined) { - localVarQueryParameter['startBatches'] = startBatches; - } - - if (endBatches !== undefined) { - localVarQueryParameter['endBatches'] = endBatches; - } - - if (metricType !== undefined) { - localVarQueryParameter['metricType'] = metricType; - } - - if (group !== undefined) { - localVarQueryParameter['group'] = group; - } - - if (metricIds) { - localVarQueryParameter['metricIds'] = metricIds; - } - - if (timeSeriesFilterName !== undefined) { - localVarQueryParameter['timeSeriesFilter.name'] = timeSeriesFilterName; - } - - if (timeSeriesFilterDoubleRangeLt !== undefined) { - localVarQueryParameter['timeSeriesFilter.doubleRange.lt'] = timeSeriesFilterDoubleRangeLt; - } - - if (timeSeriesFilterDoubleRangeLte !== undefined) { - localVarQueryParameter['timeSeriesFilter.doubleRange.lte'] = timeSeriesFilterDoubleRangeLte; - } - - if (timeSeriesFilterDoubleRangeGt !== undefined) { - localVarQueryParameter['timeSeriesFilter.doubleRange.gt'] = timeSeriesFilterDoubleRangeGt; - } - - if (timeSeriesFilterDoubleRangeGte !== undefined) { - localVarQueryParameter['timeSeriesFilter.doubleRange.gte'] = timeSeriesFilterDoubleRangeGte; - } - - if (timeSeriesFilterIntegerRangeLt !== undefined) { - localVarQueryParameter['timeSeriesFilter.integerRange.lt'] = timeSeriesFilterIntegerRangeLt; - } - - if (timeSeriesFilterIntegerRangeLte !== undefined) { - localVarQueryParameter['timeSeriesFilter.integerRange.lte'] = - timeSeriesFilterIntegerRangeLte; - } - - if (timeSeriesFilterIntegerRangeGt !== undefined) { - localVarQueryParameter['timeSeriesFilter.integerRange.gt'] = timeSeriesFilterIntegerRangeGt; - } - - if (timeSeriesFilterIntegerRangeGte !== undefined) { - localVarQueryParameter['timeSeriesFilter.integerRange.gte'] = - timeSeriesFilterIntegerRangeGte; - } - - if (timeSeriesFilterIntegerRangeIncl) { - localVarQueryParameter['timeSeriesFilter.integerRange.incl'] = - timeSeriesFilterIntegerRangeIncl; - } - - if (timeSeriesFilterIntegerRangeNotIn) { - localVarQueryParameter['timeSeriesFilter.integerRange.notIn'] = - timeSeriesFilterIntegerRangeNotIn; - } - - if (timeSeriesFilterTimeRangeLt) { - localVarQueryParameter['timeSeriesFilter.timeRange.lt'] = - typeof timeSeriesFilterTimeRangeLt === 'string' - ? timeSeriesFilterTimeRangeLt - : timeSeriesFilterTimeRangeLt.toISOString(); - } - - if (timeSeriesFilterTimeRangeLte) { - localVarQueryParameter['timeSeriesFilter.timeRange.lte'] = - typeof timeSeriesFilterTimeRangeLte === 'string' - ? timeSeriesFilterTimeRangeLte - : timeSeriesFilterTimeRangeLte.toISOString(); - } - - if (timeSeriesFilterTimeRangeGt) { - localVarQueryParameter['timeSeriesFilter.timeRange.gt'] = - typeof timeSeriesFilterTimeRangeGt === 'string' - ? timeSeriesFilterTimeRangeGt - : timeSeriesFilterTimeRangeGt.toISOString(); - } - - if (timeSeriesFilterTimeRangeGte) { - localVarQueryParameter['timeSeriesFilter.timeRange.gte'] = - typeof timeSeriesFilterTimeRangeGte === 'string' - ? timeSeriesFilterTimeRangeGte - : timeSeriesFilterTimeRangeGte.toISOString(); - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public allocationWaiting(allocationId: string, body: V1AllocationWaitingRequest, options?: any) { + return InternalApiFp(this.configuration).allocationWaiting(allocationId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Delete the requested experiment. - * @param {number} experimentId The ID of the experiment. + * + * @summary Archive runs. + * @param {V1ArchiveRunsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - deleteExperiment(experimentId: number, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling deleteExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public archiveRuns(body: V1ArchiveRunsRequest, options?: any) { + return InternalApiFp(this.configuration).archiveRuns(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Delete a label from the experiment. - * @param {number} experimentId The ID of the experiment. - * @param {string} label The label to delete. + * + * @summary Assign multiple users to multiple groups. + * @param {V1AssignMultipleGroupsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - deleteExperimentLabel(experimentId: number, label: string, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling deleteExperimentLabel.', - ); - } - // verify required parameter 'label' is not null or undefined - if (label === null || label === undefined) { - throw new RequiredError( - 'label', - 'Required parameter label was null or undefined when calling deleteExperimentLabel.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/labels/{label}` - .replace(`{${'experimentId'}}`, encodeURIComponent(String(experimentId))) - .replace(`{${'label'}}`, encodeURIComponent(String(label))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public assignMultipleGroups(body: V1AssignMultipleGroupsRequest, options?: any) { + return InternalApiFp(this.configuration).assignMultipleGroups(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Delete multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1DeleteExperimentsRequest} body + * + * @summary Bind resource pool to workspace + * @param {string} resourcePoolName The resource pool name. + * @param {V1BindRPToWorkspaceRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - deleteExperiments( - projectId: number, - body: V1DeleteExperimentsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling deleteExperiments.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling deleteExperiments.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/experiments/delete`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public bindRPToWorkspace(resourcePoolName: string, body: V1BindRPToWorkspaceRequest, options?: any) { + return InternalApiFp(this.configuration).bindRPToWorkspace(resourcePoolName, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Delete tensorboard files. - * @param {number} experimentId ID of experiment that the tensorboard files are linked to. + * + * @summary Cleanup task logs according to the retention policy. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - deleteTensorboardFiles(experimentId: number, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling deleteTensorboardFiles.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/tensorboard-files`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public cleanupLogs(options?: any) { + return InternalApiFp(this.configuration).cleanupLogs(options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested experiment. - * @param {number} experimentId The id of the experiment. + * + * @summary Reports to the searcher that the trial has completed the given searcher operation. + * @param {number} trialId The id of the trial. + * @param {V1CompleteValidateAfterOperation} body The completed operation. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperiment(experimentId: number, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling getExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public completeTrialSearcherValidation(trialId: number, body: V1CompleteValidateAfterOperation, options?: any) { + return InternalApiFp(this.configuration).completeTrialSearcherValidation(trialId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a list of checkpoints for an experiment. - * @param {number} id The experiment id. - * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. - * @param {string} [sortByMetric] Sort by custom validation metric name. - * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. - * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. - * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. + * + * @summary Continues an experiment either to make the existing experiment train longer or to retry it. + * @param {V1ContinueExperimentRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperimentCheckpoints( - id: number, - sortByAttr?: Checkpointv1SortBy, - sortByMetric?: string, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options: any = {}, - ): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling getExperimentCheckpoints.', - ); - } - const localVarPath = `/api/v1/experiments/{id}/checkpoints`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortByAttr !== undefined) { - localVarQueryParameter['sortByAttr'] = sortByAttr; - } - - if (sortByMetric !== undefined) { - localVarQueryParameter['sortByMetric'] = sortByMetric; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (states) { - localVarQueryParameter['states'] = states; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public continueExperiment(body: V1ContinueExperimentRequest, options?: any) { + return InternalApiFp(this.configuration).continueExperiment(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a list of unique experiment labels (sorted by popularity). - * @param {number} [projectId] Filter experiments by project. + * + * @summary Create an experiment. + * @param {V1CreateExperimentRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperimentLabels(projectId?: number, options: any = {}): FetchArgs { - const localVarPath = `/api/v1/experiment/labels`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (projectId !== undefined) { - localVarQueryParameter['projectId'] = projectId; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public createExperiment(body: V1CreateExperimentRequest, options?: any) { + return InternalApiFp(this.configuration).createExperiment(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a list of experiments. - * @param {V1GetExperimentsRequestSortBy} [sortBy] Sort experiments by the given field. - SORT_BY_UNSPECIFIED: Returns experiments in an unsorted list. - SORT_BY_ID: Returns experiments sorted by id. - SORT_BY_DESCRIPTION: Returns experiments sorted by description. - SORT_BY_START_TIME: Return experiments sorted by start time. - SORT_BY_END_TIME: Return experiments sorted by end time. Experiments without end_time are returned after the ones with end_time. - SORT_BY_STATE: Return experiments sorted by state. - SORT_BY_NUM_TRIALS: Return experiments sorted by number of trials. - SORT_BY_PROGRESS: Return experiments sorted by progress. - SORT_BY_USER: Return experiments sorted by user. - SORT_BY_NAME: Returns experiments sorted by name. - SORT_BY_FORKED_FROM: Returns experiments sorted by originating model. - SORT_BY_RESOURCE_POOL: Returns experiments sorted by resource pool. - SORT_BY_PROJECT_ID: Returns experiments sorted by project. - SORT_BY_CHECKPOINT_SIZE: Returns experiments sorted by checkpoint size. - SORT_BY_CHECKPOINT_COUNT: Returns experiments sorted by checkpoint count. - SORT_BY_SEARCHER_METRIC_VAL: Returns experiments sorted by searcher metric value.. - * @param {V1OrderBy} [orderBy] Order experiments in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of experiments before returning results. Negative values denote number of experiments to skip from the end before returning results. - * @param {number} [limit] Limit the number of experiments. 0 or Unspecified - returns a default of 100. -1 - returns everything. -2 - returns pagination info but no experiments. - * @param {string} [description] Limit experiments to those that match the description. - * @param {string} [name] Limit experiments to those that match the name. - * @param {Array} [labels] Limit experiments to those that match the provided labels. - * @param {boolean} [archived] Limit experiments to those that are archived. - * @param {Array} [states] Limit experiments to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. - * @param {Array} [users] Limit experiments to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit experiments to those that are owned by users with the specified userIds. - * @param {number} [projectId] Limit experiments to those within a specified project, or 0 for all projects. - * @param {number} [experimentIdFilterLt] Less than. - * @param {number} [experimentIdFilterLte] Less than or equal. - * @param {number} [experimentIdFilterGt] Greater than. - * @param {number} [experimentIdFilterGte] Greater than or equal. - * @param {Array} [experimentIdFilterIncl] In a set. `in` is a reserved word in python. - * @param {Array} [experimentIdFilterNotIn] Not in a set. - * @param {boolean} [showTrialData] whether to surface trial specific data from the best trial. + * + * @summary Create an experiment. + * @param {V1CreateGenericTaskRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperiments( - sortBy?: V1GetExperimentsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - description?: string, - name?: string, - labels?: Array, - archived?: boolean, - states?: Array, - users?: Array, - userIds?: Array, - projectId?: number, - experimentIdFilterLt?: number, - experimentIdFilterLte?: number, - experimentIdFilterGt?: number, - experimentIdFilterGte?: number, - experimentIdFilterIncl?: Array, - experimentIdFilterNotIn?: Array, - showTrialData?: boolean, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/experiments`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (description !== undefined) { - localVarQueryParameter['description'] = description; - } - - if (name !== undefined) { - localVarQueryParameter['name'] = name; - } - - if (labels) { - localVarQueryParameter['labels'] = labels; - } - - if (archived !== undefined) { - localVarQueryParameter['archived'] = archived; - } - - if (states) { - localVarQueryParameter['states'] = states; - } - - if (users) { - localVarQueryParameter['users'] = users; - } - - if (userIds) { - localVarQueryParameter['userIds'] = userIds; - } - - if (projectId !== undefined) { - localVarQueryParameter['projectId'] = projectId; - } - - if (experimentIdFilterLt !== undefined) { - localVarQueryParameter['experimentIdFilter.lt'] = experimentIdFilterLt; - } - - if (experimentIdFilterLte !== undefined) { - localVarQueryParameter['experimentIdFilter.lte'] = experimentIdFilterLte; - } - - if (experimentIdFilterGt !== undefined) { - localVarQueryParameter['experimentIdFilter.gt'] = experimentIdFilterGt; - } - - if (experimentIdFilterGte !== undefined) { - localVarQueryParameter['experimentIdFilter.gte'] = experimentIdFilterGte; - } - - if (experimentIdFilterIncl) { - localVarQueryParameter['experimentIdFilter.incl'] = experimentIdFilterIncl; - } - - if (experimentIdFilterNotIn) { - localVarQueryParameter['experimentIdFilter.notIn'] = experimentIdFilterNotIn; - } - - if (showTrialData !== undefined) { - localVarQueryParameter['showTrialData'] = showTrialData; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public createGenericTask(body: V1CreateGenericTaskRequest, options?: any) { + return InternalApiFp(this.configuration).createGenericTask(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the list of trials for an experiment. - * @param {number} experimentId Limit trials to those that are owned by the specified experiments. - * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. - * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. - * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. - * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * + * @summary Create a group with optional members on creation. + * @param {V1CreateGroupRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperimentTrials( - experimentId: number, - sortBy?: V1GetExperimentTrialsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options: any = {}, - ): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling getExperimentTrials.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/trials`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (states) { - localVarQueryParameter['states'] = states; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public createGroup(body: V1CreateGroupRequest, options?: any) { + return InternalApiFp(this.configuration).createGroup(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the validation history for an experiment. - * @param {number} experimentId The id of the experiment. + * + * @summary Create unmanaged trial. + * @param {V1CreateTrialRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperimentValidationHistory(experimentId: number, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling getExperimentValidationHistory.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/validation-history`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public createTrial(body: V1CreateTrialRequest, options?: any) { + return InternalApiFp(this.configuration).createTrial(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the model definition of an experiment. - * @param {number} experimentId The id of the experiment. + * + * @summary Remove a group. + * @param {number} groupId The id of the group that should be deleted. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getModelDef(experimentId: number, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling getModelDef.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/model_def`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public deleteGroup(groupId: number, options?: any) { + return InternalApiFp(this.configuration).deleteGroup(groupId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get one file content of model definition of an experiment. - * @param {number} experimentId The id of the experiment. - * @param {V1GetModelDefFileRequest} body + * + * @summary Delete a list of runs. + * @param {V1DeleteRunsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getModelDefFile( - experimentId: number, - body: V1GetModelDefFileRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling getModelDefFile.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling getModelDefFile.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/file`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public deleteRuns(body: V1DeleteRunsRequest, options?: any) { + return InternalApiFp(this.configuration).deleteRuns(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the model definition file tree of an experiment. - * @param {number} experimentId The id of the experiment. + * + * @summary Get the set of metric names recorded for a list of experiments. + * @param {Array} ids The ids for the experiments. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getModelDefTree(experimentId: number, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling getModelDefTree.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/file_tree`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public expMetricNames(ids: Array, periodSeconds?: number, options?: any) { + return InternalApiFp(this.configuration).expMetricNames(ids, periodSeconds, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the list of custom searcher events with long polling. - * @param {number} experimentId The ID of the experiment. + * + * @summary Get details about an Allocation. + * @param {string} allocationId The id of the allocation. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getSearcherEvents(experimentId: number, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling getSearcherEvents.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/searcher_events`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getAllocation(allocationId: string, options?: any) { + return InternalApiFp(this.configuration).getAllocation(allocationId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a single trial. - * @param {number} trialId The requested trial's id. + * + * @summary Get the best searcher validation for an experiment by the given metric. + * @param {number} experimentId The ID of the experiment. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getTrial(trialId: number, options: any = {}): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling getTrial.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getBestSearcherValidationMetric(experimentId: number, options?: any) { + return InternalApiFp(this.configuration).getBestSearcherValidationMetric(experimentId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a list of checkpoints for a trial. - * @param {number} id The trial id. - * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. - * @param {string} [sortByMetric] Sort by custom validation metric name. - * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. - * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. - * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. + * + * @summary Get the current searcher operation. + * @param {number} trialId The id of the trial. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getTrialCheckpoints( - id: number, - sortByAttr?: Checkpointv1SortBy, - sortByMetric?: string, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options: any = {}, - ): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling getTrialCheckpoints.', - ); - } - const localVarPath = `/api/v1/trials/{id}/checkpoints`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortByAttr !== undefined) { - localVarQueryParameter['sortByAttr'] = sortByAttr; - } - - if (sortByMetric !== undefined) { - localVarQueryParameter['sortByMetric'] = sortByMetric; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (states) { - localVarQueryParameter['states'] = states; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getCurrentTrialSearcherOperation(trialId: number, options?: any) { + return InternalApiFp(this.configuration).getCurrentTrialSearcherOperation(trialId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Kill an experiment. - * @param {number} id The experiment id. + * + * @summary Get task config + * @param {string} taskId The id of the task. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - killExperiment(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling killExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/{id}/kill`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getGenericTaskConfig(taskId: string, options?: any) { + return InternalApiFp(this.configuration).getGenericTaskConfig(taskId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Kill multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1KillExperimentsRequest} body + * + * @summary Get a group by id. + * @param {number} groupId The id of the group to return. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - killExperiments( - projectId: number, - body: V1KillExperimentsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling killExperiments.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling killExperiments.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/experiments/kill`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getGroup(groupId: number, options?: any) { + return InternalApiFp(this.configuration).getGroup(groupId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Kill a trial. - * @param {number} id The trial id + * + * @summary Search for groups with optional filters. + * @param {V1GetGroupsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - killTrial(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling killTrial.', - ); - } - const localVarPath = `/api/v1/trials/{id}/kill`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getGroups(body: V1GetGroupsRequest, options?: any) { + return InternalApiFp(this.configuration).getGroups(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Move an experiment into a project. - * @param {number} experimentId The id of the experiment being moved. - * @param {V1MoveExperimentRequest} body + * + * @summary Get job queue stats for a resource pool. + * @param {Array} [resourcePools] Filter the results based on a set of resource pools. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - moveExperiment( - experimentId: number, - body: V1MoveExperimentRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling moveExperiment.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling moveExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/move`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getJobQueueStats(resourcePools?: Array, options?: any) { + return InternalApiFp(this.configuration).getJobQueueStats(resourcePools, options)(this.fetch, this.basePath) + } + /** - * - * @summary Move multiple experiments into a project. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1MoveExperimentsRequest} body + * + * @summary Get a list of jobs in queue. + * @param {number} [offset] Pagination offset. + * @param {number} [limit] Pagination limit. + * @param {string} [resourcePool] The target resource-pool for agent resource manager. + * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - moveExperiments( - projectId: number, - body: V1MoveExperimentsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling moveExperiments.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling moveExperiments.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/experiments/move`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getJobs(offset?: number, limit?: number, resourcePool?: string, orderBy?: V1OrderBy, states?: Array, options?: any) { + return InternalApiFp(this.configuration).getJobs(offset, limit, resourcePool, orderBy, states, options)(this.fetch, this.basePath) + } + /** - * - * @summary Patch an experiment's fields. - * @param {number} experimentId The id of the experiment. - * @param {V1PatchExperiment} body Patched experiment attributes. + * + * @summary Get a list of jobs in queue. + * @param {number} [offset] Pagination offset. + * @param {number} [limit] Pagination limit. + * @param {string} [resourcePool] The target resource-pool for agent resource manager. + * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - patchExperiment(experimentId: number, body: V1PatchExperiment, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling patchExperiment.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getJobsV2(offset?: number, limit?: number, resourcePool?: string, orderBy?: V1OrderBy, states?: Array, options?: any) { + return InternalApiFp(this.configuration).getJobsV2(offset, limit, resourcePool, orderBy, states, options)(this.fetch, this.basePath) + } + /** - * - * @summary Pause an experiment. - * @param {number} id The experiment id. + * + * @summary Get a list of columns for experiment list table. + * @param {number} id The id of the project. + * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - pauseExperiment(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling pauseExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/{id}/pause`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getProjectColumns(id: number, tableType?: V1TableType, options?: any) { + return InternalApiFp(this.configuration).getProjectColumns(id, tableType, options)(this.fetch, this.basePath) + } + /** - * - * @summary Pause multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1PauseExperimentsRequest} body + * + * @summary Get metrics range for a project. + * @param {number} id The id of the project. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - pauseExperiments( - projectId: number, - body: V1PauseExperimentsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling pauseExperiments.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling pauseExperiments.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/experiments/pause`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getProjectNumericMetricsRange(id: number, options?: any) { + return InternalApiFp(this.configuration).getProjectNumericMetricsRange(id, options)(this.fetch, this.basePath) + } + /** - * - * @summary Submit operations to a custom searcher. - * @param {number} experimentId The experiment ID. - * @param {V1PostSearcherOperationsRequest} body + * + * @summary Get a list of all resource pools from the cluster. + * @param {number} [offset] Skip the number of resource pools before returning results. Negative values denote number of resource pools to skip from the end before returning results. + * @param {number} [limit] Limit the number of resource pools. A value of 0 denotes no limit. + * @param {boolean} [unbound] Indicate whether or not to return unbound pools only. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - postSearcherOperations( - experimentId: number, - body: V1PostSearcherOperationsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling postSearcherOperations.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postSearcherOperations.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/searcher_operations`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getResourcePools(offset?: number, limit?: number, unbound?: boolean, options?: any) { + return InternalApiFp(this.configuration).getResourcePools(offset, limit, unbound, options)(this.fetch, this.basePath) + } + /** - * - * @summary Preview hyperparameter search. - * @param {V1PreviewHPSearchRequest} body + * + * @summary Get run metadata. + * @param {number} runId The ID of the run to get metadata for. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - previewHPSearch(body: V1PreviewHPSearchRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling previewHPSearch.', - ); - } - const localVarPath = `/api/v1/preview-hp-search`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getRunMetadata(runId: number, options?: any) { + return InternalApiFp(this.configuration).getRunMetadata(runId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Put a new label on the experiment. - * @param {number} experimentId The ID of the experiment. - * @param {string} label The label to add. + * + * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. + * @param {string} taskId The id of the task. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - putExperimentLabel(experimentId: number, label: string, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling putExperimentLabel.', - ); - } - // verify required parameter 'label' is not null or undefined - if (label === null || label === undefined) { - throw new RequiredError( - 'label', - 'Required parameter label was null or undefined when calling putExperimentLabel.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/labels/{label}` - .replace(`{${'experimentId'}}`, encodeURIComponent(String(experimentId))) - .replace(`{${'label'}}`, encodeURIComponent(String(label))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getTaskAcceleratorData(taskId: string, options?: any) { + return InternalApiFp(this.configuration).getTaskAcceleratorData(taskId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Retain logs for an experiment. - * @param {number} experimentId The ID of the experiment. - * @param {V1PutExperimentRetainLogsRequest} body + * + * @summary Get telemetry information. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - putExperimentRetainLogs( - experimentId: number, - body: V1PutExperimentRetainLogsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling putExperimentRetainLogs.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling putExperimentRetainLogs.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/retain_logs`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getTelemetry(options?: any) { + return InternalApiFp(this.configuration).getTelemetry(options)(this.fetch, this.basePath) + } + /** - * - * @summary Retain logs for an experiment. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1PutExperimentsRetainLogsRequest} body + * + * @summary Get a single trial by external id. + * @param {string} externalExperimentId External experiment id. + * @param {string} externalTrialId External trial id. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - putExperimentsRetainLogs( - projectId: number, - body: V1PutExperimentsRetainLogsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling putExperimentsRetainLogs.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling putExperimentsRetainLogs.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/experiments/retain_logs`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getTrialByExternalID(externalExperimentId: string, externalTrialId: string, options?: any) { + return InternalApiFp(this.configuration).getTrialByExternalID(externalExperimentId, externalTrialId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get experiments with grouping and search syntax - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. + * + * @summary Gets the metrics for all trials associated with this checkpoint + * @param {string} checkpointUuid UUID of the checkpoint. + * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub + * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - searchExperiments( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/experiments-search`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (projectId !== undefined) { - localVarQueryParameter['projectId'] = projectId; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (sort !== undefined) { - localVarQueryParameter['sort'] = sort; - } - - if (filter !== undefined) { - localVarQueryParameter['filter'] = filter; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getTrialMetricsByCheckpoint(checkpointUuid: string, trialSourceInfoType?: V1TrialSourceInfoType, metricGroup?: string, options?: any) { + return InternalApiFp(this.configuration).getTrialMetricsByCheckpoint(checkpointUuid, trialSourceInfoType, metricGroup, options)(this.fetch, this.basePath) + } + /** - * - * @summary Stream trial logs. - * @param {number} trialId The id of the trial. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. + * + * @summary Gets the metrics for all trials associated with this model version + * @param {string} modelName The name of the model associated with the model version. + * @param {number} modelVersionNum Sequential model version number. + * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub + * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - trialLogs( - trialId: number, - limit?: number, - follow?: boolean, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options: any = {}, - ): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling trialLogs.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/logs`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - if (agentIds) { - localVarQueryParameter['agentIds'] = agentIds; - } - - if (containerIds) { - localVarQueryParameter['containerIds'] = containerIds; - } - - if (rankIds) { - localVarQueryParameter['rankIds'] = rankIds; - } - - if (levels) { - localVarQueryParameter['levels'] = levels; - } - - if (stdtypes) { - localVarQueryParameter['stdtypes'] = stdtypes; - } - - if (sources) { - localVarQueryParameter['sources'] = sources; - } - - if (timestampBefore) { - localVarQueryParameter['timestampBefore'] = - typeof timestampBefore === 'string' ? timestampBefore : timestampBefore.toISOString(); - } - - if (timestampAfter) { - localVarQueryParameter['timestampAfter'] = - typeof timestampAfter === 'string' ? timestampAfter : timestampAfter.toISOString(); - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (searchText !== undefined) { - localVarQueryParameter['searchText'] = searchText; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getTrialMetricsByModelVersion(modelName: string, modelVersionNum: number, trialSourceInfoType?: V1TrialSourceInfoType, metricGroup?: string, options?: any) { + return InternalApiFp(this.configuration).getTrialMetricsByModelVersion(modelName, modelVersionNum, trialSourceInfoType, metricGroup, options)(this.fetch, this.basePath) + } + /** - * - * @summary Stream trial log fields. - * @param {number} trialId The ID of the trial. - * @param {boolean} [follow] Continue following fields until the trial stops. + * + * @summary Get the list of trials for an experiment. + * @param {number} id The trial id. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - trialLogsFields(trialId: number, follow?: boolean, options: any = {}): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling trialLogsFields.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/logs/fields`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getTrialRemainingLogRetentionDays(id: number, options?: any) { + return InternalApiFp(this.configuration).getTrialRemainingLogRetentionDays(id, options)(this.fetch, this.basePath) + } + /** - * - * @summary Unarchive an experiment. - * @param {number} id The experiment id. + * + * @summary Get the list of workloads for a trial. + * @param {number} trialId Limit workloads to those that are owned by the specified trial. + * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. + * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. + * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. + * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. + * @param {boolean} [includeBatchMetrics] Include per-batch metrics. + * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - unarchiveExperiment(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling unarchiveExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/{id}/unarchive`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getTrialWorkloads(trialId: number, orderBy?: V1OrderBy, offset?: number, limit?: number, sortKey?: string, filter?: GetTrialWorkloadsRequestFilterOption, includeBatchMetrics?: boolean, metricType?: V1MetricType, group?: string, removeDeletedCheckpoints?: boolean, options?: any) { + return InternalApiFp(this.configuration).getTrialWorkloads(trialId, orderBy, offset, limit, sortKey, filter, includeBatchMetrics, metricType, group, removeDeletedCheckpoints, options)(this.fetch, this.basePath) + } + /** - * - * @summary Unarchive multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1UnarchiveExperimentsRequest} body + * + * @summary Send notebook idle data to master + * @param {string} notebookId The id of the notebook. + * @param {V1IdleNotebookRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - unarchiveExperiments( - projectId: number, - body: V1UnarchiveExperimentsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling unarchiveExperiments.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling unarchiveExperiments.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/experiments/unarchive`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * ExperimentsApi - functional programming interface - * @export - */ -export const ExperimentsApiFp = function (configuration?: Configuration) { - return { + public idleNotebook(notebookId: string, body: V1IdleNotebookRequest, options?: any) { + return InternalApiFp(this.configuration).idleNotebook(notebookId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Activate an experiment. - * @param {number} id The experiment id. + * + * @summary Kill generic task + * @param {string} taskId The id of the task. + * @param {V1KillGenericTaskRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - activateExperiment( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).activateExperiment( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Activate multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1ActivateExperimentsRequest} body + public killGenericTask(taskId: string, body: V1KillGenericTaskRequest, options?: any) { + return InternalApiFp(this.configuration).killGenericTask(taskId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Get a list of runs. + * @param {V1KillRunsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - activateExperiments( - projectId: number, - body: V1ActivateExperimentsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).activateExperiments( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Archive an experiment. - * @param {number} id The experiment id. + public killRuns(body: V1KillRunsRequest, options?: any) { + return InternalApiFp(this.configuration).killRuns(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary List all resource pools, bound and unbound, available to a specific workspace + * @param {number} workspaceId Workspace ID. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - archiveExperiment( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).archiveExperiment( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Archive multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1ArchiveExperimentsRequest} body + public listRPsBoundToWorkspace(workspaceId: number, offset?: number, limit?: number, options?: any) { + return InternalApiFp(this.configuration).listRPsBoundToWorkspace(workspaceId, offset, limit, options)(this.fetch, this.basePath) + } + + /** + * + * @summary List all workspaces bound to a specific resource pool + * @param {string} resourcePoolName Resource pool name. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - archiveExperiments( - projectId: number, - body: V1ArchiveExperimentsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).archiveExperiments( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Cancel an experiment. - * @param {number} id The experiment id. + public listWorkspacesBoundToRP(resourcePoolName: string, offset?: number, limit?: number, options?: any) { + return InternalApiFp(this.configuration).listWorkspacesBoundToRP(resourcePoolName, offset, limit, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Mark the given reservation (container, pod, etc) within an allocation as a daemon reservation. In the exit of a successful exit, Determined will wait for all resources to exit - unless they are marked as daemon resources, in which case Determined will clean them up regardless of exit status after all non-daemon resources have exited. + * @param {string} allocationId The id of the allocation. + * @param {string} resourcesId The id of the clump of resources to mark as daemon. + * @param {V1MarkAllocationResourcesDaemonRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - cancelExperiment( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).cancelExperiment( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Cancel multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1CancelExperimentsRequest} body + public markAllocationResourcesDaemon(allocationId: string, resourcesId: string, body: V1MarkAllocationResourcesDaemonRequest, options?: any) { + return InternalApiFp(this.configuration).markAllocationResourcesDaemon(allocationId, resourcesId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Get the milestones (in batches processed) at which a metric is recorded by an experiment. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [periodSeconds] Seconds to wait when polling for updates. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - cancelExperiments( - projectId: number, - body: V1CancelExperimentsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).cancelExperiments( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Return a downsampled time series of metrics from multiple trials to compare them side-by-side. - * @param {Array} [trialIds] The requested trial ids. - * @param {number} [maxDatapoints] The maximum number of data points to return after downsampling. - * @param {Array} [metricNames] The names of selected metrics. - * @param {number} [startBatches] Sample from metrics after this batch number. - * @param {number} [endBatches] Sample from metrics before this batch number. - * @param {V1MetricType} [metricType] Metric group. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {Array} [metricIds] metric ids for the query. must be in the form group.metric_name. - * @param {string} [timeSeriesFilterName] metric or column name for the filter. - * @param {number} [timeSeriesFilterDoubleRangeLt] Less than. - * @param {number} [timeSeriesFilterDoubleRangeLte] Less than or equal. - * @param {number} [timeSeriesFilterDoubleRangeGt] Greater than. - * @param {number} [timeSeriesFilterDoubleRangeGte] Greater than or equal. - * @param {number} [timeSeriesFilterIntegerRangeLt] Less than. - * @param {number} [timeSeriesFilterIntegerRangeLte] Less than or equal. - * @param {number} [timeSeriesFilterIntegerRangeGt] Greater than. - * @param {number} [timeSeriesFilterIntegerRangeGte] Greater than or equal. - * @param {Array} [timeSeriesFilterIntegerRangeIncl] In a set. `in` is a reserved word in python. - * @param {Array} [timeSeriesFilterIntegerRangeNotIn] Not in a set. - * @param {Date | DateString} [timeSeriesFilterTimeRangeLt] Less than. - * @param {Date | DateString} [timeSeriesFilterTimeRangeLte] Less than or equal. - * @param {Date | DateString} [timeSeriesFilterTimeRangeGt] Greater than. - * @param {Date | DateString} [timeSeriesFilterTimeRangeGte] Greater than or equal. + public metricBatches(experimentId: number, metricName: string, metricType?: V1MetricType, group?: string, periodSeconds?: number, options?: any) { + return InternalApiFp(this.configuration).metricBatches(experimentId, metricName, metricType, group, periodSeconds, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Move runs. + * @param {V1MoveRunsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - compareTrials( - trialIds?: Array, - maxDatapoints?: number, - metricNames?: Array, - startBatches?: number, - endBatches?: number, - metricType?: V1MetricType, - group?: string, - metricIds?: Array, - timeSeriesFilterName?: string, - timeSeriesFilterDoubleRangeLt?: number, - timeSeriesFilterDoubleRangeLte?: number, - timeSeriesFilterDoubleRangeGt?: number, - timeSeriesFilterDoubleRangeGte?: number, - timeSeriesFilterIntegerRangeLt?: number, - timeSeriesFilterIntegerRangeLte?: number, - timeSeriesFilterIntegerRangeGt?: number, - timeSeriesFilterIntegerRangeGte?: number, - timeSeriesFilterIntegerRangeIncl?: Array, - timeSeriesFilterIntegerRangeNotIn?: Array, - timeSeriesFilterTimeRangeLt?: Date | DateString, - timeSeriesFilterTimeRangeLte?: Date | DateString, - timeSeriesFilterTimeRangeGt?: Date | DateString, - timeSeriesFilterTimeRangeGte?: Date | DateString, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).compareTrials( - trialIds, - maxDatapoints, - metricNames, - startBatches, - endBatches, - metricType, - group, - metricIds, - timeSeriesFilterName, - timeSeriesFilterDoubleRangeLt, - timeSeriesFilterDoubleRangeLte, - timeSeriesFilterDoubleRangeGt, - timeSeriesFilterDoubleRangeGte, - timeSeriesFilterIntegerRangeLt, - timeSeriesFilterIntegerRangeLte, - timeSeriesFilterIntegerRangeGt, - timeSeriesFilterIntegerRangeGte, - timeSeriesFilterIntegerRangeIncl, - timeSeriesFilterIntegerRangeNotIn, - timeSeriesFilterTimeRangeLt, - timeSeriesFilterTimeRangeLte, - timeSeriesFilterTimeRangeGt, - timeSeriesFilterTimeRangeGte, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Delete the requested experiment. - * @param {number} experimentId The ID of the experiment. + public moveRuns(body: V1MoveRunsRequest, options?: any) { + return InternalApiFp(this.configuration).moveRuns(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary NotifyContainterRunning is used to notify the master that the container is running. On HPC, the launcher will report a state of "Running" as soon as Slurm starts the job, but the container may be in the process of getting pulled down from the Internet, so the experiment is not really considered to be in a "Running" state until all the containers that are part of the experiment are running and not being pulled. + * @param {string} allocationId The ID of the allocation. + * @param {V1NotifyContainerRunningRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - deleteExperiment( - experimentId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).deleteExperiment( - experimentId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Delete a label from the experiment. - * @param {number} experimentId The ID of the experiment. - * @param {string} label The label to delete. + public notifyContainerRunning(allocationId: string, body: V1NotifyContainerRunningRequest, options?: any) { + return InternalApiFp(this.configuration).notifyContainerRunning(allocationId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Overwrite resource pool - workspace bindings + * @param {string} resourcePoolName The resource pool name. + * @param {V1OverwriteRPWorkspaceBindingsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - deleteExperimentLabel( - experimentId: number, - label: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator( - configuration, - ).deleteExperimentLabel(experimentId, label, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Delete multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1DeleteExperimentsRequest} body + public overwriteRPWorkspaceBindings(resourcePoolName: string, body: V1OverwriteRPWorkspaceBindingsRequest, options?: any) { + return InternalApiFp(this.configuration).overwriteRPWorkspaceBindings(resourcePoolName, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Update checkpoints. Won't modify checkpoint files. + * @param {V1PatchCheckpointsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - deleteExperiments( - projectId: number, - body: V1DeleteExperimentsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).deleteExperiments( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Delete tensorboard files. - * @param {number} experimentId ID of experiment that the tensorboard files are linked to. + public patchCheckpoints(body: V1PatchCheckpointsRequest, options?: any) { + return InternalApiFp(this.configuration).patchCheckpoints(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Patch (an unmanaged) trial. + * @param {number} trialId Trial id. + * @param {V1PatchTrialRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - deleteTensorboardFiles( - experimentId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator( - configuration, - ).deleteTensorboardFiles(experimentId, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the requested experiment. - * @param {number} experimentId The id of the experiment. + public patchTrial(trialId: number, body: V1PatchTrialRequest, options?: any) { + return InternalApiFp(this.configuration).patchTrial(trialId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Patch multiple users' activation status. + * @param {V1PatchUsersRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperiment( - experimentId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getExperiment( - experimentId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of checkpoints for an experiment. - * @param {number} id The experiment id. - * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. - * @param {string} [sortByMetric] Sort by custom validation metric name. - * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. - * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. - * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. + public patchUsers(body: V1PatchUsersRequest, options?: any) { + return InternalApiFp(this.configuration).patchUsers(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Pause generic task + * @param {string} taskId The id of the task. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperimentCheckpoints( - id: number, - sortByAttr?: Checkpointv1SortBy, - sortByMetric?: string, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator( - configuration, - ).getExperimentCheckpoints( - id, - sortByAttr, - sortByMetric, - orderBy, - offset, - limit, - states, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of unique experiment labels (sorted by popularity). - * @param {number} [projectId] Filter experiments by project. + public pauseGenericTask(taskId: string, options?: any) { + return InternalApiFp(this.configuration).pauseGenericTask(taskId, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Pause experiment associated with provided runs. + * @param {V1PauseRunsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperimentLabels( - projectId?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getExperimentLabels( - projectId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of experiments. - * @param {V1GetExperimentsRequestSortBy} [sortBy] Sort experiments by the given field. - SORT_BY_UNSPECIFIED: Returns experiments in an unsorted list. - SORT_BY_ID: Returns experiments sorted by id. - SORT_BY_DESCRIPTION: Returns experiments sorted by description. - SORT_BY_START_TIME: Return experiments sorted by start time. - SORT_BY_END_TIME: Return experiments sorted by end time. Experiments without end_time are returned after the ones with end_time. - SORT_BY_STATE: Return experiments sorted by state. - SORT_BY_NUM_TRIALS: Return experiments sorted by number of trials. - SORT_BY_PROGRESS: Return experiments sorted by progress. - SORT_BY_USER: Return experiments sorted by user. - SORT_BY_NAME: Returns experiments sorted by name. - SORT_BY_FORKED_FROM: Returns experiments sorted by originating model. - SORT_BY_RESOURCE_POOL: Returns experiments sorted by resource pool. - SORT_BY_PROJECT_ID: Returns experiments sorted by project. - SORT_BY_CHECKPOINT_SIZE: Returns experiments sorted by checkpoint size. - SORT_BY_CHECKPOINT_COUNT: Returns experiments sorted by checkpoint count. - SORT_BY_SEARCHER_METRIC_VAL: Returns experiments sorted by searcher metric value.. - * @param {V1OrderBy} [orderBy] Order experiments in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of experiments before returning results. Negative values denote number of experiments to skip from the end before returning results. - * @param {number} [limit] Limit the number of experiments. 0 or Unspecified - returns a default of 100. -1 - returns everything. -2 - returns pagination info but no experiments. - * @param {string} [description] Limit experiments to those that match the description. - * @param {string} [name] Limit experiments to those that match the name. - * @param {Array} [labels] Limit experiments to those that match the provided labels. - * @param {boolean} [archived] Limit experiments to those that are archived. - * @param {Array} [states] Limit experiments to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. - * @param {Array} [users] Limit experiments to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit experiments to those that are owned by users with the specified userIds. - * @param {number} [projectId] Limit experiments to those within a specified project, or 0 for all projects. - * @param {number} [experimentIdFilterLt] Less than. - * @param {number} [experimentIdFilterLte] Less than or equal. - * @param {number} [experimentIdFilterGt] Greater than. - * @param {number} [experimentIdFilterGte] Greater than or equal. - * @param {Array} [experimentIdFilterIncl] In a set. `in` is a reserved word in python. - * @param {Array} [experimentIdFilterNotIn] Not in a set. - * @param {boolean} [showTrialData] whether to surface trial specific data from the best trial. + public pauseRuns(body: V1PauseRunsRequest, options?: any) { + return InternalApiFp(this.configuration).pauseRuns(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. + * @param {string} allocationId The id of the allocation. + * @param {V1PostAllocationAcceleratorDataRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperiments( - sortBy?: V1GetExperimentsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - description?: string, - name?: string, - labels?: Array, - archived?: boolean, - states?: Array, - users?: Array, - userIds?: Array, - projectId?: number, - experimentIdFilterLt?: number, - experimentIdFilterLte?: number, - experimentIdFilterGt?: number, - experimentIdFilterGte?: number, - experimentIdFilterIncl?: Array, - experimentIdFilterNotIn?: Array, - showTrialData?: boolean, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getExperiments( - sortBy, - orderBy, - offset, - limit, - description, - name, - labels, - archived, - states, - users, - userIds, - projectId, - experimentIdFilterLt, - experimentIdFilterLte, - experimentIdFilterGt, - experimentIdFilterGte, - experimentIdFilterIncl, - experimentIdFilterNotIn, - showTrialData, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the list of trials for an experiment. - * @param {number} experimentId Limit trials to those that are owned by the specified experiments. - * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. - * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. - * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. - * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + public postAllocationAcceleratorData(allocationId: string, body: V1PostAllocationAcceleratorDataRequest, options?: any) { + return InternalApiFp(this.configuration).postAllocationAcceleratorData(allocationId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary PostAllocationProxyAddress sets the proxy address to use when proxying to services provided by an allocation. Upon receipt, the master will also register any proxies specified by the task. + * @param {string} allocationId The id of the allocation. + * @param {V1PostAllocationProxyAddressRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperimentTrials( - experimentId: number, - sortBy?: V1GetExperimentTrialsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getExperimentTrials( - experimentId, - sortBy, - orderBy, - offset, - limit, - states, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the validation history for an experiment. - * @param {number} experimentId The id of the experiment. + public postAllocationProxyAddress(allocationId: string, body: V1PostAllocationProxyAddressRequest, options?: any) { + return InternalApiFp(this.configuration).postAllocationProxyAddress(allocationId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Update run metadata. + * @param {number} runId The ID of the run to post metadata for. + * @param {V1PostRunMetadataRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getExperimentValidationHistory( - experimentId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator( - configuration, - ).getExperimentValidationHistory(experimentId, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the model definition of an experiment. - * @param {number} experimentId The id of the experiment. + public postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options?: any) { + return InternalApiFp(this.configuration).postRunMetadata(runId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Persist the given task logs. + * @param {V1PostTaskLogsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getModelDef( - experimentId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getModelDef( - experimentId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get one file content of model definition of an experiment. - * @param {number} experimentId The id of the experiment. - * @param {V1GetModelDefFileRequest} body + public postTaskLogs(body: V1PostTaskLogsRequest, options?: any) { + return InternalApiFp(this.configuration).postTaskLogs(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Persist the given TrialProfilerMetricsBatch. The trial ID is in the labels. + * @param {V1PostTrialProfilerMetricsBatchRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getModelDefFile( - experimentId: number, - body: V1GetModelDefFileRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getModelDefFile( - experimentId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the model definition file tree of an experiment. - * @param {number} experimentId The id of the experiment. + public postTrialProfilerMetricsBatch(body: V1PostTrialProfilerMetricsBatchRequest, options?: any) { + return InternalApiFp(this.configuration).postTrialProfilerMetricsBatch(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary For bookkeeping, update trial runner metadata (currently just state). + * @param {number} trialId The id of the trial. + * @param {V1TrialRunnerMetadata} body The state for the trial runner. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getModelDefTree( - experimentId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getModelDefTree( - experimentId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the list of custom searcher events with long polling. - * @param {number} experimentId The ID of the experiment. + public postTrialRunnerMetadata(trialId: number, body: V1TrialRunnerMetadata, options?: any) { + return InternalApiFp(this.configuration).postTrialRunnerMetadata(trialId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Put an experiment by external id. + * @param {string} externalExperimentId External experiment id. + * @param {V1CreateExperimentRequest} body CreateExperimentRequest payload. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getSearcherEvents( - experimentId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getSearcherEvents( - experimentId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a single trial. - * @param {number} trialId The requested trial's id. + public putExperiment(externalExperimentId: string, body: V1CreateExperimentRequest, options?: any) { + return InternalApiFp(this.configuration).putExperiment(externalExperimentId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Put a trial. + * @param {V1PutTrialRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getTrial( - trialId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getTrial( - trialId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of checkpoints for a trial. - * @param {number} id The trial id. - * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. - * @param {string} [sortByMetric] Sort by custom validation metric name. - * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. - * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. - * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. + public putTrial(body: V1PutTrialRequest, options?: any) { + return InternalApiFp(this.configuration).putTrial(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Record a checkpoint. + * @param {V1Checkpoint} body The training metrics to persist. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - getTrialCheckpoints( - id: number, - sortByAttr?: Checkpointv1SortBy, - sortByMetric?: string, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).getTrialCheckpoints( - id, - sortByAttr, - sortByMetric, - orderBy, - offset, - limit, - states, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Kill an experiment. - * @param {number} id The experiment id. + public reportCheckpoint(body: V1Checkpoint, options?: any) { + return InternalApiFp(this.configuration).reportCheckpoint(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Record metrics for specified trial. + * @param {number} metricsTrialId The trial associated with these metrics. + * @param {V1ReportTrialMetricsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - killExperiment( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).killExperiment( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Kill multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1KillExperimentsRequest} body + public reportTrialMetrics(metricsTrialId: number, body: V1ReportTrialMetricsRequest, options?: any) { + return InternalApiFp(this.configuration).reportTrialMetrics(metricsTrialId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary For bookkeeping, updates the progress towards to current requested searcher training length. + * @param {number} trialId The id of the trial. + * @param {number} body Total units completed by the trial, in terms of the unit used to configure the searcher. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - killExperiments( - projectId: number, - body: V1KillExperimentsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).killExperiments( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Kill a trial. - * @param {number} id The trial id + public reportTrialProgress(trialId: number, body: number, options?: any) { + return InternalApiFp(this.configuration).reportTrialProgress(trialId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Reports to the searcher that the trial has completed the current requested amount of training with the given searcher validation metric. + * @param {number} trialId The id of the trial. + * @param {V1TrialEarlyExit} body The exit reason. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - killTrial( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).killTrial( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Move an experiment into a project. - * @param {number} experimentId The id of the experiment being moved. - * @param {V1MoveExperimentRequest} body + public reportTrialSearcherEarlyExit(trialId: number, body: V1TrialEarlyExit, options?: any) { + return InternalApiFp(this.configuration).reportTrialSearcherEarlyExit(trialId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Reports a TrialSourceInfo entry for tracking inference or fine-tuning runs + * @param {V1ReportTrialSourceInfoRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - moveExperiment( - experimentId: number, - body: V1MoveExperimentRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).moveExperiment( - experimentId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Move multiple experiments into a project. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1MoveExperimentsRequest} body + public reportTrialSourceInfo(body: V1ReportTrialSourceInfoRequest, options?: any) { + return InternalApiFp(this.configuration).reportTrialSourceInfo(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Record training metrics for specified training. + * @param {number} trainingMetricsTrialId The trial associated with these metrics. + * @param {V1TrialMetrics} body The training metrics to persist. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - moveExperiments( - projectId: number, - body: V1MoveExperimentsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).moveExperiments( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Patch an experiment's fields. - * @param {number} experimentId The id of the experiment. - * @param {V1PatchExperiment} body Patched experiment attributes. + public reportTrialTrainingMetrics(trainingMetricsTrialId: number, body: V1TrialMetrics, options?: any) { + return InternalApiFp(this.configuration).reportTrialTrainingMetrics(trainingMetricsTrialId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Record validation metrics. + * @param {number} validationMetricsTrialId The trial associated with these metrics. + * @param {V1TrialMetrics} body The training metrics to persist. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - patchExperiment( - experimentId: number, - body: V1PatchExperiment, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).patchExperiment( - experimentId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Pause an experiment. - * @param {number} id The experiment id. + public reportTrialValidationMetrics(validationMetricsTrialId: number, body: V1TrialMetrics, options?: any) { + return InternalApiFp(this.configuration).reportTrialValidationMetrics(validationMetricsTrialId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Unpause experiment associated with provided runs. + * @param {V1ResumeRunsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - pauseExperiment( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).pauseExperiment( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Pause multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1PauseExperimentsRequest} body + public resumeRuns(body: V1ResumeRunsRequest, options?: any) { + return InternalApiFp(this.configuration).resumeRuns(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. + * @param {V1RunPrepareForReportingRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - pauseExperiments( - projectId: number, - body: V1PauseExperimentsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).pauseExperiments( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Submit operations to a custom searcher. - * @param {number} experimentId The experiment ID. - * @param {V1PostSearcherOperationsRequest} body + public runPrepareForReporting(body: V1RunPrepareForReportingRequest, options?: any) { + return InternalApiFp(this.configuration).runPrepareForReporting(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Get experiments with grouping and search syntax + * @param {number} [projectId] ID of the project to look at. + * @param {number} [offset] How many experiments to skip before including in the results. + * @param {number} [limit] How many results to show. + * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). + * @param {string} [filter] Filter expression. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - postSearcherOperations( - experimentId: number, - body: V1PostSearcherOperationsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator( - configuration, - ).postSearcherOperations(experimentId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Preview hyperparameter search. - * @param {V1PreviewHPSearchRequest} body + public searchExperiments(projectId?: number, offset?: number, limit?: number, sort?: string, filter?: string, options?: any) { + return InternalApiFp(this.configuration).searchExperiments(projectId, offset, limit, sort, filter, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Get a list of runs. + * @param {V1SearchRunsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - previewHPSearch( - body: V1PreviewHPSearchRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).previewHPSearch( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Put a new label on the experiment. - * @param {number} experimentId The ID of the experiment. - * @param {string} label The label to add. + public searchRuns(body: V1SearchRunsRequest, options?: any) { + return InternalApiFp(this.configuration).searchRuns(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Start (an unmanaged) trial. + * @param {number} trialId Trial id. + * @param {V1StartTrialRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - putExperimentLabel( - experimentId: number, - label: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).putExperimentLabel( - experimentId, - label, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Retain logs for an experiment. - * @param {number} experimentId The ID of the experiment. - * @param {V1PutExperimentRetainLogsRequest} body + public startTrial(trialId: number, body: V1StartTrialRequest, options?: any) { + return InternalApiFp(this.configuration).startTrial(trialId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Get a sample of the metrics over time for a sample of the trials. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [maxTrials] Maximum number of trials to fetch data for. + * @param {number} [maxDatapoints] Maximum number of initial / historical data points. + * @param {number} [startBatches] Beginning of window (inclusive) to fetch data for. + * @param {number} [endBatches] Ending of window (inclusive) to fetch data for. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - putExperimentRetainLogs( - experimentId: number, - body: V1PutExperimentRetainLogsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator( - configuration, - ).putExperimentRetainLogs(experimentId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Retain logs for an experiment. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1PutExperimentsRetainLogsRequest} body + public trialsSample(experimentId: number, metricName: string, metricType?: V1MetricType, group?: string, maxTrials?: number, maxDatapoints?: number, startBatches?: number, endBatches?: number, periodSeconds?: number, options?: any) { + return InternalApiFp(this.configuration).trialsSample(experimentId, metricName, metricType, group, maxTrials, maxDatapoints, startBatches, endBatches, periodSeconds, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Get a snapshot of a metric across all trials at a certain point of progress. + * @param {number} experimentId The id of the experiment. + * @param {string} metricName A metric name. + * @param {number} batchesProcessed The point of progress at which to query metrics. + * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {number} [batchesMargin] A range either side of batches_processed to include near-misses. + * @param {number} [periodSeconds] Seconds to wait when polling for updates. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - putExperimentsRetainLogs( - projectId: number, - body: V1PutExperimentsRetainLogsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator( - configuration, - ).putExperimentsRetainLogs(projectId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get experiments with grouping and search syntax - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. + public trialsSnapshot(experimentId: number, metricName: string, batchesProcessed: number, metricType?: V1MetricType, group?: string, batchesMargin?: number, periodSeconds?: number, options?: any) { + return InternalApiFp(this.configuration).trialsSnapshot(experimentId, metricName, batchesProcessed, metricType, group, batchesMargin, periodSeconds, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Unarchive runs. + * @param {V1UnarchiveRunsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof InternalApi */ - searchExperiments( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).searchExperiments( - projectId, - offset, - limit, - sort, - filter, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream trial logs. - * @param {number} trialId The id of the trial. + public unarchiveRuns(body: V1UnarchiveRunsRequest, options?: any) { + return InternalApiFp(this.configuration).unarchiveRuns(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Unbind resource pool to workspace + * @param {string} resourcePoolName The resource pool name. + * @param {V1UnbindRPFromWorkspaceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InternalApi + */ + public unbindRPFromWorkspace(resourcePoolName: string, body: V1UnbindRPFromWorkspaceRequest, options?: any) { + return InternalApiFp(this.configuration).unbindRPFromWorkspace(resourcePoolName, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Unpause generic task + * @param {string} taskId The id of the task. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InternalApi + */ + public unpauseGenericTask(taskId: string, options?: any) { + return InternalApiFp(this.configuration).unpauseGenericTask(taskId, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Update group info. + * @param {number} groupId The id of the group + * @param {V1UpdateGroupRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InternalApi + */ + public updateGroup(groupId: number, body: V1UpdateGroupRequest, options?: any) { + return InternalApiFp(this.configuration).updateGroup(groupId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Control the job queues. + * @param {V1UpdateJobQueueRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof InternalApi + */ + public updateJobQueue(body: V1UpdateJobQueueRequest, options?: any) { + return InternalApiFp(this.configuration).updateJobQueue(body, options)(this.fetch, this.basePath) + } + +} + +/** + * JobsApi - fetch parameter creator + * @export + */ +export const JobsApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Stream task logs. + * @param {string} taskId The id of the task. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [allocationIds] Limit the task logs to particular allocations. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogs(taskId: string, limit?: number, follow?: boolean, allocationIds?: Array, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling taskLogs.'); + } + const localVarPath = `/api/v1/tasks/{taskId}/logs` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + if (allocationIds) { + localVarQueryParameter['allocationIds'] = allocationIds + } + + if (agentIds) { + localVarQueryParameter['agentIds'] = agentIds + } + + if (containerIds) { + localVarQueryParameter['containerIds'] = containerIds + } + + if (rankIds) { + localVarQueryParameter['rankIds'] = rankIds + } + + if (levels) { + localVarQueryParameter['levels'] = levels + } + + if (stdtypes) { + localVarQueryParameter['stdtypes'] = stdtypes + } + + if (sources) { + localVarQueryParameter['sources'] = sources + } + + if (timestampBefore) { + localVarQueryParameter['timestampBefore'] = typeof timestampBefore === "string" ? timestampBefore : timestampBefore.toISOString() + } + + if (timestampAfter) { + localVarQueryParameter['timestampAfter'] = typeof timestampAfter === "string" ? timestampAfter : timestampAfter.toISOString() + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (searchText !== undefined) { + localVarQueryParameter['searchText'] = searchText + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream task log fields. + * @param {string} taskId The ID of the task. + * @param {boolean} [follow] Continue following fields until the task stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogsFields(taskId: string, follow?: boolean, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling taskLogsFields.'); + } + const localVarPath = `/api/v1/tasks/{taskId}/logs/fields` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * JobsApi - functional programming interface + * @export + */ +export const JobsApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Stream task logs. + * @param {string} taskId The id of the task. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [allocationIds] Limit the task logs to particular allocations. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogs(taskId: string, limit?: number, follow?: boolean, allocationIds?: Array, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = JobsApiFetchParamCreator(configuration).taskLogs(taskId, limit, follow, allocationIds, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream task log fields. + * @param {string} taskId The ID of the task. + * @param {boolean} [follow] Continue following fields until the task stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogsFields(taskId: string, follow?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = JobsApiFetchParamCreator(configuration).taskLogsFields(taskId, follow, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * JobsApi - factory interface + * @export + */ +export const JobsApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Stream task logs. + * @param {string} taskId The id of the task. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [allocationIds] Limit the task logs to particular allocations. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogs(taskId: string, limit?: number, follow?: boolean, allocationIds?: Array, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any) { + return JobsApiFp(configuration).taskLogs(taskId, limit, follow, allocationIds, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options)(fetch, basePath); + }, + /** + * + * @summary Stream task log fields. + * @param {string} taskId The ID of the task. + * @param {boolean} [follow] Continue following fields until the task stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogsFields(taskId: string, follow?: boolean, options?: any) { + return JobsApiFp(configuration).taskLogsFields(taskId, follow, options)(fetch, basePath); + }, + } +}; + +/** + * JobsApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class JobsApi extends BaseAPI { + /** + * + * @summary Stream task logs. + * @param {string} taskId The id of the task. * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [allocationIds] Limit the task logs to particular allocations. * @param {Array} [agentIds] Limit the trial logs to a subset of agents. * @param {Array} [containerIds] Limit the trial logs to a subset of containers. * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. @@ -19097,23485 +26260,9353 @@ export const ExperimentsApiFp = function (configuration?: Configuration) { * @param {string} [searchText] Search the logs by whether the text contains a substring. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof JobsApi */ - trialLogs( - trialId: number, - limit?: number, - follow?: boolean, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).trialLogs( - trialId, - limit, - follow, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream trial log fields. - * @param {number} trialId The ID of the trial. - * @param {boolean} [follow] Continue following fields until the trial stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - trialLogsFields( - trialId: number, - follow?: boolean, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).trialLogsFields( - trialId, - follow, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Unarchive an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveExperiment( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).unarchiveExperiment( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Unarchive multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1UnarchiveExperimentsRequest} body + public taskLogs(taskId: string, limit?: number, follow?: boolean, allocationIds?: Array, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any) { + return JobsApiFp(this.configuration).taskLogs(taskId, limit, follow, allocationIds, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Stream task log fields. + * @param {string} taskId The ID of the task. + * @param {boolean} [follow] Continue following fields until the task stops. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof JobsApi */ - unarchiveExperiments( - projectId: number, - body: V1UnarchiveExperimentsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ExperimentsApiFetchParamCreator(configuration).unarchiveExperiments( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; + public taskLogsFields(taskId: string, follow?: boolean, options?: any) { + return JobsApiFp(this.configuration).taskLogsFields(taskId, follow, options)(this.fetch, this.basePath) + } + +} + +/** + * ModelsApi - fetch parameter creator + * @export + */ +export const ModelsApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Archive a model + * @param {string} modelName The name of the model to archive. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveModel(modelName: string, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling archiveModel.'); + } + const localVarPath = `/api/v1/models/{modelName}/archive` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Delete a model + * @param {string} modelName The name of the model to delete. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteModel(modelName: string, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling deleteModel.'); + } + const localVarPath = `/api/v1/models/{modelName}` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Delete a model version + * @param {string} modelName The name of the model associated with the model version. + * @param {number} modelVersionNum Sequential model version number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteModelVersion(modelName: string, modelVersionNum: number, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling deleteModelVersion.'); + } + // verify required parameter 'modelVersionNum' is not null or undefined + if (modelVersionNum === null || modelVersionNum === undefined) { + throw new RequiredError('modelVersionNum','Required parameter modelVersionNum was null or undefined when calling deleteModelVersion.'); + } + const localVarPath = `/api/v1/models/{modelName}/versions/{modelVersionNum}` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))) + .replace(`{${"modelVersionNum"}}`, encodeURIComponent(String(modelVersionNum))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested model. + * @param {string} modelName The name of the model. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModel(modelName: string, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling getModel.'); + } + const localVarPath = `/api/v1/models/{modelName}` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of unique model labels (sorted by popularity). + * @param {number} [workspaceId] Optional workspace ID to limit query for model tags. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelLabels(workspaceId?: number, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/model/labels`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (workspaceId !== undefined) { + localVarQueryParameter['workspaceId'] = workspaceId + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of models. + * @param {V1GetModelsRequestSortBy} [sortBy] Sort the models by the given field. - SORT_BY_UNSPECIFIED: Returns models in an unsorted list. - SORT_BY_NAME: Returns models sorted by name. - SORT_BY_DESCRIPTION: Returns models sorted by description. - SORT_BY_CREATION_TIME: Returns models sorted by creation time. - SORT_BY_LAST_UPDATED_TIME: Returns models sorted by last updated time. - SORT_BY_NUM_VERSIONS: Returns models sorted by number of version. - SORT_BY_WORKSPACE: Returns models sorted by workspace name. + * @param {V1OrderBy} [orderBy] Order models in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of models before returning results. Negative values denote number of models to skip from the end before returning results. + * @param {number} [limit] Limit the number of models. A value of 0 denotes no limit. + * @param {string} [name] Limit the models to those matching or partially-matching the name. + * @param {string} [description] Limit the models to those matching or partially-matching the description. + * @param {Array} [labels] Limit the models to those with the following labels. + * @param {boolean} [archived] Limit to unarchived models only. + * @param {Array} [users] Limit the models to those made by the users with the following usernames. + * @param {Array} [workspaceNames] Limit models to those that belong to the following workspace names. + * @param {Array} [userIds] Limit the models to those made by the users with the following userIds. + * @param {number} [id] Limit the models to this model id. + * @param {Array} [workspaceIds] Limit models to those that belong to the following workspace ids. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModels(sortBy?: V1GetModelsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, description?: string, labels?: Array, archived?: boolean, users?: Array, workspaceNames?: Array, userIds?: Array, id?: number, workspaceIds?: Array, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/models`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (name !== undefined) { + localVarQueryParameter['name'] = name + } + + if (description !== undefined) { + localVarQueryParameter['description'] = description + } + + if (labels) { + localVarQueryParameter['labels'] = labels + } + + if (archived !== undefined) { + localVarQueryParameter['archived'] = archived + } + + if (users) { + localVarQueryParameter['users'] = users + } + + if (workspaceNames) { + localVarQueryParameter['workspaceNames'] = workspaceNames + } + + if (userIds) { + localVarQueryParameter['userIds'] = userIds + } + + if (id !== undefined) { + localVarQueryParameter['id'] = id + } + + if (workspaceIds) { + localVarQueryParameter['workspaceIds'] = workspaceIds + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested model version. + * @param {string} modelName The name of the model. + * @param {number} modelVersionNum Sequential model version number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelVersion(modelName: string, modelVersionNum: number, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling getModelVersion.'); + } + // verify required parameter 'modelVersionNum' is not null or undefined + if (modelVersionNum === null || modelVersionNum === undefined) { + throw new RequiredError('modelVersionNum','Required parameter modelVersionNum was null or undefined when calling getModelVersion.'); + } + const localVarPath = `/api/v1/models/{modelName}/versions/{modelVersionNum}` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))) + .replace(`{${"modelVersionNum"}}`, encodeURIComponent(String(modelVersionNum))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of versions for the requested model. + * @param {string} modelName The name of the model. + * @param {V1GetModelVersionsRequestSortBy} [sortBy] Sort the model versions by the given field. - SORT_BY_UNSPECIFIED: Returns model versions in an unsorted list. - SORT_BY_VERSION: Returns model versions sorted by version number. - SORT_BY_CREATION_TIME: Returns model versions sorted by creation_time. + * @param {V1OrderBy} [orderBy] Order model versions in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of model versions before returning results. Negative values denote number of models to skip from the end before returning results. + * @param {number} [limit] Limit the number of model versions. A value of 0 denotes no limit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelVersions(modelName: string, sortBy?: V1GetModelVersionsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling getModelVersions.'); + } + const localVarPath = `/api/v1/models/{modelName}/versions` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Move a model into a workspace + * @param {string} modelName The target model name. + * @param {V1MoveModelRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveModel(modelName: string, body: V1MoveModelRequest, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling moveModel.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling moveModel.'); + } + const localVarPath = `/api/v1/models/{modelName}/move` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Patch a model's fields. + * @param {string} modelName The name of the model being updated. + * @param {V1PatchModel} body The model desired model fields and values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchModel(modelName: string, body: V1PatchModel, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling patchModel.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchModel.'); + } + const localVarPath = `/api/v1/models/{modelName}` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Patch a model version's fields. + * @param {string} modelName The name of the model being updated. + * @param {number} modelVersionNum The model version number being updated. + * @param {V1PatchModelVersion} body Patch payload. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchModelVersion(modelName: string, modelVersionNum: number, body: V1PatchModelVersion, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling patchModelVersion.'); + } + // verify required parameter 'modelVersionNum' is not null or undefined + if (modelVersionNum === null || modelVersionNum === undefined) { + throw new RequiredError('modelVersionNum','Required parameter modelVersionNum was null or undefined when calling patchModelVersion.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchModelVersion.'); + } + const localVarPath = `/api/v1/models/{modelName}/versions/{modelVersionNum}` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))) + .replace(`{${"modelVersionNum"}}`, encodeURIComponent(String(modelVersionNum))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create a model in the registry. + * @param {V1PostModelRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postModel(body: V1PostModelRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postModel.'); + } + const localVarPath = `/api/v1/models`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create a model version. + * @param {string} modelName The name of the model to add this version to. + * @param {V1PostModelVersionRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postModelVersion(modelName: string, body: V1PostModelVersionRequest, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling postModelVersion.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postModelVersion.'); + } + const localVarPath = `/api/v1/models/{modelName}/versions` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Unarchive a model + * @param {string} modelName The name of the model to un-archive. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveModel(modelName: string, options: any = {}): FetchArgs { + // verify required parameter 'modelName' is not null or undefined + if (modelName === null || modelName === undefined) { + throw new RequiredError('modelName','Required parameter modelName was null or undefined when calling unarchiveModel.'); + } + const localVarPath = `/api/v1/models/{modelName}/unarchive` + .replace(`{${"modelName"}}`, encodeURIComponent(String(modelName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } }; /** - * ExperimentsApi - factory interface + * ModelsApi - functional programming interface * @export */ -export const ExperimentsApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Activate an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - activateExperiment(id: number, options?: any) { - return ExperimentsApiFp(configuration).activateExperiment(id, options)(fetch, basePath); - }, +export const ModelsApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Archive a model + * @param {string} modelName The name of the model to archive. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveModel(modelName: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).archiveModel(modelName, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Delete a model + * @param {string} modelName The name of the model to delete. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteModel(modelName: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).deleteModel(modelName, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Delete a model version + * @param {string} modelName The name of the model associated with the model version. + * @param {number} modelVersionNum Sequential model version number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteModelVersion(modelName: string, modelVersionNum: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).deleteModelVersion(modelName, modelVersionNum, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested model. + * @param {string} modelName The name of the model. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModel(modelName: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).getModel(modelName, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of unique model labels (sorted by popularity). + * @param {number} [workspaceId] Optional workspace ID to limit query for model tags. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelLabels(workspaceId?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).getModelLabels(workspaceId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of models. + * @param {V1GetModelsRequestSortBy} [sortBy] Sort the models by the given field. - SORT_BY_UNSPECIFIED: Returns models in an unsorted list. - SORT_BY_NAME: Returns models sorted by name. - SORT_BY_DESCRIPTION: Returns models sorted by description. - SORT_BY_CREATION_TIME: Returns models sorted by creation time. - SORT_BY_LAST_UPDATED_TIME: Returns models sorted by last updated time. - SORT_BY_NUM_VERSIONS: Returns models sorted by number of version. - SORT_BY_WORKSPACE: Returns models sorted by workspace name. + * @param {V1OrderBy} [orderBy] Order models in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of models before returning results. Negative values denote number of models to skip from the end before returning results. + * @param {number} [limit] Limit the number of models. A value of 0 denotes no limit. + * @param {string} [name] Limit the models to those matching or partially-matching the name. + * @param {string} [description] Limit the models to those matching or partially-matching the description. + * @param {Array} [labels] Limit the models to those with the following labels. + * @param {boolean} [archived] Limit to unarchived models only. + * @param {Array} [users] Limit the models to those made by the users with the following usernames. + * @param {Array} [workspaceNames] Limit models to those that belong to the following workspace names. + * @param {Array} [userIds] Limit the models to those made by the users with the following userIds. + * @param {number} [id] Limit the models to this model id. + * @param {Array} [workspaceIds] Limit models to those that belong to the following workspace ids. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModels(sortBy?: V1GetModelsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, description?: string, labels?: Array, archived?: boolean, users?: Array, workspaceNames?: Array, userIds?: Array, id?: number, workspaceIds?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).getModels(sortBy, orderBy, offset, limit, name, description, labels, archived, users, workspaceNames, userIds, id, workspaceIds, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested model version. + * @param {string} modelName The name of the model. + * @param {number} modelVersionNum Sequential model version number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelVersion(modelName: string, modelVersionNum: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).getModelVersion(modelName, modelVersionNum, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of versions for the requested model. + * @param {string} modelName The name of the model. + * @param {V1GetModelVersionsRequestSortBy} [sortBy] Sort the model versions by the given field. - SORT_BY_UNSPECIFIED: Returns model versions in an unsorted list. - SORT_BY_VERSION: Returns model versions sorted by version number. - SORT_BY_CREATION_TIME: Returns model versions sorted by creation_time. + * @param {V1OrderBy} [orderBy] Order model versions in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of model versions before returning results. Negative values denote number of models to skip from the end before returning results. + * @param {number} [limit] Limit the number of model versions. A value of 0 denotes no limit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelVersions(modelName: string, sortBy?: V1GetModelVersionsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).getModelVersions(modelName, sortBy, orderBy, offset, limit, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Move a model into a workspace + * @param {string} modelName The target model name. + * @param {V1MoveModelRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveModel(modelName: string, body: V1MoveModelRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).moveModel(modelName, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Patch a model's fields. + * @param {string} modelName The name of the model being updated. + * @param {V1PatchModel} body The model desired model fields and values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchModel(modelName: string, body: V1PatchModel, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).patchModel(modelName, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Patch a model version's fields. + * @param {string} modelName The name of the model being updated. + * @param {number} modelVersionNum The model version number being updated. + * @param {V1PatchModelVersion} body Patch payload. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchModelVersion(modelName: string, modelVersionNum: number, body: V1PatchModelVersion, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).patchModelVersion(modelName, modelVersionNum, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create a model in the registry. + * @param {V1PostModelRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postModel(body: V1PostModelRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).postModel(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create a model version. + * @param {string} modelName The name of the model to add this version to. + * @param {V1PostModelVersionRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postModelVersion(modelName: string, body: V1PostModelVersionRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).postModelVersion(modelName, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Unarchive a model + * @param {string} modelName The name of the model to un-archive. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveModel(modelName: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).unarchiveModel(modelName, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * ModelsApi - factory interface + * @export + */ +export const ModelsApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Archive a model + * @param {string} modelName The name of the model to archive. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveModel(modelName: string, options?: any) { + return ModelsApiFp(configuration).archiveModel(modelName, options)(fetch, basePath); + }, + /** + * + * @summary Delete a model + * @param {string} modelName The name of the model to delete. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteModel(modelName: string, options?: any) { + return ModelsApiFp(configuration).deleteModel(modelName, options)(fetch, basePath); + }, + /** + * + * @summary Delete a model version + * @param {string} modelName The name of the model associated with the model version. + * @param {number} modelVersionNum Sequential model version number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteModelVersion(modelName: string, modelVersionNum: number, options?: any) { + return ModelsApiFp(configuration).deleteModelVersion(modelName, modelVersionNum, options)(fetch, basePath); + }, + /** + * + * @summary Get the requested model. + * @param {string} modelName The name of the model. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModel(modelName: string, options?: any) { + return ModelsApiFp(configuration).getModel(modelName, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of unique model labels (sorted by popularity). + * @param {number} [workspaceId] Optional workspace ID to limit query for model tags. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelLabels(workspaceId?: number, options?: any) { + return ModelsApiFp(configuration).getModelLabels(workspaceId, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of models. + * @param {V1GetModelsRequestSortBy} [sortBy] Sort the models by the given field. - SORT_BY_UNSPECIFIED: Returns models in an unsorted list. - SORT_BY_NAME: Returns models sorted by name. - SORT_BY_DESCRIPTION: Returns models sorted by description. - SORT_BY_CREATION_TIME: Returns models sorted by creation time. - SORT_BY_LAST_UPDATED_TIME: Returns models sorted by last updated time. - SORT_BY_NUM_VERSIONS: Returns models sorted by number of version. - SORT_BY_WORKSPACE: Returns models sorted by workspace name. + * @param {V1OrderBy} [orderBy] Order models in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of models before returning results. Negative values denote number of models to skip from the end before returning results. + * @param {number} [limit] Limit the number of models. A value of 0 denotes no limit. + * @param {string} [name] Limit the models to those matching or partially-matching the name. + * @param {string} [description] Limit the models to those matching or partially-matching the description. + * @param {Array} [labels] Limit the models to those with the following labels. + * @param {boolean} [archived] Limit to unarchived models only. + * @param {Array} [users] Limit the models to those made by the users with the following usernames. + * @param {Array} [workspaceNames] Limit models to those that belong to the following workspace names. + * @param {Array} [userIds] Limit the models to those made by the users with the following userIds. + * @param {number} [id] Limit the models to this model id. + * @param {Array} [workspaceIds] Limit models to those that belong to the following workspace ids. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModels(sortBy?: V1GetModelsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, description?: string, labels?: Array, archived?: boolean, users?: Array, workspaceNames?: Array, userIds?: Array, id?: number, workspaceIds?: Array, options?: any) { + return ModelsApiFp(configuration).getModels(sortBy, orderBy, offset, limit, name, description, labels, archived, users, workspaceNames, userIds, id, workspaceIds, options)(fetch, basePath); + }, + /** + * + * @summary Get the requested model version. + * @param {string} modelName The name of the model. + * @param {number} modelVersionNum Sequential model version number. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelVersion(modelName: string, modelVersionNum: number, options?: any) { + return ModelsApiFp(configuration).getModelVersion(modelName, modelVersionNum, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of versions for the requested model. + * @param {string} modelName The name of the model. + * @param {V1GetModelVersionsRequestSortBy} [sortBy] Sort the model versions by the given field. - SORT_BY_UNSPECIFIED: Returns model versions in an unsorted list. - SORT_BY_VERSION: Returns model versions sorted by version number. - SORT_BY_CREATION_TIME: Returns model versions sorted by creation_time. + * @param {V1OrderBy} [orderBy] Order model versions in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of model versions before returning results. Negative values denote number of models to skip from the end before returning results. + * @param {number} [limit] Limit the number of model versions. A value of 0 denotes no limit. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getModelVersions(modelName: string, sortBy?: V1GetModelVersionsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, options?: any) { + return ModelsApiFp(configuration).getModelVersions(modelName, sortBy, orderBy, offset, limit, options)(fetch, basePath); + }, + /** + * + * @summary Move a model into a workspace + * @param {string} modelName The target model name. + * @param {V1MoveModelRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveModel(modelName: string, body: V1MoveModelRequest, options?: any) { + return ModelsApiFp(configuration).moveModel(modelName, body, options)(fetch, basePath); + }, + /** + * + * @summary Patch a model's fields. + * @param {string} modelName The name of the model being updated. + * @param {V1PatchModel} body The model desired model fields and values. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchModel(modelName: string, body: V1PatchModel, options?: any) { + return ModelsApiFp(configuration).patchModel(modelName, body, options)(fetch, basePath); + }, + /** + * + * @summary Patch a model version's fields. + * @param {string} modelName The name of the model being updated. + * @param {number} modelVersionNum The model version number being updated. + * @param {V1PatchModelVersion} body Patch payload. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchModelVersion(modelName: string, modelVersionNum: number, body: V1PatchModelVersion, options?: any) { + return ModelsApiFp(configuration).patchModelVersion(modelName, modelVersionNum, body, options)(fetch, basePath); + }, + /** + * + * @summary Create a model in the registry. + * @param {V1PostModelRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postModel(body: V1PostModelRequest, options?: any) { + return ModelsApiFp(configuration).postModel(body, options)(fetch, basePath); + }, + /** + * + * @summary Create a model version. + * @param {string} modelName The name of the model to add this version to. + * @param {V1PostModelVersionRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postModelVersion(modelName: string, body: V1PostModelVersionRequest, options?: any) { + return ModelsApiFp(configuration).postModelVersion(modelName, body, options)(fetch, basePath); + }, + /** + * + * @summary Unarchive a model + * @param {string} modelName The name of the model to un-archive. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveModel(modelName: string, options?: any) { + return ModelsApiFp(configuration).unarchiveModel(modelName, options)(fetch, basePath); + }, + } +}; + +/** + * ModelsApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class ModelsApi extends BaseAPI { /** - * - * @summary Activate multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1ActivateExperimentsRequest} body + * + * @summary Archive a model + * @param {string} modelName The name of the model to archive. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - activateExperiments(projectId: number, body: V1ActivateExperimentsRequest, options?: any) { - return ExperimentsApiFp(configuration).activateExperiments( - projectId, - body, - options, - )(fetch, basePath); - }, + public archiveModel(modelName: string, options?: any) { + return ModelsApiFp(this.configuration).archiveModel(modelName, options)(this.fetch, this.basePath) + } + /** - * - * @summary Archive an experiment. - * @param {number} id The experiment id. + * + * @summary Delete a model + * @param {string} modelName The name of the model to delete. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - archiveExperiment(id: number, options?: any) { - return ExperimentsApiFp(configuration).archiveExperiment(id, options)(fetch, basePath); - }, + public deleteModel(modelName: string, options?: any) { + return ModelsApiFp(this.configuration).deleteModel(modelName, options)(this.fetch, this.basePath) + } + /** - * - * @summary Archive multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1ArchiveExperimentsRequest} body + * + * @summary Delete a model version + * @param {string} modelName The name of the model associated with the model version. + * @param {number} modelVersionNum Sequential model version number. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - archiveExperiments(projectId: number, body: V1ArchiveExperimentsRequest, options?: any) { - return ExperimentsApiFp(configuration).archiveExperiments( - projectId, - body, - options, - )(fetch, basePath); - }, + public deleteModelVersion(modelName: string, modelVersionNum: number, options?: any) { + return ModelsApiFp(this.configuration).deleteModelVersion(modelName, modelVersionNum, options)(this.fetch, this.basePath) + } + /** - * - * @summary Cancel an experiment. - * @param {number} id The experiment id. + * + * @summary Get the requested model. + * @param {string} modelName The name of the model. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - cancelExperiment(id: number, options?: any) { - return ExperimentsApiFp(configuration).cancelExperiment(id, options)(fetch, basePath); - }, + public getModel(modelName: string, options?: any) { + return ModelsApiFp(this.configuration).getModel(modelName, options)(this.fetch, this.basePath) + } + /** - * - * @summary Cancel multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1CancelExperimentsRequest} body + * + * @summary Get a list of unique model labels (sorted by popularity). + * @param {number} [workspaceId] Optional workspace ID to limit query for model tags. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - cancelExperiments(projectId: number, body: V1CancelExperimentsRequest, options?: any) { - return ExperimentsApiFp(configuration).cancelExperiments( - projectId, - body, - options, - )(fetch, basePath); - }, + public getModelLabels(workspaceId?: number, options?: any) { + return ModelsApiFp(this.configuration).getModelLabels(workspaceId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Return a downsampled time series of metrics from multiple trials to compare them side-by-side. - * @param {Array} [trialIds] The requested trial ids. - * @param {number} [maxDatapoints] The maximum number of data points to return after downsampling. - * @param {Array} [metricNames] The names of selected metrics. - * @param {number} [startBatches] Sample from metrics after this batch number. - * @param {number} [endBatches] Sample from metrics before this batch number. - * @param {V1MetricType} [metricType] Metric group. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {Array} [metricIds] metric ids for the query. must be in the form group.metric_name. - * @param {string} [timeSeriesFilterName] metric or column name for the filter. - * @param {number} [timeSeriesFilterDoubleRangeLt] Less than. - * @param {number} [timeSeriesFilterDoubleRangeLte] Less than or equal. - * @param {number} [timeSeriesFilterDoubleRangeGt] Greater than. - * @param {number} [timeSeriesFilterDoubleRangeGte] Greater than or equal. - * @param {number} [timeSeriesFilterIntegerRangeLt] Less than. - * @param {number} [timeSeriesFilterIntegerRangeLte] Less than or equal. - * @param {number} [timeSeriesFilterIntegerRangeGt] Greater than. - * @param {number} [timeSeriesFilterIntegerRangeGte] Greater than or equal. - * @param {Array} [timeSeriesFilterIntegerRangeIncl] In a set. `in` is a reserved word in python. - * @param {Array} [timeSeriesFilterIntegerRangeNotIn] Not in a set. - * @param {Date | DateString} [timeSeriesFilterTimeRangeLt] Less than. - * @param {Date | DateString} [timeSeriesFilterTimeRangeLte] Less than or equal. - * @param {Date | DateString} [timeSeriesFilterTimeRangeGt] Greater than. - * @param {Date | DateString} [timeSeriesFilterTimeRangeGte] Greater than or equal. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - compareTrials( - trialIds?: Array, - maxDatapoints?: number, - metricNames?: Array, - startBatches?: number, - endBatches?: number, - metricType?: V1MetricType, - group?: string, - metricIds?: Array, - timeSeriesFilterName?: string, - timeSeriesFilterDoubleRangeLt?: number, - timeSeriesFilterDoubleRangeLte?: number, - timeSeriesFilterDoubleRangeGt?: number, - timeSeriesFilterDoubleRangeGte?: number, - timeSeriesFilterIntegerRangeLt?: number, - timeSeriesFilterIntegerRangeLte?: number, - timeSeriesFilterIntegerRangeGt?: number, - timeSeriesFilterIntegerRangeGte?: number, - timeSeriesFilterIntegerRangeIncl?: Array, - timeSeriesFilterIntegerRangeNotIn?: Array, - timeSeriesFilterTimeRangeLt?: Date | DateString, - timeSeriesFilterTimeRangeLte?: Date | DateString, - timeSeriesFilterTimeRangeGt?: Date | DateString, - timeSeriesFilterTimeRangeGte?: Date | DateString, - options?: any, - ) { - return ExperimentsApiFp(configuration).compareTrials( - trialIds, - maxDatapoints, - metricNames, - startBatches, - endBatches, - metricType, - group, - metricIds, - timeSeriesFilterName, - timeSeriesFilterDoubleRangeLt, - timeSeriesFilterDoubleRangeLte, - timeSeriesFilterDoubleRangeGt, - timeSeriesFilterDoubleRangeGte, - timeSeriesFilterIntegerRangeLt, - timeSeriesFilterIntegerRangeLte, - timeSeriesFilterIntegerRangeGt, - timeSeriesFilterIntegerRangeGte, - timeSeriesFilterIntegerRangeIncl, - timeSeriesFilterIntegerRangeNotIn, - timeSeriesFilterTimeRangeLt, - timeSeriesFilterTimeRangeLte, - timeSeriesFilterTimeRangeGt, - timeSeriesFilterTimeRangeGte, - options, - )(fetch, basePath); - }, - /** - * - * @summary Delete the requested experiment. - * @param {number} experimentId The ID of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteExperiment(experimentId: number, options?: any) { - return ExperimentsApiFp(configuration).deleteExperiment(experimentId, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Delete a label from the experiment. - * @param {number} experimentId The ID of the experiment. - * @param {string} label The label to delete. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteExperimentLabel(experimentId: number, label: string, options?: any) { - return ExperimentsApiFp(configuration).deleteExperimentLabel( - experimentId, - label, - options, - )(fetch, basePath); - }, - /** - * - * @summary Delete multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1DeleteExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteExperiments(projectId: number, body: V1DeleteExperimentsRequest, options?: any) { - return ExperimentsApiFp(configuration).deleteExperiments( - projectId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Delete tensorboard files. - * @param {number} experimentId ID of experiment that the tensorboard files are linked to. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteTensorboardFiles(experimentId: number, options?: any) { - return ExperimentsApiFp(configuration).deleteTensorboardFiles(experimentId, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get the requested experiment. - * @param {number} experimentId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getExperiment(experimentId: number, options?: any) { - return ExperimentsApiFp(configuration).getExperiment(experimentId, options)(fetch, basePath); - }, - /** - * - * @summary Get a list of checkpoints for an experiment. - * @param {number} id The experiment id. - * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. - * @param {string} [sortByMetric] Sort by custom validation metric name. - * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. - * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. - * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getExperimentCheckpoints( - id: number, - sortByAttr?: Checkpointv1SortBy, - sortByMetric?: string, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ) { - return ExperimentsApiFp(configuration).getExperimentCheckpoints( - id, - sortByAttr, - sortByMetric, - orderBy, - offset, - limit, - states, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get a list of unique experiment labels (sorted by popularity). - * @param {number} [projectId] Filter experiments by project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getExperimentLabels(projectId?: number, options?: any) { - return ExperimentsApiFp(configuration).getExperimentLabels(projectId, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get a list of experiments. - * @param {V1GetExperimentsRequestSortBy} [sortBy] Sort experiments by the given field. - SORT_BY_UNSPECIFIED: Returns experiments in an unsorted list. - SORT_BY_ID: Returns experiments sorted by id. - SORT_BY_DESCRIPTION: Returns experiments sorted by description. - SORT_BY_START_TIME: Return experiments sorted by start time. - SORT_BY_END_TIME: Return experiments sorted by end time. Experiments without end_time are returned after the ones with end_time. - SORT_BY_STATE: Return experiments sorted by state. - SORT_BY_NUM_TRIALS: Return experiments sorted by number of trials. - SORT_BY_PROGRESS: Return experiments sorted by progress. - SORT_BY_USER: Return experiments sorted by user. - SORT_BY_NAME: Returns experiments sorted by name. - SORT_BY_FORKED_FROM: Returns experiments sorted by originating model. - SORT_BY_RESOURCE_POOL: Returns experiments sorted by resource pool. - SORT_BY_PROJECT_ID: Returns experiments sorted by project. - SORT_BY_CHECKPOINT_SIZE: Returns experiments sorted by checkpoint size. - SORT_BY_CHECKPOINT_COUNT: Returns experiments sorted by checkpoint count. - SORT_BY_SEARCHER_METRIC_VAL: Returns experiments sorted by searcher metric value.. - * @param {V1OrderBy} [orderBy] Order experiments in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of experiments before returning results. Negative values denote number of experiments to skip from the end before returning results. - * @param {number} [limit] Limit the number of experiments. 0 or Unspecified - returns a default of 100. -1 - returns everything. -2 - returns pagination info but no experiments. - * @param {string} [description] Limit experiments to those that match the description. - * @param {string} [name] Limit experiments to those that match the name. - * @param {Array} [labels] Limit experiments to those that match the provided labels. - * @param {boolean} [archived] Limit experiments to those that are archived. - * @param {Array} [states] Limit experiments to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. - * @param {Array} [users] Limit experiments to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit experiments to those that are owned by users with the specified userIds. - * @param {number} [projectId] Limit experiments to those within a specified project, or 0 for all projects. - * @param {number} [experimentIdFilterLt] Less than. - * @param {number} [experimentIdFilterLte] Less than or equal. - * @param {number} [experimentIdFilterGt] Greater than. - * @param {number} [experimentIdFilterGte] Greater than or equal. - * @param {Array} [experimentIdFilterIncl] In a set. `in` is a reserved word in python. - * @param {Array} [experimentIdFilterNotIn] Not in a set. - * @param {boolean} [showTrialData] whether to surface trial specific data from the best trial. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getExperiments( - sortBy?: V1GetExperimentsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - description?: string, - name?: string, - labels?: Array, - archived?: boolean, - states?: Array, - users?: Array, - userIds?: Array, - projectId?: number, - experimentIdFilterLt?: number, - experimentIdFilterLte?: number, - experimentIdFilterGt?: number, - experimentIdFilterGte?: number, - experimentIdFilterIncl?: Array, - experimentIdFilterNotIn?: Array, - showTrialData?: boolean, - options?: any, - ) { - return ExperimentsApiFp(configuration).getExperiments( - sortBy, - orderBy, - offset, - limit, - description, - name, - labels, - archived, - states, - users, - userIds, - projectId, - experimentIdFilterLt, - experimentIdFilterLte, - experimentIdFilterGt, - experimentIdFilterGte, - experimentIdFilterIncl, - experimentIdFilterNotIn, - showTrialData, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get the list of trials for an experiment. - * @param {number} experimentId Limit trials to those that are owned by the specified experiments. - * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. - * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. - * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. - * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getExperimentTrials( - experimentId: number, - sortBy?: V1GetExperimentTrialsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ) { - return ExperimentsApiFp(configuration).getExperimentTrials( - experimentId, - sortBy, - orderBy, - offset, - limit, - states, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get the validation history for an experiment. - * @param {number} experimentId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getExperimentValidationHistory(experimentId: number, options?: any) { - return ExperimentsApiFp(configuration).getExperimentValidationHistory(experimentId, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get the model definition of an experiment. - * @param {number} experimentId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelDef(experimentId: number, options?: any) { - return ExperimentsApiFp(configuration).getModelDef(experimentId, options)(fetch, basePath); - }, - /** - * - * @summary Get one file content of model definition of an experiment. - * @param {number} experimentId The id of the experiment. - * @param {V1GetModelDefFileRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelDefFile(experimentId: number, body: V1GetModelDefFileRequest, options?: any) { - return ExperimentsApiFp(configuration).getModelDefFile( - experimentId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get the model definition file tree of an experiment. - * @param {number} experimentId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelDefTree(experimentId: number, options?: any) { - return ExperimentsApiFp(configuration).getModelDefTree(experimentId, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get the list of custom searcher events with long polling. - * @param {number} experimentId The ID of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getSearcherEvents(experimentId: number, options?: any) { - return ExperimentsApiFp(configuration).getSearcherEvents(experimentId, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get a single trial. - * @param {number} trialId The requested trial's id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrial(trialId: number, options?: any) { - return ExperimentsApiFp(configuration).getTrial(trialId, options)(fetch, basePath); - }, - /** - * - * @summary Get a list of checkpoints for a trial. - * @param {number} id The trial id. - * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. - * @param {string} [sortByMetric] Sort by custom validation metric name. - * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. - * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. - * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialCheckpoints( - id: number, - sortByAttr?: Checkpointv1SortBy, - sortByMetric?: string, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ) { - return ExperimentsApiFp(configuration).getTrialCheckpoints( - id, - sortByAttr, - sortByMetric, - orderBy, - offset, - limit, - states, - options, - )(fetch, basePath); - }, - /** - * - * @summary Kill an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killExperiment(id: number, options?: any) { - return ExperimentsApiFp(configuration).killExperiment(id, options)(fetch, basePath); - }, - /** - * - * @summary Kill multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1KillExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killExperiments(projectId: number, body: V1KillExperimentsRequest, options?: any) { - return ExperimentsApiFp(configuration).killExperiments( - projectId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Kill a trial. - * @param {number} id The trial id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killTrial(id: number, options?: any) { - return ExperimentsApiFp(configuration).killTrial(id, options)(fetch, basePath); - }, - /** - * - * @summary Move an experiment into a project. - * @param {number} experimentId The id of the experiment being moved. - * @param {V1MoveExperimentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveExperiment(experimentId: number, body: V1MoveExperimentRequest, options?: any) { - return ExperimentsApiFp(configuration).moveExperiment( - experimentId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Move multiple experiments into a project. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1MoveExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveExperiments(projectId: number, body: V1MoveExperimentsRequest, options?: any) { - return ExperimentsApiFp(configuration).moveExperiments( - projectId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Patch an experiment's fields. - * @param {number} experimentId The id of the experiment. - * @param {V1PatchExperiment} body Patched experiment attributes. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchExperiment(experimentId: number, body: V1PatchExperiment, options?: any) { - return ExperimentsApiFp(configuration).patchExperiment( - experimentId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Pause an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - pauseExperiment(id: number, options?: any) { - return ExperimentsApiFp(configuration).pauseExperiment(id, options)(fetch, basePath); - }, - /** - * - * @summary Pause multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1PauseExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - pauseExperiments(projectId: number, body: V1PauseExperimentsRequest, options?: any) { - return ExperimentsApiFp(configuration).pauseExperiments( - projectId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Submit operations to a custom searcher. - * @param {number} experimentId The experiment ID. - * @param {V1PostSearcherOperationsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postSearcherOperations( - experimentId: number, - body: V1PostSearcherOperationsRequest, - options?: any, - ) { - return ExperimentsApiFp(configuration).postSearcherOperations( - experimentId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Preview hyperparameter search. - * @param {V1PreviewHPSearchRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - previewHPSearch(body: V1PreviewHPSearchRequest, options?: any) { - return ExperimentsApiFp(configuration).previewHPSearch(body, options)(fetch, basePath); - }, - /** - * - * @summary Put a new label on the experiment. - * @param {number} experimentId The ID of the experiment. - * @param {string} label The label to add. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putExperimentLabel(experimentId: number, label: string, options?: any) { - return ExperimentsApiFp(configuration).putExperimentLabel( - experimentId, - label, - options, - )(fetch, basePath); - }, - /** - * - * @summary Retain logs for an experiment. - * @param {number} experimentId The ID of the experiment. - * @param {V1PutExperimentRetainLogsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putExperimentRetainLogs( - experimentId: number, - body: V1PutExperimentRetainLogsRequest, - options?: any, - ) { - return ExperimentsApiFp(configuration).putExperimentRetainLogs( - experimentId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Retain logs for an experiment. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1PutExperimentsRetainLogsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putExperimentsRetainLogs( - projectId: number, - body: V1PutExperimentsRetainLogsRequest, - options?: any, - ) { - return ExperimentsApiFp(configuration).putExperimentsRetainLogs( - projectId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get experiments with grouping and search syntax - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchExperiments( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options?: any, - ) { - return ExperimentsApiFp(configuration).searchExperiments( - projectId, - offset, - limit, - sort, - filter, - options, - )(fetch, basePath); - }, - /** - * - * @summary Stream trial logs. - * @param {number} trialId The id of the trial. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - trialLogs( - trialId: number, - limit?: number, - follow?: boolean, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ) { - return ExperimentsApiFp(configuration).trialLogs( - trialId, - limit, - follow, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - )(fetch, basePath); - }, - /** - * - * @summary Stream trial log fields. - * @param {number} trialId The ID of the trial. - * @param {boolean} [follow] Continue following fields until the trial stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - trialLogsFields(trialId: number, follow?: boolean, options?: any) { - return ExperimentsApiFp(configuration).trialLogsFields( - trialId, - follow, - options, - )(fetch, basePath); - }, - /** - * - * @summary Unarchive an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveExperiment(id: number, options?: any) { - return ExperimentsApiFp(configuration).unarchiveExperiment(id, options)(fetch, basePath); - }, - /** - * - * @summary Unarchive multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1UnarchiveExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveExperiments(projectId: number, body: V1UnarchiveExperimentsRequest, options?: any) { - return ExperimentsApiFp(configuration).unarchiveExperiments( - projectId, - body, - options, - )(fetch, basePath); - }, - }; -}; - -/** - * ExperimentsApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class ExperimentsApi extends BaseAPI { - /** - * - * @summary Activate an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public activateExperiment(id: number, options?: any) { - return ExperimentsApiFp(this.configuration).activateExperiment(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Activate multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1ActivateExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public activateExperiments(projectId: number, body: V1ActivateExperimentsRequest, options?: any) { - return ExperimentsApiFp(this.configuration).activateExperiments( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Archive an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public archiveExperiment(id: number, options?: any) { - return ExperimentsApiFp(this.configuration).archiveExperiment(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Archive multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1ArchiveExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public archiveExperiments(projectId: number, body: V1ArchiveExperimentsRequest, options?: any) { - return ExperimentsApiFp(this.configuration).archiveExperiments( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Cancel an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public cancelExperiment(id: number, options?: any) { - return ExperimentsApiFp(this.configuration).cancelExperiment(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Cancel multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1CancelExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public cancelExperiments(projectId: number, body: V1CancelExperimentsRequest, options?: any) { - return ExperimentsApiFp(this.configuration).cancelExperiments( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Return a downsampled time series of metrics from multiple trials to compare them side-by-side. - * @param {Array} [trialIds] The requested trial ids. - * @param {number} [maxDatapoints] The maximum number of data points to return after downsampling. - * @param {Array} [metricNames] The names of selected metrics. - * @param {number} [startBatches] Sample from metrics after this batch number. - * @param {number} [endBatches] Sample from metrics before this batch number. - * @param {V1MetricType} [metricType] Metric group. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {Array} [metricIds] metric ids for the query. must be in the form group.metric_name. - * @param {string} [timeSeriesFilterName] metric or column name for the filter. - * @param {number} [timeSeriesFilterDoubleRangeLt] Less than. - * @param {number} [timeSeriesFilterDoubleRangeLte] Less than or equal. - * @param {number} [timeSeriesFilterDoubleRangeGt] Greater than. - * @param {number} [timeSeriesFilterDoubleRangeGte] Greater than or equal. - * @param {number} [timeSeriesFilterIntegerRangeLt] Less than. - * @param {number} [timeSeriesFilterIntegerRangeLte] Less than or equal. - * @param {number} [timeSeriesFilterIntegerRangeGt] Greater than. - * @param {number} [timeSeriesFilterIntegerRangeGte] Greater than or equal. - * @param {Array} [timeSeriesFilterIntegerRangeIncl] In a set. `in` is a reserved word in python. - * @param {Array} [timeSeriesFilterIntegerRangeNotIn] Not in a set. - * @param {Date | DateString} [timeSeriesFilterTimeRangeLt] Less than. - * @param {Date | DateString} [timeSeriesFilterTimeRangeLte] Less than or equal. - * @param {Date | DateString} [timeSeriesFilterTimeRangeGt] Greater than. - * @param {Date | DateString} [timeSeriesFilterTimeRangeGte] Greater than or equal. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public compareTrials( - trialIds?: Array, - maxDatapoints?: number, - metricNames?: Array, - startBatches?: number, - endBatches?: number, - metricType?: V1MetricType, - group?: string, - metricIds?: Array, - timeSeriesFilterName?: string, - timeSeriesFilterDoubleRangeLt?: number, - timeSeriesFilterDoubleRangeLte?: number, - timeSeriesFilterDoubleRangeGt?: number, - timeSeriesFilterDoubleRangeGte?: number, - timeSeriesFilterIntegerRangeLt?: number, - timeSeriesFilterIntegerRangeLte?: number, - timeSeriesFilterIntegerRangeGt?: number, - timeSeriesFilterIntegerRangeGte?: number, - timeSeriesFilterIntegerRangeIncl?: Array, - timeSeriesFilterIntegerRangeNotIn?: Array, - timeSeriesFilterTimeRangeLt?: Date | DateString, - timeSeriesFilterTimeRangeLte?: Date | DateString, - timeSeriesFilterTimeRangeGt?: Date | DateString, - timeSeriesFilterTimeRangeGte?: Date | DateString, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).compareTrials( - trialIds, - maxDatapoints, - metricNames, - startBatches, - endBatches, - metricType, - group, - metricIds, - timeSeriesFilterName, - timeSeriesFilterDoubleRangeLt, - timeSeriesFilterDoubleRangeLte, - timeSeriesFilterDoubleRangeGt, - timeSeriesFilterDoubleRangeGte, - timeSeriesFilterIntegerRangeLt, - timeSeriesFilterIntegerRangeLte, - timeSeriesFilterIntegerRangeGt, - timeSeriesFilterIntegerRangeGte, - timeSeriesFilterIntegerRangeIncl, - timeSeriesFilterIntegerRangeNotIn, - timeSeriesFilterTimeRangeLt, - timeSeriesFilterTimeRangeLte, - timeSeriesFilterTimeRangeGt, - timeSeriesFilterTimeRangeGte, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Delete the requested experiment. - * @param {number} experimentId The ID of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public deleteExperiment(experimentId: number, options?: any) { - return ExperimentsApiFp(this.configuration).deleteExperiment(experimentId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Delete a label from the experiment. - * @param {number} experimentId The ID of the experiment. - * @param {string} label The label to delete. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public deleteExperimentLabel(experimentId: number, label: string, options?: any) { - return ExperimentsApiFp(this.configuration).deleteExperimentLabel( - experimentId, - label, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Delete multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1DeleteExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public deleteExperiments(projectId: number, body: V1DeleteExperimentsRequest, options?: any) { - return ExperimentsApiFp(this.configuration).deleteExperiments( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Delete tensorboard files. - * @param {number} experimentId ID of experiment that the tensorboard files are linked to. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public deleteTensorboardFiles(experimentId: number, options?: any) { - return ExperimentsApiFp(this.configuration).deleteTensorboardFiles(experimentId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get the requested experiment. - * @param {number} experimentId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getExperiment(experimentId: number, options?: any) { - return ExperimentsApiFp(this.configuration).getExperiment(experimentId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of checkpoints for an experiment. - * @param {number} id The experiment id. - * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. - * @param {string} [sortByMetric] Sort by custom validation metric name. - * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. - * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. - * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getExperimentCheckpoints( - id: number, - sortByAttr?: Checkpointv1SortBy, - sortByMetric?: string, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).getExperimentCheckpoints( - id, - sortByAttr, - sortByMetric, - orderBy, - offset, - limit, - states, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a list of unique experiment labels (sorted by popularity). - * @param {number} [projectId] Filter experiments by project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getExperimentLabels(projectId?: number, options?: any) { - return ExperimentsApiFp(this.configuration).getExperimentLabels(projectId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of experiments. - * @param {V1GetExperimentsRequestSortBy} [sortBy] Sort experiments by the given field. - SORT_BY_UNSPECIFIED: Returns experiments in an unsorted list. - SORT_BY_ID: Returns experiments sorted by id. - SORT_BY_DESCRIPTION: Returns experiments sorted by description. - SORT_BY_START_TIME: Return experiments sorted by start time. - SORT_BY_END_TIME: Return experiments sorted by end time. Experiments without end_time are returned after the ones with end_time. - SORT_BY_STATE: Return experiments sorted by state. - SORT_BY_NUM_TRIALS: Return experiments sorted by number of trials. - SORT_BY_PROGRESS: Return experiments sorted by progress. - SORT_BY_USER: Return experiments sorted by user. - SORT_BY_NAME: Returns experiments sorted by name. - SORT_BY_FORKED_FROM: Returns experiments sorted by originating model. - SORT_BY_RESOURCE_POOL: Returns experiments sorted by resource pool. - SORT_BY_PROJECT_ID: Returns experiments sorted by project. - SORT_BY_CHECKPOINT_SIZE: Returns experiments sorted by checkpoint size. - SORT_BY_CHECKPOINT_COUNT: Returns experiments sorted by checkpoint count. - SORT_BY_SEARCHER_METRIC_VAL: Returns experiments sorted by searcher metric value.. - * @param {V1OrderBy} [orderBy] Order experiments in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of experiments before returning results. Negative values denote number of experiments to skip from the end before returning results. - * @param {number} [limit] Limit the number of experiments. 0 or Unspecified - returns a default of 100. -1 - returns everything. -2 - returns pagination info but no experiments. - * @param {string} [description] Limit experiments to those that match the description. - * @param {string} [name] Limit experiments to those that match the name. - * @param {Array} [labels] Limit experiments to those that match the provided labels. - * @param {boolean} [archived] Limit experiments to those that are archived. - * @param {Array} [states] Limit experiments to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. - * @param {Array} [users] Limit experiments to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit experiments to those that are owned by users with the specified userIds. - * @param {number} [projectId] Limit experiments to those within a specified project, or 0 for all projects. - * @param {number} [experimentIdFilterLt] Less than. - * @param {number} [experimentIdFilterLte] Less than or equal. - * @param {number} [experimentIdFilterGt] Greater than. - * @param {number} [experimentIdFilterGte] Greater than or equal. - * @param {Array} [experimentIdFilterIncl] In a set. `in` is a reserved word in python. - * @param {Array} [experimentIdFilterNotIn] Not in a set. - * @param {boolean} [showTrialData] whether to surface trial specific data from the best trial. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getExperiments( - sortBy?: V1GetExperimentsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - description?: string, - name?: string, - labels?: Array, - archived?: boolean, - states?: Array, - users?: Array, - userIds?: Array, - projectId?: number, - experimentIdFilterLt?: number, - experimentIdFilterLte?: number, - experimentIdFilterGt?: number, - experimentIdFilterGte?: number, - experimentIdFilterIncl?: Array, - experimentIdFilterNotIn?: Array, - showTrialData?: boolean, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).getExperiments( - sortBy, - orderBy, - offset, - limit, - description, - name, - labels, - archived, - states, - users, - userIds, - projectId, - experimentIdFilterLt, - experimentIdFilterLte, - experimentIdFilterGt, - experimentIdFilterGte, - experimentIdFilterIncl, - experimentIdFilterNotIn, - showTrialData, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get the list of trials for an experiment. - * @param {number} experimentId Limit trials to those that are owned by the specified experiments. - * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. - * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. - * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. - * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getExperimentTrials( - experimentId: number, - sortBy?: V1GetExperimentTrialsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).getExperimentTrials( - experimentId, - sortBy, - orderBy, - offset, - limit, - states, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get the validation history for an experiment. - * @param {number} experimentId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getExperimentValidationHistory(experimentId: number, options?: any) { - return ExperimentsApiFp(this.configuration).getExperimentValidationHistory( - experimentId, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get the model definition of an experiment. - * @param {number} experimentId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getModelDef(experimentId: number, options?: any) { - return ExperimentsApiFp(this.configuration).getModelDef(experimentId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get one file content of model definition of an experiment. - * @param {number} experimentId The id of the experiment. - * @param {V1GetModelDefFileRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getModelDefFile(experimentId: number, body: V1GetModelDefFileRequest, options?: any) { - return ExperimentsApiFp(this.configuration).getModelDefFile( - experimentId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get the model definition file tree of an experiment. - * @param {number} experimentId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getModelDefTree(experimentId: number, options?: any) { - return ExperimentsApiFp(this.configuration).getModelDefTree(experimentId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get the list of custom searcher events with long polling. - * @param {number} experimentId The ID of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getSearcherEvents(experimentId: number, options?: any) { - return ExperimentsApiFp(this.configuration).getSearcherEvents(experimentId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a single trial. - * @param {number} trialId The requested trial's id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getTrial(trialId: number, options?: any) { - return ExperimentsApiFp(this.configuration).getTrial(trialId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of checkpoints for a trial. - * @param {number} id The trial id. - * @param {Checkpointv1SortBy} [sortByAttr] Sort by preset checkpoint attribute. - SORT_BY_UNSPECIFIED: Returns checkpoints in an unsorted list. - SORT_BY_UUID: Returns checkpoints sorted by UUID. - SORT_BY_TRIAL_ID: Returns checkpoints sorted by trial id. - SORT_BY_BATCH_NUMBER: Returns checkpoints sorted by batch number. - SORT_BY_END_TIME: Returns checkpoints sorted by end time. - SORT_BY_STATE: Returns checkpoints sorted by state. - SORT_BY_SEARCHER_METRIC: Returns checkpoints sorted by the experiment's `searcher.metric` configuration setting. - * @param {string} [sortByMetric] Sort by custom validation metric name. - * @param {V1OrderBy} [orderBy] Order checkpoints in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of checkpoints before returning results. Negative values denote number of checkpoints to skip from the end before returning results. - * @param {number} [limit] Limit the number of checkpoints. A value of 0 denotes no limit. - * @param {Array} [states] Limit the checkpoints to those that match the states. - STATE_UNSPECIFIED: The state of the checkpoint is unknown. - STATE_ACTIVE: The checkpoint is in an active state. - STATE_COMPLETED: The checkpoint is persisted to checkpoint storage. - STATE_ERROR: The checkpoint errored. - STATE_DELETED: The checkpoint has been deleted. - STATE_PARTIALLY_DELETED: The checkpoint has been partially deleted. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public getTrialCheckpoints( - id: number, - sortByAttr?: Checkpointv1SortBy, - sortByMetric?: string, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).getTrialCheckpoints( - id, - sortByAttr, - sortByMetric, - orderBy, - offset, - limit, - states, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Kill an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public killExperiment(id: number, options?: any) { - return ExperimentsApiFp(this.configuration).killExperiment(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Kill multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1KillExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public killExperiments(projectId: number, body: V1KillExperimentsRequest, options?: any) { - return ExperimentsApiFp(this.configuration).killExperiments( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Kill a trial. - * @param {number} id The trial id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public killTrial(id: number, options?: any) { - return ExperimentsApiFp(this.configuration).killTrial(id, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Move an experiment into a project. - * @param {number} experimentId The id of the experiment being moved. - * @param {V1MoveExperimentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public moveExperiment(experimentId: number, body: V1MoveExperimentRequest, options?: any) { - return ExperimentsApiFp(this.configuration).moveExperiment( - experimentId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Move multiple experiments into a project. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1MoveExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public moveExperiments(projectId: number, body: V1MoveExperimentsRequest, options?: any) { - return ExperimentsApiFp(this.configuration).moveExperiments( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Patch an experiment's fields. - * @param {number} experimentId The id of the experiment. - * @param {V1PatchExperiment} body Patched experiment attributes. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public patchExperiment(experimentId: number, body: V1PatchExperiment, options?: any) { - return ExperimentsApiFp(this.configuration).patchExperiment( - experimentId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Pause an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public pauseExperiment(id: number, options?: any) { - return ExperimentsApiFp(this.configuration).pauseExperiment(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Pause multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1PauseExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public pauseExperiments(projectId: number, body: V1PauseExperimentsRequest, options?: any) { - return ExperimentsApiFp(this.configuration).pauseExperiments( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Submit operations to a custom searcher. - * @param {number} experimentId The experiment ID. - * @param {V1PostSearcherOperationsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public postSearcherOperations( - experimentId: number, - body: V1PostSearcherOperationsRequest, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).postSearcherOperations( - experimentId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Preview hyperparameter search. - * @param {V1PreviewHPSearchRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public previewHPSearch(body: V1PreviewHPSearchRequest, options?: any) { - return ExperimentsApiFp(this.configuration).previewHPSearch(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Put a new label on the experiment. - * @param {number} experimentId The ID of the experiment. - * @param {string} label The label to add. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public putExperimentLabel(experimentId: number, label: string, options?: any) { - return ExperimentsApiFp(this.configuration).putExperimentLabel( - experimentId, - label, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Retain logs for an experiment. - * @param {number} experimentId The ID of the experiment. - * @param {V1PutExperimentRetainLogsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public putExperimentRetainLogs( - experimentId: number, - body: V1PutExperimentRetainLogsRequest, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).putExperimentRetainLogs( - experimentId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Retain logs for an experiment. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1PutExperimentsRetainLogsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public putExperimentsRetainLogs( - projectId: number, - body: V1PutExperimentsRetainLogsRequest, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).putExperimentsRetainLogs( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get experiments with grouping and search syntax - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public searchExperiments( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).searchExperiments( - projectId, - offset, - limit, - sort, - filter, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Stream trial logs. - * @param {number} trialId The id of the trial. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public trialLogs( - trialId: number, - limit?: number, - follow?: boolean, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).trialLogs( - trialId, - limit, - follow, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Stream trial log fields. - * @param {number} trialId The ID of the trial. - * @param {boolean} [follow] Continue following fields until the trial stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public trialLogsFields(trialId: number, follow?: boolean, options?: any) { - return ExperimentsApiFp(this.configuration).trialLogsFields( - trialId, - follow, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Unarchive an experiment. - * @param {number} id The experiment id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public unarchiveExperiment(id: number, options?: any) { - return ExperimentsApiFp(this.configuration).unarchiveExperiment(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Unarchive multiple experiments. - * @param {number} projectId Project id that the experiments belong to. - * @param {V1UnarchiveExperimentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ExperimentsApi - */ - public unarchiveExperiments( - projectId: number, - body: V1UnarchiveExperimentsRequest, - options?: any, - ) { - return ExperimentsApiFp(this.configuration).unarchiveExperiments( - projectId, - body, - options, - )(this.fetch, this.basePath); - } -} - -/** - * InternalApi - fetch parameter creator - * @export - */ -export const InternalApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Acknowledge the receipt of a signal to stop the given allocation early. This is used indicate and exit 0 isn't final; specifically, it is used for HP search directed early stops and preemption signals (not necessarily just scheduler preemption). - * @param {string} allocationId The allocation that is acknowledging the request. - * @param {V1AckAllocationPreemptionSignalRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - ackAllocationPreemptionSignal( - allocationId: string, - body: V1AckAllocationPreemptionSignalRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling ackAllocationPreemptionSignal.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling ackAllocationPreemptionSignal.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/signals/ack_preemption`.replace( - `{${'allocationId'}}`, - encodeURIComponent(String(allocationId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary AllocationAllGather performs an all gather through the master. An allocation can only perform once all gather at a time. - * @param {string} allocationId The ID of the allocation. - * @param {V1AllocationAllGatherRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationAllGather( - allocationId: string, - body: V1AllocationAllGatherRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling allocationAllGather.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling allocationAllGather.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/all_gather`.replace( - `{${'allocationId'}}`, - encodeURIComponent(String(allocationId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Report the receipt of a signal to stop the given allocation early. This is used to communicate back from a SLURM job that it has been notified of a pending preememption. Upon a call to this API the RM should then trigger a checkpoint and immediate exit. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationPendingPreemptionSignalRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationPendingPreemptionSignal( - allocationId: string, - body: V1AllocationPendingPreemptionSignalRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling allocationPendingPreemptionSignal.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling allocationPendingPreemptionSignal.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/signals/pending_preemption`.replace( - `{${'allocationId'}}`, - encodeURIComponent(String(allocationId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Long poll preemption signals for the given allocation. If the allocation has been preempted when called, it will return so immediately. Otherwise, the connection will be kept open until the timeout is reached or the allocation is preempted. - * @param {string} allocationId The id of the allocation. - * @param {number} [timeoutSeconds] The timeout in seconds. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationPreemptionSignal( - allocationId: string, - timeoutSeconds?: number, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling allocationPreemptionSignal.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/signals/preemption`.replace( - `{${'allocationId'}}`, - encodeURIComponent(String(allocationId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (timeoutSeconds !== undefined) { - localVarQueryParameter['timeoutSeconds'] = timeoutSeconds; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Set allocation to ready state. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationReadyRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationReady( - allocationId: string, - body: V1AllocationReadyRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling allocationReady.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling allocationReady.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/ready`.replace( - `{${'allocationId'}}`, - encodeURIComponent(String(allocationId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Gather an allocation's rendezvous info. Blocks until all trial containers connect to gather their rendezvous information and responds to them all at once. - * @param {string} allocationId The id of the allocation. - * @param {string} resourcesId The id of the clump of resources. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationRendezvousInfo( - allocationId: string, - resourcesId: string, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling allocationRendezvousInfo.', - ); - } - // verify required parameter 'resourcesId' is not null or undefined - if (resourcesId === null || resourcesId === undefined) { - throw new RequiredError( - 'resourcesId', - 'Required parameter resourcesId was null or undefined when calling allocationRendezvousInfo.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/resources/{resourcesId}/rendezvous` - .replace(`{${'allocationId'}}`, encodeURIComponent(String(allocationId))) - .replace(`{${'resourcesId'}}`, encodeURIComponent(String(resourcesId))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Set allocation to waiting state. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationWaitingRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationWaiting( - allocationId: string, - body: V1AllocationWaitingRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling allocationWaiting.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling allocationWaiting.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/waiting`.replace( - `{${'allocationId'}}`, - encodeURIComponent(String(allocationId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Archive runs. - * @param {V1ArchiveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - archiveRuns(body: V1ArchiveRunsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling archiveRuns.', - ); - } - const localVarPath = `/api/v1/runs/archive`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Assign multiple users to multiple groups. - * @param {V1AssignMultipleGroupsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assignMultipleGroups(body: V1AssignMultipleGroupsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling assignMultipleGroups.', - ); - } - const localVarPath = `/api/v1/users/assignments`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Bind resource pool to workspace - * @param {string} resourcePoolName The resource pool name. - * @param {V1BindRPToWorkspaceRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - bindRPToWorkspace( - resourcePoolName: string, - body: V1BindRPToWorkspaceRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'resourcePoolName' is not null or undefined - if (resourcePoolName === null || resourcePoolName === undefined) { - throw new RequiredError( - 'resourcePoolName', - 'Required parameter resourcePoolName was null or undefined when calling bindRPToWorkspace.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling bindRPToWorkspace.', - ); - } - const localVarPath = `/api/v1/resource-pools/{resourcePoolName}/workspace-bindings`.replace( - `{${'resourcePoolName'}}`, - encodeURIComponent(String(resourcePoolName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Cleanup task logs according to the retention policy. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - cleanupLogs(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/cleanup_logs`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Reports to the searcher that the trial has completed the given searcher operation. - * @param {number} trialId The id of the trial. - * @param {V1CompleteValidateAfterOperation} body The completed operation. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - completeTrialSearcherValidation( - trialId: number, - body: V1CompleteValidateAfterOperation, - options: any = {}, - ): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling completeTrialSearcherValidation.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling completeTrialSearcherValidation.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/searcher/completed_operation`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Continues an experiment either to make the existing experiment train longer or to retry it. - * @param {V1ContinueExperimentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - continueExperiment(body: V1ContinueExperimentRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling continueExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/continue`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Create an experiment. - * @param {V1CreateExperimentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createExperiment(body: V1CreateExperimentRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling createExperiment.', - ); - } - const localVarPath = `/api/v1/experiments`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Create an experiment. - * @param {V1CreateGenericTaskRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createGenericTask(body: V1CreateGenericTaskRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling createGenericTask.', - ); - } - const localVarPath = `/api/v1/generic-tasks`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Create a group with optional members on creation. - * @param {V1CreateGroupRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createGroup(body: V1CreateGroupRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling createGroup.', - ); - } - const localVarPath = `/api/v1/groups`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Create unmanaged trial. - * @param {V1CreateTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createTrial(body: V1CreateTrialRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling createTrial.', - ); - } - const localVarPath = `/api/v1/trials`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Remove a group. - * @param {number} groupId The id of the group that should be deleted. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteGroup(groupId: number, options: any = {}): FetchArgs { - // verify required parameter 'groupId' is not null or undefined - if (groupId === null || groupId === undefined) { - throw new RequiredError( - 'groupId', - 'Required parameter groupId was null or undefined when calling deleteGroup.', - ); - } - const localVarPath = `/api/v1/groups/{groupId}`.replace( - `{${'groupId'}}`, - encodeURIComponent(String(groupId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Delete a list of runs. - * @param {V1DeleteRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteRuns(body: V1DeleteRunsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling deleteRuns.', - ); - } - const localVarPath = `/api/v1/runs/delete`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the set of metric names recorded for a list of experiments. - * @param {Array} ids The ids for the experiments. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - expMetricNames(ids: Array, periodSeconds?: number, options: any = {}): FetchArgs { - // verify required parameter 'ids' is not null or undefined - if (ids === null || ids === undefined) { - throw new RequiredError( - 'ids', - 'Required parameter ids was null or undefined when calling expMetricNames.', - ); - } - const localVarPath = `/api/v1/experiments/metrics-stream/metric-names`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (ids) { - localVarQueryParameter['ids'] = ids; - } - - if (periodSeconds !== undefined) { - localVarQueryParameter['periodSeconds'] = periodSeconds; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get details about an Allocation. - * @param {string} allocationId The id of the allocation. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAllocation(allocationId: string, options: any = {}): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling getAllocation.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}`.replace( - `{${'allocationId'}}`, - encodeURIComponent(String(allocationId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the best searcher validation for an experiment by the given metric. - * @param {number} experimentId The ID of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getBestSearcherValidationMetric(experimentId: number, options: any = {}): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling getBestSearcherValidationMetric.', - ); - } - const localVarPath = - `/api/v1/experiments/{experimentId}/searcher/best_searcher_validation_metric`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the current searcher operation. - * @param {number} trialId The id of the trial. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getCurrentTrialSearcherOperation(trialId: number, options: any = {}): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling getCurrentTrialSearcherOperation.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/searcher/operation`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get task config - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGenericTaskConfig(taskId: string, options: any = {}): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling getGenericTaskConfig.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}/config`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a group by id. - * @param {number} groupId The id of the group to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGroup(groupId: number, options: any = {}): FetchArgs { - // verify required parameter 'groupId' is not null or undefined - if (groupId === null || groupId === undefined) { - throw new RequiredError( - 'groupId', - 'Required parameter groupId was null or undefined when calling getGroup.', - ); - } - const localVarPath = `/api/v1/groups/{groupId}`.replace( - `{${'groupId'}}`, - encodeURIComponent(String(groupId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Search for groups with optional filters. - * @param {V1GetGroupsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGroups(body: V1GetGroupsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling getGroups.', - ); - } - const localVarPath = `/api/v1/groups/search`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get job queue stats for a resource pool. - * @param {Array} [resourcePools] Filter the results based on a set of resource pools. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getJobQueueStats(resourcePools?: Array, options: any = {}): FetchArgs { - const localVarPath = `/api/v1/job-queues/stats`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (resourcePools) { - localVarQueryParameter['resourcePools'] = resourcePools; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of jobs in queue. - * @param {number} [offset] Pagination offset. - * @param {number} [limit] Pagination limit. - * @param {string} [resourcePool] The target resource-pool for agent resource manager. - * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getJobs( - offset?: number, - limit?: number, - resourcePool?: string, - orderBy?: V1OrderBy, - states?: Array, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/job-queues`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (resourcePool !== undefined) { - localVarQueryParameter['resourcePool'] = resourcePool; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (states) { - localVarQueryParameter['states'] = states; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of jobs in queue. - * @param {number} [offset] Pagination offset. - * @param {number} [limit] Pagination limit. - * @param {string} [resourcePool] The target resource-pool for agent resource manager. - * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getJobsV2( - offset?: number, - limit?: number, - resourcePool?: string, - orderBy?: V1OrderBy, - states?: Array, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/job-queues-v2`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (resourcePool !== undefined) { - localVarQueryParameter['resourcePool'] = resourcePool; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (states) { - localVarQueryParameter['states'] = states; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of columns for experiment list table. - * @param {number} id The id of the project. - * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectColumns(id: number, tableType?: V1TableType, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling getProjectColumns.', - ); - } - const localVarPath = `/api/v1/projects/{id}/columns`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (tableType !== undefined) { - localVarQueryParameter['tableType'] = tableType; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get metrics range for a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectNumericMetricsRange(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling getProjectNumericMetricsRange.', - ); - } - const localVarPath = `/api/v1/projects/{id}/experiments/metric-ranges`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of all resource pools from the cluster. - * @param {number} [offset] Skip the number of resource pools before returning results. Negative values denote number of resource pools to skip from the end before returning results. - * @param {number} [limit] Limit the number of resource pools. A value of 0 denotes no limit. - * @param {boolean} [unbound] Indicate whether or not to return unbound pools only. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getResourcePools( - offset?: number, - limit?: number, - unbound?: boolean, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/resource-pools`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (unbound !== undefined) { - localVarQueryParameter['unbound'] = unbound; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get run metadata. - * @param {number} runId The ID of the run to get metadata for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRunMetadata(runId: number, options: any = {}): FetchArgs { - // verify required parameter 'runId' is not null or undefined - if (runId === null || runId === undefined) { - throw new RequiredError( - 'runId', - 'Required parameter runId was null or undefined when calling getRunMetadata.', - ); - } - const localVarPath = `/api/v1/runs/{runId}/metadata`.replace( - `{${'runId'}}`, - encodeURIComponent(String(runId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTaskAcceleratorData(taskId: string, options: any = {}): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling getTaskAcceleratorData.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}/acceleratorData`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get telemetry information. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTelemetry(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/master/telemetry`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a single trial by external id. - * @param {string} externalExperimentId External experiment id. - * @param {string} externalTrialId External trial id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialByExternalID( - externalExperimentId: string, - externalTrialId: string, - options: any = {}, - ): FetchArgs { - // verify required parameter 'externalExperimentId' is not null or undefined - if (externalExperimentId === null || externalExperimentId === undefined) { - throw new RequiredError( - 'externalExperimentId', - 'Required parameter externalExperimentId was null or undefined when calling getTrialByExternalID.', - ); - } - // verify required parameter 'externalTrialId' is not null or undefined - if (externalTrialId === null || externalTrialId === undefined) { - throw new RequiredError( - 'externalTrialId', - 'Required parameter externalTrialId was null or undefined when calling getTrialByExternalID.', - ); - } - const localVarPath = `/api/v1/trials/by-external-id/{externalExperimentId}/{externalTrialId}` - .replace(`{${'externalExperimentId'}}`, encodeURIComponent(String(externalExperimentId))) - .replace(`{${'externalTrialId'}}`, encodeURIComponent(String(externalTrialId))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Gets the metrics for all trials associated with this checkpoint - * @param {string} checkpointUuid UUID of the checkpoint. - * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub - * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialMetricsByCheckpoint( - checkpointUuid: string, - trialSourceInfoType?: V1TrialSourceInfoType, - metricGroup?: string, - options: any = {}, - ): FetchArgs { - // verify required parameter 'checkpointUuid' is not null or undefined - if (checkpointUuid === null || checkpointUuid === undefined) { - throw new RequiredError( - 'checkpointUuid', - 'Required parameter checkpointUuid was null or undefined when calling getTrialMetricsByCheckpoint.', - ); - } - const localVarPath = `/api/v1/checkpoints/{checkpointUuid}/metrics`.replace( - `{${'checkpointUuid'}}`, - encodeURIComponent(String(checkpointUuid)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (trialSourceInfoType !== undefined) { - localVarQueryParameter['trialSourceInfoType'] = trialSourceInfoType; - } - - if (metricGroup !== undefined) { - localVarQueryParameter['metricGroup'] = metricGroup; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Gets the metrics for all trials associated with this model version - * @param {string} modelName The name of the model associated with the model version. - * @param {number} modelVersionNum Sequential model version number. - * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub - * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialMetricsByModelVersion( - modelName: string, - modelVersionNum: number, - trialSourceInfoType?: V1TrialSourceInfoType, - metricGroup?: string, - options: any = {}, - ): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling getTrialMetricsByModelVersion.', - ); - } - // verify required parameter 'modelVersionNum' is not null or undefined - if (modelVersionNum === null || modelVersionNum === undefined) { - throw new RequiredError( - 'modelVersionNum', - 'Required parameter modelVersionNum was null or undefined when calling getTrialMetricsByModelVersion.', - ); - } - const localVarPath = `/api/v1/models/{modelName}/versions/{modelVersionNum}/metrics` - .replace(`{${'modelName'}}`, encodeURIComponent(String(modelName))) - .replace(`{${'modelVersionNum'}}`, encodeURIComponent(String(modelVersionNum))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (trialSourceInfoType !== undefined) { - localVarQueryParameter['trialSourceInfoType'] = trialSourceInfoType; - } - - if (metricGroup !== undefined) { - localVarQueryParameter['metricGroup'] = metricGroup; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the list of trials for an experiment. - * @param {number} id The trial id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialRemainingLogRetentionDays(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling getTrialRemainingLogRetentionDays.', - ); - } - const localVarPath = `/api/v1/trials/{id}/remaining_log_retention_days`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the list of workloads for a trial. - * @param {number} trialId Limit workloads to those that are owned by the specified trial. - * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. - * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. - * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. - * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. - * @param {boolean} [includeBatchMetrics] Include per-batch metrics. - * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialWorkloads( - trialId: number, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - sortKey?: string, - filter?: GetTrialWorkloadsRequestFilterOption, - includeBatchMetrics?: boolean, - metricType?: V1MetricType, - group?: string, - removeDeletedCheckpoints?: boolean, - options: any = {}, - ): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling getTrialWorkloads.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/workloads`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (sortKey !== undefined) { - localVarQueryParameter['sortKey'] = sortKey; - } - - if (filter !== undefined) { - localVarQueryParameter['filter'] = filter; - } - - if (includeBatchMetrics !== undefined) { - localVarQueryParameter['includeBatchMetrics'] = includeBatchMetrics; - } - - if (metricType !== undefined) { - localVarQueryParameter['metricType'] = metricType; - } - - if (group !== undefined) { - localVarQueryParameter['group'] = group; - } - - if (removeDeletedCheckpoints !== undefined) { - localVarQueryParameter['removeDeletedCheckpoints'] = removeDeletedCheckpoints; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Send notebook idle data to master - * @param {string} notebookId The id of the notebook. - * @param {V1IdleNotebookRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - idleNotebook(notebookId: string, body: V1IdleNotebookRequest, options: any = {}): FetchArgs { - // verify required parameter 'notebookId' is not null or undefined - if (notebookId === null || notebookId === undefined) { - throw new RequiredError( - 'notebookId', - 'Required parameter notebookId was null or undefined when calling idleNotebook.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling idleNotebook.', - ); - } - const localVarPath = `/api/v1/notebooks/{notebookId}/report_idle`.replace( - `{${'notebookId'}}`, - encodeURIComponent(String(notebookId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Kill generic task - * @param {string} taskId The id of the task. - * @param {V1KillGenericTaskRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killGenericTask(taskId: string, body: V1KillGenericTaskRequest, options: any = {}): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling killGenericTask.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling killGenericTask.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}/kill`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of runs. - * @param {V1KillRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killRuns(body: V1KillRunsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling killRuns.', - ); - } - const localVarPath = `/api/v1/runs/kill`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary List all resource pools, bound and unbound, available to a specific workspace - * @param {number} workspaceId Workspace ID. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listRPsBoundToWorkspace( - workspaceId: number, - offset?: number, - limit?: number, - options: any = {}, - ): FetchArgs { - // verify required parameter 'workspaceId' is not null or undefined - if (workspaceId === null || workspaceId === undefined) { - throw new RequiredError( - 'workspaceId', - 'Required parameter workspaceId was null or undefined when calling listRPsBoundToWorkspace.', - ); - } - const localVarPath = `/api/v1/workspaces/{workspaceId}/available-resource-pools`.replace( - `{${'workspaceId'}}`, - encodeURIComponent(String(workspaceId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary List all workspaces bound to a specific resource pool - * @param {string} resourcePoolName Resource pool name. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listWorkspacesBoundToRP( - resourcePoolName: string, - offset?: number, - limit?: number, - options: any = {}, - ): FetchArgs { - // verify required parameter 'resourcePoolName' is not null or undefined - if (resourcePoolName === null || resourcePoolName === undefined) { - throw new RequiredError( - 'resourcePoolName', - 'Required parameter resourcePoolName was null or undefined when calling listWorkspacesBoundToRP.', - ); - } - const localVarPath = `/api/v1/resource-pools/{resourcePoolName}/workspace-bindings`.replace( - `{${'resourcePoolName'}}`, - encodeURIComponent(String(resourcePoolName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Mark the given reservation (container, pod, etc) within an allocation as a daemon reservation. In the exit of a successful exit, Determined will wait for all resources to exit - unless they are marked as daemon resources, in which case Determined will clean them up regardless of exit status after all non-daemon resources have exited. - * @param {string} allocationId The id of the allocation. - * @param {string} resourcesId The id of the clump of resources to mark as daemon. - * @param {V1MarkAllocationResourcesDaemonRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - markAllocationResourcesDaemon( - allocationId: string, - resourcesId: string, - body: V1MarkAllocationResourcesDaemonRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling markAllocationResourcesDaemon.', - ); - } - // verify required parameter 'resourcesId' is not null or undefined - if (resourcesId === null || resourcesId === undefined) { - throw new RequiredError( - 'resourcesId', - 'Required parameter resourcesId was null or undefined when calling markAllocationResourcesDaemon.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling markAllocationResourcesDaemon.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/resources/{resourcesId}/daemon` - .replace(`{${'allocationId'}}`, encodeURIComponent(String(allocationId))) - .replace(`{${'resourcesId'}}`, encodeURIComponent(String(resourcesId))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the milestones (in batches processed) at which a metric is recorded by an experiment. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - metricBatches( - experimentId: number, - metricName: string, - metricType?: V1MetricType, - group?: string, - periodSeconds?: number, - options: any = {}, - ): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling metricBatches.', - ); - } - // verify required parameter 'metricName' is not null or undefined - if (metricName === null || metricName === undefined) { - throw new RequiredError( - 'metricName', - 'Required parameter metricName was null or undefined when calling metricBatches.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/metrics-stream/batches`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (metricName !== undefined) { - localVarQueryParameter['metricName'] = metricName; - } - - if (metricType !== undefined) { - localVarQueryParameter['metricType'] = metricType; - } - - if (group !== undefined) { - localVarQueryParameter['group'] = group; - } - - if (periodSeconds !== undefined) { - localVarQueryParameter['periodSeconds'] = periodSeconds; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Move runs. - * @param {V1MoveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveRuns(body: V1MoveRunsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling moveRuns.', - ); - } - const localVarPath = `/api/v1/runs/move`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary NotifyContainterRunning is used to notify the master that the container is running. On HPC, the launcher will report a state of "Running" as soon as Slurm starts the job, but the container may be in the process of getting pulled down from the Internet, so the experiment is not really considered to be in a "Running" state until all the containers that are part of the experiment are running and not being pulled. - * @param {string} allocationId The ID of the allocation. - * @param {V1NotifyContainerRunningRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - notifyContainerRunning( - allocationId: string, - body: V1NotifyContainerRunningRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling notifyContainerRunning.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling notifyContainerRunning.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/notify_container_running`.replace( - `{${'allocationId'}}`, - encodeURIComponent(String(allocationId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Overwrite resource pool - workspace bindings - * @param {string} resourcePoolName The resource pool name. - * @param {V1OverwriteRPWorkspaceBindingsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - overwriteRPWorkspaceBindings( - resourcePoolName: string, - body: V1OverwriteRPWorkspaceBindingsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'resourcePoolName' is not null or undefined - if (resourcePoolName === null || resourcePoolName === undefined) { - throw new RequiredError( - 'resourcePoolName', - 'Required parameter resourcePoolName was null or undefined when calling overwriteRPWorkspaceBindings.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling overwriteRPWorkspaceBindings.', - ); - } - const localVarPath = `/api/v1/resource-pools/{resourcePoolName}/workspace-bindings`.replace( - `{${'resourcePoolName'}}`, - encodeURIComponent(String(resourcePoolName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Update checkpoints. Won't modify checkpoint files. - * @param {V1PatchCheckpointsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchCheckpoints(body: V1PatchCheckpointsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchCheckpoints.', - ); - } - const localVarPath = `/api/v1/checkpoints`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Patch (an unmanaged) trial. - * @param {number} trialId Trial id. - * @param {V1PatchTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchTrial(trialId: number, body: V1PatchTrialRequest, options: any = {}): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling patchTrial.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchTrial.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Patch multiple users' activation status. - * @param {V1PatchUsersRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchUsers(body: V1PatchUsersRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchUsers.', - ); - } - const localVarPath = `/api/v1/users`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Pause generic task - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - pauseGenericTask(taskId: string, options: any = {}): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling pauseGenericTask.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}/pause`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Pause experiment associated with provided runs. - * @param {V1PauseRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - pauseRuns(body: V1PauseRunsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling pauseRuns.', - ); - } - const localVarPath = `/api/v1/runs/pause`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. - * @param {string} allocationId The id of the allocation. - * @param {V1PostAllocationAcceleratorDataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postAllocationAcceleratorData( - allocationId: string, - body: V1PostAllocationAcceleratorDataRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling postAllocationAcceleratorData.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postAllocationAcceleratorData.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/acceleratorData`.replace( - `{${'allocationId'}}`, - encodeURIComponent(String(allocationId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary PostAllocationProxyAddress sets the proxy address to use when proxying to services provided by an allocation. Upon receipt, the master will also register any proxies specified by the task. - * @param {string} allocationId The id of the allocation. - * @param {V1PostAllocationProxyAddressRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postAllocationProxyAddress( - allocationId: string, - body: V1PostAllocationProxyAddressRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'allocationId' is not null or undefined - if (allocationId === null || allocationId === undefined) { - throw new RequiredError( - 'allocationId', - 'Required parameter allocationId was null or undefined when calling postAllocationProxyAddress.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postAllocationProxyAddress.', - ); - } - const localVarPath = `/api/v1/allocations/{allocationId}/proxy_address`.replace( - `{${'allocationId'}}`, - encodeURIComponent(String(allocationId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Update run metadata. - * @param {number} runId The ID of the run to post metadata for. - * @param {V1PostRunMetadataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options: any = {}): FetchArgs { - // verify required parameter 'runId' is not null or undefined - if (runId === null || runId === undefined) { - throw new RequiredError( - 'runId', - 'Required parameter runId was null or undefined when calling postRunMetadata.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postRunMetadata.', - ); - } - const localVarPath = `/api/v1/runs/{runId}/metadata`.replace( - `{${'runId'}}`, - encodeURIComponent(String(runId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Persist the given task logs. - * @param {V1PostTaskLogsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTaskLogs(body: V1PostTaskLogsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postTaskLogs.', - ); - } - const localVarPath = `/api/v1/task/logs`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Persist the given TrialProfilerMetricsBatch. The trial ID is in the labels. - * @param {V1PostTrialProfilerMetricsBatchRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTrialProfilerMetricsBatch( - body: V1PostTrialProfilerMetricsBatchRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postTrialProfilerMetricsBatch.', - ); - } - const localVarPath = `/api/v1/trials/profiler/metrics`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary For bookkeeping, update trial runner metadata (currently just state). - * @param {number} trialId The id of the trial. - * @param {V1TrialRunnerMetadata} body The state for the trial runner. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTrialRunnerMetadata( - trialId: number, - body: V1TrialRunnerMetadata, - options: any = {}, - ): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling postTrialRunnerMetadata.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postTrialRunnerMetadata.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/runner/metadata`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Put an experiment by external id. - * @param {string} externalExperimentId External experiment id. - * @param {V1CreateExperimentRequest} body CreateExperimentRequest payload. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putExperiment( - externalExperimentId: string, - body: V1CreateExperimentRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'externalExperimentId' is not null or undefined - if (externalExperimentId === null || externalExperimentId === undefined) { - throw new RequiredError( - 'externalExperimentId', - 'Required parameter externalExperimentId was null or undefined when calling putExperiment.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling putExperiment.', - ); - } - const localVarPath = `/api/v1/experiments/by-external-id/{externalExperimentId}`.replace( - `{${'externalExperimentId'}}`, - encodeURIComponent(String(externalExperimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Put a trial. - * @param {V1PutTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putTrial(body: V1PutTrialRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling putTrial.', - ); - } - const localVarPath = `/api/v1/trials`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Record a checkpoint. - * @param {V1Checkpoint} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportCheckpoint(body: V1Checkpoint, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling reportCheckpoint.', - ); - } - const localVarPath = `/api/v1/checkpoints`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Record metrics for specified trial. - * @param {number} metricsTrialId The trial associated with these metrics. - * @param {V1ReportTrialMetricsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialMetrics( - metricsTrialId: number, - body: V1ReportTrialMetricsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'metricsTrialId' is not null or undefined - if (metricsTrialId === null || metricsTrialId === undefined) { - throw new RequiredError( - 'metricsTrialId', - 'Required parameter metricsTrialId was null or undefined when calling reportTrialMetrics.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling reportTrialMetrics.', - ); - } - const localVarPath = `/api/v1/trials/{metricsTrialId}/metrics`.replace( - `{${'metricsTrialId'}}`, - encodeURIComponent(String(metricsTrialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary For bookkeeping, updates the progress towards to current requested searcher training length. - * @param {number} trialId The id of the trial. - * @param {number} body Total units completed by the trial, in terms of the unit used to configure the searcher. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialProgress(trialId: number, body: number, options: any = {}): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling reportTrialProgress.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling reportTrialProgress.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/progress`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Reports to the searcher that the trial has completed the current requested amount of training with the given searcher validation metric. - * @param {number} trialId The id of the trial. - * @param {V1TrialEarlyExit} body The exit reason. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialSearcherEarlyExit( - trialId: number, - body: V1TrialEarlyExit, - options: any = {}, - ): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling reportTrialSearcherEarlyExit.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling reportTrialSearcherEarlyExit.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/early_exit`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Reports a TrialSourceInfo entry for tracking inference or fine-tuning runs - * @param {V1ReportTrialSourceInfoRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialSourceInfo(body: V1ReportTrialSourceInfoRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling reportTrialSourceInfo.', - ); - } - const localVarPath = `/api/v1/trial-source-info`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Record training metrics for specified training. - * @param {number} trainingMetricsTrialId The trial associated with these metrics. - * @param {V1TrialMetrics} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialTrainingMetrics( - trainingMetricsTrialId: number, - body: V1TrialMetrics, - options: any = {}, - ): FetchArgs { - // verify required parameter 'trainingMetricsTrialId' is not null or undefined - if (trainingMetricsTrialId === null || trainingMetricsTrialId === undefined) { - throw new RequiredError( - 'trainingMetricsTrialId', - 'Required parameter trainingMetricsTrialId was null or undefined when calling reportTrialTrainingMetrics.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling reportTrialTrainingMetrics.', - ); - } - const localVarPath = `/api/v1/trials/{trainingMetricsTrialId}/training_metrics`.replace( - `{${'trainingMetricsTrialId'}}`, - encodeURIComponent(String(trainingMetricsTrialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Record validation metrics. - * @param {number} validationMetricsTrialId The trial associated with these metrics. - * @param {V1TrialMetrics} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialValidationMetrics( - validationMetricsTrialId: number, - body: V1TrialMetrics, - options: any = {}, - ): FetchArgs { - // verify required parameter 'validationMetricsTrialId' is not null or undefined - if (validationMetricsTrialId === null || validationMetricsTrialId === undefined) { - throw new RequiredError( - 'validationMetricsTrialId', - 'Required parameter validationMetricsTrialId was null or undefined when calling reportTrialValidationMetrics.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling reportTrialValidationMetrics.', - ); - } - const localVarPath = `/api/v1/trials/{validationMetricsTrialId}/validation_metrics`.replace( - `{${'validationMetricsTrialId'}}`, - encodeURIComponent(String(validationMetricsTrialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Unpause experiment associated with provided runs. - * @param {V1ResumeRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - resumeRuns(body: V1ResumeRunsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling resumeRuns.', - ); - } - const localVarPath = `/api/v1/runs/resume`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. - * @param {V1RunPrepareForReportingRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - runPrepareForReporting(body: V1RunPrepareForReportingRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling runPrepareForReporting.', - ); - } - const localVarPath = `/api/v1/runs/start`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get experiments with grouping and search syntax - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchExperiments( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/experiments-search`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (projectId !== undefined) { - localVarQueryParameter['projectId'] = projectId; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (sort !== undefined) { - localVarQueryParameter['sort'] = sort; - } - - if (filter !== undefined) { - localVarQueryParameter['filter'] = filter; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of runs. - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchRuns( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/runs`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (projectId !== undefined) { - localVarQueryParameter['projectId'] = projectId; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (sort !== undefined) { - localVarQueryParameter['sort'] = sort; - } - - if (filter !== undefined) { - localVarQueryParameter['filter'] = filter; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Start (an unmanaged) trial. - * @param {number} trialId Trial id. - * @param {V1StartTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - startTrial(trialId: number, body: V1StartTrialRequest, options: any = {}): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling startTrial.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling startTrial.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/start`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a sample of the metrics over time for a sample of the trials. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [maxTrials] Maximum number of trials to fetch data for. - * @param {number} [maxDatapoints] Maximum number of initial / historical data points. - * @param {number} [startBatches] Beginning of window (inclusive) to fetch data for. - * @param {number} [endBatches] Ending of window (inclusive) to fetch data for. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - trialsSample( - experimentId: number, - metricName: string, - metricType?: V1MetricType, - group?: string, - maxTrials?: number, - maxDatapoints?: number, - startBatches?: number, - endBatches?: number, - periodSeconds?: number, - options: any = {}, - ): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling trialsSample.', - ); - } - // verify required parameter 'metricName' is not null or undefined - if (metricName === null || metricName === undefined) { - throw new RequiredError( - 'metricName', - 'Required parameter metricName was null or undefined when calling trialsSample.', - ); - } - const localVarPath = - `/api/v1/experiments/{experimentId}/metrics-stream/trials-sample`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (metricName !== undefined) { - localVarQueryParameter['metricName'] = metricName; - } - - if (metricType !== undefined) { - localVarQueryParameter['metricType'] = metricType; - } - - if (group !== undefined) { - localVarQueryParameter['group'] = group; - } - - if (maxTrials !== undefined) { - localVarQueryParameter['maxTrials'] = maxTrials; - } - - if (maxDatapoints !== undefined) { - localVarQueryParameter['maxDatapoints'] = maxDatapoints; - } - - if (startBatches !== undefined) { - localVarQueryParameter['startBatches'] = startBatches; - } - - if (endBatches !== undefined) { - localVarQueryParameter['endBatches'] = endBatches; - } - - if (periodSeconds !== undefined) { - localVarQueryParameter['periodSeconds'] = periodSeconds; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a snapshot of a metric across all trials at a certain point of progress. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {number} batchesProcessed The point of progress at which to query metrics. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [batchesMargin] A range either side of batches_processed to include near-misses. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - trialsSnapshot( - experimentId: number, - metricName: string, - batchesProcessed: number, - metricType?: V1MetricType, - group?: string, - batchesMargin?: number, - periodSeconds?: number, - options: any = {}, - ): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling trialsSnapshot.', - ); - } - // verify required parameter 'metricName' is not null or undefined - if (metricName === null || metricName === undefined) { - throw new RequiredError( - 'metricName', - 'Required parameter metricName was null or undefined when calling trialsSnapshot.', - ); - } - // verify required parameter 'batchesProcessed' is not null or undefined - if (batchesProcessed === null || batchesProcessed === undefined) { - throw new RequiredError( - 'batchesProcessed', - 'Required parameter batchesProcessed was null or undefined when calling trialsSnapshot.', - ); - } - const localVarPath = - `/api/v1/experiments/{experimentId}/metrics-stream/trials-snapshot`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (metricName !== undefined) { - localVarQueryParameter['metricName'] = metricName; - } - - if (metricType !== undefined) { - localVarQueryParameter['metricType'] = metricType; - } - - if (group !== undefined) { - localVarQueryParameter['group'] = group; - } - - if (batchesProcessed !== undefined) { - localVarQueryParameter['batchesProcessed'] = batchesProcessed; - } - - if (batchesMargin !== undefined) { - localVarQueryParameter['batchesMargin'] = batchesMargin; - } - - if (periodSeconds !== undefined) { - localVarQueryParameter['periodSeconds'] = periodSeconds; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Unarchive runs. - * @param {V1UnarchiveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveRuns(body: V1UnarchiveRunsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling unarchiveRuns.', - ); - } - const localVarPath = `/api/v1/runs/unarchive`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Unbind resource pool to workspace - * @param {string} resourcePoolName The resource pool name. - * @param {V1UnbindRPFromWorkspaceRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unbindRPFromWorkspace( - resourcePoolName: string, - body: V1UnbindRPFromWorkspaceRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'resourcePoolName' is not null or undefined - if (resourcePoolName === null || resourcePoolName === undefined) { - throw new RequiredError( - 'resourcePoolName', - 'Required parameter resourcePoolName was null or undefined when calling unbindRPFromWorkspace.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling unbindRPFromWorkspace.', - ); - } - const localVarPath = `/api/v1/resource-pools/{resourcePoolName}/workspace-bindings`.replace( - `{${'resourcePoolName'}}`, - encodeURIComponent(String(resourcePoolName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Unpause generic task - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unpauseGenericTask(taskId: string, options: any = {}): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling unpauseGenericTask.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}/unpause`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Update group info. - * @param {number} groupId The id of the group - * @param {V1UpdateGroupRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateGroup(groupId: number, body: V1UpdateGroupRequest, options: any = {}): FetchArgs { - // verify required parameter 'groupId' is not null or undefined - if (groupId === null || groupId === undefined) { - throw new RequiredError( - 'groupId', - 'Required parameter groupId was null or undefined when calling updateGroup.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling updateGroup.', - ); - } - const localVarPath = `/api/v1/groups/{groupId}`.replace( - `{${'groupId'}}`, - encodeURIComponent(String(groupId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Control the job queues. - * @param {V1UpdateJobQueueRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateJobQueue(body: V1UpdateJobQueueRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling updateJobQueue.', - ); - } - const localVarPath = `/api/v1/job-queues`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * InternalApi - functional programming interface - * @export - */ -export const InternalApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Acknowledge the receipt of a signal to stop the given allocation early. This is used indicate and exit 0 isn't final; specifically, it is used for HP search directed early stops and preemption signals (not necessarily just scheduler preemption). - * @param {string} allocationId The allocation that is acknowledging the request. - * @param {V1AckAllocationPreemptionSignalRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - ackAllocationPreemptionSignal( - allocationId: string, - body: V1AckAllocationPreemptionSignalRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).ackAllocationPreemptionSignal(allocationId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary AllocationAllGather performs an all gather through the master. An allocation can only perform once all gather at a time. - * @param {string} allocationId The ID of the allocation. - * @param {V1AllocationAllGatherRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationAllGather( - allocationId: string, - body: V1AllocationAllGatherRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).allocationAllGather( - allocationId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Report the receipt of a signal to stop the given allocation early. This is used to communicate back from a SLURM job that it has been notified of a pending preememption. Upon a call to this API the RM should then trigger a checkpoint and immediate exit. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationPendingPreemptionSignalRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationPendingPreemptionSignal( - allocationId: string, - body: V1AllocationPendingPreemptionSignalRequest, - options?: any, - ): ( - fetch?: FetchAPI, - basePath?: string, - ) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).allocationPendingPreemptionSignal(allocationId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Long poll preemption signals for the given allocation. If the allocation has been preempted when called, it will return so immediately. Otherwise, the connection will be kept open until the timeout is reached or the allocation is preempted. - * @param {string} allocationId The id of the allocation. - * @param {number} [timeoutSeconds] The timeout in seconds. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationPreemptionSignal( - allocationId: string, - timeoutSeconds?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).allocationPreemptionSignal(allocationId, timeoutSeconds, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Set allocation to ready state. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationReadyRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationReady( - allocationId: string, - body: V1AllocationReadyRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).allocationReady( - allocationId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Gather an allocation's rendezvous info. Blocks until all trial containers connect to gather their rendezvous information and responds to them all at once. - * @param {string} allocationId The id of the allocation. - * @param {string} resourcesId The id of the clump of resources. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationRendezvousInfo( - allocationId: string, - resourcesId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).allocationRendezvousInfo(allocationId, resourcesId, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Set allocation to waiting state. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationWaitingRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationWaiting( - allocationId: string, - body: V1AllocationWaitingRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).allocationWaiting( - allocationId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Archive runs. - * @param {V1ArchiveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - archiveRuns( - body: V1ArchiveRunsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).archiveRuns( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Assign multiple users to multiple groups. - * @param {V1AssignMultipleGroupsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assignMultipleGroups( - body: V1AssignMultipleGroupsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).assignMultipleGroups( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Bind resource pool to workspace - * @param {string} resourcePoolName The resource pool name. - * @param {V1BindRPToWorkspaceRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - bindRPToWorkspace( - resourcePoolName: string, - body: V1BindRPToWorkspaceRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).bindRPToWorkspace( - resourcePoolName, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Cleanup task logs according to the retention policy. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - cleanupLogs( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).cleanupLogs(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Reports to the searcher that the trial has completed the given searcher operation. - * @param {number} trialId The id of the trial. - * @param {V1CompleteValidateAfterOperation} body The completed operation. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - completeTrialSearcherValidation( - trialId: number, - body: V1CompleteValidateAfterOperation, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).completeTrialSearcherValidation(trialId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Continues an experiment either to make the existing experiment train longer or to retry it. - * @param {V1ContinueExperimentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - continueExperiment( - body: V1ContinueExperimentRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).continueExperiment( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Create an experiment. - * @param {V1CreateExperimentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createExperiment( - body: V1CreateExperimentRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).createExperiment( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Create an experiment. - * @param {V1CreateGenericTaskRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createGenericTask( - body: V1CreateGenericTaskRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).createGenericTask( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Create a group with optional members on creation. - * @param {V1CreateGroupRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createGroup( - body: V1CreateGroupRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).createGroup( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Create unmanaged trial. - * @param {V1CreateTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createTrial( - body: V1CreateTrialRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).createTrial( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Remove a group. - * @param {number} groupId The id of the group that should be deleted. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteGroup( - groupId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).deleteGroup( - groupId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Delete a list of runs. - * @param {V1DeleteRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteRuns( - body: V1DeleteRunsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).deleteRuns( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the set of metric names recorded for a list of experiments. - * @param {Array} ids The ids for the experiments. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - expMetricNames( - ids: Array, - periodSeconds?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).expMetricNames( - ids, - periodSeconds, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get details about an Allocation. - * @param {string} allocationId The id of the allocation. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAllocation( - allocationId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getAllocation( - allocationId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the best searcher validation for an experiment by the given metric. - * @param {number} experimentId The ID of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getBestSearcherValidationMetric( - experimentId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).getBestSearcherValidationMetric(experimentId, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the current searcher operation. - * @param {number} trialId The id of the trial. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getCurrentTrialSearcherOperation( - trialId: number, - options?: any, - ): ( - fetch?: FetchAPI, - basePath?: string, - ) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).getCurrentTrialSearcherOperation(trialId, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get task config - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGenericTaskConfig( - taskId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getGenericTaskConfig( - taskId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a group by id. - * @param {number} groupId The id of the group to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGroup( - groupId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getGroup( - groupId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Search for groups with optional filters. - * @param {V1GetGroupsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGroups( - body: V1GetGroupsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getGroups( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get job queue stats for a resource pool. - * @param {Array} [resourcePools] Filter the results based on a set of resource pools. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getJobQueueStats( - resourcePools?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getJobQueueStats( - resourcePools, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of jobs in queue. - * @param {number} [offset] Pagination offset. - * @param {number} [limit] Pagination limit. - * @param {string} [resourcePool] The target resource-pool for agent resource manager. - * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getJobs( - offset?: number, - limit?: number, - resourcePool?: string, - orderBy?: V1OrderBy, - states?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getJobs( - offset, - limit, - resourcePool, - orderBy, - states, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of jobs in queue. - * @param {number} [offset] Pagination offset. - * @param {number} [limit] Pagination limit. - * @param {string} [resourcePool] The target resource-pool for agent resource manager. - * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getJobsV2( - offset?: number, - limit?: number, - resourcePool?: string, - orderBy?: V1OrderBy, - states?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getJobsV2( - offset, - limit, - resourcePool, - orderBy, - states, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of columns for experiment list table. - * @param {number} id The id of the project. - * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectColumns( - id: number, - tableType?: V1TableType, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getProjectColumns( - id, - tableType, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get metrics range for a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectNumericMetricsRange( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).getProjectNumericMetricsRange(id, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of all resource pools from the cluster. - * @param {number} [offset] Skip the number of resource pools before returning results. Negative values denote number of resource pools to skip from the end before returning results. - * @param {number} [limit] Limit the number of resource pools. A value of 0 denotes no limit. - * @param {boolean} [unbound] Indicate whether or not to return unbound pools only. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getResourcePools( - offset?: number, - limit?: number, - unbound?: boolean, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getResourcePools( - offset, - limit, - unbound, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get run metadata. - * @param {number} runId The ID of the run to get metadata for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRunMetadata( - runId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getRunMetadata( - runId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTaskAcceleratorData( - taskId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTaskAcceleratorData( - taskId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get telemetry information. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTelemetry( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTelemetry(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a single trial by external id. - * @param {string} externalExperimentId External experiment id. - * @param {string} externalTrialId External trial id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialByExternalID( - externalExperimentId: string, - externalTrialId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTrialByExternalID( - externalExperimentId, - externalTrialId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Gets the metrics for all trials associated with this checkpoint - * @param {string} checkpointUuid UUID of the checkpoint. - * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub - * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialMetricsByCheckpoint( - checkpointUuid: string, - trialSourceInfoType?: V1TrialSourceInfoType, - metricGroup?: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).getTrialMetricsByCheckpoint(checkpointUuid, trialSourceInfoType, metricGroup, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Gets the metrics for all trials associated with this model version - * @param {string} modelName The name of the model associated with the model version. - * @param {number} modelVersionNum Sequential model version number. - * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub - * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialMetricsByModelVersion( - modelName: string, - modelVersionNum: number, - trialSourceInfoType?: V1TrialSourceInfoType, - metricGroup?: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).getTrialMetricsByModelVersion( - modelName, - modelVersionNum, - trialSourceInfoType, - metricGroup, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the list of trials for an experiment. - * @param {number} id The trial id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialRemainingLogRetentionDays( - id: number, - options?: any, - ): ( - fetch?: FetchAPI, - basePath?: string, - ) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).getTrialRemainingLogRetentionDays(id, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the list of workloads for a trial. - * @param {number} trialId Limit workloads to those that are owned by the specified trial. - * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. - * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. - * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. - * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. - * @param {boolean} [includeBatchMetrics] Include per-batch metrics. - * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialWorkloads( - trialId: number, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - sortKey?: string, - filter?: GetTrialWorkloadsRequestFilterOption, - includeBatchMetrics?: boolean, - metricType?: V1MetricType, - group?: string, - removeDeletedCheckpoints?: boolean, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).getTrialWorkloads( - trialId, - orderBy, - offset, - limit, - sortKey, - filter, - includeBatchMetrics, - metricType, - group, - removeDeletedCheckpoints, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Send notebook idle data to master - * @param {string} notebookId The id of the notebook. - * @param {V1IdleNotebookRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - idleNotebook( - notebookId: string, - body: V1IdleNotebookRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).idleNotebook( - notebookId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Kill generic task - * @param {string} taskId The id of the task. - * @param {V1KillGenericTaskRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killGenericTask( - taskId: string, - body: V1KillGenericTaskRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).killGenericTask( - taskId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of runs. - * @param {V1KillRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killRuns( - body: V1KillRunsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).killRuns(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary List all resource pools, bound and unbound, available to a specific workspace - * @param {number} workspaceId Workspace ID. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listRPsBoundToWorkspace( - workspaceId: number, - offset?: number, - limit?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).listRPsBoundToWorkspace( - workspaceId, - offset, - limit, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary List all workspaces bound to a specific resource pool - * @param {string} resourcePoolName Resource pool name. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listWorkspacesBoundToRP( - resourcePoolName: string, - offset?: number, - limit?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).listWorkspacesBoundToRP( - resourcePoolName, - offset, - limit, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Mark the given reservation (container, pod, etc) within an allocation as a daemon reservation. In the exit of a successful exit, Determined will wait for all resources to exit - unless they are marked as daemon resources, in which case Determined will clean them up regardless of exit status after all non-daemon resources have exited. - * @param {string} allocationId The id of the allocation. - * @param {string} resourcesId The id of the clump of resources to mark as daemon. - * @param {V1MarkAllocationResourcesDaemonRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - markAllocationResourcesDaemon( - allocationId: string, - resourcesId: string, - body: V1MarkAllocationResourcesDaemonRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).markAllocationResourcesDaemon(allocationId, resourcesId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the milestones (in batches processed) at which a metric is recorded by an experiment. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - metricBatches( - experimentId: number, - metricName: string, - metricType?: V1MetricType, - group?: string, - periodSeconds?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).metricBatches( - experimentId, - metricName, - metricType, - group, - periodSeconds, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Move runs. - * @param {V1MoveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveRuns( - body: V1MoveRunsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).moveRuns(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary NotifyContainterRunning is used to notify the master that the container is running. On HPC, the launcher will report a state of "Running" as soon as Slurm starts the job, but the container may be in the process of getting pulled down from the Internet, so the experiment is not really considered to be in a "Running" state until all the containers that are part of the experiment are running and not being pulled. - * @param {string} allocationId The ID of the allocation. - * @param {V1NotifyContainerRunningRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - notifyContainerRunning( - allocationId: string, - body: V1NotifyContainerRunningRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).notifyContainerRunning( - allocationId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Overwrite resource pool - workspace bindings - * @param {string} resourcePoolName The resource pool name. - * @param {V1OverwriteRPWorkspaceBindingsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - overwriteRPWorkspaceBindings( - resourcePoolName: string, - body: V1OverwriteRPWorkspaceBindingsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).overwriteRPWorkspaceBindings(resourcePoolName, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Update checkpoints. Won't modify checkpoint files. - * @param {V1PatchCheckpointsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchCheckpoints( - body: V1PatchCheckpointsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).patchCheckpoints( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Patch (an unmanaged) trial. - * @param {number} trialId Trial id. - * @param {V1PatchTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchTrial( - trialId: number, - body: V1PatchTrialRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).patchTrial( - trialId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Patch multiple users' activation status. - * @param {V1PatchUsersRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchUsers( - body: V1PatchUsersRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).patchUsers( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Pause generic task - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - pauseGenericTask( - taskId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).pauseGenericTask( - taskId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Pause experiment associated with provided runs. - * @param {V1PauseRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - pauseRuns( - body: V1PauseRunsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).pauseRuns( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. - * @param {string} allocationId The id of the allocation. - * @param {V1PostAllocationAcceleratorDataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postAllocationAcceleratorData( - allocationId: string, - body: V1PostAllocationAcceleratorDataRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).postAllocationAcceleratorData(allocationId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary PostAllocationProxyAddress sets the proxy address to use when proxying to services provided by an allocation. Upon receipt, the master will also register any proxies specified by the task. - * @param {string} allocationId The id of the allocation. - * @param {V1PostAllocationProxyAddressRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postAllocationProxyAddress( - allocationId: string, - body: V1PostAllocationProxyAddressRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).postAllocationProxyAddress(allocationId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Update run metadata. - * @param {number} runId The ID of the run to post metadata for. - * @param {V1PostRunMetadataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postRunMetadata( - runId: number, - body: V1PostRunMetadataRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).postRunMetadata( - runId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Persist the given task logs. - * @param {V1PostTaskLogsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTaskLogs( - body: V1PostTaskLogsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).postTaskLogs( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Persist the given TrialProfilerMetricsBatch. The trial ID is in the labels. - * @param {V1PostTrialProfilerMetricsBatchRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTrialProfilerMetricsBatch( - body: V1PostTrialProfilerMetricsBatchRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).postTrialProfilerMetricsBatch(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary For bookkeeping, update trial runner metadata (currently just state). - * @param {number} trialId The id of the trial. - * @param {V1TrialRunnerMetadata} body The state for the trial runner. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTrialRunnerMetadata( - trialId: number, - body: V1TrialRunnerMetadata, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).postTrialRunnerMetadata( - trialId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Put an experiment by external id. - * @param {string} externalExperimentId External experiment id. - * @param {V1CreateExperimentRequest} body CreateExperimentRequest payload. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putExperiment( - externalExperimentId: string, - body: V1CreateExperimentRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).putExperiment( - externalExperimentId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Put a trial. - * @param {V1PutTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putTrial( - body: V1PutTrialRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).putTrial(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Record a checkpoint. - * @param {V1Checkpoint} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportCheckpoint( - body: V1Checkpoint, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportCheckpoint( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Record metrics for specified trial. - * @param {number} metricsTrialId The trial associated with these metrics. - * @param {V1ReportTrialMetricsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialMetrics( - metricsTrialId: number, - body: V1ReportTrialMetricsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportTrialMetrics( - metricsTrialId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary For bookkeeping, updates the progress towards to current requested searcher training length. - * @param {number} trialId The id of the trial. - * @param {number} body Total units completed by the trial, in terms of the unit used to configure the searcher. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialProgress( - trialId: number, - body: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportTrialProgress( - trialId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Reports to the searcher that the trial has completed the current requested amount of training with the given searcher validation metric. - * @param {number} trialId The id of the trial. - * @param {V1TrialEarlyExit} body The exit reason. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialSearcherEarlyExit( - trialId: number, - body: V1TrialEarlyExit, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).reportTrialSearcherEarlyExit(trialId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Reports a TrialSourceInfo entry for tracking inference or fine-tuning runs - * @param {V1ReportTrialSourceInfoRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialSourceInfo( - body: V1ReportTrialSourceInfoRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).reportTrialSourceInfo( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Record training metrics for specified training. - * @param {number} trainingMetricsTrialId The trial associated with these metrics. - * @param {V1TrialMetrics} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialTrainingMetrics( - trainingMetricsTrialId: number, - body: V1TrialMetrics, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).reportTrialTrainingMetrics(trainingMetricsTrialId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Record validation metrics. - * @param {number} validationMetricsTrialId The trial associated with these metrics. - * @param {V1TrialMetrics} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialValidationMetrics( - validationMetricsTrialId: number, - body: V1TrialMetrics, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator( - configuration, - ).reportTrialValidationMetrics(validationMetricsTrialId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Unpause experiment associated with provided runs. - * @param {V1ResumeRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - resumeRuns( - body: V1ResumeRunsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).resumeRuns( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. - * @param {V1RunPrepareForReportingRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - runPrepareForReporting( - body: V1RunPrepareForReportingRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).runPrepareForReporting( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get experiments with grouping and search syntax - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchExperiments( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).searchExperiments( - projectId, - offset, - limit, - sort, - filter, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of runs. - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchRuns( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).searchRuns( - projectId, - offset, - limit, - sort, - filter, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Start (an unmanaged) trial. - * @param {number} trialId Trial id. - * @param {V1StartTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - startTrial( - trialId: number, - body: V1StartTrialRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).startTrial( - trialId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a sample of the metrics over time for a sample of the trials. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [maxTrials] Maximum number of trials to fetch data for. - * @param {number} [maxDatapoints] Maximum number of initial / historical data points. - * @param {number} [startBatches] Beginning of window (inclusive) to fetch data for. - * @param {number} [endBatches] Ending of window (inclusive) to fetch data for. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - trialsSample( - experimentId: number, - metricName: string, - metricType?: V1MetricType, - group?: string, - maxTrials?: number, - maxDatapoints?: number, - startBatches?: number, - endBatches?: number, - periodSeconds?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).trialsSample( - experimentId, - metricName, - metricType, - group, - maxTrials, - maxDatapoints, - startBatches, - endBatches, - periodSeconds, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a snapshot of a metric across all trials at a certain point of progress. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {number} batchesProcessed The point of progress at which to query metrics. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [batchesMargin] A range either side of batches_processed to include near-misses. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - trialsSnapshot( - experimentId: number, - metricName: string, - batchesProcessed: number, - metricType?: V1MetricType, - group?: string, - batchesMargin?: number, - periodSeconds?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).trialsSnapshot( - experimentId, - metricName, - batchesProcessed, - metricType, - group, - batchesMargin, - periodSeconds, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Unarchive runs. - * @param {V1UnarchiveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveRuns( - body: V1UnarchiveRunsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).unarchiveRuns( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Unbind resource pool to workspace - * @param {string} resourcePoolName The resource pool name. - * @param {V1UnbindRPFromWorkspaceRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unbindRPFromWorkspace( - resourcePoolName: string, - body: V1UnbindRPFromWorkspaceRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).unbindRPFromWorkspace( - resourcePoolName, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Unpause generic task - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unpauseGenericTask( - taskId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).unpauseGenericTask( - taskId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Update group info. - * @param {number} groupId The id of the group - * @param {V1UpdateGroupRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateGroup( - groupId: number, - body: V1UpdateGroupRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).updateGroup( - groupId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Control the job queues. - * @param {V1UpdateJobQueueRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateJobQueue( - body: V1UpdateJobQueueRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = InternalApiFetchParamCreator(configuration).updateJobQueue( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * InternalApi - factory interface - * @export - */ -export const InternalApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Acknowledge the receipt of a signal to stop the given allocation early. This is used indicate and exit 0 isn't final; specifically, it is used for HP search directed early stops and preemption signals (not necessarily just scheduler preemption). - * @param {string} allocationId The allocation that is acknowledging the request. - * @param {V1AckAllocationPreemptionSignalRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - ackAllocationPreemptionSignal( - allocationId: string, - body: V1AckAllocationPreemptionSignalRequest, - options?: any, - ) { - return InternalApiFp(configuration).ackAllocationPreemptionSignal( - allocationId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary AllocationAllGather performs an all gather through the master. An allocation can only perform once all gather at a time. - * @param {string} allocationId The ID of the allocation. - * @param {V1AllocationAllGatherRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationAllGather(allocationId: string, body: V1AllocationAllGatherRequest, options?: any) { - return InternalApiFp(configuration).allocationAllGather( - allocationId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Report the receipt of a signal to stop the given allocation early. This is used to communicate back from a SLURM job that it has been notified of a pending preememption. Upon a call to this API the RM should then trigger a checkpoint and immediate exit. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationPendingPreemptionSignalRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationPendingPreemptionSignal( - allocationId: string, - body: V1AllocationPendingPreemptionSignalRequest, - options?: any, - ) { - return InternalApiFp(configuration).allocationPendingPreemptionSignal( - allocationId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Long poll preemption signals for the given allocation. If the allocation has been preempted when called, it will return so immediately. Otherwise, the connection will be kept open until the timeout is reached or the allocation is preempted. - * @param {string} allocationId The id of the allocation. - * @param {number} [timeoutSeconds] The timeout in seconds. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationPreemptionSignal(allocationId: string, timeoutSeconds?: number, options?: any) { - return InternalApiFp(configuration).allocationPreemptionSignal( - allocationId, - timeoutSeconds, - options, - )(fetch, basePath); - }, - /** - * - * @summary Set allocation to ready state. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationReadyRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationReady(allocationId: string, body: V1AllocationReadyRequest, options?: any) { - return InternalApiFp(configuration).allocationReady( - allocationId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Gather an allocation's rendezvous info. Blocks until all trial containers connect to gather their rendezvous information and responds to them all at once. - * @param {string} allocationId The id of the allocation. - * @param {string} resourcesId The id of the clump of resources. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationRendezvousInfo(allocationId: string, resourcesId: string, options?: any) { - return InternalApiFp(configuration).allocationRendezvousInfo( - allocationId, - resourcesId, - options, - )(fetch, basePath); - }, - /** - * - * @summary Set allocation to waiting state. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationWaitingRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - allocationWaiting(allocationId: string, body: V1AllocationWaitingRequest, options?: any) { - return InternalApiFp(configuration).allocationWaiting( - allocationId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Archive runs. - * @param {V1ArchiveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - archiveRuns(body: V1ArchiveRunsRequest, options?: any) { - return InternalApiFp(configuration).archiveRuns(body, options)(fetch, basePath); - }, - /** - * - * @summary Assign multiple users to multiple groups. - * @param {V1AssignMultipleGroupsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assignMultipleGroups(body: V1AssignMultipleGroupsRequest, options?: any) { - return InternalApiFp(configuration).assignMultipleGroups(body, options)(fetch, basePath); - }, - /** - * - * @summary Bind resource pool to workspace - * @param {string} resourcePoolName The resource pool name. - * @param {V1BindRPToWorkspaceRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - bindRPToWorkspace(resourcePoolName: string, body: V1BindRPToWorkspaceRequest, options?: any) { - return InternalApiFp(configuration).bindRPToWorkspace( - resourcePoolName, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Cleanup task logs according to the retention policy. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - cleanupLogs(options?: any) { - return InternalApiFp(configuration).cleanupLogs(options)(fetch, basePath); - }, - /** - * - * @summary Reports to the searcher that the trial has completed the given searcher operation. - * @param {number} trialId The id of the trial. - * @param {V1CompleteValidateAfterOperation} body The completed operation. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - completeTrialSearcherValidation( - trialId: number, - body: V1CompleteValidateAfterOperation, - options?: any, - ) { - return InternalApiFp(configuration).completeTrialSearcherValidation( - trialId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Continues an experiment either to make the existing experiment train longer or to retry it. - * @param {V1ContinueExperimentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - continueExperiment(body: V1ContinueExperimentRequest, options?: any) { - return InternalApiFp(configuration).continueExperiment(body, options)(fetch, basePath); - }, - /** - * - * @summary Create an experiment. - * @param {V1CreateExperimentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createExperiment(body: V1CreateExperimentRequest, options?: any) { - return InternalApiFp(configuration).createExperiment(body, options)(fetch, basePath); - }, - /** - * - * @summary Create an experiment. - * @param {V1CreateGenericTaskRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createGenericTask(body: V1CreateGenericTaskRequest, options?: any) { - return InternalApiFp(configuration).createGenericTask(body, options)(fetch, basePath); - }, - /** - * - * @summary Create a group with optional members on creation. - * @param {V1CreateGroupRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createGroup(body: V1CreateGroupRequest, options?: any) { - return InternalApiFp(configuration).createGroup(body, options)(fetch, basePath); - }, - /** - * - * @summary Create unmanaged trial. - * @param {V1CreateTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createTrial(body: V1CreateTrialRequest, options?: any) { - return InternalApiFp(configuration).createTrial(body, options)(fetch, basePath); - }, - /** - * - * @summary Remove a group. - * @param {number} groupId The id of the group that should be deleted. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteGroup(groupId: number, options?: any) { - return InternalApiFp(configuration).deleteGroup(groupId, options)(fetch, basePath); - }, - /** - * - * @summary Delete a list of runs. - * @param {V1DeleteRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteRuns(body: V1DeleteRunsRequest, options?: any) { - return InternalApiFp(configuration).deleteRuns(body, options)(fetch, basePath); - }, - /** - * - * @summary Get the set of metric names recorded for a list of experiments. - * @param {Array} ids The ids for the experiments. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - expMetricNames(ids: Array, periodSeconds?: number, options?: any) { - return InternalApiFp(configuration).expMetricNames( - ids, - periodSeconds, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get details about an Allocation. - * @param {string} allocationId The id of the allocation. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getAllocation(allocationId: string, options?: any) { - return InternalApiFp(configuration).getAllocation(allocationId, options)(fetch, basePath); - }, - /** - * - * @summary Get the best searcher validation for an experiment by the given metric. - * @param {number} experimentId The ID of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getBestSearcherValidationMetric(experimentId: number, options?: any) { - return InternalApiFp(configuration).getBestSearcherValidationMetric(experimentId, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get the current searcher operation. - * @param {number} trialId The id of the trial. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getCurrentTrialSearcherOperation(trialId: number, options?: any) { - return InternalApiFp(configuration).getCurrentTrialSearcherOperation(trialId, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get task config - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGenericTaskConfig(taskId: string, options?: any) { - return InternalApiFp(configuration).getGenericTaskConfig(taskId, options)(fetch, basePath); - }, - /** - * - * @summary Get a group by id. - * @param {number} groupId The id of the group to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGroup(groupId: number, options?: any) { - return InternalApiFp(configuration).getGroup(groupId, options)(fetch, basePath); - }, - /** - * - * @summary Search for groups with optional filters. - * @param {V1GetGroupsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGroups(body: V1GetGroupsRequest, options?: any) { - return InternalApiFp(configuration).getGroups(body, options)(fetch, basePath); - }, - /** - * - * @summary Get job queue stats for a resource pool. - * @param {Array} [resourcePools] Filter the results based on a set of resource pools. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getJobQueueStats(resourcePools?: Array, options?: any) { - return InternalApiFp(configuration).getJobQueueStats(resourcePools, options)(fetch, basePath); - }, - /** - * - * @summary Get a list of jobs in queue. - * @param {number} [offset] Pagination offset. - * @param {number} [limit] Pagination limit. - * @param {string} [resourcePool] The target resource-pool for agent resource manager. - * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getJobs( - offset?: number, - limit?: number, - resourcePool?: string, - orderBy?: V1OrderBy, - states?: Array, - options?: any, - ) { - return InternalApiFp(configuration).getJobs( - offset, - limit, - resourcePool, - orderBy, - states, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get a list of jobs in queue. - * @param {number} [offset] Pagination offset. - * @param {number} [limit] Pagination limit. - * @param {string} [resourcePool] The target resource-pool for agent resource manager. - * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getJobsV2( - offset?: number, - limit?: number, - resourcePool?: string, - orderBy?: V1OrderBy, - states?: Array, - options?: any, - ) { - return InternalApiFp(configuration).getJobsV2( - offset, - limit, - resourcePool, - orderBy, - states, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get a list of columns for experiment list table. - * @param {number} id The id of the project. - * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectColumns(id: number, tableType?: V1TableType, options?: any) { - return InternalApiFp(configuration).getProjectColumns( - id, - tableType, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get metrics range for a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectNumericMetricsRange(id: number, options?: any) { - return InternalApiFp(configuration).getProjectNumericMetricsRange(id, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get a list of all resource pools from the cluster. - * @param {number} [offset] Skip the number of resource pools before returning results. Negative values denote number of resource pools to skip from the end before returning results. - * @param {number} [limit] Limit the number of resource pools. A value of 0 denotes no limit. - * @param {boolean} [unbound] Indicate whether or not to return unbound pools only. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getResourcePools(offset?: number, limit?: number, unbound?: boolean, options?: any) { - return InternalApiFp(configuration).getResourcePools( - offset, - limit, - unbound, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get run metadata. - * @param {number} runId The ID of the run to get metadata for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRunMetadata(runId: number, options?: any) { - return InternalApiFp(configuration).getRunMetadata(runId, options)(fetch, basePath); - }, - /** - * - * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTaskAcceleratorData(taskId: string, options?: any) { - return InternalApiFp(configuration).getTaskAcceleratorData(taskId, options)(fetch, basePath); - }, - /** - * - * @summary Get telemetry information. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTelemetry(options?: any) { - return InternalApiFp(configuration).getTelemetry(options)(fetch, basePath); - }, - /** - * - * @summary Get a single trial by external id. - * @param {string} externalExperimentId External experiment id. - * @param {string} externalTrialId External trial id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialByExternalID(externalExperimentId: string, externalTrialId: string, options?: any) { - return InternalApiFp(configuration).getTrialByExternalID( - externalExperimentId, - externalTrialId, - options, - )(fetch, basePath); - }, - /** - * - * @summary Gets the metrics for all trials associated with this checkpoint - * @param {string} checkpointUuid UUID of the checkpoint. - * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub - * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialMetricsByCheckpoint( - checkpointUuid: string, - trialSourceInfoType?: V1TrialSourceInfoType, - metricGroup?: string, - options?: any, - ) { - return InternalApiFp(configuration).getTrialMetricsByCheckpoint( - checkpointUuid, - trialSourceInfoType, - metricGroup, - options, - )(fetch, basePath); - }, - /** - * - * @summary Gets the metrics for all trials associated with this model version - * @param {string} modelName The name of the model associated with the model version. - * @param {number} modelVersionNum Sequential model version number. - * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub - * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialMetricsByModelVersion( - modelName: string, - modelVersionNum: number, - trialSourceInfoType?: V1TrialSourceInfoType, - metricGroup?: string, - options?: any, - ) { - return InternalApiFp(configuration).getTrialMetricsByModelVersion( - modelName, - modelVersionNum, - trialSourceInfoType, - metricGroup, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get the list of trials for an experiment. - * @param {number} id The trial id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialRemainingLogRetentionDays(id: number, options?: any) { - return InternalApiFp(configuration).getTrialRemainingLogRetentionDays(id, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get the list of workloads for a trial. - * @param {number} trialId Limit workloads to those that are owned by the specified trial. - * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. - * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. - * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. - * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. - * @param {boolean} [includeBatchMetrics] Include per-batch metrics. - * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialWorkloads( - trialId: number, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - sortKey?: string, - filter?: GetTrialWorkloadsRequestFilterOption, - includeBatchMetrics?: boolean, - metricType?: V1MetricType, - group?: string, - removeDeletedCheckpoints?: boolean, - options?: any, - ) { - return InternalApiFp(configuration).getTrialWorkloads( - trialId, - orderBy, - offset, - limit, - sortKey, - filter, - includeBatchMetrics, - metricType, - group, - removeDeletedCheckpoints, - options, - )(fetch, basePath); - }, - /** - * - * @summary Send notebook idle data to master - * @param {string} notebookId The id of the notebook. - * @param {V1IdleNotebookRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - idleNotebook(notebookId: string, body: V1IdleNotebookRequest, options?: any) { - return InternalApiFp(configuration).idleNotebook(notebookId, body, options)(fetch, basePath); - }, - /** - * - * @summary Kill generic task - * @param {string} taskId The id of the task. - * @param {V1KillGenericTaskRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killGenericTask(taskId: string, body: V1KillGenericTaskRequest, options?: any) { - return InternalApiFp(configuration).killGenericTask(taskId, body, options)(fetch, basePath); - }, - /** - * - * @summary Get a list of runs. - * @param {V1KillRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killRuns(body: V1KillRunsRequest, options?: any) { - return InternalApiFp(configuration).killRuns(body, options)(fetch, basePath); - }, - /** - * - * @summary List all resource pools, bound and unbound, available to a specific workspace - * @param {number} workspaceId Workspace ID. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listRPsBoundToWorkspace(workspaceId: number, offset?: number, limit?: number, options?: any) { - return InternalApiFp(configuration).listRPsBoundToWorkspace( - workspaceId, - offset, - limit, - options, - )(fetch, basePath); - }, - /** - * - * @summary List all workspaces bound to a specific resource pool - * @param {string} resourcePoolName Resource pool name. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listWorkspacesBoundToRP( - resourcePoolName: string, - offset?: number, - limit?: number, - options?: any, - ) { - return InternalApiFp(configuration).listWorkspacesBoundToRP( - resourcePoolName, - offset, - limit, - options, - )(fetch, basePath); - }, - /** - * - * @summary Mark the given reservation (container, pod, etc) within an allocation as a daemon reservation. In the exit of a successful exit, Determined will wait for all resources to exit - unless they are marked as daemon resources, in which case Determined will clean them up regardless of exit status after all non-daemon resources have exited. - * @param {string} allocationId The id of the allocation. - * @param {string} resourcesId The id of the clump of resources to mark as daemon. - * @param {V1MarkAllocationResourcesDaemonRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - markAllocationResourcesDaemon( - allocationId: string, - resourcesId: string, - body: V1MarkAllocationResourcesDaemonRequest, - options?: any, - ) { - return InternalApiFp(configuration).markAllocationResourcesDaemon( - allocationId, - resourcesId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get the milestones (in batches processed) at which a metric is recorded by an experiment. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - metricBatches( - experimentId: number, - metricName: string, - metricType?: V1MetricType, - group?: string, - periodSeconds?: number, - options?: any, - ) { - return InternalApiFp(configuration).metricBatches( - experimentId, - metricName, - metricType, - group, - periodSeconds, - options, - )(fetch, basePath); - }, - /** - * - * @summary Move runs. - * @param {V1MoveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveRuns(body: V1MoveRunsRequest, options?: any) { - return InternalApiFp(configuration).moveRuns(body, options)(fetch, basePath); - }, - /** - * - * @summary NotifyContainterRunning is used to notify the master that the container is running. On HPC, the launcher will report a state of "Running" as soon as Slurm starts the job, but the container may be in the process of getting pulled down from the Internet, so the experiment is not really considered to be in a "Running" state until all the containers that are part of the experiment are running and not being pulled. - * @param {string} allocationId The ID of the allocation. - * @param {V1NotifyContainerRunningRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - notifyContainerRunning( - allocationId: string, - body: V1NotifyContainerRunningRequest, - options?: any, - ) { - return InternalApiFp(configuration).notifyContainerRunning( - allocationId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Overwrite resource pool - workspace bindings - * @param {string} resourcePoolName The resource pool name. - * @param {V1OverwriteRPWorkspaceBindingsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - overwriteRPWorkspaceBindings( - resourcePoolName: string, - body: V1OverwriteRPWorkspaceBindingsRequest, - options?: any, - ) { - return InternalApiFp(configuration).overwriteRPWorkspaceBindings( - resourcePoolName, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Update checkpoints. Won't modify checkpoint files. - * @param {V1PatchCheckpointsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchCheckpoints(body: V1PatchCheckpointsRequest, options?: any) { - return InternalApiFp(configuration).patchCheckpoints(body, options)(fetch, basePath); - }, - /** - * - * @summary Patch (an unmanaged) trial. - * @param {number} trialId Trial id. - * @param {V1PatchTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchTrial(trialId: number, body: V1PatchTrialRequest, options?: any) { - return InternalApiFp(configuration).patchTrial(trialId, body, options)(fetch, basePath); - }, - /** - * - * @summary Patch multiple users' activation status. - * @param {V1PatchUsersRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchUsers(body: V1PatchUsersRequest, options?: any) { - return InternalApiFp(configuration).patchUsers(body, options)(fetch, basePath); - }, - /** - * - * @summary Pause generic task - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - pauseGenericTask(taskId: string, options?: any) { - return InternalApiFp(configuration).pauseGenericTask(taskId, options)(fetch, basePath); - }, - /** - * - * @summary Pause experiment associated with provided runs. - * @param {V1PauseRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - pauseRuns(body: V1PauseRunsRequest, options?: any) { - return InternalApiFp(configuration).pauseRuns(body, options)(fetch, basePath); - }, - /** - * - * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. - * @param {string} allocationId The id of the allocation. - * @param {V1PostAllocationAcceleratorDataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postAllocationAcceleratorData( - allocationId: string, - body: V1PostAllocationAcceleratorDataRequest, - options?: any, - ) { - return InternalApiFp(configuration).postAllocationAcceleratorData( - allocationId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary PostAllocationProxyAddress sets the proxy address to use when proxying to services provided by an allocation. Upon receipt, the master will also register any proxies specified by the task. - * @param {string} allocationId The id of the allocation. - * @param {V1PostAllocationProxyAddressRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postAllocationProxyAddress( - allocationId: string, - body: V1PostAllocationProxyAddressRequest, - options?: any, - ) { - return InternalApiFp(configuration).postAllocationProxyAddress( - allocationId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Update run metadata. - * @param {number} runId The ID of the run to post metadata for. - * @param {V1PostRunMetadataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options?: any) { - return InternalApiFp(configuration).postRunMetadata(runId, body, options)(fetch, basePath); - }, - /** - * - * @summary Persist the given task logs. - * @param {V1PostTaskLogsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTaskLogs(body: V1PostTaskLogsRequest, options?: any) { - return InternalApiFp(configuration).postTaskLogs(body, options)(fetch, basePath); - }, - /** - * - * @summary Persist the given TrialProfilerMetricsBatch. The trial ID is in the labels. - * @param {V1PostTrialProfilerMetricsBatchRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTrialProfilerMetricsBatch(body: V1PostTrialProfilerMetricsBatchRequest, options?: any) { - return InternalApiFp(configuration).postTrialProfilerMetricsBatch(body, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary For bookkeeping, update trial runner metadata (currently just state). - * @param {number} trialId The id of the trial. - * @param {V1TrialRunnerMetadata} body The state for the trial runner. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTrialRunnerMetadata(trialId: number, body: V1TrialRunnerMetadata, options?: any) { - return InternalApiFp(configuration).postTrialRunnerMetadata( - trialId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Put an experiment by external id. - * @param {string} externalExperimentId External experiment id. - * @param {V1CreateExperimentRequest} body CreateExperimentRequest payload. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putExperiment(externalExperimentId: string, body: V1CreateExperimentRequest, options?: any) { - return InternalApiFp(configuration).putExperiment( - externalExperimentId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Put a trial. - * @param {V1PutTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putTrial(body: V1PutTrialRequest, options?: any) { - return InternalApiFp(configuration).putTrial(body, options)(fetch, basePath); - }, - /** - * - * @summary Record a checkpoint. - * @param {V1Checkpoint} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportCheckpoint(body: V1Checkpoint, options?: any) { - return InternalApiFp(configuration).reportCheckpoint(body, options)(fetch, basePath); - }, - /** - * - * @summary Record metrics for specified trial. - * @param {number} metricsTrialId The trial associated with these metrics. - * @param {V1ReportTrialMetricsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialMetrics(metricsTrialId: number, body: V1ReportTrialMetricsRequest, options?: any) { - return InternalApiFp(configuration).reportTrialMetrics( - metricsTrialId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary For bookkeeping, updates the progress towards to current requested searcher training length. - * @param {number} trialId The id of the trial. - * @param {number} body Total units completed by the trial, in terms of the unit used to configure the searcher. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialProgress(trialId: number, body: number, options?: any) { - return InternalApiFp(configuration).reportTrialProgress( - trialId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Reports to the searcher that the trial has completed the current requested amount of training with the given searcher validation metric. - * @param {number} trialId The id of the trial. - * @param {V1TrialEarlyExit} body The exit reason. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialSearcherEarlyExit(trialId: number, body: V1TrialEarlyExit, options?: any) { - return InternalApiFp(configuration).reportTrialSearcherEarlyExit( - trialId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Reports a TrialSourceInfo entry for tracking inference or fine-tuning runs - * @param {V1ReportTrialSourceInfoRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialSourceInfo(body: V1ReportTrialSourceInfoRequest, options?: any) { - return InternalApiFp(configuration).reportTrialSourceInfo(body, options)(fetch, basePath); - }, - /** - * - * @summary Record training metrics for specified training. - * @param {number} trainingMetricsTrialId The trial associated with these metrics. - * @param {V1TrialMetrics} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialTrainingMetrics( - trainingMetricsTrialId: number, - body: V1TrialMetrics, - options?: any, - ) { - return InternalApiFp(configuration).reportTrialTrainingMetrics( - trainingMetricsTrialId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Record validation metrics. - * @param {number} validationMetricsTrialId The trial associated with these metrics. - * @param {V1TrialMetrics} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - reportTrialValidationMetrics( - validationMetricsTrialId: number, - body: V1TrialMetrics, - options?: any, - ) { - return InternalApiFp(configuration).reportTrialValidationMetrics( - validationMetricsTrialId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Unpause experiment associated with provided runs. - * @param {V1ResumeRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - resumeRuns(body: V1ResumeRunsRequest, options?: any) { - return InternalApiFp(configuration).resumeRuns(body, options)(fetch, basePath); - }, - /** - * - * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. - * @param {V1RunPrepareForReportingRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - runPrepareForReporting(body: V1RunPrepareForReportingRequest, options?: any) { - return InternalApiFp(configuration).runPrepareForReporting(body, options)(fetch, basePath); - }, - /** - * - * @summary Get experiments with grouping and search syntax - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchExperiments( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options?: any, - ) { - return InternalApiFp(configuration).searchExperiments( - projectId, - offset, - limit, - sort, - filter, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get a list of runs. - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchRuns( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options?: any, - ) { - return InternalApiFp(configuration).searchRuns( - projectId, - offset, - limit, - sort, - filter, - options, - )(fetch, basePath); - }, - /** - * - * @summary Start (an unmanaged) trial. - * @param {number} trialId Trial id. - * @param {V1StartTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - startTrial(trialId: number, body: V1StartTrialRequest, options?: any) { - return InternalApiFp(configuration).startTrial(trialId, body, options)(fetch, basePath); - }, - /** - * - * @summary Get a sample of the metrics over time for a sample of the trials. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [maxTrials] Maximum number of trials to fetch data for. - * @param {number} [maxDatapoints] Maximum number of initial / historical data points. - * @param {number} [startBatches] Beginning of window (inclusive) to fetch data for. - * @param {number} [endBatches] Ending of window (inclusive) to fetch data for. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - trialsSample( - experimentId: number, - metricName: string, - metricType?: V1MetricType, - group?: string, - maxTrials?: number, - maxDatapoints?: number, - startBatches?: number, - endBatches?: number, - periodSeconds?: number, - options?: any, - ) { - return InternalApiFp(configuration).trialsSample( - experimentId, - metricName, - metricType, - group, - maxTrials, - maxDatapoints, - startBatches, - endBatches, - periodSeconds, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get a snapshot of a metric across all trials at a certain point of progress. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {number} batchesProcessed The point of progress at which to query metrics. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [batchesMargin] A range either side of batches_processed to include near-misses. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - trialsSnapshot( - experimentId: number, - metricName: string, - batchesProcessed: number, - metricType?: V1MetricType, - group?: string, - batchesMargin?: number, - periodSeconds?: number, - options?: any, - ) { - return InternalApiFp(configuration).trialsSnapshot( - experimentId, - metricName, - batchesProcessed, - metricType, - group, - batchesMargin, - periodSeconds, - options, - )(fetch, basePath); - }, - /** - * - * @summary Unarchive runs. - * @param {V1UnarchiveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveRuns(body: V1UnarchiveRunsRequest, options?: any) { - return InternalApiFp(configuration).unarchiveRuns(body, options)(fetch, basePath); - }, - /** - * - * @summary Unbind resource pool to workspace - * @param {string} resourcePoolName The resource pool name. - * @param {V1UnbindRPFromWorkspaceRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unbindRPFromWorkspace( - resourcePoolName: string, - body: V1UnbindRPFromWorkspaceRequest, - options?: any, - ) { - return InternalApiFp(configuration).unbindRPFromWorkspace( - resourcePoolName, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Unpause generic task - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unpauseGenericTask(taskId: string, options?: any) { - return InternalApiFp(configuration).unpauseGenericTask(taskId, options)(fetch, basePath); - }, - /** - * - * @summary Update group info. - * @param {number} groupId The id of the group - * @param {V1UpdateGroupRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateGroup(groupId: number, body: V1UpdateGroupRequest, options?: any) { - return InternalApiFp(configuration).updateGroup(groupId, body, options)(fetch, basePath); - }, - /** - * - * @summary Control the job queues. - * @param {V1UpdateJobQueueRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - updateJobQueue(body: V1UpdateJobQueueRequest, options?: any) { - return InternalApiFp(configuration).updateJobQueue(body, options)(fetch, basePath); - }, - }; -}; - -/** - * InternalApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class InternalApi extends BaseAPI { - /** - * - * @summary Acknowledge the receipt of a signal to stop the given allocation early. This is used indicate and exit 0 isn't final; specifically, it is used for HP search directed early stops and preemption signals (not necessarily just scheduler preemption). - * @param {string} allocationId The allocation that is acknowledging the request. - * @param {V1AckAllocationPreemptionSignalRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public ackAllocationPreemptionSignal( - allocationId: string, - body: V1AckAllocationPreemptionSignalRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).ackAllocationPreemptionSignal( - allocationId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary AllocationAllGather performs an all gather through the master. An allocation can only perform once all gather at a time. - * @param {string} allocationId The ID of the allocation. - * @param {V1AllocationAllGatherRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public allocationAllGather( - allocationId: string, - body: V1AllocationAllGatherRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).allocationAllGather( - allocationId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Report the receipt of a signal to stop the given allocation early. This is used to communicate back from a SLURM job that it has been notified of a pending preememption. Upon a call to this API the RM should then trigger a checkpoint and immediate exit. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationPendingPreemptionSignalRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public allocationPendingPreemptionSignal( - allocationId: string, - body: V1AllocationPendingPreemptionSignalRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).allocationPendingPreemptionSignal( - allocationId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Long poll preemption signals for the given allocation. If the allocation has been preempted when called, it will return so immediately. Otherwise, the connection will be kept open until the timeout is reached or the allocation is preempted. - * @param {string} allocationId The id of the allocation. - * @param {number} [timeoutSeconds] The timeout in seconds. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public allocationPreemptionSignal(allocationId: string, timeoutSeconds?: number, options?: any) { - return InternalApiFp(this.configuration).allocationPreemptionSignal( - allocationId, - timeoutSeconds, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Set allocation to ready state. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationReadyRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public allocationReady(allocationId: string, body: V1AllocationReadyRequest, options?: any) { - return InternalApiFp(this.configuration).allocationReady( - allocationId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Gather an allocation's rendezvous info. Blocks until all trial containers connect to gather their rendezvous information and responds to them all at once. - * @param {string} allocationId The id of the allocation. - * @param {string} resourcesId The id of the clump of resources. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public allocationRendezvousInfo(allocationId: string, resourcesId: string, options?: any) { - return InternalApiFp(this.configuration).allocationRendezvousInfo( - allocationId, - resourcesId, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Set allocation to waiting state. - * @param {string} allocationId The id of the allocation. - * @param {V1AllocationWaitingRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public allocationWaiting(allocationId: string, body: V1AllocationWaitingRequest, options?: any) { - return InternalApiFp(this.configuration).allocationWaiting( - allocationId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Archive runs. - * @param {V1ArchiveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public archiveRuns(body: V1ArchiveRunsRequest, options?: any) { - return InternalApiFp(this.configuration).archiveRuns(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Assign multiple users to multiple groups. - * @param {V1AssignMultipleGroupsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public assignMultipleGroups(body: V1AssignMultipleGroupsRequest, options?: any) { - return InternalApiFp(this.configuration).assignMultipleGroups(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Bind resource pool to workspace - * @param {string} resourcePoolName The resource pool name. - * @param {V1BindRPToWorkspaceRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public bindRPToWorkspace( - resourcePoolName: string, - body: V1BindRPToWorkspaceRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).bindRPToWorkspace( - resourcePoolName, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Cleanup task logs according to the retention policy. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public cleanupLogs(options?: any) { - return InternalApiFp(this.configuration).cleanupLogs(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Reports to the searcher that the trial has completed the given searcher operation. - * @param {number} trialId The id of the trial. - * @param {V1CompleteValidateAfterOperation} body The completed operation. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public completeTrialSearcherValidation( - trialId: number, - body: V1CompleteValidateAfterOperation, - options?: any, - ) { - return InternalApiFp(this.configuration).completeTrialSearcherValidation( - trialId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Continues an experiment either to make the existing experiment train longer or to retry it. - * @param {V1ContinueExperimentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public continueExperiment(body: V1ContinueExperimentRequest, options?: any) { - return InternalApiFp(this.configuration).continueExperiment(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Create an experiment. - * @param {V1CreateExperimentRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public createExperiment(body: V1CreateExperimentRequest, options?: any) { - return InternalApiFp(this.configuration).createExperiment(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Create an experiment. - * @param {V1CreateGenericTaskRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public createGenericTask(body: V1CreateGenericTaskRequest, options?: any) { - return InternalApiFp(this.configuration).createGenericTask(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Create a group with optional members on creation. - * @param {V1CreateGroupRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public createGroup(body: V1CreateGroupRequest, options?: any) { - return InternalApiFp(this.configuration).createGroup(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Create unmanaged trial. - * @param {V1CreateTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public createTrial(body: V1CreateTrialRequest, options?: any) { - return InternalApiFp(this.configuration).createTrial(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Remove a group. - * @param {number} groupId The id of the group that should be deleted. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public deleteGroup(groupId: number, options?: any) { - return InternalApiFp(this.configuration).deleteGroup(groupId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Delete a list of runs. - * @param {V1DeleteRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public deleteRuns(body: V1DeleteRunsRequest, options?: any) { - return InternalApiFp(this.configuration).deleteRuns(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get the set of metric names recorded for a list of experiments. - * @param {Array} ids The ids for the experiments. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public expMetricNames(ids: Array, periodSeconds?: number, options?: any) { - return InternalApiFp(this.configuration).expMetricNames( - ids, - periodSeconds, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get details about an Allocation. - * @param {string} allocationId The id of the allocation. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getAllocation(allocationId: string, options?: any) { - return InternalApiFp(this.configuration).getAllocation(allocationId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get the best searcher validation for an experiment by the given metric. - * @param {number} experimentId The ID of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getBestSearcherValidationMetric(experimentId: number, options?: any) { - return InternalApiFp(this.configuration).getBestSearcherValidationMetric(experimentId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get the current searcher operation. - * @param {number} trialId The id of the trial. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getCurrentTrialSearcherOperation(trialId: number, options?: any) { - return InternalApiFp(this.configuration).getCurrentTrialSearcherOperation(trialId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get task config - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getGenericTaskConfig(taskId: string, options?: any) { - return InternalApiFp(this.configuration).getGenericTaskConfig(taskId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a group by id. - * @param {number} groupId The id of the group to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getGroup(groupId: number, options?: any) { - return InternalApiFp(this.configuration).getGroup(groupId, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Search for groups with optional filters. - * @param {V1GetGroupsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getGroups(body: V1GetGroupsRequest, options?: any) { - return InternalApiFp(this.configuration).getGroups(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get job queue stats for a resource pool. - * @param {Array} [resourcePools] Filter the results based on a set of resource pools. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getJobQueueStats(resourcePools?: Array, options?: any) { - return InternalApiFp(this.configuration).getJobQueueStats(resourcePools, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of jobs in queue. - * @param {number} [offset] Pagination offset. - * @param {number} [limit] Pagination limit. - * @param {string} [resourcePool] The target resource-pool for agent resource manager. - * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getJobs( - offset?: number, - limit?: number, - resourcePool?: string, - orderBy?: V1OrderBy, - states?: Array, - options?: any, - ) { - return InternalApiFp(this.configuration).getJobs( - offset, - limit, - resourcePool, - orderBy, - states, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a list of jobs in queue. - * @param {number} [offset] Pagination offset. - * @param {number} [limit] Pagination limit. - * @param {string} [resourcePool] The target resource-pool for agent resource manager. - * @param {V1OrderBy} [orderBy] Order results in either ascending or descending order by the number of jobs ahead. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {Array} [states] Filter to jobs with states among those given. - STATE_UNSPECIFIED: Unspecified state. - STATE_QUEUED: Job is queued and waiting to be schedlued. - STATE_SCHEDULED: Job is scheduled. - STATE_SCHEDULED_BACKFILLED: Job is scheduled as a backfill. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getJobsV2( - offset?: number, - limit?: number, - resourcePool?: string, - orderBy?: V1OrderBy, - states?: Array, - options?: any, - ) { - return InternalApiFp(this.configuration).getJobsV2( - offset, - limit, - resourcePool, - orderBy, - states, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a list of columns for experiment list table. - * @param {number} id The id of the project. - * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getProjectColumns(id: number, tableType?: V1TableType, options?: any) { - return InternalApiFp(this.configuration).getProjectColumns( - id, - tableType, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get metrics range for a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getProjectNumericMetricsRange(id: number, options?: any) { - return InternalApiFp(this.configuration).getProjectNumericMetricsRange(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of all resource pools from the cluster. - * @param {number} [offset] Skip the number of resource pools before returning results. Negative values denote number of resource pools to skip from the end before returning results. - * @param {number} [limit] Limit the number of resource pools. A value of 0 denotes no limit. - * @param {boolean} [unbound] Indicate whether or not to return unbound pools only. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getResourcePools(offset?: number, limit?: number, unbound?: boolean, options?: any) { - return InternalApiFp(this.configuration).getResourcePools( - offset, - limit, - unbound, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get run metadata. - * @param {number} runId The ID of the run to get metadata for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getRunMetadata(runId: number, options?: any) { - return InternalApiFp(this.configuration).getRunMetadata(runId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary GetTaskAcceleratorData gets the accelerator data for each allocation associated with a task. - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getTaskAcceleratorData(taskId: string, options?: any) { - return InternalApiFp(this.configuration).getTaskAcceleratorData(taskId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get telemetry information. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getTelemetry(options?: any) { - return InternalApiFp(this.configuration).getTelemetry(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get a single trial by external id. - * @param {string} externalExperimentId External experiment id. - * @param {string} externalTrialId External trial id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getTrialByExternalID( - externalExperimentId: string, - externalTrialId: string, - options?: any, - ) { - return InternalApiFp(this.configuration).getTrialByExternalID( - externalExperimentId, - externalTrialId, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Gets the metrics for all trials associated with this checkpoint - * @param {string} checkpointUuid UUID of the checkpoint. - * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub - * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getTrialMetricsByCheckpoint( - checkpointUuid: string, - trialSourceInfoType?: V1TrialSourceInfoType, - metricGroup?: string, - options?: any, - ) { - return InternalApiFp(this.configuration).getTrialMetricsByCheckpoint( - checkpointUuid, - trialSourceInfoType, - metricGroup, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Gets the metrics for all trials associated with this model version - * @param {string} modelName The name of the model associated with the model version. - * @param {number} modelVersionNum Sequential model version number. - * @param {V1TrialSourceInfoType} [trialSourceInfoType] Type of the TrialSourceInfo. - TRIAL_SOURCE_INFO_TYPE_UNSPECIFIED: The type is unspecified - TRIAL_SOURCE_INFO_TYPE_INFERENCE: "Inference" Trial Source Info Type, used for batch inference - TRIAL_SOURCE_INFO_TYPE_FINE_TUNING: "Fine Tuning" Trial Source Info Type, used in model hub - * @param {string} [metricGroup] Metric Group string ("training", "validation", or anything else) (nil means all groups). - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getTrialMetricsByModelVersion( - modelName: string, - modelVersionNum: number, - trialSourceInfoType?: V1TrialSourceInfoType, - metricGroup?: string, - options?: any, - ) { - return InternalApiFp(this.configuration).getTrialMetricsByModelVersion( - modelName, - modelVersionNum, - trialSourceInfoType, - metricGroup, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get the list of trials for an experiment. - * @param {number} id The trial id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getTrialRemainingLogRetentionDays(id: number, options?: any) { - return InternalApiFp(this.configuration).getTrialRemainingLogRetentionDays(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get the list of workloads for a trial. - * @param {number} trialId Limit workloads to those that are owned by the specified trial. - * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. - * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. - * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. - * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. - * @param {boolean} [includeBatchMetrics] Include per-batch metrics. - * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public getTrialWorkloads( - trialId: number, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - sortKey?: string, - filter?: GetTrialWorkloadsRequestFilterOption, - includeBatchMetrics?: boolean, - metricType?: V1MetricType, - group?: string, - removeDeletedCheckpoints?: boolean, - options?: any, - ) { - return InternalApiFp(this.configuration).getTrialWorkloads( - trialId, - orderBy, - offset, - limit, - sortKey, - filter, - includeBatchMetrics, - metricType, - group, - removeDeletedCheckpoints, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Send notebook idle data to master - * @param {string} notebookId The id of the notebook. - * @param {V1IdleNotebookRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public idleNotebook(notebookId: string, body: V1IdleNotebookRequest, options?: any) { - return InternalApiFp(this.configuration).idleNotebook( - notebookId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Kill generic task - * @param {string} taskId The id of the task. - * @param {V1KillGenericTaskRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public killGenericTask(taskId: string, body: V1KillGenericTaskRequest, options?: any) { - return InternalApiFp(this.configuration).killGenericTask( - taskId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a list of runs. - * @param {V1KillRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public killRuns(body: V1KillRunsRequest, options?: any) { - return InternalApiFp(this.configuration).killRuns(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary List all resource pools, bound and unbound, available to a specific workspace - * @param {number} workspaceId Workspace ID. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public listRPsBoundToWorkspace( - workspaceId: number, - offset?: number, - limit?: number, - options?: any, - ) { - return InternalApiFp(this.configuration).listRPsBoundToWorkspace( - workspaceId, - offset, - limit, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary List all workspaces bound to a specific resource pool - * @param {string} resourcePoolName Resource pool name. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public listWorkspacesBoundToRP( - resourcePoolName: string, - offset?: number, - limit?: number, - options?: any, - ) { - return InternalApiFp(this.configuration).listWorkspacesBoundToRP( - resourcePoolName, - offset, - limit, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Mark the given reservation (container, pod, etc) within an allocation as a daemon reservation. In the exit of a successful exit, Determined will wait for all resources to exit - unless they are marked as daemon resources, in which case Determined will clean them up regardless of exit status after all non-daemon resources have exited. - * @param {string} allocationId The id of the allocation. - * @param {string} resourcesId The id of the clump of resources to mark as daemon. - * @param {V1MarkAllocationResourcesDaemonRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public markAllocationResourcesDaemon( - allocationId: string, - resourcesId: string, - body: V1MarkAllocationResourcesDaemonRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).markAllocationResourcesDaemon( - allocationId, - resourcesId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get the milestones (in batches processed) at which a metric is recorded by an experiment. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public metricBatches( - experimentId: number, - metricName: string, - metricType?: V1MetricType, - group?: string, - periodSeconds?: number, - options?: any, - ) { - return InternalApiFp(this.configuration).metricBatches( - experimentId, - metricName, - metricType, - group, - periodSeconds, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Move runs. - * @param {V1MoveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public moveRuns(body: V1MoveRunsRequest, options?: any) { - return InternalApiFp(this.configuration).moveRuns(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary NotifyContainterRunning is used to notify the master that the container is running. On HPC, the launcher will report a state of "Running" as soon as Slurm starts the job, but the container may be in the process of getting pulled down from the Internet, so the experiment is not really considered to be in a "Running" state until all the containers that are part of the experiment are running and not being pulled. - * @param {string} allocationId The ID of the allocation. - * @param {V1NotifyContainerRunningRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public notifyContainerRunning( - allocationId: string, - body: V1NotifyContainerRunningRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).notifyContainerRunning( - allocationId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Overwrite resource pool - workspace bindings - * @param {string} resourcePoolName The resource pool name. - * @param {V1OverwriteRPWorkspaceBindingsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public overwriteRPWorkspaceBindings( - resourcePoolName: string, - body: V1OverwriteRPWorkspaceBindingsRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).overwriteRPWorkspaceBindings( - resourcePoolName, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Update checkpoints. Won't modify checkpoint files. - * @param {V1PatchCheckpointsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public patchCheckpoints(body: V1PatchCheckpointsRequest, options?: any) { - return InternalApiFp(this.configuration).patchCheckpoints(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Patch (an unmanaged) trial. - * @param {number} trialId Trial id. - * @param {V1PatchTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public patchTrial(trialId: number, body: V1PatchTrialRequest, options?: any) { - return InternalApiFp(this.configuration).patchTrial( - trialId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Patch multiple users' activation status. - * @param {V1PatchUsersRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public patchUsers(body: V1PatchUsersRequest, options?: any) { - return InternalApiFp(this.configuration).patchUsers(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Pause generic task - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public pauseGenericTask(taskId: string, options?: any) { - return InternalApiFp(this.configuration).pauseGenericTask(taskId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Pause experiment associated with provided runs. - * @param {V1PauseRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public pauseRuns(body: V1PauseRunsRequest, options?: any) { - return InternalApiFp(this.configuration).pauseRuns(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary PostAllocationAcceleratorData sets the accelerator for a given allocation. - * @param {string} allocationId The id of the allocation. - * @param {V1PostAllocationAcceleratorDataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public postAllocationAcceleratorData( - allocationId: string, - body: V1PostAllocationAcceleratorDataRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).postAllocationAcceleratorData( - allocationId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary PostAllocationProxyAddress sets the proxy address to use when proxying to services provided by an allocation. Upon receipt, the master will also register any proxies specified by the task. - * @param {string} allocationId The id of the allocation. - * @param {V1PostAllocationProxyAddressRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public postAllocationProxyAddress( - allocationId: string, - body: V1PostAllocationProxyAddressRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).postAllocationProxyAddress( - allocationId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Update run metadata. - * @param {number} runId The ID of the run to post metadata for. - * @param {V1PostRunMetadataRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public postRunMetadata(runId: number, body: V1PostRunMetadataRequest, options?: any) { - return InternalApiFp(this.configuration).postRunMetadata( - runId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Persist the given task logs. - * @param {V1PostTaskLogsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public postTaskLogs(body: V1PostTaskLogsRequest, options?: any) { - return InternalApiFp(this.configuration).postTaskLogs(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Persist the given TrialProfilerMetricsBatch. The trial ID is in the labels. - * @param {V1PostTrialProfilerMetricsBatchRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public postTrialProfilerMetricsBatch( - body: V1PostTrialProfilerMetricsBatchRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).postTrialProfilerMetricsBatch(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary For bookkeeping, update trial runner metadata (currently just state). - * @param {number} trialId The id of the trial. - * @param {V1TrialRunnerMetadata} body The state for the trial runner. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public postTrialRunnerMetadata(trialId: number, body: V1TrialRunnerMetadata, options?: any) { - return InternalApiFp(this.configuration).postTrialRunnerMetadata( - trialId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Put an experiment by external id. - * @param {string} externalExperimentId External experiment id. - * @param {V1CreateExperimentRequest} body CreateExperimentRequest payload. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public putExperiment( - externalExperimentId: string, - body: V1CreateExperimentRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).putExperiment( - externalExperimentId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Put a trial. - * @param {V1PutTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public putTrial(body: V1PutTrialRequest, options?: any) { - return InternalApiFp(this.configuration).putTrial(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Record a checkpoint. - * @param {V1Checkpoint} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public reportCheckpoint(body: V1Checkpoint, options?: any) { - return InternalApiFp(this.configuration).reportCheckpoint(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Record metrics for specified trial. - * @param {number} metricsTrialId The trial associated with these metrics. - * @param {V1ReportTrialMetricsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public reportTrialMetrics( - metricsTrialId: number, - body: V1ReportTrialMetricsRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).reportTrialMetrics( - metricsTrialId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary For bookkeeping, updates the progress towards to current requested searcher training length. - * @param {number} trialId The id of the trial. - * @param {number} body Total units completed by the trial, in terms of the unit used to configure the searcher. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public reportTrialProgress(trialId: number, body: number, options?: any) { - return InternalApiFp(this.configuration).reportTrialProgress( - trialId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Reports to the searcher that the trial has completed the current requested amount of training with the given searcher validation metric. - * @param {number} trialId The id of the trial. - * @param {V1TrialEarlyExit} body The exit reason. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public reportTrialSearcherEarlyExit(trialId: number, body: V1TrialEarlyExit, options?: any) { - return InternalApiFp(this.configuration).reportTrialSearcherEarlyExit( - trialId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Reports a TrialSourceInfo entry for tracking inference or fine-tuning runs - * @param {V1ReportTrialSourceInfoRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public reportTrialSourceInfo(body: V1ReportTrialSourceInfoRequest, options?: any) { - return InternalApiFp(this.configuration).reportTrialSourceInfo(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Record training metrics for specified training. - * @param {number} trainingMetricsTrialId The trial associated with these metrics. - * @param {V1TrialMetrics} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public reportTrialTrainingMetrics( - trainingMetricsTrialId: number, - body: V1TrialMetrics, - options?: any, - ) { - return InternalApiFp(this.configuration).reportTrialTrainingMetrics( - trainingMetricsTrialId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Record validation metrics. - * @param {number} validationMetricsTrialId The trial associated with these metrics. - * @param {V1TrialMetrics} body The training metrics to persist. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public reportTrialValidationMetrics( - validationMetricsTrialId: number, - body: V1TrialMetrics, - options?: any, - ) { - return InternalApiFp(this.configuration).reportTrialValidationMetrics( - validationMetricsTrialId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Unpause experiment associated with provided runs. - * @param {V1ResumeRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public resumeRuns(body: V1ResumeRunsRequest, options?: any) { - return InternalApiFp(this.configuration).resumeRuns(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Start syncing and prepare to be able to report to a run. This should be called once per task that will report to the run. - * @param {V1RunPrepareForReportingRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public runPrepareForReporting(body: V1RunPrepareForReportingRequest, options?: any) { - return InternalApiFp(this.configuration).runPrepareForReporting(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get experiments with grouping and search syntax - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public searchExperiments( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options?: any, - ) { - return InternalApiFp(this.configuration).searchExperiments( - projectId, - offset, - limit, - sort, - filter, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a list of runs. - * @param {number} [projectId] ID of the project to look at. - * @param {number} [offset] How many experiments to skip before including in the results. - * @param {number} [limit] How many results to show. - * @param {string} [sort] Sort parameters in the format =(asc|desc),=(asc|desc). - * @param {string} [filter] Filter expression. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public searchRuns( - projectId?: number, - offset?: number, - limit?: number, - sort?: string, - filter?: string, - options?: any, - ) { - return InternalApiFp(this.configuration).searchRuns( - projectId, - offset, - limit, - sort, - filter, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Start (an unmanaged) trial. - * @param {number} trialId Trial id. - * @param {V1StartTrialRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public startTrial(trialId: number, body: V1StartTrialRequest, options?: any) { - return InternalApiFp(this.configuration).startTrial( - trialId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a sample of the metrics over time for a sample of the trials. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [maxTrials] Maximum number of trials to fetch data for. - * @param {number} [maxDatapoints] Maximum number of initial / historical data points. - * @param {number} [startBatches] Beginning of window (inclusive) to fetch data for. - * @param {number} [endBatches] Ending of window (inclusive) to fetch data for. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public trialsSample( - experimentId: number, - metricName: string, - metricType?: V1MetricType, - group?: string, - maxTrials?: number, - maxDatapoints?: number, - startBatches?: number, - endBatches?: number, - periodSeconds?: number, - options?: any, - ) { - return InternalApiFp(this.configuration).trialsSample( - experimentId, - metricName, - metricType, - group, - maxTrials, - maxDatapoints, - startBatches, - endBatches, - periodSeconds, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a snapshot of a metric across all trials at a certain point of progress. - * @param {number} experimentId The id of the experiment. - * @param {string} metricName A metric name. - * @param {number} batchesProcessed The point of progress at which to query metrics. - * @param {V1MetricType} [metricType] The type of metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {number} [batchesMargin] A range either side of batches_processed to include near-misses. - * @param {number} [periodSeconds] Seconds to wait when polling for updates. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public trialsSnapshot( - experimentId: number, - metricName: string, - batchesProcessed: number, - metricType?: V1MetricType, - group?: string, - batchesMargin?: number, - periodSeconds?: number, - options?: any, - ) { - return InternalApiFp(this.configuration).trialsSnapshot( - experimentId, - metricName, - batchesProcessed, - metricType, - group, - batchesMargin, - periodSeconds, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Unarchive runs. - * @param {V1UnarchiveRunsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public unarchiveRuns(body: V1UnarchiveRunsRequest, options?: any) { - return InternalApiFp(this.configuration).unarchiveRuns(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Unbind resource pool to workspace - * @param {string} resourcePoolName The resource pool name. - * @param {V1UnbindRPFromWorkspaceRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public unbindRPFromWorkspace( - resourcePoolName: string, - body: V1UnbindRPFromWorkspaceRequest, - options?: any, - ) { - return InternalApiFp(this.configuration).unbindRPFromWorkspace( - resourcePoolName, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Unpause generic task - * @param {string} taskId The id of the task. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public unpauseGenericTask(taskId: string, options?: any) { - return InternalApiFp(this.configuration).unpauseGenericTask(taskId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Update group info. - * @param {number} groupId The id of the group - * @param {V1UpdateGroupRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public updateGroup(groupId: number, body: V1UpdateGroupRequest, options?: any) { - return InternalApiFp(this.configuration).updateGroup( - groupId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Control the job queues. - * @param {V1UpdateJobQueueRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof InternalApi - */ - public updateJobQueue(body: V1UpdateJobQueueRequest, options?: any) { - return InternalApiFp(this.configuration).updateJobQueue(body, options)( - this.fetch, - this.basePath, - ); - } -} - -/** - * JobsApi - fetch parameter creator - * @export - */ -export const JobsApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Stream task logs. - * @param {string} taskId The id of the task. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [allocationIds] Limit the task logs to particular allocations. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogs( - taskId: string, - limit?: number, - follow?: boolean, - allocationIds?: Array, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options: any = {}, - ): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling taskLogs.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}/logs`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - if (allocationIds) { - localVarQueryParameter['allocationIds'] = allocationIds; - } - - if (agentIds) { - localVarQueryParameter['agentIds'] = agentIds; - } - - if (containerIds) { - localVarQueryParameter['containerIds'] = containerIds; - } - - if (rankIds) { - localVarQueryParameter['rankIds'] = rankIds; - } - - if (levels) { - localVarQueryParameter['levels'] = levels; - } - - if (stdtypes) { - localVarQueryParameter['stdtypes'] = stdtypes; - } - - if (sources) { - localVarQueryParameter['sources'] = sources; - } - - if (timestampBefore) { - localVarQueryParameter['timestampBefore'] = - typeof timestampBefore === 'string' ? timestampBefore : timestampBefore.toISOString(); - } - - if (timestampAfter) { - localVarQueryParameter['timestampAfter'] = - typeof timestampAfter === 'string' ? timestampAfter : timestampAfter.toISOString(); - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (searchText !== undefined) { - localVarQueryParameter['searchText'] = searchText; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Stream task log fields. - * @param {string} taskId The ID of the task. - * @param {boolean} [follow] Continue following fields until the task stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogsFields(taskId: string, follow?: boolean, options: any = {}): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling taskLogsFields.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}/logs/fields`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * JobsApi - functional programming interface - * @export - */ -export const JobsApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Stream task logs. - * @param {string} taskId The id of the task. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [allocationIds] Limit the task logs to particular allocations. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogs( - taskId: string, - limit?: number, - follow?: boolean, - allocationIds?: Array, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = JobsApiFetchParamCreator(configuration).taskLogs( - taskId, - limit, - follow, - allocationIds, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream task log fields. - * @param {string} taskId The ID of the task. - * @param {boolean} [follow] Continue following fields until the task stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogsFields( - taskId: string, - follow?: boolean, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = JobsApiFetchParamCreator(configuration).taskLogsFields( - taskId, - follow, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * JobsApi - factory interface - * @export - */ -export const JobsApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Stream task logs. - * @param {string} taskId The id of the task. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [allocationIds] Limit the task logs to particular allocations. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogs( - taskId: string, - limit?: number, - follow?: boolean, - allocationIds?: Array, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ) { - return JobsApiFp(configuration).taskLogs( - taskId, - limit, - follow, - allocationIds, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - )(fetch, basePath); - }, - /** - * - * @summary Stream task log fields. - * @param {string} taskId The ID of the task. - * @param {boolean} [follow] Continue following fields until the task stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogsFields(taskId: string, follow?: boolean, options?: any) { - return JobsApiFp(configuration).taskLogsFields(taskId, follow, options)(fetch, basePath); - }, - }; -}; - -/** - * JobsApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class JobsApi extends BaseAPI { - /** - * - * @summary Stream task logs. - * @param {string} taskId The id of the task. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [allocationIds] Limit the task logs to particular allocations. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof JobsApi - */ - public taskLogs( - taskId: string, - limit?: number, - follow?: boolean, - allocationIds?: Array, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ) { - return JobsApiFp(this.configuration).taskLogs( - taskId, - limit, - follow, - allocationIds, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Stream task log fields. - * @param {string} taskId The ID of the task. - * @param {boolean} [follow] Continue following fields until the task stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof JobsApi - */ - public taskLogsFields(taskId: string, follow?: boolean, options?: any) { - return JobsApiFp(this.configuration).taskLogsFields( - taskId, - follow, - options, - )(this.fetch, this.basePath); - } -} - -/** - * ModelsApi - fetch parameter creator - * @export - */ -export const ModelsApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Archive a model - * @param {string} modelName The name of the model to archive. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - archiveModel(modelName: string, options: any = {}): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling archiveModel.', - ); - } - const localVarPath = `/api/v1/models/{modelName}/archive`.replace( - `{${'modelName'}}`, - encodeURIComponent(String(modelName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Delete a model - * @param {string} modelName The name of the model to delete. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteModel(modelName: string, options: any = {}): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling deleteModel.', - ); - } - const localVarPath = `/api/v1/models/{modelName}`.replace( - `{${'modelName'}}`, - encodeURIComponent(String(modelName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Delete a model version - * @param {string} modelName The name of the model associated with the model version. - * @param {number} modelVersionNum Sequential model version number. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteModelVersion(modelName: string, modelVersionNum: number, options: any = {}): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling deleteModelVersion.', - ); - } - // verify required parameter 'modelVersionNum' is not null or undefined - if (modelVersionNum === null || modelVersionNum === undefined) { - throw new RequiredError( - 'modelVersionNum', - 'Required parameter modelVersionNum was null or undefined when calling deleteModelVersion.', - ); - } - const localVarPath = `/api/v1/models/{modelName}/versions/{modelVersionNum}` - .replace(`{${'modelName'}}`, encodeURIComponent(String(modelName))) - .replace(`{${'modelVersionNum'}}`, encodeURIComponent(String(modelVersionNum))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the requested model. - * @param {string} modelName The name of the model. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModel(modelName: string, options: any = {}): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling getModel.', - ); - } - const localVarPath = `/api/v1/models/{modelName}`.replace( - `{${'modelName'}}`, - encodeURIComponent(String(modelName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of unique model labels (sorted by popularity). - * @param {number} [workspaceId] Optional workspace ID to limit query for model tags. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelLabels(workspaceId?: number, options: any = {}): FetchArgs { - const localVarPath = `/api/v1/model/labels`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (workspaceId !== undefined) { - localVarQueryParameter['workspaceId'] = workspaceId; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of models. - * @param {V1GetModelsRequestSortBy} [sortBy] Sort the models by the given field. - SORT_BY_UNSPECIFIED: Returns models in an unsorted list. - SORT_BY_NAME: Returns models sorted by name. - SORT_BY_DESCRIPTION: Returns models sorted by description. - SORT_BY_CREATION_TIME: Returns models sorted by creation time. - SORT_BY_LAST_UPDATED_TIME: Returns models sorted by last updated time. - SORT_BY_NUM_VERSIONS: Returns models sorted by number of version. - SORT_BY_WORKSPACE: Returns models sorted by workspace name. - * @param {V1OrderBy} [orderBy] Order models in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of models before returning results. Negative values denote number of models to skip from the end before returning results. - * @param {number} [limit] Limit the number of models. A value of 0 denotes no limit. - * @param {string} [name] Limit the models to those matching or partially-matching the name. - * @param {string} [description] Limit the models to those matching or partially-matching the description. - * @param {Array} [labels] Limit the models to those with the following labels. - * @param {boolean} [archived] Limit to unarchived models only. - * @param {Array} [users] Limit the models to those made by the users with the following usernames. - * @param {Array} [workspaceNames] Limit models to those that belong to the following workspace names. - * @param {Array} [userIds] Limit the models to those made by the users with the following userIds. - * @param {number} [id] Limit the models to this model id. - * @param {Array} [workspaceIds] Limit models to those that belong to the following workspace ids. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModels( - sortBy?: V1GetModelsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - description?: string, - labels?: Array, - archived?: boolean, - users?: Array, - workspaceNames?: Array, - userIds?: Array, - id?: number, - workspaceIds?: Array, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/models`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (name !== undefined) { - localVarQueryParameter['name'] = name; - } - - if (description !== undefined) { - localVarQueryParameter['description'] = description; - } - - if (labels) { - localVarQueryParameter['labels'] = labels; - } - - if (archived !== undefined) { - localVarQueryParameter['archived'] = archived; - } - - if (users) { - localVarQueryParameter['users'] = users; - } - - if (workspaceNames) { - localVarQueryParameter['workspaceNames'] = workspaceNames; - } - - if (userIds) { - localVarQueryParameter['userIds'] = userIds; - } - - if (id !== undefined) { - localVarQueryParameter['id'] = id; - } - - if (workspaceIds) { - localVarQueryParameter['workspaceIds'] = workspaceIds; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the requested model version. - * @param {string} modelName The name of the model. - * @param {number} modelVersionNum Sequential model version number. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelVersion(modelName: string, modelVersionNum: number, options: any = {}): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling getModelVersion.', - ); - } - // verify required parameter 'modelVersionNum' is not null or undefined - if (modelVersionNum === null || modelVersionNum === undefined) { - throw new RequiredError( - 'modelVersionNum', - 'Required parameter modelVersionNum was null or undefined when calling getModelVersion.', - ); - } - const localVarPath = `/api/v1/models/{modelName}/versions/{modelVersionNum}` - .replace(`{${'modelName'}}`, encodeURIComponent(String(modelName))) - .replace(`{${'modelVersionNum'}}`, encodeURIComponent(String(modelVersionNum))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of versions for the requested model. - * @param {string} modelName The name of the model. - * @param {V1GetModelVersionsRequestSortBy} [sortBy] Sort the model versions by the given field. - SORT_BY_UNSPECIFIED: Returns model versions in an unsorted list. - SORT_BY_VERSION: Returns model versions sorted by version number. - SORT_BY_CREATION_TIME: Returns model versions sorted by creation_time. - * @param {V1OrderBy} [orderBy] Order model versions in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of model versions before returning results. Negative values denote number of models to skip from the end before returning results. - * @param {number} [limit] Limit the number of model versions. A value of 0 denotes no limit. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelVersions( - modelName: string, - sortBy?: V1GetModelVersionsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - options: any = {}, - ): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling getModelVersions.', - ); - } - const localVarPath = `/api/v1/models/{modelName}/versions`.replace( - `{${'modelName'}}`, - encodeURIComponent(String(modelName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Move a model into a workspace - * @param {string} modelName The target model name. - * @param {V1MoveModelRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveModel(modelName: string, body: V1MoveModelRequest, options: any = {}): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling moveModel.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling moveModel.', - ); - } - const localVarPath = `/api/v1/models/{modelName}/move`.replace( - `{${'modelName'}}`, - encodeURIComponent(String(modelName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Patch a model's fields. - * @param {string} modelName The name of the model being updated. - * @param {V1PatchModel} body The model desired model fields and values. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchModel(modelName: string, body: V1PatchModel, options: any = {}): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling patchModel.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchModel.', - ); - } - const localVarPath = `/api/v1/models/{modelName}`.replace( - `{${'modelName'}}`, - encodeURIComponent(String(modelName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Patch a model version's fields. - * @param {string} modelName The name of the model being updated. - * @param {number} modelVersionNum The model version number being updated. - * @param {V1PatchModelVersion} body Patch payload. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchModelVersion( - modelName: string, - modelVersionNum: number, - body: V1PatchModelVersion, - options: any = {}, - ): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling patchModelVersion.', - ); - } - // verify required parameter 'modelVersionNum' is not null or undefined - if (modelVersionNum === null || modelVersionNum === undefined) { - throw new RequiredError( - 'modelVersionNum', - 'Required parameter modelVersionNum was null or undefined when calling patchModelVersion.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchModelVersion.', - ); - } - const localVarPath = `/api/v1/models/{modelName}/versions/{modelVersionNum}` - .replace(`{${'modelName'}}`, encodeURIComponent(String(modelName))) - .replace(`{${'modelVersionNum'}}`, encodeURIComponent(String(modelVersionNum))); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Create a model in the registry. - * @param {V1PostModelRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postModel(body: V1PostModelRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postModel.', - ); - } - const localVarPath = `/api/v1/models`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Create a model version. - * @param {string} modelName The name of the model to add this version to. - * @param {V1PostModelVersionRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postModelVersion( - modelName: string, - body: V1PostModelVersionRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling postModelVersion.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postModelVersion.', - ); - } - const localVarPath = `/api/v1/models/{modelName}/versions`.replace( - `{${'modelName'}}`, - encodeURIComponent(String(modelName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Unarchive a model - * @param {string} modelName The name of the model to un-archive. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveModel(modelName: string, options: any = {}): FetchArgs { - // verify required parameter 'modelName' is not null or undefined - if (modelName === null || modelName === undefined) { - throw new RequiredError( - 'modelName', - 'Required parameter modelName was null or undefined when calling unarchiveModel.', - ); - } - const localVarPath = `/api/v1/models/{modelName}/unarchive`.replace( - `{${'modelName'}}`, - encodeURIComponent(String(modelName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * ModelsApi - functional programming interface - * @export - */ -export const ModelsApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Archive a model - * @param {string} modelName The name of the model to archive. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - archiveModel( - modelName: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).archiveModel( - modelName, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Delete a model - * @param {string} modelName The name of the model to delete. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteModel( - modelName: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).deleteModel( - modelName, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Delete a model version - * @param {string} modelName The name of the model associated with the model version. - * @param {number} modelVersionNum Sequential model version number. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteModelVersion( - modelName: string, - modelVersionNum: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).deleteModelVersion( - modelName, - modelVersionNum, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the requested model. - * @param {string} modelName The name of the model. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModel( - modelName: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).getModel( - modelName, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of unique model labels (sorted by popularity). - * @param {number} [workspaceId] Optional workspace ID to limit query for model tags. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelLabels( - workspaceId?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).getModelLabels( - workspaceId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of models. - * @param {V1GetModelsRequestSortBy} [sortBy] Sort the models by the given field. - SORT_BY_UNSPECIFIED: Returns models in an unsorted list. - SORT_BY_NAME: Returns models sorted by name. - SORT_BY_DESCRIPTION: Returns models sorted by description. - SORT_BY_CREATION_TIME: Returns models sorted by creation time. - SORT_BY_LAST_UPDATED_TIME: Returns models sorted by last updated time. - SORT_BY_NUM_VERSIONS: Returns models sorted by number of version. - SORT_BY_WORKSPACE: Returns models sorted by workspace name. - * @param {V1OrderBy} [orderBy] Order models in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of models before returning results. Negative values denote number of models to skip from the end before returning results. - * @param {number} [limit] Limit the number of models. A value of 0 denotes no limit. - * @param {string} [name] Limit the models to those matching or partially-matching the name. - * @param {string} [description] Limit the models to those matching or partially-matching the description. - * @param {Array} [labels] Limit the models to those with the following labels. - * @param {boolean} [archived] Limit to unarchived models only. - * @param {Array} [users] Limit the models to those made by the users with the following usernames. - * @param {Array} [workspaceNames] Limit models to those that belong to the following workspace names. - * @param {Array} [userIds] Limit the models to those made by the users with the following userIds. - * @param {number} [id] Limit the models to this model id. - * @param {Array} [workspaceIds] Limit models to those that belong to the following workspace ids. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModels( - sortBy?: V1GetModelsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - description?: string, - labels?: Array, - archived?: boolean, - users?: Array, - workspaceNames?: Array, - userIds?: Array, - id?: number, - workspaceIds?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).getModels( - sortBy, - orderBy, - offset, - limit, - name, - description, - labels, - archived, - users, - workspaceNames, - userIds, - id, - workspaceIds, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the requested model version. - * @param {string} modelName The name of the model. - * @param {number} modelVersionNum Sequential model version number. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelVersion( - modelName: string, - modelVersionNum: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).getModelVersion( - modelName, - modelVersionNum, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of versions for the requested model. - * @param {string} modelName The name of the model. - * @param {V1GetModelVersionsRequestSortBy} [sortBy] Sort the model versions by the given field. - SORT_BY_UNSPECIFIED: Returns model versions in an unsorted list. - SORT_BY_VERSION: Returns model versions sorted by version number. - SORT_BY_CREATION_TIME: Returns model versions sorted by creation_time. - * @param {V1OrderBy} [orderBy] Order model versions in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of model versions before returning results. Negative values denote number of models to skip from the end before returning results. - * @param {number} [limit] Limit the number of model versions. A value of 0 denotes no limit. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelVersions( - modelName: string, - sortBy?: V1GetModelVersionsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).getModelVersions( - modelName, - sortBy, - orderBy, - offset, - limit, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Move a model into a workspace - * @param {string} modelName The target model name. - * @param {V1MoveModelRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveModel( - modelName: string, - body: V1MoveModelRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).moveModel( - modelName, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Patch a model's fields. - * @param {string} modelName The name of the model being updated. - * @param {V1PatchModel} body The model desired model fields and values. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchModel( - modelName: string, - body: V1PatchModel, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).patchModel( - modelName, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Patch a model version's fields. - * @param {string} modelName The name of the model being updated. - * @param {number} modelVersionNum The model version number being updated. - * @param {V1PatchModelVersion} body Patch payload. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchModelVersion( - modelName: string, - modelVersionNum: number, - body: V1PatchModelVersion, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).patchModelVersion( - modelName, - modelVersionNum, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Create a model in the registry. - * @param {V1PostModelRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postModel( - body: V1PostModelRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).postModel(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Create a model version. - * @param {string} modelName The name of the model to add this version to. - * @param {V1PostModelVersionRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postModelVersion( - modelName: string, - body: V1PostModelVersionRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).postModelVersion( - modelName, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Unarchive a model - * @param {string} modelName The name of the model to un-archive. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveModel( - modelName: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ModelsApiFetchParamCreator(configuration).unarchiveModel( - modelName, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * ModelsApi - factory interface - * @export - */ -export const ModelsApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Archive a model - * @param {string} modelName The name of the model to archive. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - archiveModel(modelName: string, options?: any) { - return ModelsApiFp(configuration).archiveModel(modelName, options)(fetch, basePath); - }, - /** - * - * @summary Delete a model - * @param {string} modelName The name of the model to delete. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteModel(modelName: string, options?: any) { - return ModelsApiFp(configuration).deleteModel(modelName, options)(fetch, basePath); - }, - /** - * - * @summary Delete a model version - * @param {string} modelName The name of the model associated with the model version. - * @param {number} modelVersionNum Sequential model version number. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteModelVersion(modelName: string, modelVersionNum: number, options?: any) { - return ModelsApiFp(configuration).deleteModelVersion( - modelName, - modelVersionNum, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get the requested model. - * @param {string} modelName The name of the model. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModel(modelName: string, options?: any) { - return ModelsApiFp(configuration).getModel(modelName, options)(fetch, basePath); - }, - /** - * - * @summary Get a list of unique model labels (sorted by popularity). - * @param {number} [workspaceId] Optional workspace ID to limit query for model tags. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelLabels(workspaceId?: number, options?: any) { - return ModelsApiFp(configuration).getModelLabels(workspaceId, options)(fetch, basePath); - }, - /** - * - * @summary Get a list of models. - * @param {V1GetModelsRequestSortBy} [sortBy] Sort the models by the given field. - SORT_BY_UNSPECIFIED: Returns models in an unsorted list. - SORT_BY_NAME: Returns models sorted by name. - SORT_BY_DESCRIPTION: Returns models sorted by description. - SORT_BY_CREATION_TIME: Returns models sorted by creation time. - SORT_BY_LAST_UPDATED_TIME: Returns models sorted by last updated time. - SORT_BY_NUM_VERSIONS: Returns models sorted by number of version. - SORT_BY_WORKSPACE: Returns models sorted by workspace name. - * @param {V1OrderBy} [orderBy] Order models in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of models before returning results. Negative values denote number of models to skip from the end before returning results. - * @param {number} [limit] Limit the number of models. A value of 0 denotes no limit. - * @param {string} [name] Limit the models to those matching or partially-matching the name. - * @param {string} [description] Limit the models to those matching or partially-matching the description. - * @param {Array} [labels] Limit the models to those with the following labels. - * @param {boolean} [archived] Limit to unarchived models only. - * @param {Array} [users] Limit the models to those made by the users with the following usernames. - * @param {Array} [workspaceNames] Limit models to those that belong to the following workspace names. - * @param {Array} [userIds] Limit the models to those made by the users with the following userIds. - * @param {number} [id] Limit the models to this model id. - * @param {Array} [workspaceIds] Limit models to those that belong to the following workspace ids. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModels( - sortBy?: V1GetModelsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - description?: string, - labels?: Array, - archived?: boolean, - users?: Array, - workspaceNames?: Array, - userIds?: Array, - id?: number, - workspaceIds?: Array, - options?: any, - ) { - return ModelsApiFp(configuration).getModels( - sortBy, - orderBy, - offset, - limit, - name, - description, - labels, - archived, - users, - workspaceNames, - userIds, - id, - workspaceIds, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get the requested model version. - * @param {string} modelName The name of the model. - * @param {number} modelVersionNum Sequential model version number. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelVersion(modelName: string, modelVersionNum: number, options?: any) { - return ModelsApiFp(configuration).getModelVersion( - modelName, - modelVersionNum, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get a list of versions for the requested model. - * @param {string} modelName The name of the model. - * @param {V1GetModelVersionsRequestSortBy} [sortBy] Sort the model versions by the given field. - SORT_BY_UNSPECIFIED: Returns model versions in an unsorted list. - SORT_BY_VERSION: Returns model versions sorted by version number. - SORT_BY_CREATION_TIME: Returns model versions sorted by creation_time. - * @param {V1OrderBy} [orderBy] Order model versions in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of model versions before returning results. Negative values denote number of models to skip from the end before returning results. - * @param {number} [limit] Limit the number of model versions. A value of 0 denotes no limit. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getModelVersions( - modelName: string, - sortBy?: V1GetModelVersionsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - options?: any, - ) { - return ModelsApiFp(configuration).getModelVersions( - modelName, - sortBy, - orderBy, - offset, - limit, - options, - )(fetch, basePath); - }, - /** - * - * @summary Move a model into a workspace - * @param {string} modelName The target model name. - * @param {V1MoveModelRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveModel(modelName: string, body: V1MoveModelRequest, options?: any) { - return ModelsApiFp(configuration).moveModel(modelName, body, options)(fetch, basePath); - }, - /** - * - * @summary Patch a model's fields. - * @param {string} modelName The name of the model being updated. - * @param {V1PatchModel} body The model desired model fields and values. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchModel(modelName: string, body: V1PatchModel, options?: any) { - return ModelsApiFp(configuration).patchModel(modelName, body, options)(fetch, basePath); - }, - /** - * - * @summary Patch a model version's fields. - * @param {string} modelName The name of the model being updated. - * @param {number} modelVersionNum The model version number being updated. - * @param {V1PatchModelVersion} body Patch payload. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchModelVersion( - modelName: string, - modelVersionNum: number, - body: V1PatchModelVersion, - options?: any, - ) { - return ModelsApiFp(configuration).patchModelVersion( - modelName, - modelVersionNum, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Create a model in the registry. - * @param {V1PostModelRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postModel(body: V1PostModelRequest, options?: any) { - return ModelsApiFp(configuration).postModel(body, options)(fetch, basePath); - }, - /** - * - * @summary Create a model version. - * @param {string} modelName The name of the model to add this version to. - * @param {V1PostModelVersionRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postModelVersion(modelName: string, body: V1PostModelVersionRequest, options?: any) { - return ModelsApiFp(configuration).postModelVersion(modelName, body, options)(fetch, basePath); - }, - /** - * - * @summary Unarchive a model - * @param {string} modelName The name of the model to un-archive. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveModel(modelName: string, options?: any) { - return ModelsApiFp(configuration).unarchiveModel(modelName, options)(fetch, basePath); - }, - }; -}; - -/** - * ModelsApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class ModelsApi extends BaseAPI { - /** - * - * @summary Archive a model - * @param {string} modelName The name of the model to archive. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public archiveModel(modelName: string, options?: any) { - return ModelsApiFp(this.configuration).archiveModel(modelName, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Delete a model - * @param {string} modelName The name of the model to delete. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public deleteModel(modelName: string, options?: any) { - return ModelsApiFp(this.configuration).deleteModel(modelName, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Delete a model version - * @param {string} modelName The name of the model associated with the model version. - * @param {number} modelVersionNum Sequential model version number. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public deleteModelVersion(modelName: string, modelVersionNum: number, options?: any) { - return ModelsApiFp(this.configuration).deleteModelVersion( - modelName, - modelVersionNum, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get the requested model. - * @param {string} modelName The name of the model. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public getModel(modelName: string, options?: any) { - return ModelsApiFp(this.configuration).getModel(modelName, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get a list of unique model labels (sorted by popularity). - * @param {number} [workspaceId] Optional workspace ID to limit query for model tags. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public getModelLabels(workspaceId?: number, options?: any) { - return ModelsApiFp(this.configuration).getModelLabels(workspaceId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of models. - * @param {V1GetModelsRequestSortBy} [sortBy] Sort the models by the given field. - SORT_BY_UNSPECIFIED: Returns models in an unsorted list. - SORT_BY_NAME: Returns models sorted by name. - SORT_BY_DESCRIPTION: Returns models sorted by description. - SORT_BY_CREATION_TIME: Returns models sorted by creation time. - SORT_BY_LAST_UPDATED_TIME: Returns models sorted by last updated time. - SORT_BY_NUM_VERSIONS: Returns models sorted by number of version. - SORT_BY_WORKSPACE: Returns models sorted by workspace name. - * @param {V1OrderBy} [orderBy] Order models in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of models before returning results. Negative values denote number of models to skip from the end before returning results. - * @param {number} [limit] Limit the number of models. A value of 0 denotes no limit. - * @param {string} [name] Limit the models to those matching or partially-matching the name. - * @param {string} [description] Limit the models to those matching or partially-matching the description. - * @param {Array} [labels] Limit the models to those with the following labels. - * @param {boolean} [archived] Limit to unarchived models only. - * @param {Array} [users] Limit the models to those made by the users with the following usernames. - * @param {Array} [workspaceNames] Limit models to those that belong to the following workspace names. - * @param {Array} [userIds] Limit the models to those made by the users with the following userIds. - * @param {number} [id] Limit the models to this model id. - * @param {Array} [workspaceIds] Limit models to those that belong to the following workspace ids. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public getModels( - sortBy?: V1GetModelsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - description?: string, - labels?: Array, - archived?: boolean, - users?: Array, - workspaceNames?: Array, - userIds?: Array, - id?: number, - workspaceIds?: Array, - options?: any, - ) { - return ModelsApiFp(this.configuration).getModels( - sortBy, - orderBy, - offset, - limit, - name, - description, - labels, - archived, - users, - workspaceNames, - userIds, - id, - workspaceIds, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get the requested model version. - * @param {string} modelName The name of the model. - * @param {number} modelVersionNum Sequential model version number. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public getModelVersion(modelName: string, modelVersionNum: number, options?: any) { - return ModelsApiFp(this.configuration).getModelVersion( - modelName, - modelVersionNum, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a list of versions for the requested model. - * @param {string} modelName The name of the model. - * @param {V1GetModelVersionsRequestSortBy} [sortBy] Sort the model versions by the given field. - SORT_BY_UNSPECIFIED: Returns model versions in an unsorted list. - SORT_BY_VERSION: Returns model versions sorted by version number. - SORT_BY_CREATION_TIME: Returns model versions sorted by creation_time. - * @param {V1OrderBy} [orderBy] Order model versions in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of model versions before returning results. Negative values denote number of models to skip from the end before returning results. - * @param {number} [limit] Limit the number of model versions. A value of 0 denotes no limit. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public getModelVersions( - modelName: string, - sortBy?: V1GetModelVersionsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - options?: any, - ) { - return ModelsApiFp(this.configuration).getModelVersions( - modelName, - sortBy, - orderBy, - offset, - limit, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Move a model into a workspace - * @param {string} modelName The target model name. - * @param {V1MoveModelRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public moveModel(modelName: string, body: V1MoveModelRequest, options?: any) { - return ModelsApiFp(this.configuration).moveModel( - modelName, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Patch a model's fields. - * @param {string} modelName The name of the model being updated. - * @param {V1PatchModel} body The model desired model fields and values. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public patchModel(modelName: string, body: V1PatchModel, options?: any) { - return ModelsApiFp(this.configuration).patchModel( - modelName, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Patch a model version's fields. - * @param {string} modelName The name of the model being updated. - * @param {number} modelVersionNum The model version number being updated. - * @param {V1PatchModelVersion} body Patch payload. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public patchModelVersion( - modelName: string, - modelVersionNum: number, - body: V1PatchModelVersion, - options?: any, - ) { - return ModelsApiFp(this.configuration).patchModelVersion( - modelName, - modelVersionNum, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Create a model in the registry. - * @param {V1PostModelRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public postModel(body: V1PostModelRequest, options?: any) { - return ModelsApiFp(this.configuration).postModel(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Create a model version. - * @param {string} modelName The name of the model to add this version to. - * @param {V1PostModelVersionRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public postModelVersion(modelName: string, body: V1PostModelVersionRequest, options?: any) { - return ModelsApiFp(this.configuration).postModelVersion( - modelName, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Unarchive a model - * @param {string} modelName The name of the model to un-archive. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ModelsApi - */ - public unarchiveModel(modelName: string, options?: any) { - return ModelsApiFp(this.configuration).unarchiveModel(modelName, options)( - this.fetch, - this.basePath, - ); - } -} - -/** - * NotebooksApi - fetch parameter creator - * @export - */ -export const NotebooksApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Get the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getNotebook(notebookId: string, options: any = {}): FetchArgs { - // verify required parameter 'notebookId' is not null or undefined - if (notebookId === null || notebookId === undefined) { - throw new RequiredError( - 'notebookId', - 'Required parameter notebookId was null or undefined when calling getNotebook.', - ); - } - const localVarPath = `/api/v1/notebooks/{notebookId}`.replace( - `{${'notebookId'}}`, - encodeURIComponent(String(notebookId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of notebooks. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort notebooks by the given field. - SORT_BY_UNSPECIFIED: Returns notebooks in an unsorted list. - SORT_BY_ID: Returns notebooks sorted by id. - SORT_BY_DESCRIPTION: Returns notebooks sorted by description. - SORT_BY_START_TIME: Return notebooks sorted by start time. - SORT_BY_WORKSPACE_ID: Return notebooks sorted by workspace_id - * @param {V1OrderBy} [orderBy] Order notebooks in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of notebooks before returning results. Negative values denote number of notebooks to skip from the end before returning results. - * @param {number} [limit] Limit the number of notebooks. A value of 0 denotes no limit. - * @param {Array} [users] Limit notebooks to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit notebooks to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getNotebooks( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/notebooks`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (users) { - localVarQueryParameter['users'] = users; - } - - if (userIds) { - localVarQueryParameter['userIds'] = userIds; - } - - if (workspaceId !== undefined) { - localVarQueryParameter['workspaceId'] = workspaceId; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Kill the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killNotebook(notebookId: string, options: any = {}): FetchArgs { - // verify required parameter 'notebookId' is not null or undefined - if (notebookId === null || notebookId === undefined) { - throw new RequiredError( - 'notebookId', - 'Required parameter notebookId was null or undefined when calling killNotebook.', - ); - } - const localVarPath = `/api/v1/notebooks/{notebookId}/kill`.replace( - `{${'notebookId'}}`, - encodeURIComponent(String(notebookId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Launch a notebook. - * @param {V1LaunchNotebookRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - launchNotebook(body: V1LaunchNotebookRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling launchNotebook.', - ); - } - const localVarPath = `/api/v1/notebooks`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Set the priority of the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {V1SetNotebookPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setNotebookPriority( - notebookId: string, - body: V1SetNotebookPriorityRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'notebookId' is not null or undefined - if (notebookId === null || notebookId === undefined) { - throw new RequiredError( - 'notebookId', - 'Required parameter notebookId was null or undefined when calling setNotebookPriority.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling setNotebookPriority.', - ); - } - const localVarPath = `/api/v1/notebooks/{notebookId}/set_priority`.replace( - `{${'notebookId'}}`, - encodeURIComponent(String(notebookId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * NotebooksApi - functional programming interface - * @export - */ -export const NotebooksApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Get the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getNotebook( - notebookId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NotebooksApiFetchParamCreator(configuration).getNotebook( - notebookId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of notebooks. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort notebooks by the given field. - SORT_BY_UNSPECIFIED: Returns notebooks in an unsorted list. - SORT_BY_ID: Returns notebooks sorted by id. - SORT_BY_DESCRIPTION: Returns notebooks sorted by description. - SORT_BY_START_TIME: Return notebooks sorted by start time. - SORT_BY_WORKSPACE_ID: Return notebooks sorted by workspace_id - * @param {V1OrderBy} [orderBy] Order notebooks in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of notebooks before returning results. Negative values denote number of notebooks to skip from the end before returning results. - * @param {number} [limit] Limit the number of notebooks. A value of 0 denotes no limit. - * @param {Array} [users] Limit notebooks to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit notebooks to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getNotebooks( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NotebooksApiFetchParamCreator(configuration).getNotebooks( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Kill the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killNotebook( - notebookId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NotebooksApiFetchParamCreator(configuration).killNotebook( - notebookId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Launch a notebook. - * @param {V1LaunchNotebookRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - launchNotebook( - body: V1LaunchNotebookRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NotebooksApiFetchParamCreator(configuration).launchNotebook( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Set the priority of the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {V1SetNotebookPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setNotebookPriority( - notebookId: string, - body: V1SetNotebookPriorityRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = NotebooksApiFetchParamCreator(configuration).setNotebookPriority( - notebookId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * NotebooksApi - factory interface - * @export - */ -export const NotebooksApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Get the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getNotebook(notebookId: string, options?: any) { - return NotebooksApiFp(configuration).getNotebook(notebookId, options)(fetch, basePath); - }, - /** - * - * @summary Get a list of notebooks. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort notebooks by the given field. - SORT_BY_UNSPECIFIED: Returns notebooks in an unsorted list. - SORT_BY_ID: Returns notebooks sorted by id. - SORT_BY_DESCRIPTION: Returns notebooks sorted by description. - SORT_BY_START_TIME: Return notebooks sorted by start time. - SORT_BY_WORKSPACE_ID: Return notebooks sorted by workspace_id - * @param {V1OrderBy} [orderBy] Order notebooks in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of notebooks before returning results. Negative values denote number of notebooks to skip from the end before returning results. - * @param {number} [limit] Limit the number of notebooks. A value of 0 denotes no limit. - * @param {Array} [users] Limit notebooks to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit notebooks to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getNotebooks( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ) { - return NotebooksApiFp(configuration).getNotebooks( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - )(fetch, basePath); - }, - /** - * - * @summary Kill the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killNotebook(notebookId: string, options?: any) { - return NotebooksApiFp(configuration).killNotebook(notebookId, options)(fetch, basePath); - }, - /** - * - * @summary Launch a notebook. - * @param {V1LaunchNotebookRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - launchNotebook(body: V1LaunchNotebookRequest, options?: any) { - return NotebooksApiFp(configuration).launchNotebook(body, options)(fetch, basePath); - }, - /** - * - * @summary Set the priority of the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {V1SetNotebookPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setNotebookPriority(notebookId: string, body: V1SetNotebookPriorityRequest, options?: any) { - return NotebooksApiFp(configuration).setNotebookPriority( - notebookId, - body, - options, - )(fetch, basePath); - }, - }; -}; - -/** - * NotebooksApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class NotebooksApi extends BaseAPI { - /** - * - * @summary Get the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof NotebooksApi - */ - public getNotebook(notebookId: string, options?: any) { - return NotebooksApiFp(this.configuration).getNotebook(notebookId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of notebooks. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort notebooks by the given field. - SORT_BY_UNSPECIFIED: Returns notebooks in an unsorted list. - SORT_BY_ID: Returns notebooks sorted by id. - SORT_BY_DESCRIPTION: Returns notebooks sorted by description. - SORT_BY_START_TIME: Return notebooks sorted by start time. - SORT_BY_WORKSPACE_ID: Return notebooks sorted by workspace_id - * @param {V1OrderBy} [orderBy] Order notebooks in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of notebooks before returning results. Negative values denote number of notebooks to skip from the end before returning results. - * @param {number} [limit] Limit the number of notebooks. A value of 0 denotes no limit. - * @param {Array} [users] Limit notebooks to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit notebooks to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof NotebooksApi - */ - public getNotebooks( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ) { - return NotebooksApiFp(this.configuration).getNotebooks( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Kill the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof NotebooksApi - */ - public killNotebook(notebookId: string, options?: any) { - return NotebooksApiFp(this.configuration).killNotebook(notebookId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Launch a notebook. - * @param {V1LaunchNotebookRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof NotebooksApi - */ - public launchNotebook(body: V1LaunchNotebookRequest, options?: any) { - return NotebooksApiFp(this.configuration).launchNotebook(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Set the priority of the requested notebook. - * @param {string} notebookId The id of the notebook. - * @param {V1SetNotebookPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof NotebooksApi - */ - public setNotebookPriority( - notebookId: string, - body: V1SetNotebookPriorityRequest, - options?: any, - ) { - return NotebooksApiFp(this.configuration).setNotebookPriority( - notebookId, - body, - options, - )(this.fetch, this.basePath); - } -} - -/** - * ProfilerApi - fetch parameter creator - * @export - */ -export const ProfilerApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Stream the available series in a trial's profiler metrics. - * @param {number} trialId The requested trial's id. - * @param {boolean} [follow] Continue streaming labels until the trial stops. Defaults to False. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialProfilerAvailableSeries( - trialId: number, - follow?: boolean, - options: any = {}, - ): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling getTrialProfilerAvailableSeries.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/profiler/available_series`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Stream trial profiler metrics. - * @param {number} labelsTrialId The ID of the trial. - * @param {string} [labelsName] The name of the metric. - * @param {string} [labelsAgentId] The agent ID associated with the metric. - * @param {string} [labelsGpuUuid] The GPU UUID associated with the metric. - * @param {TrialProfilerMetricLabelsProfilerMetricType} [labelsMetricType] The type of the metric. - PROFILER_METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - PROFILER_METRIC_TYPE_SYSTEM: For systems metrics, like GPU utilization or memory. - PROFILER_METRIC_TYPE_TIMING: For timing metrics, like how long a backwards pass or getting a batch from the dataloader took. - PROFILER_METRIC_TYPE_MISC: For other miscellaneous metrics. - * @param {boolean} [follow] Continue streaming metrics until the trial stops. Defaults to False. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialProfilerMetrics( - labelsTrialId: number, - labelsName?: string, - labelsAgentId?: string, - labelsGpuUuid?: string, - labelsMetricType?: TrialProfilerMetricLabelsProfilerMetricType, - follow?: boolean, - options: any = {}, - ): FetchArgs { - // verify required parameter 'labelsTrialId' is not null or undefined - if (labelsTrialId === null || labelsTrialId === undefined) { - throw new RequiredError( - 'labelsTrialId', - 'Required parameter labelsTrialId was null or undefined when calling getTrialProfilerMetrics.', - ); - } - const localVarPath = `/api/v1/trials/{labelsTrialId}/profiler/metrics`.replace( - `{${'labelsTrialId'}}`, - encodeURIComponent(String(labelsTrialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (labelsName !== undefined) { - localVarQueryParameter['labels.name'] = labelsName; - } - - if (labelsAgentId !== undefined) { - localVarQueryParameter['labels.agentId'] = labelsAgentId; - } - - if (labelsGpuUuid !== undefined) { - localVarQueryParameter['labels.gpuUuid'] = labelsGpuUuid; - } - - if (labelsMetricType !== undefined) { - localVarQueryParameter['labels.metricType'] = labelsMetricType; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * ProfilerApi - functional programming interface - * @export - */ -export const ProfilerApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Stream the available series in a trial's profiler metrics. - * @param {number} trialId The requested trial's id. - * @param {boolean} [follow] Continue streaming labels until the trial stops. Defaults to False. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialProfilerAvailableSeries( - trialId: number, - follow?: boolean, - options?: any, - ): ( - fetch?: FetchAPI, - basePath?: string, - ) => Promise { - const localVarFetchArgs = ProfilerApiFetchParamCreator( - configuration, - ).getTrialProfilerAvailableSeries(trialId, follow, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream trial profiler metrics. - * @param {number} labelsTrialId The ID of the trial. - * @param {string} [labelsName] The name of the metric. - * @param {string} [labelsAgentId] The agent ID associated with the metric. - * @param {string} [labelsGpuUuid] The GPU UUID associated with the metric. - * @param {TrialProfilerMetricLabelsProfilerMetricType} [labelsMetricType] The type of the metric. - PROFILER_METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - PROFILER_METRIC_TYPE_SYSTEM: For systems metrics, like GPU utilization or memory. - PROFILER_METRIC_TYPE_TIMING: For timing metrics, like how long a backwards pass or getting a batch from the dataloader took. - PROFILER_METRIC_TYPE_MISC: For other miscellaneous metrics. - * @param {boolean} [follow] Continue streaming metrics until the trial stops. Defaults to False. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialProfilerMetrics( - labelsTrialId: number, - labelsName?: string, - labelsAgentId?: string, - labelsGpuUuid?: string, - labelsMetricType?: TrialProfilerMetricLabelsProfilerMetricType, - follow?: boolean, - options?: any, - ): ( - fetch?: FetchAPI, - basePath?: string, - ) => Promise { - const localVarFetchArgs = ProfilerApiFetchParamCreator(configuration).getTrialProfilerMetrics( - labelsTrialId, - labelsName, - labelsAgentId, - labelsGpuUuid, - labelsMetricType, - follow, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * ProfilerApi - factory interface - * @export - */ -export const ProfilerApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Stream the available series in a trial's profiler metrics. - * @param {number} trialId The requested trial's id. - * @param {boolean} [follow] Continue streaming labels until the trial stops. Defaults to False. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialProfilerAvailableSeries(trialId: number, follow?: boolean, options?: any) { - return ProfilerApiFp(configuration).getTrialProfilerAvailableSeries( - trialId, - follow, - options, - )(fetch, basePath); - }, - /** - * - * @summary Stream trial profiler metrics. - * @param {number} labelsTrialId The ID of the trial. - * @param {string} [labelsName] The name of the metric. - * @param {string} [labelsAgentId] The agent ID associated with the metric. - * @param {string} [labelsGpuUuid] The GPU UUID associated with the metric. - * @param {TrialProfilerMetricLabelsProfilerMetricType} [labelsMetricType] The type of the metric. - PROFILER_METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - PROFILER_METRIC_TYPE_SYSTEM: For systems metrics, like GPU utilization or memory. - PROFILER_METRIC_TYPE_TIMING: For timing metrics, like how long a backwards pass or getting a batch from the dataloader took. - PROFILER_METRIC_TYPE_MISC: For other miscellaneous metrics. - * @param {boolean} [follow] Continue streaming metrics until the trial stops. Defaults to False. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialProfilerMetrics( - labelsTrialId: number, - labelsName?: string, - labelsAgentId?: string, - labelsGpuUuid?: string, - labelsMetricType?: TrialProfilerMetricLabelsProfilerMetricType, - follow?: boolean, - options?: any, - ) { - return ProfilerApiFp(configuration).getTrialProfilerMetrics( - labelsTrialId, - labelsName, - labelsAgentId, - labelsGpuUuid, - labelsMetricType, - follow, - options, - )(fetch, basePath); - }, - }; -}; - -/** - * ProfilerApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class ProfilerApi extends BaseAPI { - /** - * - * @summary Stream the available series in a trial's profiler metrics. - * @param {number} trialId The requested trial's id. - * @param {boolean} [follow] Continue streaming labels until the trial stops. Defaults to False. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProfilerApi - */ - public getTrialProfilerAvailableSeries(trialId: number, follow?: boolean, options?: any) { - return ProfilerApiFp(this.configuration).getTrialProfilerAvailableSeries( - trialId, - follow, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Stream trial profiler metrics. - * @param {number} labelsTrialId The ID of the trial. - * @param {string} [labelsName] The name of the metric. - * @param {string} [labelsAgentId] The agent ID associated with the metric. - * @param {string} [labelsGpuUuid] The GPU UUID associated with the metric. - * @param {TrialProfilerMetricLabelsProfilerMetricType} [labelsMetricType] The type of the metric. - PROFILER_METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - PROFILER_METRIC_TYPE_SYSTEM: For systems metrics, like GPU utilization or memory. - PROFILER_METRIC_TYPE_TIMING: For timing metrics, like how long a backwards pass or getting a batch from the dataloader took. - PROFILER_METRIC_TYPE_MISC: For other miscellaneous metrics. - * @param {boolean} [follow] Continue streaming metrics until the trial stops. Defaults to False. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProfilerApi - */ - public getTrialProfilerMetrics( - labelsTrialId: number, - labelsName?: string, - labelsAgentId?: string, - labelsGpuUuid?: string, - labelsMetricType?: TrialProfilerMetricLabelsProfilerMetricType, - follow?: boolean, - options?: any, - ) { - return ProfilerApiFp(this.configuration).getTrialProfilerMetrics( - labelsTrialId, - labelsName, - labelsAgentId, - labelsGpuUuid, - labelsMetricType, - follow, - options, - )(this.fetch, this.basePath); - } -} - -/** - * ProjectsApi - fetch parameter creator - * @export - */ -export const ProjectsApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Add a note to a project. - * @param {number} projectId The id of the project. - * @param {V1Note} body The note to add. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - addProjectNote(projectId: number, body: V1Note, options: any = {}): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling addProjectNote.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling addProjectNote.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/notes`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Archive a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - archiveProject(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling archiveProject.', - ); - } - const localVarPath = `/api/v1/projects/{id}/archive`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Delete a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteProject(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling deleteProject.', - ); - } - const localVarPath = `/api/v1/projects/{id}`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the requested project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProject(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling getProject.', - ); - } - const localVarPath = `/api/v1/projects/{id}`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the request project by key. - * @param {string} key The key of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectByKey(key: string, options: any = {}): FetchArgs { - // verify required parameter 'key' is not null or undefined - if (key === null || key === undefined) { - throw new RequiredError( - 'key', - 'Required parameter key was null or undefined when calling getProjectByKey.', - ); - } - const localVarPath = `/api/v1/projects/key/{key}`.replace( - `{${'key'}}`, - encodeURIComponent(String(key)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of columns for experiment list table. - * @param {number} id The id of the project. - * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectColumns(id: number, tableType?: V1TableType, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling getProjectColumns.', - ); - } - const localVarPath = `/api/v1/projects/{id}/columns`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (tableType !== undefined) { - localVarQueryParameter['tableType'] = tableType; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get metrics range for a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectNumericMetricsRange(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling getProjectNumericMetricsRange.', - ); - } - const localVarPath = `/api/v1/projects/{id}/experiments/metric-ranges`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get projects by user activity - * @param {number} [limit] Limit number of project entries. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectsByUserActivity(limit?: number, options: any = {}): FetchArgs { - const localVarPath = `/api/v1/user/projects/activity`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Move a project into a workspace. - * @param {number} projectId The id of the project being moved. - * @param {V1MoveProjectRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveProject(projectId: number, body: V1MoveProjectRequest, options: any = {}): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling moveProject.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling moveProject.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/move`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Update a project. - * @param {number} id The id of the project. - * @param {V1PatchProject} body The desired project fields and values to update. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchProject(id: number, body: V1PatchProject, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling patchProject.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchProject.', - ); - } - const localVarPath = `/api/v1/projects/{id}`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Create a project. - * @param {number} workspaceId Id of the associated workspace. - * @param {V1PostProjectRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postProject(workspaceId: number, body: V1PostProjectRequest, options: any = {}): FetchArgs { - // verify required parameter 'workspaceId' is not null or undefined - if (workspaceId === null || workspaceId === undefined) { - throw new RequiredError( - 'workspaceId', - 'Required parameter workspaceId was null or undefined when calling postProject.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postProject.', - ); - } - const localVarPath = `/api/v1/workspaces/{workspaceId}/projects`.replace( - `{${'workspaceId'}}`, - encodeURIComponent(String(workspaceId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Set project notes. - * @param {number} projectId The id of the project. - * @param {V1PutProjectNotesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putProjectNotes( - projectId: number, - body: V1PutProjectNotesRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'projectId' is not null or undefined - if (projectId === null || projectId === undefined) { - throw new RequiredError( - 'projectId', - 'Required parameter projectId was null or undefined when calling putProjectNotes.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling putProjectNotes.', - ); - } - const localVarPath = `/api/v1/projects/{projectId}/notes`.replace( - `{${'projectId'}}`, - encodeURIComponent(String(projectId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Unarchive a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveProject(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling unarchiveProject.', - ); - } - const localVarPath = `/api/v1/projects/{id}/unarchive`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * ProjectsApi - functional programming interface - * @export - */ -export const ProjectsApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Add a note to a project. - * @param {number} projectId The id of the project. - * @param {V1Note} body The note to add. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - addProjectNote( - projectId: number, - body: V1Note, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).addProjectNote( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Archive a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - archiveProject( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).archiveProject( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Delete a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteProject( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).deleteProject( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the requested project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProject( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).getProject(id, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the request project by key. - * @param {string} key The key of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectByKey( - key: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).getProjectByKey( - key, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of columns for experiment list table. - * @param {number} id The id of the project. - * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectColumns( - id: number, - tableType?: V1TableType, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).getProjectColumns( - id, - tableType, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get metrics range for a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectNumericMetricsRange( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator( - configuration, - ).getProjectNumericMetricsRange(id, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get projects by user activity - * @param {number} [limit] Limit number of project entries. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectsByUserActivity( - limit?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator( - configuration, - ).getProjectsByUserActivity(limit, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Move a project into a workspace. - * @param {number} projectId The id of the project being moved. - * @param {V1MoveProjectRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveProject( - projectId: number, - body: V1MoveProjectRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).moveProject( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Update a project. - * @param {number} id The id of the project. - * @param {V1PatchProject} body The desired project fields and values to update. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchProject( - id: number, - body: V1PatchProject, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).patchProject( - id, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Create a project. - * @param {number} workspaceId Id of the associated workspace. - * @param {V1PostProjectRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postProject( - workspaceId: number, - body: V1PostProjectRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).postProject( - workspaceId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Set project notes. - * @param {number} projectId The id of the project. - * @param {V1PutProjectNotesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putProjectNotes( - projectId: number, - body: V1PutProjectNotesRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).putProjectNotes( - projectId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Unarchive a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveProject( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).unarchiveProject( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * ProjectsApi - factory interface - * @export - */ -export const ProjectsApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Add a note to a project. - * @param {number} projectId The id of the project. - * @param {V1Note} body The note to add. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - addProjectNote(projectId: number, body: V1Note, options?: any) { - return ProjectsApiFp(configuration).addProjectNote(projectId, body, options)(fetch, basePath); - }, - /** - * - * @summary Archive a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - archiveProject(id: number, options?: any) { - return ProjectsApiFp(configuration).archiveProject(id, options)(fetch, basePath); - }, - /** - * - * @summary Delete a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteProject(id: number, options?: any) { - return ProjectsApiFp(configuration).deleteProject(id, options)(fetch, basePath); - }, - /** - * - * @summary Get the requested project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProject(id: number, options?: any) { - return ProjectsApiFp(configuration).getProject(id, options)(fetch, basePath); - }, - /** - * - * @summary Get the request project by key. - * @param {string} key The key of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectByKey(key: string, options?: any) { - return ProjectsApiFp(configuration).getProjectByKey(key, options)(fetch, basePath); - }, - /** - * - * @summary Get a list of columns for experiment list table. - * @param {number} id The id of the project. - * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectColumns(id: number, tableType?: V1TableType, options?: any) { - return ProjectsApiFp(configuration).getProjectColumns( - id, - tableType, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get metrics range for a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectNumericMetricsRange(id: number, options?: any) { - return ProjectsApiFp(configuration).getProjectNumericMetricsRange(id, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get projects by user activity - * @param {number} [limit] Limit number of project entries. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getProjectsByUserActivity(limit?: number, options?: any) { - return ProjectsApiFp(configuration).getProjectsByUserActivity(limit, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Move a project into a workspace. - * @param {number} projectId The id of the project being moved. - * @param {V1MoveProjectRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - moveProject(projectId: number, body: V1MoveProjectRequest, options?: any) { - return ProjectsApiFp(configuration).moveProject(projectId, body, options)(fetch, basePath); - }, - /** - * - * @summary Update a project. - * @param {number} id The id of the project. - * @param {V1PatchProject} body The desired project fields and values to update. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchProject(id: number, body: V1PatchProject, options?: any) { - return ProjectsApiFp(configuration).patchProject(id, body, options)(fetch, basePath); - }, - /** - * - * @summary Create a project. - * @param {number} workspaceId Id of the associated workspace. - * @param {V1PostProjectRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postProject(workspaceId: number, body: V1PostProjectRequest, options?: any) { - return ProjectsApiFp(configuration).postProject(workspaceId, body, options)(fetch, basePath); - }, - /** - * - * @summary Set project notes. - * @param {number} projectId The id of the project. - * @param {V1PutProjectNotesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putProjectNotes(projectId: number, body: V1PutProjectNotesRequest, options?: any) { - return ProjectsApiFp(configuration).putProjectNotes( - projectId, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Unarchive a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - unarchiveProject(id: number, options?: any) { - return ProjectsApiFp(configuration).unarchiveProject(id, options)(fetch, basePath); - }, - }; -}; - -/** - * ProjectsApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class ProjectsApi extends BaseAPI { - /** - * - * @summary Add a note to a project. - * @param {number} projectId The id of the project. - * @param {V1Note} body The note to add. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public addProjectNote(projectId: number, body: V1Note, options?: any) { - return ProjectsApiFp(this.configuration).addProjectNote( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Archive a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public archiveProject(id: number, options?: any) { - return ProjectsApiFp(this.configuration).archiveProject(id, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Delete a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public deleteProject(id: number, options?: any) { - return ProjectsApiFp(this.configuration).deleteProject(id, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get the requested project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public getProject(id: number, options?: any) { - return ProjectsApiFp(this.configuration).getProject(id, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get the request project by key. - * @param {string} key The key of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public getProjectByKey(key: string, options?: any) { - return ProjectsApiFp(this.configuration).getProjectByKey(key, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of columns for experiment list table. - * @param {number} id The id of the project. - * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public getProjectColumns(id: number, tableType?: V1TableType, options?: any) { - return ProjectsApiFp(this.configuration).getProjectColumns( - id, - tableType, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get metrics range for a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public getProjectNumericMetricsRange(id: number, options?: any) { - return ProjectsApiFp(this.configuration).getProjectNumericMetricsRange(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get projects by user activity - * @param {number} [limit] Limit number of project entries. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public getProjectsByUserActivity(limit?: number, options?: any) { - return ProjectsApiFp(this.configuration).getProjectsByUserActivity(limit, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Move a project into a workspace. - * @param {number} projectId The id of the project being moved. - * @param {V1MoveProjectRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public moveProject(projectId: number, body: V1MoveProjectRequest, options?: any) { - return ProjectsApiFp(this.configuration).moveProject( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Update a project. - * @param {number} id The id of the project. - * @param {V1PatchProject} body The desired project fields and values to update. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public patchProject(id: number, body: V1PatchProject, options?: any) { - return ProjectsApiFp(this.configuration).patchProject( - id, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Create a project. - * @param {number} workspaceId Id of the associated workspace. - * @param {V1PostProjectRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public postProject(workspaceId: number, body: V1PostProjectRequest, options?: any) { - return ProjectsApiFp(this.configuration).postProject( - workspaceId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Set project notes. - * @param {number} projectId The id of the project. - * @param {V1PutProjectNotesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public putProjectNotes(projectId: number, body: V1PutProjectNotesRequest, options?: any) { - return ProjectsApiFp(this.configuration).putProjectNotes( - projectId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Unarchive a project. - * @param {number} id The id of the project. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ProjectsApi - */ - public unarchiveProject(id: number, options?: any) { - return ProjectsApiFp(this.configuration).unarchiveProject(id, options)( - this.fetch, - this.basePath, - ); - } -} - -/** - * RBACApi - fetch parameter creator - * @export - */ -export const RBACApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary AssignRoles adds a set of role assignments to the system. - * @param {V1AssignRolesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assignRoles(body: V1AssignRolesRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling assignRoles.', - ); - } - const localVarPath = `/api/v1/roles/add-assignments`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get groups and users assigned to a given workspace with what roles are assigned. - * @param {number} workspaceId ID of workspace getting groups and users. - * @param {string} [name] Name of groups and users to search by. Name filters by group name for groups. Name filters by display name then username if display name is null for users. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGroupsAndUsersAssignedToWorkspace( - workspaceId: number, - name?: string, - options: any = {}, - ): FetchArgs { - // verify required parameter 'workspaceId' is not null or undefined - if (workspaceId === null || workspaceId === undefined) { - throw new RequiredError( - 'workspaceId', - 'Required parameter workspaceId was null or undefined when calling getGroupsAndUsersAssignedToWorkspace.', - ); - } - const localVarPath = `/api/v1/roles/workspace/{workspaceId}`.replace( - `{${'workspaceId'}}`, - encodeURIComponent(String(workspaceId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (name !== undefined) { - localVarQueryParameter['name'] = name; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary List all permissions for the logged in user in all scopes. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getPermissionsSummary(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/permissions/summary`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the roles which are assigned to a group. - * @param {number} groupId The id of the group to search for role assignments for - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRolesAssignedToGroup(groupId: number, options: any = {}): FetchArgs { - // verify required parameter 'groupId' is not null or undefined - if (groupId === null || groupId === undefined) { - throw new RequiredError( - 'groupId', - 'Required parameter groupId was null or undefined when calling getRolesAssignedToGroup.', - ); - } - const localVarPath = `/api/v1/roles/search/by-group/{groupId}`.replace( - `{${'groupId'}}`, - encodeURIComponent(String(groupId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the roles which are assigned to a user. - * @param {number} userId The id of the user to search for role assignments for - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRolesAssignedToUser(userId: number, options: any = {}): FetchArgs { - // verify required parameter 'userId' is not null or undefined - if (userId === null || userId === undefined) { - throw new RequiredError( - 'userId', - 'Required parameter userId was null or undefined when calling getRolesAssignedToUser.', - ); - } - const localVarPath = `/api/v1/roles/search/by-user/{userId}`.replace( - `{${'userId'}}`, - encodeURIComponent(String(userId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a set of roles with the corresponding IDs. - * @param {V1GetRolesByIDRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRolesByID(body: V1GetRolesByIDRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling getRolesByID.', - ); - } - const localVarPath = `/api/v1/roles/search/by-ids`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary ListRoles returns roles and groups/users granted that role. - * @param {V1ListRolesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listRoles(body: V1ListRolesRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling listRoles.', - ); - } - const localVarPath = `/api/v1/roles/search`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary RemoveAssignments removes a set of role assignments from the system. - * @param {V1RemoveAssignmentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - removeAssignments(body: V1RemoveAssignmentsRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling removeAssignments.', - ); - } - const localVarPath = `/api/v1/roles/remove-assignments`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Search for roles assignable to a given scope. - * @param {V1SearchRolesAssignableToScopeRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchRolesAssignableToScope( - body: V1SearchRolesAssignableToScopeRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling searchRolesAssignableToScope.', - ); - } - const localVarPath = `/api/v1/roles/search/by-assignability`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * RBACApi - functional programming interface - * @export - */ -export const RBACApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary AssignRoles adds a set of role assignments to the system. - * @param {V1AssignRolesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assignRoles( - body: V1AssignRolesRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = RBACApiFetchParamCreator(configuration).assignRoles(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get groups and users assigned to a given workspace with what roles are assigned. - * @param {number} workspaceId ID of workspace getting groups and users. - * @param {string} [name] Name of groups and users to search by. Name filters by group name for groups. Name filters by display name then username if display name is null for users. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGroupsAndUsersAssignedToWorkspace( - workspaceId: number, - name?: string, - options?: any, - ): ( - fetch?: FetchAPI, - basePath?: string, - ) => Promise { - const localVarFetchArgs = RBACApiFetchParamCreator( - configuration, - ).getGroupsAndUsersAssignedToWorkspace(workspaceId, name, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary List all permissions for the logged in user in all scopes. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getPermissionsSummary( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = - RBACApiFetchParamCreator(configuration).getPermissionsSummary(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the roles which are assigned to a group. - * @param {number} groupId The id of the group to search for role assignments for - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRolesAssignedToGroup( - groupId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = RBACApiFetchParamCreator(configuration).getRolesAssignedToGroup( - groupId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the roles which are assigned to a user. - * @param {number} userId The id of the user to search for role assignments for - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRolesAssignedToUser( - userId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = RBACApiFetchParamCreator(configuration).getRolesAssignedToUser( - userId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a set of roles with the corresponding IDs. - * @param {V1GetRolesByIDRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRolesByID( - body: V1GetRolesByIDRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = RBACApiFetchParamCreator(configuration).getRolesByID(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary ListRoles returns roles and groups/users granted that role. - * @param {V1ListRolesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listRoles( - body: V1ListRolesRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = RBACApiFetchParamCreator(configuration).listRoles(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary RemoveAssignments removes a set of role assignments from the system. - * @param {V1RemoveAssignmentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - removeAssignments( - body: V1RemoveAssignmentsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = RBACApiFetchParamCreator(configuration).removeAssignments( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Search for roles assignable to a given scope. - * @param {V1SearchRolesAssignableToScopeRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchRolesAssignableToScope( - body: V1SearchRolesAssignableToScopeRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = RBACApiFetchParamCreator( - configuration, - ).searchRolesAssignableToScope(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * RBACApi - factory interface - * @export - */ -export const RBACApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary AssignRoles adds a set of role assignments to the system. - * @param {V1AssignRolesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - assignRoles(body: V1AssignRolesRequest, options?: any) { - return RBACApiFp(configuration).assignRoles(body, options)(fetch, basePath); - }, - /** - * - * @summary Get groups and users assigned to a given workspace with what roles are assigned. - * @param {number} workspaceId ID of workspace getting groups and users. - * @param {string} [name] Name of groups and users to search by. Name filters by group name for groups. Name filters by display name then username if display name is null for users. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getGroupsAndUsersAssignedToWorkspace(workspaceId: number, name?: string, options?: any) { - return RBACApiFp(configuration).getGroupsAndUsersAssignedToWorkspace( - workspaceId, - name, - options, - )(fetch, basePath); - }, - /** - * - * @summary List all permissions for the logged in user in all scopes. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getPermissionsSummary(options?: any) { - return RBACApiFp(configuration).getPermissionsSummary(options)(fetch, basePath); - }, - /** - * - * @summary Get the roles which are assigned to a group. - * @param {number} groupId The id of the group to search for role assignments for - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRolesAssignedToGroup(groupId: number, options?: any) { - return RBACApiFp(configuration).getRolesAssignedToGroup(groupId, options)(fetch, basePath); - }, - /** - * - * @summary Get the roles which are assigned to a user. - * @param {number} userId The id of the user to search for role assignments for - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRolesAssignedToUser(userId: number, options?: any) { - return RBACApiFp(configuration).getRolesAssignedToUser(userId, options)(fetch, basePath); - }, - /** - * - * @summary Get a set of roles with the corresponding IDs. - * @param {V1GetRolesByIDRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getRolesByID(body: V1GetRolesByIDRequest, options?: any) { - return RBACApiFp(configuration).getRolesByID(body, options)(fetch, basePath); - }, - /** - * - * @summary ListRoles returns roles and groups/users granted that role. - * @param {V1ListRolesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listRoles(body: V1ListRolesRequest, options?: any) { - return RBACApiFp(configuration).listRoles(body, options)(fetch, basePath); - }, - /** - * - * @summary RemoveAssignments removes a set of role assignments from the system. - * @param {V1RemoveAssignmentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - removeAssignments(body: V1RemoveAssignmentsRequest, options?: any) { - return RBACApiFp(configuration).removeAssignments(body, options)(fetch, basePath); - }, - /** - * - * @summary Search for roles assignable to a given scope. - * @param {V1SearchRolesAssignableToScopeRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - searchRolesAssignableToScope(body: V1SearchRolesAssignableToScopeRequest, options?: any) { - return RBACApiFp(configuration).searchRolesAssignableToScope(body, options)(fetch, basePath); - }, - }; -}; - -/** - * RBACApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class RBACApi extends BaseAPI { - /** - * - * @summary AssignRoles adds a set of role assignments to the system. - * @param {V1AssignRolesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RBACApi - */ - public assignRoles(body: V1AssignRolesRequest, options?: any) { - return RBACApiFp(this.configuration).assignRoles(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get groups and users assigned to a given workspace with what roles are assigned. - * @param {number} workspaceId ID of workspace getting groups and users. - * @param {string} [name] Name of groups and users to search by. Name filters by group name for groups. Name filters by display name then username if display name is null for users. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RBACApi - */ - public getGroupsAndUsersAssignedToWorkspace(workspaceId: number, name?: string, options?: any) { - return RBACApiFp(this.configuration).getGroupsAndUsersAssignedToWorkspace( - workspaceId, - name, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary List all permissions for the logged in user in all scopes. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RBACApi - */ - public getPermissionsSummary(options?: any) { - return RBACApiFp(this.configuration).getPermissionsSummary(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get the roles which are assigned to a group. - * @param {number} groupId The id of the group to search for role assignments for - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RBACApi - */ - public getRolesAssignedToGroup(groupId: number, options?: any) { - return RBACApiFp(this.configuration).getRolesAssignedToGroup(groupId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get the roles which are assigned to a user. - * @param {number} userId The id of the user to search for role assignments for - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RBACApi - */ - public getRolesAssignedToUser(userId: number, options?: any) { - return RBACApiFp(this.configuration).getRolesAssignedToUser(userId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a set of roles with the corresponding IDs. - * @param {V1GetRolesByIDRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RBACApi - */ - public getRolesByID(body: V1GetRolesByIDRequest, options?: any) { - return RBACApiFp(this.configuration).getRolesByID(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary ListRoles returns roles and groups/users granted that role. - * @param {V1ListRolesRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RBACApi - */ - public listRoles(body: V1ListRolesRequest, options?: any) { - return RBACApiFp(this.configuration).listRoles(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary RemoveAssignments removes a set of role assignments from the system. - * @param {V1RemoveAssignmentsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RBACApi - */ - public removeAssignments(body: V1RemoveAssignmentsRequest, options?: any) { - return RBACApiFp(this.configuration).removeAssignments(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Search for roles assignable to a given scope. - * @param {V1SearchRolesAssignableToScopeRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof RBACApi - */ - public searchRolesAssignableToScope(body: V1SearchRolesAssignableToScopeRequest, options?: any) { - return RBACApiFp(this.configuration).searchRolesAssignableToScope(body, options)( - this.fetch, - this.basePath, - ); - } -} - -/** - * ShellsApi - fetch parameter creator - * @export - */ -export const ShellsApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Get the requested shell. - * @param {string} shellId The id of the shell. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getShell(shellId: string, options: any = {}): FetchArgs { - // verify required parameter 'shellId' is not null or undefined - if (shellId === null || shellId === undefined) { - throw new RequiredError( - 'shellId', - 'Required parameter shellId was null or undefined when calling getShell.', - ); - } - const localVarPath = `/api/v1/shells/{shellId}`.replace( - `{${'shellId'}}`, - encodeURIComponent(String(shellId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of shells. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort shells by the given field. - SORT_BY_UNSPECIFIED: Returns shells in an unsorted list. - SORT_BY_ID: Returns shells sorted by id. - SORT_BY_DESCRIPTION: Returns shells sorted by description. - SORT_BY_START_TIME: Return shells sorted by start time. - SORT_BY_WORKSPACE_ID: Return shells sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order shells in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of shells before returning results. Negative values denote number of shells to skip from the end before returning results. - * @param {number} [limit] Limit the number of shells. A value of 0 denotes no limit. - * @param {Array} [users] Limit shells to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit shells to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getShells( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/shells`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (users) { - localVarQueryParameter['users'] = users; - } - - if (userIds) { - localVarQueryParameter['userIds'] = userIds; - } - - if (workspaceId !== undefined) { - localVarQueryParameter['workspaceId'] = workspaceId; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Kill the requested shell. - * @param {string} shellId The id of the shell. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killShell(shellId: string, options: any = {}): FetchArgs { - // verify required parameter 'shellId' is not null or undefined - if (shellId === null || shellId === undefined) { - throw new RequiredError( - 'shellId', - 'Required parameter shellId was null or undefined when calling killShell.', - ); - } - const localVarPath = `/api/v1/shells/{shellId}/kill`.replace( - `{${'shellId'}}`, - encodeURIComponent(String(shellId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Launch a shell. - * @param {V1LaunchShellRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - launchShell(body: V1LaunchShellRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling launchShell.', - ); - } - const localVarPath = `/api/v1/shells`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Set the priority of the requested shell. - * @param {string} shellId The id of the shell. - * @param {V1SetShellPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setShellPriority( - shellId: string, - body: V1SetShellPriorityRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'shellId' is not null or undefined - if (shellId === null || shellId === undefined) { - throw new RequiredError( - 'shellId', - 'Required parameter shellId was null or undefined when calling setShellPriority.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling setShellPriority.', - ); - } - const localVarPath = `/api/v1/shells/{shellId}/set_priority`.replace( - `{${'shellId'}}`, - encodeURIComponent(String(shellId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * ShellsApi - functional programming interface - * @export - */ -export const ShellsApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Get the requested shell. - * @param {string} shellId The id of the shell. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getShell( - shellId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ShellsApiFetchParamCreator(configuration).getShell( - shellId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of shells. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort shells by the given field. - SORT_BY_UNSPECIFIED: Returns shells in an unsorted list. - SORT_BY_ID: Returns shells sorted by id. - SORT_BY_DESCRIPTION: Returns shells sorted by description. - SORT_BY_START_TIME: Return shells sorted by start time. - SORT_BY_WORKSPACE_ID: Return shells sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order shells in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of shells before returning results. Negative values denote number of shells to skip from the end before returning results. - * @param {number} [limit] Limit the number of shells. A value of 0 denotes no limit. - * @param {Array} [users] Limit shells to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit shells to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getShells( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ShellsApiFetchParamCreator(configuration).getShells( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Kill the requested shell. - * @param {string} shellId The id of the shell. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killShell( - shellId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ShellsApiFetchParamCreator(configuration).killShell( - shellId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Launch a shell. - * @param {V1LaunchShellRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - launchShell( - body: V1LaunchShellRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ShellsApiFetchParamCreator(configuration).launchShell( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Set the priority of the requested shell. - * @param {string} shellId The id of the shell. - * @param {V1SetShellPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setShellPriority( - shellId: string, - body: V1SetShellPriorityRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = ShellsApiFetchParamCreator(configuration).setShellPriority( - shellId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * ShellsApi - factory interface - * @export - */ -export const ShellsApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Get the requested shell. - * @param {string} shellId The id of the shell. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getShell(shellId: string, options?: any) { - return ShellsApiFp(configuration).getShell(shellId, options)(fetch, basePath); - }, - /** - * - * @summary Get a list of shells. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort shells by the given field. - SORT_BY_UNSPECIFIED: Returns shells in an unsorted list. - SORT_BY_ID: Returns shells sorted by id. - SORT_BY_DESCRIPTION: Returns shells sorted by description. - SORT_BY_START_TIME: Return shells sorted by start time. - SORT_BY_WORKSPACE_ID: Return shells sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order shells in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of shells before returning results. Negative values denote number of shells to skip from the end before returning results. - * @param {number} [limit] Limit the number of shells. A value of 0 denotes no limit. - * @param {Array} [users] Limit shells to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit shells to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getShells( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ) { - return ShellsApiFp(configuration).getShells( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - )(fetch, basePath); - }, - /** - * - * @summary Kill the requested shell. - * @param {string} shellId The id of the shell. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killShell(shellId: string, options?: any) { - return ShellsApiFp(configuration).killShell(shellId, options)(fetch, basePath); - }, - /** - * - * @summary Launch a shell. - * @param {V1LaunchShellRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - launchShell(body: V1LaunchShellRequest, options?: any) { - return ShellsApiFp(configuration).launchShell(body, options)(fetch, basePath); - }, - /** - * - * @summary Set the priority of the requested shell. - * @param {string} shellId The id of the shell. - * @param {V1SetShellPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setShellPriority(shellId: string, body: V1SetShellPriorityRequest, options?: any) { - return ShellsApiFp(configuration).setShellPriority(shellId, body, options)(fetch, basePath); - }, - }; -}; - -/** - * ShellsApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class ShellsApi extends BaseAPI { - /** - * - * @summary Get the requested shell. - * @param {string} shellId The id of the shell. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ShellsApi - */ - public getShell(shellId: string, options?: any) { - return ShellsApiFp(this.configuration).getShell(shellId, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get a list of shells. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort shells by the given field. - SORT_BY_UNSPECIFIED: Returns shells in an unsorted list. - SORT_BY_ID: Returns shells sorted by id. - SORT_BY_DESCRIPTION: Returns shells sorted by description. - SORT_BY_START_TIME: Return shells sorted by start time. - SORT_BY_WORKSPACE_ID: Return shells sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order shells in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of shells before returning results. Negative values denote number of shells to skip from the end before returning results. - * @param {number} [limit] Limit the number of shells. A value of 0 denotes no limit. - * @param {Array} [users] Limit shells to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit shells to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ShellsApi - */ - public getShells( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ) { - return ShellsApiFp(this.configuration).getShells( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Kill the requested shell. - * @param {string} shellId The id of the shell. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ShellsApi - */ - public killShell(shellId: string, options?: any) { - return ShellsApiFp(this.configuration).killShell(shellId, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Launch a shell. - * @param {V1LaunchShellRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ShellsApi - */ - public launchShell(body: V1LaunchShellRequest, options?: any) { - return ShellsApiFp(this.configuration).launchShell(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Set the priority of the requested shell. - * @param {string} shellId The id of the shell. - * @param {V1SetShellPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof ShellsApi - */ - public setShellPriority(shellId: string, body: V1SetShellPriorityRequest, options?: any) { - return ShellsApiFp(this.configuration).setShellPriority( - shellId, - body, - options, - )(this.fetch, this.basePath); - } -} - -/** - * TasksApi - fetch parameter creator - * @export - */ -export const TasksApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Get a count of active tasks. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getActiveTasksCount(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/tasks/count`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Check the status of a requested task. - * @param {string} taskId The requested task id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTask(taskId: string, options: any = {}): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling getTask.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the model definition of a task. - * @param {string} taskId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTaskContextDirectory(taskId: string, options: any = {}): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling getTaskContextDirectory.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}/context_directory`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get all tasks. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTasks(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/tasks`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Stream task logs. - * @param {string} taskId The id of the task. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [allocationIds] Limit the task logs to particular allocations. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogs( - taskId: string, - limit?: number, - follow?: boolean, - allocationIds?: Array, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options: any = {}, - ): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling taskLogs.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}/logs`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - if (allocationIds) { - localVarQueryParameter['allocationIds'] = allocationIds; - } - - if (agentIds) { - localVarQueryParameter['agentIds'] = agentIds; - } - - if (containerIds) { - localVarQueryParameter['containerIds'] = containerIds; - } - - if (rankIds) { - localVarQueryParameter['rankIds'] = rankIds; - } - - if (levels) { - localVarQueryParameter['levels'] = levels; - } - - if (stdtypes) { - localVarQueryParameter['stdtypes'] = stdtypes; - } - - if (sources) { - localVarQueryParameter['sources'] = sources; - } - - if (timestampBefore) { - localVarQueryParameter['timestampBefore'] = - typeof timestampBefore === 'string' ? timestampBefore : timestampBefore.toISOString(); - } - - if (timestampAfter) { - localVarQueryParameter['timestampAfter'] = - typeof timestampAfter === 'string' ? timestampAfter : timestampAfter.toISOString(); - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (searchText !== undefined) { - localVarQueryParameter['searchText'] = searchText; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Stream task log fields. - * @param {string} taskId The ID of the task. - * @param {boolean} [follow] Continue following fields until the task stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogsFields(taskId: string, follow?: boolean, options: any = {}): FetchArgs { - // verify required parameter 'taskId' is not null or undefined - if (taskId === null || taskId === undefined) { - throw new RequiredError( - 'taskId', - 'Required parameter taskId was null or undefined when calling taskLogsFields.', - ); - } - const localVarPath = `/api/v1/tasks/{taskId}/logs/fields`.replace( - `{${'taskId'}}`, - encodeURIComponent(String(taskId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * TasksApi - functional programming interface - * @export - */ -export const TasksApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Get a count of active tasks. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getActiveTasksCount( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = - TasksApiFetchParamCreator(configuration).getActiveTasksCount(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Check the status of a requested task. - * @param {string} taskId The requested task id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTask( - taskId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TasksApiFetchParamCreator(configuration).getTask(taskId, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the model definition of a task. - * @param {string} taskId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTaskContextDirectory( - taskId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TasksApiFetchParamCreator(configuration).getTaskContextDirectory( - taskId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get all tasks. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTasks(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TasksApiFetchParamCreator(configuration).getTasks(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream task logs. - * @param {string} taskId The id of the task. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [allocationIds] Limit the task logs to particular allocations. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogs( - taskId: string, - limit?: number, - follow?: boolean, - allocationIds?: Array, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TasksApiFetchParamCreator(configuration).taskLogs( - taskId, - limit, - follow, - allocationIds, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream task log fields. - * @param {string} taskId The ID of the task. - * @param {boolean} [follow] Continue following fields until the task stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogsFields( - taskId: string, - follow?: boolean, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TasksApiFetchParamCreator(configuration).taskLogsFields( - taskId, - follow, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * TasksApi - factory interface - * @export - */ -export const TasksApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Get a count of active tasks. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getActiveTasksCount(options?: any) { - return TasksApiFp(configuration).getActiveTasksCount(options)(fetch, basePath); - }, - /** - * - * @summary Check the status of a requested task. - * @param {string} taskId The requested task id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTask(taskId: string, options?: any) { - return TasksApiFp(configuration).getTask(taskId, options)(fetch, basePath); - }, - /** - * - * @summary Get the model definition of a task. - * @param {string} taskId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTaskContextDirectory(taskId: string, options?: any) { - return TasksApiFp(configuration).getTaskContextDirectory(taskId, options)(fetch, basePath); - }, - /** - * - * @summary Get all tasks. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTasks(options?: any) { - return TasksApiFp(configuration).getTasks(options)(fetch, basePath); - }, - /** - * - * @summary Stream task logs. - * @param {string} taskId The id of the task. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [allocationIds] Limit the task logs to particular allocations. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogs( - taskId: string, - limit?: number, - follow?: boolean, - allocationIds?: Array, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ) { - return TasksApiFp(configuration).taskLogs( - taskId, - limit, - follow, - allocationIds, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - )(fetch, basePath); - }, - /** - * - * @summary Stream task log fields. - * @param {string} taskId The ID of the task. - * @param {boolean} [follow] Continue following fields until the task stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - taskLogsFields(taskId: string, follow?: boolean, options?: any) { - return TasksApiFp(configuration).taskLogsFields(taskId, follow, options)(fetch, basePath); - }, - }; -}; - -/** - * TasksApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class TasksApi extends BaseAPI { - /** - * - * @summary Get a count of active tasks. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public getActiveTasksCount(options?: any) { - return TasksApiFp(this.configuration).getActiveTasksCount(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Check the status of a requested task. - * @param {string} taskId The requested task id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public getTask(taskId: string, options?: any) { - return TasksApiFp(this.configuration).getTask(taskId, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get the model definition of a task. - * @param {string} taskId The id of the experiment. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public getTaskContextDirectory(taskId: string, options?: any) { - return TasksApiFp(this.configuration).getTaskContextDirectory(taskId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get all tasks. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public getTasks(options?: any) { - return TasksApiFp(this.configuration).getTasks(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Stream task logs. - * @param {string} taskId The id of the task. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [allocationIds] Limit the task logs to particular allocations. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public taskLogs( - taskId: string, - limit?: number, - follow?: boolean, - allocationIds?: Array, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ) { - return TasksApiFp(this.configuration).taskLogs( - taskId, - limit, - follow, - allocationIds, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Stream task log fields. - * @param {string} taskId The ID of the task. - * @param {boolean} [follow] Continue following fields until the task stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TasksApi - */ - public taskLogsFields(taskId: string, follow?: boolean, options?: any) { - return TasksApiFp(this.configuration).taskLogsFields( - taskId, - follow, - options, - )(this.fetch, this.basePath); - } -} - -/** - * TemplatesApi - fetch parameter creator - * @export - */ -export const TemplatesApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Delete a template. - * @param {string} templateName The id of the template. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteTemplate(templateName: string, options: any = {}): FetchArgs { - // verify required parameter 'templateName' is not null or undefined - if (templateName === null || templateName === undefined) { - throw new RequiredError( - 'templateName', - 'Required parameter templateName was null or undefined when calling deleteTemplate.', - ); - } - const localVarPath = `/api/v1/templates/{templateName}`.replace( - `{${'templateName'}}`, - encodeURIComponent(String(templateName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the requested template. - * @param {string} templateName The id of the template. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTemplate(templateName: string, options: any = {}): FetchArgs { - // verify required parameter 'templateName' is not null or undefined - if (templateName === null || templateName === undefined) { - throw new RequiredError( - 'templateName', - 'Required parameter templateName was null or undefined when calling getTemplate.', - ); - } - const localVarPath = `/api/v1/templates/{templateName}`.replace( - `{${'templateName'}}`, - encodeURIComponent(String(templateName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of templates. - * @param {V1GetTemplatesRequestSortBy} [sortBy] Sort templates by the given field. - SORT_BY_UNSPECIFIED: Returns templates in an unsorted list. - SORT_BY_NAME: Returns templates sorted by name. - * @param {V1OrderBy} [orderBy] Order templates in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of templates before returning results. Negative values denote number of templates to skip from the end before returning results. - * @param {number} [limit] Limit the number of templates. A value of 0 denotes no limit. - * @param {string} [name] Limit templates to those that match the name. - * @param {Array} [workspaceIds] Limit templates to those that match the workspace id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTemplates( - sortBy?: V1GetTemplatesRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - workspaceIds?: Array, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/templates`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (name !== undefined) { - localVarQueryParameter['name'] = name; - } - - if (workspaceIds) { - localVarQueryParameter['workspaceIds'] = workspaceIds; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Patch template config. - * @param {string} templateName The name of the template. - * @param {any} body The template value. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchTemplateConfig(templateName: string, body: any, options: any = {}): FetchArgs { - // verify required parameter 'templateName' is not null or undefined - if (templateName === null || templateName === undefined) { - throw new RequiredError( - 'templateName', - 'Required parameter templateName was null or undefined when calling patchTemplateConfig.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchTemplateConfig.', - ); - } - const localVarPath = `/api/v1/templates/{templateName}`.replace( - `{${'templateName'}}`, - encodeURIComponent(String(templateName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Patch template name. - * @param {V1PatchTemplateNameRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchTemplateName(body: V1PatchTemplateNameRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchTemplateName.', - ); - } - const localVarPath = `/api/v1/template/rename`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Post a new template. - * @param {string} templateName The name of the template. - * @param {V1Template} body The template to put. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTemplate(templateName: string, body: V1Template, options: any = {}): FetchArgs { - // verify required parameter 'templateName' is not null or undefined - if (templateName === null || templateName === undefined) { - throw new RequiredError( - 'templateName', - 'Required parameter templateName was null or undefined when calling postTemplate.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postTemplate.', - ); - } - const localVarPath = `/api/v1/templates/{templateName}`.replace( - `{${'templateName'}}`, - encodeURIComponent(String(templateName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Update or create (upsert) the requested template. - * @param {string} templateName The name of the template. - * @param {V1Template} body The template to put. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putTemplate(templateName: string, body: V1Template, options: any = {}): FetchArgs { - // verify required parameter 'templateName' is not null or undefined - if (templateName === null || templateName === undefined) { - throw new RequiredError( - 'templateName', - 'Required parameter templateName was null or undefined when calling putTemplate.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling putTemplate.', - ); - } - const localVarPath = `/api/v1/templates/{templateName}`.replace( - `{${'templateName'}}`, - encodeURIComponent(String(templateName)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * TemplatesApi - functional programming interface - * @export - */ -export const TemplatesApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Delete a template. - * @param {string} templateName The id of the template. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteTemplate( - templateName: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).deleteTemplate( - templateName, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the requested template. - * @param {string} templateName The id of the template. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTemplate( - templateName: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).getTemplate( - templateName, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of templates. - * @param {V1GetTemplatesRequestSortBy} [sortBy] Sort templates by the given field. - SORT_BY_UNSPECIFIED: Returns templates in an unsorted list. - SORT_BY_NAME: Returns templates sorted by name. - * @param {V1OrderBy} [orderBy] Order templates in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of templates before returning results. Negative values denote number of templates to skip from the end before returning results. - * @param {number} [limit] Limit the number of templates. A value of 0 denotes no limit. - * @param {string} [name] Limit templates to those that match the name. - * @param {Array} [workspaceIds] Limit templates to those that match the workspace id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTemplates( - sortBy?: V1GetTemplatesRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - workspaceIds?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).getTemplates( - sortBy, - orderBy, - offset, - limit, - name, - workspaceIds, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Patch template config. - * @param {string} templateName The name of the template. - * @param {any} body The template value. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchTemplateConfig( - templateName: string, - body: any, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).patchTemplateConfig( - templateName, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Patch template name. - * @param {V1PatchTemplateNameRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchTemplateName( - body: V1PatchTemplateNameRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).patchTemplateName( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Post a new template. - * @param {string} templateName The name of the template. - * @param {V1Template} body The template to put. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTemplate( - templateName: string, - body: V1Template, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).postTemplate( - templateName, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Update or create (upsert) the requested template. - * @param {string} templateName The name of the template. - * @param {V1Template} body The template to put. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putTemplate( - templateName: string, - body: V1Template, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).putTemplate( - templateName, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * TemplatesApi - factory interface - * @export - */ -export const TemplatesApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Delete a template. - * @param {string} templateName The id of the template. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteTemplate(templateName: string, options?: any) { - return TemplatesApiFp(configuration).deleteTemplate(templateName, options)(fetch, basePath); - }, - /** - * - * @summary Get the requested template. - * @param {string} templateName The id of the template. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTemplate(templateName: string, options?: any) { - return TemplatesApiFp(configuration).getTemplate(templateName, options)(fetch, basePath); - }, - /** - * - * @summary Get a list of templates. - * @param {V1GetTemplatesRequestSortBy} [sortBy] Sort templates by the given field. - SORT_BY_UNSPECIFIED: Returns templates in an unsorted list. - SORT_BY_NAME: Returns templates sorted by name. - * @param {V1OrderBy} [orderBy] Order templates in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of templates before returning results. Negative values denote number of templates to skip from the end before returning results. - * @param {number} [limit] Limit the number of templates. A value of 0 denotes no limit. - * @param {string} [name] Limit templates to those that match the name. - * @param {Array} [workspaceIds] Limit templates to those that match the workspace id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTemplates( - sortBy?: V1GetTemplatesRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - workspaceIds?: Array, - options?: any, - ) { - return TemplatesApiFp(configuration).getTemplates( - sortBy, - orderBy, - offset, - limit, - name, - workspaceIds, - options, - )(fetch, basePath); - }, - /** - * - * @summary Patch template config. - * @param {string} templateName The name of the template. - * @param {any} body The template value. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchTemplateConfig(templateName: string, body: any, options?: any) { - return TemplatesApiFp(configuration).patchTemplateConfig( - templateName, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Patch template name. - * @param {V1PatchTemplateNameRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - patchTemplateName(body: V1PatchTemplateNameRequest, options?: any) { - return TemplatesApiFp(configuration).patchTemplateName(body, options)(fetch, basePath); - }, - /** - * - * @summary Post a new template. - * @param {string} templateName The name of the template. - * @param {V1Template} body The template to put. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postTemplate(templateName: string, body: V1Template, options?: any) { - return TemplatesApiFp(configuration).postTemplate( - templateName, - body, - options, - )(fetch, basePath); - }, - /** - * - * @summary Update or create (upsert) the requested template. - * @param {string} templateName The name of the template. - * @param {V1Template} body The template to put. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putTemplate(templateName: string, body: V1Template, options?: any) { - return TemplatesApiFp(configuration).putTemplate( - templateName, - body, - options, - )(fetch, basePath); - }, - }; -}; - -/** - * TemplatesApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class TemplatesApi extends BaseAPI { - /** - * - * @summary Delete a template. - * @param {string} templateName The id of the template. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TemplatesApi - */ - public deleteTemplate(templateName: string, options?: any) { - return TemplatesApiFp(this.configuration).deleteTemplate(templateName, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get the requested template. - * @param {string} templateName The id of the template. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TemplatesApi - */ - public getTemplate(templateName: string, options?: any) { - return TemplatesApiFp(this.configuration).getTemplate(templateName, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of templates. - * @param {V1GetTemplatesRequestSortBy} [sortBy] Sort templates by the given field. - SORT_BY_UNSPECIFIED: Returns templates in an unsorted list. - SORT_BY_NAME: Returns templates sorted by name. - * @param {V1OrderBy} [orderBy] Order templates in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of templates before returning results. Negative values denote number of templates to skip from the end before returning results. - * @param {number} [limit] Limit the number of templates. A value of 0 denotes no limit. - * @param {string} [name] Limit templates to those that match the name. - * @param {Array} [workspaceIds] Limit templates to those that match the workspace id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TemplatesApi - */ - public getTemplates( - sortBy?: V1GetTemplatesRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - workspaceIds?: Array, - options?: any, - ) { - return TemplatesApiFp(this.configuration).getTemplates( - sortBy, - orderBy, - offset, - limit, - name, - workspaceIds, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Patch template config. - * @param {string} templateName The name of the template. - * @param {any} body The template value. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TemplatesApi - */ - public patchTemplateConfig(templateName: string, body: any, options?: any) { - return TemplatesApiFp(this.configuration).patchTemplateConfig( - templateName, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Patch template name. - * @param {V1PatchTemplateNameRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TemplatesApi - */ - public patchTemplateName(body: V1PatchTemplateNameRequest, options?: any) { - return TemplatesApiFp(this.configuration).patchTemplateName(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Post a new template. - * @param {string} templateName The name of the template. - * @param {V1Template} body The template to put. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TemplatesApi - */ - public postTemplate(templateName: string, body: V1Template, options?: any) { - return TemplatesApiFp(this.configuration).postTemplate( - templateName, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Update or create (upsert) the requested template. - * @param {string} templateName The name of the template. - * @param {V1Template} body The template to put. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TemplatesApi - */ - public putTemplate(templateName: string, body: V1Template, options?: any) { - return TemplatesApiFp(this.configuration).putTemplate( - templateName, - body, - options, - )(this.fetch, this.basePath); - } -} - -/** - * TensorboardsApi - fetch parameter creator - * @export - */ -export const TensorboardsApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Get the requested tensorboard. - * @param {string} tensorboardId The id of the tensorboard. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTensorboard(tensorboardId: string, options: any = {}): FetchArgs { - // verify required parameter 'tensorboardId' is not null or undefined - if (tensorboardId === null || tensorboardId === undefined) { - throw new RequiredError( - 'tensorboardId', - 'Required parameter tensorboardId was null or undefined when calling getTensorboard.', - ); - } - const localVarPath = `/api/v1/tensorboards/{tensorboardId}`.replace( - `{${'tensorboardId'}}`, - encodeURIComponent(String(tensorboardId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a list of tensorboards. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort tensorboards by the given field. - SORT_BY_UNSPECIFIED: Returns tensorboards in an unsorted list. - SORT_BY_ID: Returns tensorboards sorted by id. - SORT_BY_DESCRIPTION: Returns tensorboards sorted by description. - SORT_BY_START_TIME: Return tensorboards sorted by start time. - SORT_BY_WORKSPACE_ID: Return tensorboards sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order tensorboards in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of tensorboards before returning results. Negative values denote number of tensorboards to skip from the end before returning results. - * @param {number} [limit] Limit the number of tensorboards. A value of 0 denotes no limit. - * @param {Array} [users] Limit tensorboards to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit tensorboards to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit tensorboards to those that are in a specific workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTensorboards( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/tensorboards`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (users) { - localVarQueryParameter['users'] = users; - } - - if (userIds) { - localVarQueryParameter['userIds'] = userIds; - } - - if (workspaceId !== undefined) { - localVarQueryParameter['workspaceId'] = workspaceId; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Kill the requested tensorboard. - * @param {string} tensorboardId The id of the tensorboard. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killTensorboard(tensorboardId: string, options: any = {}): FetchArgs { - // verify required parameter 'tensorboardId' is not null or undefined - if (tensorboardId === null || tensorboardId === undefined) { - throw new RequiredError( - 'tensorboardId', - 'Required parameter tensorboardId was null or undefined when calling killTensorboard.', - ); - } - const localVarPath = `/api/v1/tensorboards/{tensorboardId}/kill`.replace( - `{${'tensorboardId'}}`, - encodeURIComponent(String(tensorboardId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Launch a tensorboard. - * @param {V1LaunchTensorboardRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - launchTensorboard(body: V1LaunchTensorboardRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling launchTensorboard.', - ); - } - const localVarPath = `/api/v1/tensorboards`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Set the priority of the requested TensorBoard. - * @param {string} tensorboardId The id of the TensorBoard. - * @param {V1SetTensorboardPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setTensorboardPriority( - tensorboardId: string, - body: V1SetTensorboardPriorityRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'tensorboardId' is not null or undefined - if (tensorboardId === null || tensorboardId === undefined) { - throw new RequiredError( - 'tensorboardId', - 'Required parameter tensorboardId was null or undefined when calling setTensorboardPriority.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling setTensorboardPriority.', - ); - } - const localVarPath = `/api/v1/tensorboards/{tensorboardId}/set_priority`.replace( - `{${'tensorboardId'}}`, - encodeURIComponent(String(tensorboardId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * TensorboardsApi - functional programming interface - * @export - */ -export const TensorboardsApiFp = function (configuration?: Configuration) { - return { - /** - * - * @summary Get the requested tensorboard. - * @param {string} tensorboardId The id of the tensorboard. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTensorboard( - tensorboardId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TensorboardsApiFetchParamCreator(configuration).getTensorboard( - tensorboardId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of tensorboards. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort tensorboards by the given field. - SORT_BY_UNSPECIFIED: Returns tensorboards in an unsorted list. - SORT_BY_ID: Returns tensorboards sorted by id. - SORT_BY_DESCRIPTION: Returns tensorboards sorted by description. - SORT_BY_START_TIME: Return tensorboards sorted by start time. - SORT_BY_WORKSPACE_ID: Return tensorboards sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order tensorboards in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of tensorboards before returning results. Negative values denote number of tensorboards to skip from the end before returning results. - * @param {number} [limit] Limit the number of tensorboards. A value of 0 denotes no limit. - * @param {Array} [users] Limit tensorboards to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit tensorboards to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit tensorboards to those that are in a specific workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTensorboards( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TensorboardsApiFetchParamCreator(configuration).getTensorboards( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Kill the requested tensorboard. - * @param {string} tensorboardId The id of the tensorboard. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killTensorboard( - tensorboardId: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TensorboardsApiFetchParamCreator(configuration).killTensorboard( - tensorboardId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Launch a tensorboard. - * @param {V1LaunchTensorboardRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - launchTensorboard( - body: V1LaunchTensorboardRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TensorboardsApiFetchParamCreator(configuration).launchTensorboard( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Set the priority of the requested TensorBoard. - * @param {string} tensorboardId The id of the TensorBoard. - * @param {V1SetTensorboardPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setTensorboardPriority( - tensorboardId: string, - body: V1SetTensorboardPriorityRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TensorboardsApiFetchParamCreator( - configuration, - ).setTensorboardPriority(tensorboardId, body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; -}; - -/** - * TensorboardsApi - factory interface - * @export - */ -export const TensorboardsApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Get the requested tensorboard. - * @param {string} tensorboardId The id of the tensorboard. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTensorboard(tensorboardId: string, options?: any) { - return TensorboardsApiFp(configuration).getTensorboard(tensorboardId, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Get a list of tensorboards. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort tensorboards by the given field. - SORT_BY_UNSPECIFIED: Returns tensorboards in an unsorted list. - SORT_BY_ID: Returns tensorboards sorted by id. - SORT_BY_DESCRIPTION: Returns tensorboards sorted by description. - SORT_BY_START_TIME: Return tensorboards sorted by start time. - SORT_BY_WORKSPACE_ID: Return tensorboards sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order tensorboards in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of tensorboards before returning results. Negative values denote number of tensorboards to skip from the end before returning results. - * @param {number} [limit] Limit the number of tensorboards. A value of 0 denotes no limit. - * @param {Array} [users] Limit tensorboards to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit tensorboards to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit tensorboards to those that are in a specific workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTensorboards( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ) { - return TensorboardsApiFp(configuration).getTensorboards( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - )(fetch, basePath); - }, - /** - * - * @summary Kill the requested tensorboard. - * @param {string} tensorboardId The id of the tensorboard. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killTensorboard(tensorboardId: string, options?: any) { - return TensorboardsApiFp(configuration).killTensorboard(tensorboardId, options)( - fetch, - basePath, - ); - }, - /** - * - * @summary Launch a tensorboard. - * @param {V1LaunchTensorboardRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - launchTensorboard(body: V1LaunchTensorboardRequest, options?: any) { - return TensorboardsApiFp(configuration).launchTensorboard(body, options)(fetch, basePath); - }, - /** - * - * @summary Set the priority of the requested TensorBoard. - * @param {string} tensorboardId The id of the TensorBoard. - * @param {V1SetTensorboardPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - setTensorboardPriority( - tensorboardId: string, - body: V1SetTensorboardPriorityRequest, - options?: any, - ) { - return TensorboardsApiFp(configuration).setTensorboardPriority( - tensorboardId, - body, - options, - )(fetch, basePath); - }, - }; -}; - -/** - * TensorboardsApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class TensorboardsApi extends BaseAPI { - /** - * - * @summary Get the requested tensorboard. - * @param {string} tensorboardId The id of the tensorboard. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TensorboardsApi - */ - public getTensorboard(tensorboardId: string, options?: any) { - return TensorboardsApiFp(this.configuration).getTensorboard(tensorboardId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of tensorboards. - * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort tensorboards by the given field. - SORT_BY_UNSPECIFIED: Returns tensorboards in an unsorted list. - SORT_BY_ID: Returns tensorboards sorted by id. - SORT_BY_DESCRIPTION: Returns tensorboards sorted by description. - SORT_BY_START_TIME: Return tensorboards sorted by start time. - SORT_BY_WORKSPACE_ID: Return tensorboards sorted by workspace_id. - * @param {V1OrderBy} [orderBy] Order tensorboards in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of tensorboards before returning results. Negative values denote number of tensorboards to skip from the end before returning results. - * @param {number} [limit] Limit the number of tensorboards. A value of 0 denotes no limit. - * @param {Array} [users] Limit tensorboards to those that are owned by users with the specified usernames. - * @param {Array} [userIds] Limit tensorboards to those that are owned by users with the specified userIds. - * @param {number} [workspaceId] Limit tensorboards to those that are in a specific workspace, or 0 for all accessible workspaces. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TensorboardsApi - */ - public getTensorboards( - sortBy?: V1GetTensorboardsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - users?: Array, - userIds?: Array, - workspaceId?: number, - options?: any, - ) { - return TensorboardsApiFp(this.configuration).getTensorboards( - sortBy, - orderBy, - offset, - limit, - users, - userIds, - workspaceId, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Kill the requested tensorboard. - * @param {string} tensorboardId The id of the tensorboard. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TensorboardsApi - */ - public killTensorboard(tensorboardId: string, options?: any) { - return TensorboardsApiFp(this.configuration).killTensorboard(tensorboardId, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Launch a tensorboard. - * @param {V1LaunchTensorboardRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TensorboardsApi - */ - public launchTensorboard(body: V1LaunchTensorboardRequest, options?: any) { - return TensorboardsApiFp(this.configuration).launchTensorboard(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Set the priority of the requested TensorBoard. - * @param {string} tensorboardId The id of the TensorBoard. - * @param {V1SetTensorboardPriorityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TensorboardsApi - */ - public setTensorboardPriority( - tensorboardId: string, - body: V1SetTensorboardPriorityRequest, - options?: any, - ) { - return TensorboardsApiFp(this.configuration).setTensorboardPriority( - tensorboardId, - body, - options, - )(this.fetch, this.basePath); - } -} - -/** - * TrialsApi - fetch parameter creator - * @export - */ -export const TrialsApiFetchParamCreator = function (configuration?: Configuration) { - return { - /** - * - * @summary Get the list of trials for an experiment. - * @param {number} experimentId Limit trials to those that are owned by the specified experiments. - * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. - * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. - * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. - * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getExperimentTrials( - experimentId: number, - sortBy?: V1GetExperimentTrialsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options: any = {}, - ): FetchArgs { - // verify required parameter 'experimentId' is not null or undefined - if (experimentId === null || experimentId === undefined) { - throw new RequiredError( - 'experimentId', - 'Required parameter experimentId was null or undefined when calling getExperimentTrials.', - ); - } - const localVarPath = `/api/v1/experiments/{experimentId}/trials`.replace( - `{${'experimentId'}}`, - encodeURIComponent(String(experimentId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (states) { - localVarQueryParameter['states'] = states; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Stream one or more trial's metrics. - * @param {Array} trialIds Trial IDs to get metrics for. - * @param {string} group The group of metrics to get eg 'training', 'validation', etc. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getMetrics(trialIds: Array, group: string, options: any = {}): FetchArgs { - // verify required parameter 'trialIds' is not null or undefined - if (trialIds === null || trialIds === undefined) { - throw new RequiredError( - 'trialIds', - 'Required parameter trialIds was null or undefined when calling getMetrics.', - ); - } - // verify required parameter 'group' is not null or undefined - if (group === null || group === undefined) { - throw new RequiredError( - 'group', - 'Required parameter group was null or undefined when calling getMetrics.', - ); - } - const localVarPath = `/api/v1/trials/metrics/trial_metrics`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (trialIds) { - localVarQueryParameter['trialIds'] = trialIds; - } - - if (group !== undefined) { - localVarQueryParameter['group'] = group; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Stream one or more trial's training metrics. - * @param {Array} [trialIds] Trial IDs to get metrics for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrainingMetrics(trialIds?: Array, options: any = {}): FetchArgs { - const localVarPath = `/api/v1/trials/metrics/training_metrics`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (trialIds) { - localVarQueryParameter['trialIds'] = trialIds; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get a single trial. - * @param {number} trialId The requested trial's id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrial(trialId: number, options: any = {}): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling getTrial.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Get the list of workloads for a trial. - * @param {number} trialId Limit workloads to those that are owned by the specified trial. - * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. - * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. - * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. - * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. - * @param {boolean} [includeBatchMetrics] Include per-batch metrics. - * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialWorkloads( - trialId: number, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - sortKey?: string, - filter?: GetTrialWorkloadsRequestFilterOption, - includeBatchMetrics?: boolean, - metricType?: V1MetricType, - group?: string, - removeDeletedCheckpoints?: boolean, - options: any = {}, - ): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling getTrialWorkloads.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/workloads`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (sortKey !== undefined) { - localVarQueryParameter['sortKey'] = sortKey; - } - - if (filter !== undefined) { - localVarQueryParameter['filter'] = filter; - } - - if (includeBatchMetrics !== undefined) { - localVarQueryParameter['includeBatchMetrics'] = includeBatchMetrics; - } - - if (metricType !== undefined) { - localVarQueryParameter['metricType'] = metricType; - } - - if (group !== undefined) { - localVarQueryParameter['group'] = group; - } - - if (removeDeletedCheckpoints !== undefined) { - localVarQueryParameter['removeDeletedCheckpoints'] = removeDeletedCheckpoints; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Stream one or more trial's validation metrics. - * @param {Array} [trialIds] Trial IDs to get metrics for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getValidationMetrics(trialIds?: Array, options: any = {}): FetchArgs { - const localVarPath = `/api/v1/trials/metrics/validation_metrics`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (trialIds) { - localVarQueryParameter['trialIds'] = trialIds; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Kill a trial. - * @param {number} id The trial id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - killTrial(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling killTrial.', - ); - } - const localVarPath = `/api/v1/trials/{id}/kill`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Retain logs for a Trial. - * @param {number} trialId The ID of the trial. - * @param {V1PutTrialRetainLogsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - putTrialRetainLogs( - trialId: number, - body: V1PutTrialRetainLogsRequest, - options: any = {}, - ): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling putTrialRetainLogs.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling putTrialRetainLogs.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/retain_logs`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PUT', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - /** - * - * @summary Stream trial logs. - * @param {number} trialId The id of the trial. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. + * + * @summary Get a list of models. + * @param {V1GetModelsRequestSortBy} [sortBy] Sort the models by the given field. - SORT_BY_UNSPECIFIED: Returns models in an unsorted list. - SORT_BY_NAME: Returns models sorted by name. - SORT_BY_DESCRIPTION: Returns models sorted by description. - SORT_BY_CREATION_TIME: Returns models sorted by creation time. - SORT_BY_LAST_UPDATED_TIME: Returns models sorted by last updated time. - SORT_BY_NUM_VERSIONS: Returns models sorted by number of version. - SORT_BY_WORKSPACE: Returns models sorted by workspace name. + * @param {V1OrderBy} [orderBy] Order models in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of models before returning results. Negative values denote number of models to skip from the end before returning results. + * @param {number} [limit] Limit the number of models. A value of 0 denotes no limit. + * @param {string} [name] Limit the models to those matching or partially-matching the name. + * @param {string} [description] Limit the models to those matching or partially-matching the description. + * @param {Array} [labels] Limit the models to those with the following labels. + * @param {boolean} [archived] Limit to unarchived models only. + * @param {Array} [users] Limit the models to those made by the users with the following usernames. + * @param {Array} [workspaceNames] Limit models to those that belong to the following workspace names. + * @param {Array} [userIds] Limit the models to those made by the users with the following userIds. + * @param {number} [id] Limit the models to this model id. + * @param {Array} [workspaceIds] Limit models to those that belong to the following workspace ids. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - trialLogs( - trialId: number, - limit?: number, - follow?: boolean, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options: any = {}, - ): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling trialLogs.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/logs`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - if (agentIds) { - localVarQueryParameter['agentIds'] = agentIds; - } - - if (containerIds) { - localVarQueryParameter['containerIds'] = containerIds; - } - - if (rankIds) { - localVarQueryParameter['rankIds'] = rankIds; - } - - if (levels) { - localVarQueryParameter['levels'] = levels; - } - - if (stdtypes) { - localVarQueryParameter['stdtypes'] = stdtypes; - } - - if (sources) { - localVarQueryParameter['sources'] = sources; - } - - if (timestampBefore) { - localVarQueryParameter['timestampBefore'] = - typeof timestampBefore === 'string' ? timestampBefore : timestampBefore.toISOString(); - } - - if (timestampAfter) { - localVarQueryParameter['timestampAfter'] = - typeof timestampAfter === 'string' ? timestampAfter : timestampAfter.toISOString(); - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (searchText !== undefined) { - localVarQueryParameter['searchText'] = searchText; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getModels(sortBy?: V1GetModelsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, description?: string, labels?: Array, archived?: boolean, users?: Array, workspaceNames?: Array, userIds?: Array, id?: number, workspaceIds?: Array, options?: any) { + return ModelsApiFp(this.configuration).getModels(sortBy, orderBy, offset, limit, name, description, labels, archived, users, workspaceNames, userIds, id, workspaceIds, options)(this.fetch, this.basePath) + } + /** - * - * @summary Stream trial log fields. - * @param {number} trialId The ID of the trial. - * @param {boolean} [follow] Continue following fields until the trial stops. + * + * @summary Get the requested model version. + * @param {string} modelName The name of the model. + * @param {number} modelVersionNum Sequential model version number. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - trialLogsFields(trialId: number, follow?: boolean, options: any = {}): FetchArgs { - // verify required parameter 'trialId' is not null or undefined - if (trialId === null || trialId === undefined) { - throw new RequiredError( - 'trialId', - 'Required parameter trialId was null or undefined when calling trialLogsFields.', - ); - } - const localVarPath = `/api/v1/trials/{trialId}/logs/fields`.replace( - `{${'trialId'}}`, - encodeURIComponent(String(trialId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (follow !== undefined) { - localVarQueryParameter['follow'] = follow; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * TrialsApi - functional programming interface - * @export - */ -export const TrialsApiFp = function (configuration?: Configuration) { - return { + public getModelVersion(modelName: string, modelVersionNum: number, options?: any) { + return ModelsApiFp(this.configuration).getModelVersion(modelName, modelVersionNum, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the list of trials for an experiment. - * @param {number} experimentId Limit trials to those that are owned by the specified experiments. - * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. - * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. - * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. - * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getExperimentTrials( - experimentId: number, - sortBy?: V1GetExperimentTrialsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getExperimentTrials( - experimentId, - sortBy, - orderBy, - offset, - limit, - states, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream one or more trial's metrics. - * @param {Array} trialIds Trial IDs to get metrics for. - * @param {string} group The group of metrics to get eg 'training', 'validation', etc. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getMetrics( - trialIds: Array, - group: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getMetrics( - trialIds, - group, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream one or more trial's training metrics. - * @param {Array} [trialIds] Trial IDs to get metrics for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrainingMetrics( - trialIds?: Array, - options?: any, - ): ( - fetch?: FetchAPI, - basePath?: string, - ) => Promise { - const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getTrainingMetrics( - trialIds, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a single trial. - * @param {number} trialId The requested trial's id. + * + * @summary Get a list of versions for the requested model. + * @param {string} modelName The name of the model. + * @param {V1GetModelVersionsRequestSortBy} [sortBy] Sort the model versions by the given field. - SORT_BY_UNSPECIFIED: Returns model versions in an unsorted list. - SORT_BY_VERSION: Returns model versions sorted by version number. - SORT_BY_CREATION_TIME: Returns model versions sorted by creation_time. + * @param {V1OrderBy} [orderBy] Order model versions in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of model versions before returning results. Negative values denote number of models to skip from the end before returning results. + * @param {number} [limit] Limit the number of model versions. A value of 0 denotes no limit. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - getTrial( - trialId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getTrial( - trialId, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the list of workloads for a trial. - * @param {number} trialId Limit workloads to those that are owned by the specified trial. - * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. - * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. - * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. - * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. - * @param {boolean} [includeBatchMetrics] Include per-batch metrics. - * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. + public getModelVersions(modelName: string, sortBy?: V1GetModelVersionsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, options?: any) { + return ModelsApiFp(this.configuration).getModelVersions(modelName, sortBy, orderBy, offset, limit, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Move a model into a workspace + * @param {string} modelName The target model name. + * @param {V1MoveModelRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - getTrialWorkloads( - trialId: number, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - sortKey?: string, - filter?: GetTrialWorkloadsRequestFilterOption, - includeBatchMetrics?: boolean, - metricType?: V1MetricType, - group?: string, - removeDeletedCheckpoints?: boolean, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getTrialWorkloads( - trialId, - orderBy, - offset, - limit, - sortKey, - filter, - includeBatchMetrics, - metricType, - group, - removeDeletedCheckpoints, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream one or more trial's validation metrics. - * @param {Array} [trialIds] Trial IDs to get metrics for. + public moveModel(modelName: string, body: V1MoveModelRequest, options?: any) { + return ModelsApiFp(this.configuration).moveModel(modelName, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Patch a model's fields. + * @param {string} modelName The name of the model being updated. + * @param {V1PatchModel} body The model desired model fields and values. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - getValidationMetrics( - trialIds?: Array, - options?: any, - ): ( - fetch?: FetchAPI, - basePath?: string, - ) => Promise { - const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getValidationMetrics( - trialIds, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Kill a trial. - * @param {number} id The trial id + public patchModel(modelName: string, body: V1PatchModel, options?: any) { + return ModelsApiFp(this.configuration).patchModel(modelName, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Patch a model version's fields. + * @param {string} modelName The name of the model being updated. + * @param {number} modelVersionNum The model version number being updated. + * @param {V1PatchModelVersion} body Patch payload. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - killTrial( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).killTrial(id, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public patchModelVersion(modelName: string, modelVersionNum: number, body: V1PatchModelVersion, options?: any) { + return ModelsApiFp(this.configuration).patchModelVersion(modelName, modelVersionNum, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Retain logs for a Trial. - * @param {number} trialId The ID of the trial. - * @param {V1PutTrialRetainLogsRequest} body + * + * @summary Create a model in the registry. + * @param {V1PostModelRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - putTrialRetainLogs( - trialId: number, - body: V1PutTrialRetainLogsRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).putTrialRetainLogs( - trialId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream trial logs. - * @param {number} trialId The id of the trial. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. + public postModel(body: V1PostModelRequest, options?: any) { + return ModelsApiFp(this.configuration).postModel(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Create a model version. + * @param {string} modelName The name of the model to add this version to. + * @param {V1PostModelVersionRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - trialLogs( - trialId: number, - limit?: number, - follow?: boolean, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).trialLogs( - trialId, - limit, - follow, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Stream trial log fields. - * @param {number} trialId The ID of the trial. - * @param {boolean} [follow] Continue following fields until the trial stops. + public postModelVersion(modelName: string, body: V1PostModelVersionRequest, options?: any) { + return ModelsApiFp(this.configuration).postModelVersion(modelName, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Unarchive a model + * @param {string} modelName The name of the model to un-archive. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ModelsApi */ - trialLogsFields( - trialId: number, - follow?: boolean, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).trialLogsFields( - trialId, - follow, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; + public unarchiveModel(modelName: string, options?: any) { + return ModelsApiFp(this.configuration).unarchiveModel(modelName, options)(this.fetch, this.basePath) + } + +} + +/** + * NotebooksApi - fetch parameter creator + * @export + */ +export const NotebooksApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the requested notebook. + * @param {string} notebookId The id of the notebook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getNotebook(notebookId: string, options: any = {}): FetchArgs { + // verify required parameter 'notebookId' is not null or undefined + if (notebookId === null || notebookId === undefined) { + throw new RequiredError('notebookId','Required parameter notebookId was null or undefined when calling getNotebook.'); + } + const localVarPath = `/api/v1/notebooks/{notebookId}` + .replace(`{${"notebookId"}}`, encodeURIComponent(String(notebookId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of notebooks. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort notebooks by the given field. - SORT_BY_UNSPECIFIED: Returns notebooks in an unsorted list. - SORT_BY_ID: Returns notebooks sorted by id. - SORT_BY_DESCRIPTION: Returns notebooks sorted by description. - SORT_BY_START_TIME: Return notebooks sorted by start time. - SORT_BY_WORKSPACE_ID: Return notebooks sorted by workspace_id + * @param {V1OrderBy} [orderBy] Order notebooks in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of notebooks before returning results. Negative values denote number of notebooks to skip from the end before returning results. + * @param {number} [limit] Limit the number of notebooks. A value of 0 denotes no limit. + * @param {Array} [users] Limit notebooks to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit notebooks to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getNotebooks(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/notebooks`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (users) { + localVarQueryParameter['users'] = users + } + + if (userIds) { + localVarQueryParameter['userIds'] = userIds + } + + if (workspaceId !== undefined) { + localVarQueryParameter['workspaceId'] = workspaceId + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Kill the requested notebook. + * @param {string} notebookId The id of the notebook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killNotebook(notebookId: string, options: any = {}): FetchArgs { + // verify required parameter 'notebookId' is not null or undefined + if (notebookId === null || notebookId === undefined) { + throw new RequiredError('notebookId','Required parameter notebookId was null or undefined when calling killNotebook.'); + } + const localVarPath = `/api/v1/notebooks/{notebookId}/kill` + .replace(`{${"notebookId"}}`, encodeURIComponent(String(notebookId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Launch a notebook. + * @param {V1LaunchNotebookRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchNotebook(body: V1LaunchNotebookRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling launchNotebook.'); + } + const localVarPath = `/api/v1/notebooks`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Set the priority of the requested notebook. + * @param {string} notebookId The id of the notebook. + * @param {V1SetNotebookPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setNotebookPriority(notebookId: string, body: V1SetNotebookPriorityRequest, options: any = {}): FetchArgs { + // verify required parameter 'notebookId' is not null or undefined + if (notebookId === null || notebookId === undefined) { + throw new RequiredError('notebookId','Required parameter notebookId was null or undefined when calling setNotebookPriority.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling setNotebookPriority.'); + } + const localVarPath = `/api/v1/notebooks/{notebookId}/set_priority` + .replace(`{${"notebookId"}}`, encodeURIComponent(String(notebookId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } }; /** - * TrialsApi - factory interface + * NotebooksApi - functional programming interface * @export */ -export const TrialsApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Get the list of trials for an experiment. - * @param {number} experimentId Limit trials to those that are owned by the specified experiments. - * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. - * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. - * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. - * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getExperimentTrials( - experimentId: number, - sortBy?: V1GetExperimentTrialsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ) { - return TrialsApiFp(configuration).getExperimentTrials( - experimentId, - sortBy, - orderBy, - offset, - limit, - states, - options, - )(fetch, basePath); - }, - /** - * - * @summary Stream one or more trial's metrics. - * @param {Array} trialIds Trial IDs to get metrics for. - * @param {string} group The group of metrics to get eg 'training', 'validation', etc. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getMetrics(trialIds: Array, group: string, options?: any) { - return TrialsApiFp(configuration).getMetrics(trialIds, group, options)(fetch, basePath); - }, +export const NotebooksApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the requested notebook. + * @param {string} notebookId The id of the notebook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getNotebook(notebookId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NotebooksApiFetchParamCreator(configuration).getNotebook(notebookId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of notebooks. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort notebooks by the given field. - SORT_BY_UNSPECIFIED: Returns notebooks in an unsorted list. - SORT_BY_ID: Returns notebooks sorted by id. - SORT_BY_DESCRIPTION: Returns notebooks sorted by description. - SORT_BY_START_TIME: Return notebooks sorted by start time. - SORT_BY_WORKSPACE_ID: Return notebooks sorted by workspace_id + * @param {V1OrderBy} [orderBy] Order notebooks in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of notebooks before returning results. Negative values denote number of notebooks to skip from the end before returning results. + * @param {number} [limit] Limit the number of notebooks. A value of 0 denotes no limit. + * @param {Array} [users] Limit notebooks to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit notebooks to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getNotebooks(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NotebooksApiFetchParamCreator(configuration).getNotebooks(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Kill the requested notebook. + * @param {string} notebookId The id of the notebook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killNotebook(notebookId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NotebooksApiFetchParamCreator(configuration).killNotebook(notebookId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Launch a notebook. + * @param {V1LaunchNotebookRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchNotebook(body: V1LaunchNotebookRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NotebooksApiFetchParamCreator(configuration).launchNotebook(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Set the priority of the requested notebook. + * @param {string} notebookId The id of the notebook. + * @param {V1SetNotebookPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setNotebookPriority(notebookId: string, body: V1SetNotebookPriorityRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = NotebooksApiFetchParamCreator(configuration).setNotebookPriority(notebookId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * NotebooksApi - factory interface + * @export + */ +export const NotebooksApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Get the requested notebook. + * @param {string} notebookId The id of the notebook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getNotebook(notebookId: string, options?: any) { + return NotebooksApiFp(configuration).getNotebook(notebookId, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of notebooks. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort notebooks by the given field. - SORT_BY_UNSPECIFIED: Returns notebooks in an unsorted list. - SORT_BY_ID: Returns notebooks sorted by id. - SORT_BY_DESCRIPTION: Returns notebooks sorted by description. - SORT_BY_START_TIME: Return notebooks sorted by start time. - SORT_BY_WORKSPACE_ID: Return notebooks sorted by workspace_id + * @param {V1OrderBy} [orderBy] Order notebooks in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of notebooks before returning results. Negative values denote number of notebooks to skip from the end before returning results. + * @param {number} [limit] Limit the number of notebooks. A value of 0 denotes no limit. + * @param {Array} [users] Limit notebooks to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit notebooks to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getNotebooks(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any) { + return NotebooksApiFp(configuration).getNotebooks(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options)(fetch, basePath); + }, + /** + * + * @summary Kill the requested notebook. + * @param {string} notebookId The id of the notebook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killNotebook(notebookId: string, options?: any) { + return NotebooksApiFp(configuration).killNotebook(notebookId, options)(fetch, basePath); + }, + /** + * + * @summary Launch a notebook. + * @param {V1LaunchNotebookRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchNotebook(body: V1LaunchNotebookRequest, options?: any) { + return NotebooksApiFp(configuration).launchNotebook(body, options)(fetch, basePath); + }, + /** + * + * @summary Set the priority of the requested notebook. + * @param {string} notebookId The id of the notebook. + * @param {V1SetNotebookPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setNotebookPriority(notebookId: string, body: V1SetNotebookPriorityRequest, options?: any) { + return NotebooksApiFp(configuration).setNotebookPriority(notebookId, body, options)(fetch, basePath); + }, + } +}; + +/** + * NotebooksApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class NotebooksApi extends BaseAPI { /** - * - * @summary Stream one or more trial's training metrics. - * @param {Array} [trialIds] Trial IDs to get metrics for. + * + * @summary Get the requested notebook. + * @param {string} notebookId The id of the notebook. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof NotebooksApi */ - getTrainingMetrics(trialIds?: Array, options?: any) { - return TrialsApiFp(configuration).getTrainingMetrics(trialIds, options)(fetch, basePath); - }, + public getNotebook(notebookId: string, options?: any) { + return NotebooksApiFp(this.configuration).getNotebook(notebookId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a single trial. - * @param {number} trialId The requested trial's id. + * + * @summary Get a list of notebooks. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort notebooks by the given field. - SORT_BY_UNSPECIFIED: Returns notebooks in an unsorted list. - SORT_BY_ID: Returns notebooks sorted by id. - SORT_BY_DESCRIPTION: Returns notebooks sorted by description. - SORT_BY_START_TIME: Return notebooks sorted by start time. - SORT_BY_WORKSPACE_ID: Return notebooks sorted by workspace_id + * @param {V1OrderBy} [orderBy] Order notebooks in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of notebooks before returning results. Negative values denote number of notebooks to skip from the end before returning results. + * @param {number} [limit] Limit the number of notebooks. A value of 0 denotes no limit. + * @param {Array} [users] Limit notebooks to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit notebooks to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof NotebooksApi */ - getTrial(trialId: number, options?: any) { - return TrialsApiFp(configuration).getTrial(trialId, options)(fetch, basePath); - }, + public getNotebooks(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any) { + return NotebooksApiFp(this.configuration).getNotebooks(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the list of workloads for a trial. - * @param {number} trialId Limit workloads to those that are owned by the specified trial. - * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. - * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. - * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. - * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. - * @param {boolean} [includeBatchMetrics] Include per-batch metrics. - * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getTrialWorkloads( - trialId: number, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - sortKey?: string, - filter?: GetTrialWorkloadsRequestFilterOption, - includeBatchMetrics?: boolean, - metricType?: V1MetricType, - group?: string, - removeDeletedCheckpoints?: boolean, - options?: any, - ) { - return TrialsApiFp(configuration).getTrialWorkloads( - trialId, - orderBy, - offset, - limit, - sortKey, - filter, - includeBatchMetrics, - metricType, - group, - removeDeletedCheckpoints, - options, - )(fetch, basePath); - }, - /** - * - * @summary Stream one or more trial's validation metrics. - * @param {Array} [trialIds] Trial IDs to get metrics for. + * + * @summary Kill the requested notebook. + * @param {string} notebookId The id of the notebook. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof NotebooksApi */ - getValidationMetrics(trialIds?: Array, options?: any) { - return TrialsApiFp(configuration).getValidationMetrics(trialIds, options)(fetch, basePath); - }, + public killNotebook(notebookId: string, options?: any) { + return NotebooksApiFp(this.configuration).killNotebook(notebookId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Kill a trial. - * @param {number} id The trial id + * + * @summary Launch a notebook. + * @param {V1LaunchNotebookRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof NotebooksApi */ - killTrial(id: number, options?: any) { - return TrialsApiFp(configuration).killTrial(id, options)(fetch, basePath); - }, + public launchNotebook(body: V1LaunchNotebookRequest, options?: any) { + return NotebooksApiFp(this.configuration).launchNotebook(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Retain logs for a Trial. - * @param {number} trialId The ID of the trial. - * @param {V1PutTrialRetainLogsRequest} body + * + * @summary Set the priority of the requested notebook. + * @param {string} notebookId The id of the notebook. + * @param {V1SetNotebookPriorityRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof NotebooksApi */ - putTrialRetainLogs(trialId: number, body: V1PutTrialRetainLogsRequest, options?: any) { - return TrialsApiFp(configuration).putTrialRetainLogs(trialId, body, options)(fetch, basePath); - }, + public setNotebookPriority(notebookId: string, body: V1SetNotebookPriorityRequest, options?: any) { + return NotebooksApiFp(this.configuration).setNotebookPriority(notebookId, body, options)(this.fetch, this.basePath) + } + +} + +/** + * ProfilerApi - fetch parameter creator + * @export + */ +export const ProfilerApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Stream the available series in a trial's profiler metrics. + * @param {number} trialId The requested trial's id. + * @param {boolean} [follow] Continue streaming labels until the trial stops. Defaults to False. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialProfilerAvailableSeries(trialId: number, follow?: boolean, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling getTrialProfilerAvailableSeries.'); + } + const localVarPath = `/api/v1/trials/{trialId}/profiler/available_series` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream trial profiler metrics. + * @param {number} labelsTrialId The ID of the trial. + * @param {string} [labelsName] The name of the metric. + * @param {string} [labelsAgentId] The agent ID associated with the metric. + * @param {string} [labelsGpuUuid] The GPU UUID associated with the metric. + * @param {TrialProfilerMetricLabelsProfilerMetricType} [labelsMetricType] The type of the metric. - PROFILER_METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - PROFILER_METRIC_TYPE_SYSTEM: For systems metrics, like GPU utilization or memory. - PROFILER_METRIC_TYPE_TIMING: For timing metrics, like how long a backwards pass or getting a batch from the dataloader took. - PROFILER_METRIC_TYPE_MISC: For other miscellaneous metrics. + * @param {boolean} [follow] Continue streaming metrics until the trial stops. Defaults to False. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialProfilerMetrics(labelsTrialId: number, labelsName?: string, labelsAgentId?: string, labelsGpuUuid?: string, labelsMetricType?: TrialProfilerMetricLabelsProfilerMetricType, follow?: boolean, options: any = {}): FetchArgs { + // verify required parameter 'labelsTrialId' is not null or undefined + if (labelsTrialId === null || labelsTrialId === undefined) { + throw new RequiredError('labelsTrialId','Required parameter labelsTrialId was null or undefined when calling getTrialProfilerMetrics.'); + } + const localVarPath = `/api/v1/trials/{labelsTrialId}/profiler/metrics` + .replace(`{${"labelsTrialId"}}`, encodeURIComponent(String(labelsTrialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (labelsName !== undefined) { + localVarQueryParameter['labels.name'] = labelsName + } + + if (labelsAgentId !== undefined) { + localVarQueryParameter['labels.agentId'] = labelsAgentId + } + + if (labelsGpuUuid !== undefined) { + localVarQueryParameter['labels.gpuUuid'] = labelsGpuUuid + } + + if (labelsMetricType !== undefined) { + localVarQueryParameter['labels.metricType'] = labelsMetricType + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ProfilerApi - functional programming interface + * @export + */ +export const ProfilerApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Stream the available series in a trial's profiler metrics. + * @param {number} trialId The requested trial's id. + * @param {boolean} [follow] Continue streaming labels until the trial stops. Defaults to False. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialProfilerAvailableSeries(trialId: number, follow?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProfilerApiFetchParamCreator(configuration).getTrialProfilerAvailableSeries(trialId, follow, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream trial profiler metrics. + * @param {number} labelsTrialId The ID of the trial. + * @param {string} [labelsName] The name of the metric. + * @param {string} [labelsAgentId] The agent ID associated with the metric. + * @param {string} [labelsGpuUuid] The GPU UUID associated with the metric. + * @param {TrialProfilerMetricLabelsProfilerMetricType} [labelsMetricType] The type of the metric. - PROFILER_METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - PROFILER_METRIC_TYPE_SYSTEM: For systems metrics, like GPU utilization or memory. - PROFILER_METRIC_TYPE_TIMING: For timing metrics, like how long a backwards pass or getting a batch from the dataloader took. - PROFILER_METRIC_TYPE_MISC: For other miscellaneous metrics. + * @param {boolean} [follow] Continue streaming metrics until the trial stops. Defaults to False. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialProfilerMetrics(labelsTrialId: number, labelsName?: string, labelsAgentId?: string, labelsGpuUuid?: string, labelsMetricType?: TrialProfilerMetricLabelsProfilerMetricType, follow?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProfilerApiFetchParamCreator(configuration).getTrialProfilerMetrics(labelsTrialId, labelsName, labelsAgentId, labelsGpuUuid, labelsMetricType, follow, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * ProfilerApi - factory interface + * @export + */ +export const ProfilerApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Stream the available series in a trial's profiler metrics. + * @param {number} trialId The requested trial's id. + * @param {boolean} [follow] Continue streaming labels until the trial stops. Defaults to False. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialProfilerAvailableSeries(trialId: number, follow?: boolean, options?: any) { + return ProfilerApiFp(configuration).getTrialProfilerAvailableSeries(trialId, follow, options)(fetch, basePath); + }, + /** + * + * @summary Stream trial profiler metrics. + * @param {number} labelsTrialId The ID of the trial. + * @param {string} [labelsName] The name of the metric. + * @param {string} [labelsAgentId] The agent ID associated with the metric. + * @param {string} [labelsGpuUuid] The GPU UUID associated with the metric. + * @param {TrialProfilerMetricLabelsProfilerMetricType} [labelsMetricType] The type of the metric. - PROFILER_METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - PROFILER_METRIC_TYPE_SYSTEM: For systems metrics, like GPU utilization or memory. - PROFILER_METRIC_TYPE_TIMING: For timing metrics, like how long a backwards pass or getting a batch from the dataloader took. - PROFILER_METRIC_TYPE_MISC: For other miscellaneous metrics. + * @param {boolean} [follow] Continue streaming metrics until the trial stops. Defaults to False. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialProfilerMetrics(labelsTrialId: number, labelsName?: string, labelsAgentId?: string, labelsGpuUuid?: string, labelsMetricType?: TrialProfilerMetricLabelsProfilerMetricType, follow?: boolean, options?: any) { + return ProfilerApiFp(configuration).getTrialProfilerMetrics(labelsTrialId, labelsName, labelsAgentId, labelsGpuUuid, labelsMetricType, follow, options)(fetch, basePath); + }, + } +}; + +/** + * ProfilerApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class ProfilerApi extends BaseAPI { /** - * - * @summary Stream trial logs. - * @param {number} trialId The id of the trial. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. + * + * @summary Stream the available series in a trial's profiler metrics. + * @param {number} trialId The requested trial's id. + * @param {boolean} [follow] Continue streaming labels until the trial stops. Defaults to False. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProfilerApi */ - trialLogs( - trialId: number, - limit?: number, - follow?: boolean, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ) { - return TrialsApiFp(configuration).trialLogs( - trialId, - limit, - follow, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - )(fetch, basePath); - }, - /** - * - * @summary Stream trial log fields. - * @param {number} trialId The ID of the trial. - * @param {boolean} [follow] Continue following fields until the trial stops. + public getTrialProfilerAvailableSeries(trialId: number, follow?: boolean, options?: any) { + return ProfilerApiFp(this.configuration).getTrialProfilerAvailableSeries(trialId, follow, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Stream trial profiler metrics. + * @param {number} labelsTrialId The ID of the trial. + * @param {string} [labelsName] The name of the metric. + * @param {string} [labelsAgentId] The agent ID associated with the metric. + * @param {string} [labelsGpuUuid] The GPU UUID associated with the metric. + * @param {TrialProfilerMetricLabelsProfilerMetricType} [labelsMetricType] The type of the metric. - PROFILER_METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - PROFILER_METRIC_TYPE_SYSTEM: For systems metrics, like GPU utilization or memory. - PROFILER_METRIC_TYPE_TIMING: For timing metrics, like how long a backwards pass or getting a batch from the dataloader took. - PROFILER_METRIC_TYPE_MISC: For other miscellaneous metrics. + * @param {boolean} [follow] Continue streaming metrics until the trial stops. Defaults to False. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProfilerApi */ - trialLogsFields(trialId: number, follow?: boolean, options?: any) { - return TrialsApiFp(configuration).trialLogsFields(trialId, follow, options)(fetch, basePath); - }, - }; -}; + public getTrialProfilerMetrics(labelsTrialId: number, labelsName?: string, labelsAgentId?: string, labelsGpuUuid?: string, labelsMetricType?: TrialProfilerMetricLabelsProfilerMetricType, follow?: boolean, options?: any) { + return ProfilerApiFp(this.configuration).getTrialProfilerMetrics(labelsTrialId, labelsName, labelsAgentId, labelsGpuUuid, labelsMetricType, follow, options)(this.fetch, this.basePath) + } + +} /** - * TrialsApi - object-oriented interface + * ProjectsApi - fetch parameter creator * @export - * @class - * @extends {BaseAPI} */ -export class TrialsApi extends BaseAPI { - /** - * - * @summary Get the list of trials for an experiment. - * @param {number} experimentId Limit trials to those that are owned by the specified experiments. - * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. - * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. - * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. - * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrialsApi - */ - public getExperimentTrials( - experimentId: number, - sortBy?: V1GetExperimentTrialsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - states?: Array, - options?: any, - ) { - return TrialsApiFp(this.configuration).getExperimentTrials( - experimentId, - sortBy, - orderBy, - offset, - limit, - states, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Stream one or more trial's metrics. - * @param {Array} trialIds Trial IDs to get metrics for. - * @param {string} group The group of metrics to get eg 'training', 'validation', etc. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrialsApi - */ - public getMetrics(trialIds: Array, group: string, options?: any) { - return TrialsApiFp(this.configuration).getMetrics( - trialIds, - group, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Stream one or more trial's training metrics. - * @param {Array} [trialIds] Trial IDs to get metrics for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrialsApi - */ - public getTrainingMetrics(trialIds?: Array, options?: any) { - return TrialsApiFp(this.configuration).getTrainingMetrics(trialIds, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a single trial. - * @param {number} trialId The requested trial's id. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrialsApi - */ - public getTrial(trialId: number, options?: any) { - return TrialsApiFp(this.configuration).getTrial(trialId, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get the list of workloads for a trial. - * @param {number} trialId Limit workloads to those that are owned by the specified trial. - * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. - * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. - * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. - * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. - * @param {boolean} [includeBatchMetrics] Include per-batch metrics. - * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. - * @param {string} [group] Metric group (training, validation, etc). - * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrialsApi - */ - public getTrialWorkloads( - trialId: number, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - sortKey?: string, - filter?: GetTrialWorkloadsRequestFilterOption, - includeBatchMetrics?: boolean, - metricType?: V1MetricType, - group?: string, - removeDeletedCheckpoints?: boolean, - options?: any, - ) { - return TrialsApiFp(this.configuration).getTrialWorkloads( - trialId, - orderBy, - offset, - limit, - sortKey, - filter, - includeBatchMetrics, - metricType, - group, - removeDeletedCheckpoints, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Stream one or more trial's validation metrics. - * @param {Array} [trialIds] Trial IDs to get metrics for. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrialsApi - */ - public getValidationMetrics(trialIds?: Array, options?: any) { - return TrialsApiFp(this.configuration).getValidationMetrics(trialIds, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Kill a trial. - * @param {number} id The trial id - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrialsApi - */ - public killTrial(id: number, options?: any) { - return TrialsApiFp(this.configuration).killTrial(id, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Retain logs for a Trial. - * @param {number} trialId The ID of the trial. - * @param {V1PutTrialRetainLogsRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrialsApi - */ - public putTrialRetainLogs(trialId: number, body: V1PutTrialRetainLogsRequest, options?: any) { - return TrialsApiFp(this.configuration).putTrialRetainLogs( - trialId, - body, - options, - )(this.fetch, this.basePath); - } +export const ProjectsApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Add a note to a project. + * @param {number} projectId The id of the project. + * @param {V1Note} body The note to add. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addProjectNote(projectId: number, body: V1Note, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling addProjectNote.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling addProjectNote.'); + } + const localVarPath = `/api/v1/projects/{projectId}/notes` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Archive a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveProject(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling archiveProject.'); + } + const localVarPath = `/api/v1/projects/{id}/archive` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Delete a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteProject(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling deleteProject.'); + } + const localVarPath = `/api/v1/projects/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProject(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling getProject.'); + } + const localVarPath = `/api/v1/projects/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the request project by key. + * @param {string} key The key of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectByKey(key: string, options: any = {}): FetchArgs { + // verify required parameter 'key' is not null or undefined + if (key === null || key === undefined) { + throw new RequiredError('key','Required parameter key was null or undefined when calling getProjectByKey.'); + } + const localVarPath = `/api/v1/projects/key/{key}` + .replace(`{${"key"}}`, encodeURIComponent(String(key))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of columns for experiment list table. + * @param {number} id The id of the project. + * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectColumns(id: number, tableType?: V1TableType, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling getProjectColumns.'); + } + const localVarPath = `/api/v1/projects/{id}/columns` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (tableType !== undefined) { + localVarQueryParameter['tableType'] = tableType + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get metrics range for a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectNumericMetricsRange(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling getProjectNumericMetricsRange.'); + } + const localVarPath = `/api/v1/projects/{id}/experiments/metric-ranges` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get projects by user activity + * @param {number} [limit] Limit number of project entries. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectsByUserActivity(limit?: number, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/user/projects/activity`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Move a project into a workspace. + * @param {number} projectId The id of the project being moved. + * @param {V1MoveProjectRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveProject(projectId: number, body: V1MoveProjectRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling moveProject.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling moveProject.'); + } + const localVarPath = `/api/v1/projects/{projectId}/move` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update a project. + * @param {number} id The id of the project. + * @param {V1PatchProject} body The desired project fields and values to update. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchProject(id: number, body: V1PatchProject, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling patchProject.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchProject.'); + } + const localVarPath = `/api/v1/projects/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create a project. + * @param {number} workspaceId Id of the associated workspace. + * @param {V1PostProjectRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postProject(workspaceId: number, body: V1PostProjectRequest, options: any = {}): FetchArgs { + // verify required parameter 'workspaceId' is not null or undefined + if (workspaceId === null || workspaceId === undefined) { + throw new RequiredError('workspaceId','Required parameter workspaceId was null or undefined when calling postProject.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postProject.'); + } + const localVarPath = `/api/v1/workspaces/{workspaceId}/projects` + .replace(`{${"workspaceId"}}`, encodeURIComponent(String(workspaceId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Set project notes. + * @param {number} projectId The id of the project. + * @param {V1PutProjectNotesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putProjectNotes(projectId: number, body: V1PutProjectNotesRequest, options: any = {}): FetchArgs { + // verify required parameter 'projectId' is not null or undefined + if (projectId === null || projectId === undefined) { + throw new RequiredError('projectId','Required parameter projectId was null or undefined when calling putProjectNotes.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling putProjectNotes.'); + } + const localVarPath = `/api/v1/projects/{projectId}/notes` + .replace(`{${"projectId"}}`, encodeURIComponent(String(projectId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Unarchive a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveProject(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling unarchiveProject.'); + } + const localVarPath = `/api/v1/projects/{id}/unarchive` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; - /** - * - * @summary Stream trial logs. - * @param {number} trialId The id of the trial. - * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. - * @param {boolean} [follow] Continue following logs until the trial stops. - * @param {Array} [agentIds] Limit the trial logs to a subset of agents. - * @param {Array} [containerIds] Limit the trial logs to a subset of containers. - * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. - * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. - * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. - * @param {Array} [sources] Limit the trial logs to a subset of sources. - * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. - * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. - * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {string} [searchText] Search the logs by whether the text contains a substring. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrialsApi - */ - public trialLogs( - trialId: number, - limit?: number, - follow?: boolean, - agentIds?: Array, - containerIds?: Array, - rankIds?: Array, - levels?: Array, - stdtypes?: Array, - sources?: Array, - timestampBefore?: Date | DateString, - timestampAfter?: Date | DateString, - orderBy?: V1OrderBy, - searchText?: string, - options?: any, - ) { - return TrialsApiFp(this.configuration).trialLogs( - trialId, - limit, - follow, - agentIds, - containerIds, - rankIds, - levels, - stdtypes, - sources, - timestampBefore, - timestampAfter, - orderBy, - searchText, - options, - )(this.fetch, this.basePath); - } +/** + * ProjectsApi - functional programming interface + * @export + */ +export const ProjectsApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Add a note to a project. + * @param {number} projectId The id of the project. + * @param {V1Note} body The note to add. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addProjectNote(projectId: number, body: V1Note, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).addProjectNote(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Archive a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveProject(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).archiveProject(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Delete a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteProject(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).deleteProject(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProject(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).getProject(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the request project by key. + * @param {string} key The key of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectByKey(key: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).getProjectByKey(key, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of columns for experiment list table. + * @param {number} id The id of the project. + * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectColumns(id: number, tableType?: V1TableType, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).getProjectColumns(id, tableType, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get metrics range for a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectNumericMetricsRange(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).getProjectNumericMetricsRange(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get projects by user activity + * @param {number} [limit] Limit number of project entries. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectsByUserActivity(limit?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).getProjectsByUserActivity(limit, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Move a project into a workspace. + * @param {number} projectId The id of the project being moved. + * @param {V1MoveProjectRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveProject(projectId: number, body: V1MoveProjectRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).moveProject(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Update a project. + * @param {number} id The id of the project. + * @param {V1PatchProject} body The desired project fields and values to update. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchProject(id: number, body: V1PatchProject, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).patchProject(id, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create a project. + * @param {number} workspaceId Id of the associated workspace. + * @param {V1PostProjectRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postProject(workspaceId: number, body: V1PostProjectRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).postProject(workspaceId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Set project notes. + * @param {number} projectId The id of the project. + * @param {V1PutProjectNotesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putProjectNotes(projectId: number, body: V1PutProjectNotesRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).putProjectNotes(projectId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Unarchive a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveProject(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ProjectsApiFetchParamCreator(configuration).unarchiveProject(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; - /** - * - * @summary Stream trial log fields. - * @param {number} trialId The ID of the trial. - * @param {boolean} [follow] Continue following fields until the trial stops. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof TrialsApi - */ - public trialLogsFields(trialId: number, follow?: boolean, options?: any) { - return TrialsApiFp(this.configuration).trialLogsFields( - trialId, - follow, - options, - )(this.fetch, this.basePath); - } -} +/** + * ProjectsApi - factory interface + * @export + */ +export const ProjectsApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Add a note to a project. + * @param {number} projectId The id of the project. + * @param {V1Note} body The note to add. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addProjectNote(projectId: number, body: V1Note, options?: any) { + return ProjectsApiFp(configuration).addProjectNote(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Archive a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveProject(id: number, options?: any) { + return ProjectsApiFp(configuration).archiveProject(id, options)(fetch, basePath); + }, + /** + * + * @summary Delete a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteProject(id: number, options?: any) { + return ProjectsApiFp(configuration).deleteProject(id, options)(fetch, basePath); + }, + /** + * + * @summary Get the requested project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProject(id: number, options?: any) { + return ProjectsApiFp(configuration).getProject(id, options)(fetch, basePath); + }, + /** + * + * @summary Get the request project by key. + * @param {string} key The key of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectByKey(key: string, options?: any) { + return ProjectsApiFp(configuration).getProjectByKey(key, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of columns for experiment list table. + * @param {number} id The id of the project. + * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectColumns(id: number, tableType?: V1TableType, options?: any) { + return ProjectsApiFp(configuration).getProjectColumns(id, tableType, options)(fetch, basePath); + }, + /** + * + * @summary Get metrics range for a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectNumericMetricsRange(id: number, options?: any) { + return ProjectsApiFp(configuration).getProjectNumericMetricsRange(id, options)(fetch, basePath); + }, + /** + * + * @summary Get projects by user activity + * @param {number} [limit] Limit number of project entries. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getProjectsByUserActivity(limit?: number, options?: any) { + return ProjectsApiFp(configuration).getProjectsByUserActivity(limit, options)(fetch, basePath); + }, + /** + * + * @summary Move a project into a workspace. + * @param {number} projectId The id of the project being moved. + * @param {V1MoveProjectRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + moveProject(projectId: number, body: V1MoveProjectRequest, options?: any) { + return ProjectsApiFp(configuration).moveProject(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Update a project. + * @param {number} id The id of the project. + * @param {V1PatchProject} body The desired project fields and values to update. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchProject(id: number, body: V1PatchProject, options?: any) { + return ProjectsApiFp(configuration).patchProject(id, body, options)(fetch, basePath); + }, + /** + * + * @summary Create a project. + * @param {number} workspaceId Id of the associated workspace. + * @param {V1PostProjectRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postProject(workspaceId: number, body: V1PostProjectRequest, options?: any) { + return ProjectsApiFp(configuration).postProject(workspaceId, body, options)(fetch, basePath); + }, + /** + * + * @summary Set project notes. + * @param {number} projectId The id of the project. + * @param {V1PutProjectNotesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putProjectNotes(projectId: number, body: V1PutProjectNotesRequest, options?: any) { + return ProjectsApiFp(configuration).putProjectNotes(projectId, body, options)(fetch, basePath); + }, + /** + * + * @summary Unarchive a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveProject(id: number, options?: any) { + return ProjectsApiFp(configuration).unarchiveProject(id, options)(fetch, basePath); + }, + } +}; /** - * UsersApi - fetch parameter creator + * ProjectsApi - object-oriented interface * @export + * @class + * @extends {BaseAPI} */ -export const UsersApiFetchParamCreator = function (configuration?: Configuration) { - return { +export class ProjectsApi extends BaseAPI { /** - * - * @summary Get the current user. + * + * @summary Add a note to a project. + * @param {number} projectId The id of the project. + * @param {V1Note} body The note to add. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - getMe(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/me`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public addProjectNote(projectId: number, body: V1Note, options?: any) { + return ProjectsApiFp(this.configuration).addProjectNote(projectId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested user. - * @param {number} userId The id of the user. + * + * @summary Archive a project. + * @param {number} id The id of the project. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - getUser(userId: number, options: any = {}): FetchArgs { - // verify required parameter 'userId' is not null or undefined - if (userId === null || userId === undefined) { - throw new RequiredError( - 'userId', - 'Required parameter userId was null or undefined when calling getUser.', - ); - } - const localVarPath = `/api/v1/users/{userId}`.replace( - `{${'userId'}}`, - encodeURIComponent(String(userId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public archiveProject(id: number, options?: any) { + return ProjectsApiFp(this.configuration).archiveProject(id, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested user with username. - * @param {string} username The string of the username. + * + * @summary Delete a project. + * @param {number} id The id of the project. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - getUserByUsername(username: string, options: any = {}): FetchArgs { - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError( - 'username', - 'Required parameter username was null or undefined when calling getUserByUsername.', - ); - } - const localVarPath = `/api/v1/users/{username}/by-username`.replace( - `{${'username'}}`, - encodeURIComponent(String(username)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public deleteProject(id: number, options?: any) { + return ProjectsApiFp(this.configuration).deleteProject(id, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a list of users. - * @param {V1GetUsersRequestSortBy} [sortBy] Sort users by the given field. - SORT_BY_UNSPECIFIED: Returns users in an unsorted list. - SORT_BY_DISPLAY_NAME: Returns users sorted by display name. - SORT_BY_USER_NAME: Returns users sorted by user name. - SORT_BY_ADMIN: Returns users sorted by if they are admin. - SORT_BY_ACTIVE: Returns users sorted by if they are active. - SORT_BY_MODIFIED_TIME: Returns users sorted by modified time. - SORT_BY_NAME: Returns users sorted by username unless display name exist. - SORT_BY_LAST_AUTH_TIME: Returns users sorted by last authenticated time. - SORT_BY_REMOTE: Returns users sorted by local or remote auth. - * @param {V1OrderBy} [orderBy] Order users in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. - * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. - * @param {string} [name] Filter by username or display name. - * @param {boolean} [active] Filter by status. - * @param {boolean} [admin] Filter by roles. - * @param {Array} [roleIdAssignedDirectlyToUser] Filter by roles id assigned directly to user for EE. + * + * @summary Get the requested project. + * @param {number} id The id of the project. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - getUsers( - sortBy?: V1GetUsersRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - active?: boolean, - admin?: boolean, - roleIdAssignedDirectlyToUser?: Array, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/users`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (name !== undefined) { - localVarQueryParameter['name'] = name; - } - - if (active !== undefined) { - localVarQueryParameter['active'] = active; - } - - if (admin !== undefined) { - localVarQueryParameter['admin'] = admin; - } - - if (roleIdAssignedDirectlyToUser) { - localVarQueryParameter['roleIdAssignedDirectlyToUser'] = roleIdAssignedDirectlyToUser; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getProject(id: number, options?: any) { + return ProjectsApiFp(this.configuration).getProject(id, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a user's settings for website + * + * @summary Get the request project by key. + * @param {string} key The key of the project. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - getUserSetting(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/users/setting`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getProjectByKey(key: string, options?: any) { + return ProjectsApiFp(this.configuration).getProjectByKey(key, options)(this.fetch, this.basePath) + } + /** - * - * @summary Patch a user's fields. - * @param {number} userId The id of the user. - * @param {V1PatchUser} body The updated user. + * + * @summary Get a list of columns for experiment list table. + * @param {number} id The id of the project. + * @param {V1TableType} [tableType] type of table for project columns. - TABLE_TYPE_UNSPECIFIED: Unspecified table type. - TABLE_TYPE_EXPERIMENT: experiment table. - TABLE_TYPE_RUN: run table. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - patchUser(userId: number, body: V1PatchUser, options: any = {}): FetchArgs { - // verify required parameter 'userId' is not null or undefined - if (userId === null || userId === undefined) { - throw new RequiredError( - 'userId', - 'Required parameter userId was null or undefined when calling patchUser.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchUser.', - ); - } - const localVarPath = `/api/v1/users/{userId}`.replace( - `{${'userId'}}`, - encodeURIComponent(String(userId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getProjectColumns(id: number, tableType?: V1TableType, options?: any) { + return ProjectsApiFp(this.configuration).getProjectColumns(id, tableType, options)(this.fetch, this.basePath) + } + /** - * - * @summary Create a new user. - * @param {V1PostUserRequest} body + * + * @summary Get metrics range for a project. + * @param {number} id The id of the project. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - postUser(body: V1PostUserRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postUser.', - ); - } - const localVarPath = `/api/v1/users`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getProjectNumericMetricsRange(id: number, options?: any) { + return ProjectsApiFp(this.configuration).getProjectNumericMetricsRange(id, options)(this.fetch, this.basePath) + } + /** - * - * @summary Patch a user's activity - * @param {V1PostUserActivityRequest} body + * + * @summary Get projects by user activity + * @param {number} [limit] Limit number of project entries. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - postUserActivity(body: V1PostUserActivityRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postUserActivity.', - ); - } - const localVarPath = `/api/v1/users/activity`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getProjectsByUserActivity(limit?: number, options?: any) { + return ProjectsApiFp(this.configuration).getProjectsByUserActivity(limit, options)(this.fetch, this.basePath) + } + /** - * - * @summary Post a user's settings for website - * @param {V1PostUserSettingRequest} body + * + * @summary Move a project into a workspace. + * @param {number} projectId The id of the project being moved. + * @param {V1MoveProjectRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - postUserSetting(body: V1PostUserSettingRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postUserSetting.', - ); - } - const localVarPath = `/api/v1/users/setting`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public moveProject(projectId: number, body: V1MoveProjectRequest, options?: any) { + return ProjectsApiFp(this.configuration).moveProject(projectId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Reset a user's settings for website + * + * @summary Update a project. + * @param {number} id The id of the project. + * @param {V1PatchProject} body The desired project fields and values to update. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - resetUserSetting(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/users/setting/reset`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public patchProject(id: number, body: V1PatchProject, options?: any) { + return ProjectsApiFp(this.configuration).patchProject(id, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Set the requested user's password. - * @param {number} userId The id of the user. - * @param {string} body The password of the user. + * + * @summary Create a project. + * @param {number} workspaceId Id of the associated workspace. + * @param {V1PostProjectRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ProjectsApi */ - setUserPassword(userId: number, body: string, options: any = {}): FetchArgs { - // verify required parameter 'userId' is not null or undefined - if (userId === null || userId === undefined) { - throw new RequiredError( - 'userId', - 'Required parameter userId was null or undefined when calling setUserPassword.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling setUserPassword.', - ); - } - const localVarPath = `/api/v1/users/{userId}/password`.replace( - `{${'userId'}}`, - encodeURIComponent(String(userId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } + public postProject(workspaceId: number, body: V1PostProjectRequest, options?: any) { + return ProjectsApiFp(this.configuration).postProject(workspaceId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Set project notes. + * @param {number} projectId The id of the project. + * @param {V1PutProjectNotesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ProjectsApi + */ + public putProjectNotes(projectId: number, body: V1PutProjectNotesRequest, options?: any) { + return ProjectsApiFp(this.configuration).putProjectNotes(projectId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Unarchive a project. + * @param {number} id The id of the project. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ProjectsApi + */ + public unarchiveProject(id: number, options?: any) { + return ProjectsApiFp(this.configuration).unarchiveProject(id, options)(this.fetch, this.basePath) + } + +} - localVarHeaderParameter['Content-Type'] = 'application/json'; +/** + * RBACApi - fetch parameter creator + * @export + */ +export const RBACApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary AssignRoles adds a set of role assignments to the system. + * @param {V1AssignRolesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assignRoles(body: V1AssignRolesRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling assignRoles.'); + } + const localVarPath = `/api/v1/roles/add-assignments`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get groups and users assigned to a given workspace with what roles are assigned. + * @param {number} workspaceId ID of workspace getting groups and users. + * @param {string} [name] Name of groups and users to search by. Name filters by group name for groups. Name filters by display name then username if display name is null for users. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGroupsAndUsersAssignedToWorkspace(workspaceId: number, name?: string, options: any = {}): FetchArgs { + // verify required parameter 'workspaceId' is not null or undefined + if (workspaceId === null || workspaceId === undefined) { + throw new RequiredError('workspaceId','Required parameter workspaceId was null or undefined when calling getGroupsAndUsersAssignedToWorkspace.'); + } + const localVarPath = `/api/v1/roles/workspace/{workspaceId}` + .replace(`{${"workspaceId"}}`, encodeURIComponent(String(workspaceId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (name !== undefined) { + localVarQueryParameter['name'] = name + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary List all permissions for the logged in user in all scopes. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPermissionsSummary(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/permissions/summary`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the roles which are assigned to a group. + * @param {number} groupId The id of the group to search for role assignments for + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRolesAssignedToGroup(groupId: number, options: any = {}): FetchArgs { + // verify required parameter 'groupId' is not null or undefined + if (groupId === null || groupId === undefined) { + throw new RequiredError('groupId','Required parameter groupId was null or undefined when calling getRolesAssignedToGroup.'); + } + const localVarPath = `/api/v1/roles/search/by-group/{groupId}` + .replace(`{${"groupId"}}`, encodeURIComponent(String(groupId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the roles which are assigned to a user. + * @param {number} userId The id of the user to search for role assignments for + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRolesAssignedToUser(userId: number, options: any = {}): FetchArgs { + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError('userId','Required parameter userId was null or undefined when calling getRolesAssignedToUser.'); + } + const localVarPath = `/api/v1/roles/search/by-user/{userId}` + .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a set of roles with the corresponding IDs. + * @param {V1GetRolesByIDRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRolesByID(body: V1GetRolesByIDRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling getRolesByID.'); + } + const localVarPath = `/api/v1/roles/search/by-ids`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary ListRoles returns roles and groups/users granted that role. + * @param {V1ListRolesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRoles(body: V1ListRolesRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling listRoles.'); + } + const localVarPath = `/api/v1/roles/search`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary RemoveAssignments removes a set of role assignments from the system. + * @param {V1RemoveAssignmentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + removeAssignments(body: V1RemoveAssignmentsRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling removeAssignments.'); + } + const localVarPath = `/api/v1/roles/remove-assignments`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Search for roles assignable to a given scope. + * @param {V1SearchRolesAssignableToScopeRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchRolesAssignableToScope(body: V1SearchRolesAssignableToScopeRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling searchRolesAssignableToScope.'); + } + const localVarPath = `/api/v1/roles/search/by-assignability`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - const needsSerialization = - localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body) : body; +/** + * RBACApi - functional programming interface + * @export + */ +export const RBACApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary AssignRoles adds a set of role assignments to the system. + * @param {V1AssignRolesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assignRoles(body: V1AssignRolesRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = RBACApiFetchParamCreator(configuration).assignRoles(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get groups and users assigned to a given workspace with what roles are assigned. + * @param {number} workspaceId ID of workspace getting groups and users. + * @param {string} [name] Name of groups and users to search by. Name filters by group name for groups. Name filters by display name then username if display name is null for users. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGroupsAndUsersAssignedToWorkspace(workspaceId: number, name?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = RBACApiFetchParamCreator(configuration).getGroupsAndUsersAssignedToWorkspace(workspaceId, name, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary List all permissions for the logged in user in all scopes. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPermissionsSummary(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = RBACApiFetchParamCreator(configuration).getPermissionsSummary(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the roles which are assigned to a group. + * @param {number} groupId The id of the group to search for role assignments for + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRolesAssignedToGroup(groupId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = RBACApiFetchParamCreator(configuration).getRolesAssignedToGroup(groupId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the roles which are assigned to a user. + * @param {number} userId The id of the user to search for role assignments for + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRolesAssignedToUser(userId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = RBACApiFetchParamCreator(configuration).getRolesAssignedToUser(userId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a set of roles with the corresponding IDs. + * @param {V1GetRolesByIDRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRolesByID(body: V1GetRolesByIDRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = RBACApiFetchParamCreator(configuration).getRolesByID(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary ListRoles returns roles and groups/users granted that role. + * @param {V1ListRolesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRoles(body: V1ListRolesRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = RBACApiFetchParamCreator(configuration).listRoles(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary RemoveAssignments removes a set of role assignments from the system. + * @param {V1RemoveAssignmentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + removeAssignments(body: V1RemoveAssignmentsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = RBACApiFetchParamCreator(configuration).removeAssignments(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Search for roles assignable to a given scope. + * @param {V1SearchRolesAssignableToScopeRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchRolesAssignableToScope(body: V1SearchRolesAssignableToScopeRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = RBACApiFetchParamCreator(configuration).searchRolesAssignableToScope(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; +/** + * RBACApi - factory interface + * @export + */ +export const RBACApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary AssignRoles adds a set of role assignments to the system. + * @param {V1AssignRolesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + assignRoles(body: V1AssignRolesRequest, options?: any) { + return RBACApiFp(configuration).assignRoles(body, options)(fetch, basePath); + }, + /** + * + * @summary Get groups and users assigned to a given workspace with what roles are assigned. + * @param {number} workspaceId ID of workspace getting groups and users. + * @param {string} [name] Name of groups and users to search by. Name filters by group name for groups. Name filters by display name then username if display name is null for users. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getGroupsAndUsersAssignedToWorkspace(workspaceId: number, name?: string, options?: any) { + return RBACApiFp(configuration).getGroupsAndUsersAssignedToWorkspace(workspaceId, name, options)(fetch, basePath); + }, + /** + * + * @summary List all permissions for the logged in user in all scopes. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPermissionsSummary(options?: any) { + return RBACApiFp(configuration).getPermissionsSummary(options)(fetch, basePath); + }, + /** + * + * @summary Get the roles which are assigned to a group. + * @param {number} groupId The id of the group to search for role assignments for + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRolesAssignedToGroup(groupId: number, options?: any) { + return RBACApiFp(configuration).getRolesAssignedToGroup(groupId, options)(fetch, basePath); + }, + /** + * + * @summary Get the roles which are assigned to a user. + * @param {number} userId The id of the user to search for role assignments for + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRolesAssignedToUser(userId: number, options?: any) { + return RBACApiFp(configuration).getRolesAssignedToUser(userId, options)(fetch, basePath); + }, + /** + * + * @summary Get a set of roles with the corresponding IDs. + * @param {V1GetRolesByIDRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRolesByID(body: V1GetRolesByIDRequest, options?: any) { + return RBACApiFp(configuration).getRolesByID(body, options)(fetch, basePath); + }, + /** + * + * @summary ListRoles returns roles and groups/users granted that role. + * @param {V1ListRolesRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRoles(body: V1ListRolesRequest, options?: any) { + return RBACApiFp(configuration).listRoles(body, options)(fetch, basePath); + }, + /** + * + * @summary RemoveAssignments removes a set of role assignments from the system. + * @param {V1RemoveAssignmentsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + removeAssignments(body: V1RemoveAssignmentsRequest, options?: any) { + return RBACApiFp(configuration).removeAssignments(body, options)(fetch, basePath); + }, + /** + * + * @summary Search for roles assignable to a given scope. + * @param {V1SearchRolesAssignableToScopeRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + searchRolesAssignableToScope(body: V1SearchRolesAssignableToScopeRequest, options?: any) { + return RBACApiFp(configuration).searchRolesAssignableToScope(body, options)(fetch, basePath); + }, + } }; /** - * UsersApi - functional programming interface + * RBACApi - object-oriented interface * @export + * @class + * @extends {BaseAPI} */ -export const UsersApiFp = function (configuration?: Configuration) { - return { +export class RBACApi extends BaseAPI { /** - * - * @summary Get the current user. + * + * @summary AssignRoles adds a set of role assignments to the system. + * @param {V1AssignRolesRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RBACApi */ - getMe(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).getMe(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public assignRoles(body: V1AssignRolesRequest, options?: any) { + return RBACApiFp(this.configuration).assignRoles(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested user. - * @param {number} userId The id of the user. + * + * @summary Get groups and users assigned to a given workspace with what roles are assigned. + * @param {number} workspaceId ID of workspace getting groups and users. + * @param {string} [name] Name of groups and users to search by. Name filters by group name for groups. Name filters by display name then username if display name is null for users. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RBACApi */ - getUser( - userId: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).getUser(userId, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public getGroupsAndUsersAssignedToWorkspace(workspaceId: number, name?: string, options?: any) { + return RBACApiFp(this.configuration).getGroupsAndUsersAssignedToWorkspace(workspaceId, name, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested user with username. - * @param {string} username The string of the username. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getUserByUsername( - username: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).getUserByUsername( - username, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of users. - * @param {V1GetUsersRequestSortBy} [sortBy] Sort users by the given field. - SORT_BY_UNSPECIFIED: Returns users in an unsorted list. - SORT_BY_DISPLAY_NAME: Returns users sorted by display name. - SORT_BY_USER_NAME: Returns users sorted by user name. - SORT_BY_ADMIN: Returns users sorted by if they are admin. - SORT_BY_ACTIVE: Returns users sorted by if they are active. - SORT_BY_MODIFIED_TIME: Returns users sorted by modified time. - SORT_BY_NAME: Returns users sorted by username unless display name exist. - SORT_BY_LAST_AUTH_TIME: Returns users sorted by last authenticated time. - SORT_BY_REMOTE: Returns users sorted by local or remote auth. - * @param {V1OrderBy} [orderBy] Order users in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. - * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. - * @param {string} [name] Filter by username or display name. - * @param {boolean} [active] Filter by status. - * @param {boolean} [admin] Filter by roles. - * @param {Array} [roleIdAssignedDirectlyToUser] Filter by roles id assigned directly to user for EE. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getUsers( - sortBy?: V1GetUsersRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - active?: boolean, - admin?: boolean, - roleIdAssignedDirectlyToUser?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).getUsers( - sortBy, - orderBy, - offset, - limit, - name, - active, - admin, - roleIdAssignedDirectlyToUser, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a user's settings for website + * + * @summary List all permissions for the logged in user in all scopes. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RBACApi */ - getUserSetting( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).getUserSetting(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public getPermissionsSummary(options?: any) { + return RBACApiFp(this.configuration).getPermissionsSummary(options)(this.fetch, this.basePath) + } + /** - * - * @summary Patch a user's fields. - * @param {number} userId The id of the user. - * @param {V1PatchUser} body The updated user. + * + * @summary Get the roles which are assigned to a group. + * @param {number} groupId The id of the group to search for role assignments for * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RBACApi */ - patchUser( - userId: number, - body: V1PatchUser, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).patchUser( - userId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Create a new user. - * @param {V1PostUserRequest} body + public getRolesAssignedToGroup(groupId: number, options?: any) { + return RBACApiFp(this.configuration).getRolesAssignedToGroup(groupId, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Get the roles which are assigned to a user. + * @param {number} userId The id of the user to search for role assignments for * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RBACApi */ - postUser( - body: V1PostUserRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).postUser(body, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public getRolesAssignedToUser(userId: number, options?: any) { + return RBACApiFp(this.configuration).getRolesAssignedToUser(userId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Patch a user's activity - * @param {V1PostUserActivityRequest} body + * + * @summary Get a set of roles with the corresponding IDs. + * @param {V1GetRolesByIDRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RBACApi */ - postUserActivity( - body: V1PostUserActivityRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).postUserActivity( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Post a user's settings for website - * @param {V1PostUserSettingRequest} body + public getRolesByID(body: V1GetRolesByIDRequest, options?: any) { + return RBACApiFp(this.configuration).getRolesByID(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary ListRoles returns roles and groups/users granted that role. + * @param {V1ListRolesRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RBACApi */ - postUserSetting( - body: V1PostUserSettingRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).postUserSetting( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Reset a user's settings for website + public listRoles(body: V1ListRolesRequest, options?: any) { + return RBACApiFp(this.configuration).listRoles(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary RemoveAssignments removes a set of role assignments from the system. + * @param {V1RemoveAssignmentsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RBACApi */ - resetUserSetting( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).resetUserSetting(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public removeAssignments(body: V1RemoveAssignmentsRequest, options?: any) { + return RBACApiFp(this.configuration).removeAssignments(body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Set the requested user's password. - * @param {number} userId The id of the user. - * @param {string} body The password of the user. + * + * @summary Search for roles assignable to a given scope. + * @param {V1SearchRolesAssignableToScopeRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof RBACApi */ - setUserPassword( - userId: number, - body: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = UsersApiFetchParamCreator(configuration).setUserPassword( - userId, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; + public searchRolesAssignableToScope(body: V1SearchRolesAssignableToScopeRequest, options?: any) { + return RBACApiFp(this.configuration).searchRolesAssignableToScope(body, options)(this.fetch, this.basePath) + } + +} + +/** + * ShellsApi - fetch parameter creator + * @export + */ +export const ShellsApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the requested shell. + * @param {string} shellId The id of the shell. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getShell(shellId: string, options: any = {}): FetchArgs { + // verify required parameter 'shellId' is not null or undefined + if (shellId === null || shellId === undefined) { + throw new RequiredError('shellId','Required parameter shellId was null or undefined when calling getShell.'); + } + const localVarPath = `/api/v1/shells/{shellId}` + .replace(`{${"shellId"}}`, encodeURIComponent(String(shellId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of shells. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort shells by the given field. - SORT_BY_UNSPECIFIED: Returns shells in an unsorted list. - SORT_BY_ID: Returns shells sorted by id. - SORT_BY_DESCRIPTION: Returns shells sorted by description. - SORT_BY_START_TIME: Return shells sorted by start time. - SORT_BY_WORKSPACE_ID: Return shells sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order shells in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of shells before returning results. Negative values denote number of shells to skip from the end before returning results. + * @param {number} [limit] Limit the number of shells. A value of 0 denotes no limit. + * @param {Array} [users] Limit shells to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit shells to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getShells(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/shells`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (users) { + localVarQueryParameter['users'] = users + } + + if (userIds) { + localVarQueryParameter['userIds'] = userIds + } + + if (workspaceId !== undefined) { + localVarQueryParameter['workspaceId'] = workspaceId + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Kill the requested shell. + * @param {string} shellId The id of the shell. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killShell(shellId: string, options: any = {}): FetchArgs { + // verify required parameter 'shellId' is not null or undefined + if (shellId === null || shellId === undefined) { + throw new RequiredError('shellId','Required parameter shellId was null or undefined when calling killShell.'); + } + const localVarPath = `/api/v1/shells/{shellId}/kill` + .replace(`{${"shellId"}}`, encodeURIComponent(String(shellId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Launch a shell. + * @param {V1LaunchShellRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchShell(body: V1LaunchShellRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling launchShell.'); + } + const localVarPath = `/api/v1/shells`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Set the priority of the requested shell. + * @param {string} shellId The id of the shell. + * @param {V1SetShellPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setShellPriority(shellId: string, body: V1SetShellPriorityRequest, options: any = {}): FetchArgs { + // verify required parameter 'shellId' is not null or undefined + if (shellId === null || shellId === undefined) { + throw new RequiredError('shellId','Required parameter shellId was null or undefined when calling setShellPriority.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling setShellPriority.'); + } + const localVarPath = `/api/v1/shells/{shellId}/set_priority` + .replace(`{${"shellId"}}`, encodeURIComponent(String(shellId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } }; /** - * UsersApi - factory interface + * ShellsApi - functional programming interface + * @export + */ +export const ShellsApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the requested shell. + * @param {string} shellId The id of the shell. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getShell(shellId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ShellsApiFetchParamCreator(configuration).getShell(shellId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of shells. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort shells by the given field. - SORT_BY_UNSPECIFIED: Returns shells in an unsorted list. - SORT_BY_ID: Returns shells sorted by id. - SORT_BY_DESCRIPTION: Returns shells sorted by description. - SORT_BY_START_TIME: Return shells sorted by start time. - SORT_BY_WORKSPACE_ID: Return shells sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order shells in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of shells before returning results. Negative values denote number of shells to skip from the end before returning results. + * @param {number} [limit] Limit the number of shells. A value of 0 denotes no limit. + * @param {Array} [users] Limit shells to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit shells to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getShells(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ShellsApiFetchParamCreator(configuration).getShells(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Kill the requested shell. + * @param {string} shellId The id of the shell. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killShell(shellId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ShellsApiFetchParamCreator(configuration).killShell(shellId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Launch a shell. + * @param {V1LaunchShellRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchShell(body: V1LaunchShellRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ShellsApiFetchParamCreator(configuration).launchShell(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Set the priority of the requested shell. + * @param {string} shellId The id of the shell. + * @param {V1SetShellPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setShellPriority(shellId: string, body: V1SetShellPriorityRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = ShellsApiFetchParamCreator(configuration).setShellPriority(shellId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * ShellsApi - factory interface + * @export + */ +export const ShellsApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Get the requested shell. + * @param {string} shellId The id of the shell. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getShell(shellId: string, options?: any) { + return ShellsApiFp(configuration).getShell(shellId, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of shells. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort shells by the given field. - SORT_BY_UNSPECIFIED: Returns shells in an unsorted list. - SORT_BY_ID: Returns shells sorted by id. - SORT_BY_DESCRIPTION: Returns shells sorted by description. - SORT_BY_START_TIME: Return shells sorted by start time. - SORT_BY_WORKSPACE_ID: Return shells sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order shells in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of shells before returning results. Negative values denote number of shells to skip from the end before returning results. + * @param {number} [limit] Limit the number of shells. A value of 0 denotes no limit. + * @param {Array} [users] Limit shells to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit shells to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getShells(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any) { + return ShellsApiFp(configuration).getShells(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options)(fetch, basePath); + }, + /** + * + * @summary Kill the requested shell. + * @param {string} shellId The id of the shell. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killShell(shellId: string, options?: any) { + return ShellsApiFp(configuration).killShell(shellId, options)(fetch, basePath); + }, + /** + * + * @summary Launch a shell. + * @param {V1LaunchShellRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchShell(body: V1LaunchShellRequest, options?: any) { + return ShellsApiFp(configuration).launchShell(body, options)(fetch, basePath); + }, + /** + * + * @summary Set the priority of the requested shell. + * @param {string} shellId The id of the shell. + * @param {V1SetShellPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setShellPriority(shellId: string, body: V1SetShellPriorityRequest, options?: any) { + return ShellsApiFp(configuration).setShellPriority(shellId, body, options)(fetch, basePath); + }, + } +}; + +/** + * ShellsApi - object-oriented interface * @export + * @class + * @extends {BaseAPI} */ -export const UsersApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { +export class ShellsApi extends BaseAPI { /** - * - * @summary Get the current user. + * + * @summary Get the requested shell. + * @param {string} shellId The id of the shell. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ShellsApi */ - getMe(options?: any) { - return UsersApiFp(configuration).getMe(options)(fetch, basePath); - }, + public getShell(shellId: string, options?: any) { + return ShellsApiFp(this.configuration).getShell(shellId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested user. - * @param {number} userId The id of the user. + * + * @summary Get a list of shells. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort shells by the given field. - SORT_BY_UNSPECIFIED: Returns shells in an unsorted list. - SORT_BY_ID: Returns shells sorted by id. - SORT_BY_DESCRIPTION: Returns shells sorted by description. - SORT_BY_START_TIME: Return shells sorted by start time. - SORT_BY_WORKSPACE_ID: Return shells sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order shells in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of shells before returning results. Negative values denote number of shells to skip from the end before returning results. + * @param {number} [limit] Limit the number of shells. A value of 0 denotes no limit. + * @param {Array} [users] Limit shells to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit shells to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit to those within a specified workspace, or 0 for all accessible workspaces. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ShellsApi */ - getUser(userId: number, options?: any) { - return UsersApiFp(configuration).getUser(userId, options)(fetch, basePath); - }, + public getShells(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any) { + return ShellsApiFp(this.configuration).getShells(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested user with username. - * @param {string} username The string of the username. + * + * @summary Kill the requested shell. + * @param {string} shellId The id of the shell. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ShellsApi */ - getUserByUsername(username: string, options?: any) { - return UsersApiFp(configuration).getUserByUsername(username, options)(fetch, basePath); - }, + public killShell(shellId: string, options?: any) { + return ShellsApiFp(this.configuration).killShell(shellId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a list of users. - * @param {V1GetUsersRequestSortBy} [sortBy] Sort users by the given field. - SORT_BY_UNSPECIFIED: Returns users in an unsorted list. - SORT_BY_DISPLAY_NAME: Returns users sorted by display name. - SORT_BY_USER_NAME: Returns users sorted by user name. - SORT_BY_ADMIN: Returns users sorted by if they are admin. - SORT_BY_ACTIVE: Returns users sorted by if they are active. - SORT_BY_MODIFIED_TIME: Returns users sorted by modified time. - SORT_BY_NAME: Returns users sorted by username unless display name exist. - SORT_BY_LAST_AUTH_TIME: Returns users sorted by last authenticated time. - SORT_BY_REMOTE: Returns users sorted by local or remote auth. - * @param {V1OrderBy} [orderBy] Order users in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. - * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. - * @param {string} [name] Filter by username or display name. - * @param {boolean} [active] Filter by status. - * @param {boolean} [admin] Filter by roles. - * @param {Array} [roleIdAssignedDirectlyToUser] Filter by roles id assigned directly to user for EE. + * + * @summary Launch a shell. + * @param {V1LaunchShellRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ShellsApi */ - getUsers( - sortBy?: V1GetUsersRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - active?: boolean, - admin?: boolean, - roleIdAssignedDirectlyToUser?: Array, - options?: any, - ) { - return UsersApiFp(configuration).getUsers( - sortBy, - orderBy, - offset, - limit, - name, - active, - admin, - roleIdAssignedDirectlyToUser, - options, - )(fetch, basePath); - }, - /** - * - * @summary Get a user's settings for website + public launchShell(body: V1LaunchShellRequest, options?: any) { + return ShellsApiFp(this.configuration).launchShell(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Set the priority of the requested shell. + * @param {string} shellId The id of the shell. + * @param {V1SetShellPriorityRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof ShellsApi */ - getUserSetting(options?: any) { - return UsersApiFp(configuration).getUserSetting(options)(fetch, basePath); - }, + public setShellPriority(shellId: string, body: V1SetShellPriorityRequest, options?: any) { + return ShellsApiFp(this.configuration).setShellPriority(shellId, body, options)(this.fetch, this.basePath) + } + +} + +/** + * TasksApi - fetch parameter creator + * @export + */ +export const TasksApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Get a count of active tasks. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getActiveTasksCount(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/tasks/count`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Check the status of a requested task. + * @param {string} taskId The requested task id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTask(taskId: string, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling getTask.'); + } + const localVarPath = `/api/v1/tasks/{taskId}` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the model definition of a task. + * @param {string} taskId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTaskContextDirectory(taskId: string, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling getTaskContextDirectory.'); + } + const localVarPath = `/api/v1/tasks/{taskId}/context_directory` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get all tasks. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTasks(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/tasks`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream task logs. + * @param {string} taskId The id of the task. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [allocationIds] Limit the task logs to particular allocations. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogs(taskId: string, limit?: number, follow?: boolean, allocationIds?: Array, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling taskLogs.'); + } + const localVarPath = `/api/v1/tasks/{taskId}/logs` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + if (allocationIds) { + localVarQueryParameter['allocationIds'] = allocationIds + } + + if (agentIds) { + localVarQueryParameter['agentIds'] = agentIds + } + + if (containerIds) { + localVarQueryParameter['containerIds'] = containerIds + } + + if (rankIds) { + localVarQueryParameter['rankIds'] = rankIds + } + + if (levels) { + localVarQueryParameter['levels'] = levels + } + + if (stdtypes) { + localVarQueryParameter['stdtypes'] = stdtypes + } + + if (sources) { + localVarQueryParameter['sources'] = sources + } + + if (timestampBefore) { + localVarQueryParameter['timestampBefore'] = typeof timestampBefore === "string" ? timestampBefore : timestampBefore.toISOString() + } + + if (timestampAfter) { + localVarQueryParameter['timestampAfter'] = typeof timestampAfter === "string" ? timestampAfter : timestampAfter.toISOString() + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (searchText !== undefined) { + localVarQueryParameter['searchText'] = searchText + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream task log fields. + * @param {string} taskId The ID of the task. + * @param {boolean} [follow] Continue following fields until the task stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogsFields(taskId: string, follow?: boolean, options: any = {}): FetchArgs { + // verify required parameter 'taskId' is not null or undefined + if (taskId === null || taskId === undefined) { + throw new RequiredError('taskId','Required parameter taskId was null or undefined when calling taskLogsFields.'); + } + const localVarPath = `/api/v1/tasks/{taskId}/logs/fields` + .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * TasksApi - functional programming interface + * @export + */ +export const TasksApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Get a count of active tasks. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getActiveTasksCount(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TasksApiFetchParamCreator(configuration).getActiveTasksCount(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Check the status of a requested task. + * @param {string} taskId The requested task id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTask(taskId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TasksApiFetchParamCreator(configuration).getTask(taskId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the model definition of a task. + * @param {string} taskId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTaskContextDirectory(taskId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TasksApiFetchParamCreator(configuration).getTaskContextDirectory(taskId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get all tasks. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTasks(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TasksApiFetchParamCreator(configuration).getTasks(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream task logs. + * @param {string} taskId The id of the task. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [allocationIds] Limit the task logs to particular allocations. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogs(taskId: string, limit?: number, follow?: boolean, allocationIds?: Array, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TasksApiFetchParamCreator(configuration).taskLogs(taskId, limit, follow, allocationIds, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream task log fields. + * @param {string} taskId The ID of the task. + * @param {boolean} [follow] Continue following fields until the task stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogsFields(taskId: string, follow?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TasksApiFetchParamCreator(configuration).taskLogsFields(taskId, follow, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * TasksApi - factory interface + * @export + */ +export const TasksApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Get a count of active tasks. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getActiveTasksCount(options?: any) { + return TasksApiFp(configuration).getActiveTasksCount(options)(fetch, basePath); + }, + /** + * + * @summary Check the status of a requested task. + * @param {string} taskId The requested task id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTask(taskId: string, options?: any) { + return TasksApiFp(configuration).getTask(taskId, options)(fetch, basePath); + }, + /** + * + * @summary Get the model definition of a task. + * @param {string} taskId The id of the experiment. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTaskContextDirectory(taskId: string, options?: any) { + return TasksApiFp(configuration).getTaskContextDirectory(taskId, options)(fetch, basePath); + }, + /** + * + * @summary Get all tasks. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTasks(options?: any) { + return TasksApiFp(configuration).getTasks(options)(fetch, basePath); + }, + /** + * + * @summary Stream task logs. + * @param {string} taskId The id of the task. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [allocationIds] Limit the task logs to particular allocations. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogs(taskId: string, limit?: number, follow?: boolean, allocationIds?: Array, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any) { + return TasksApiFp(configuration).taskLogs(taskId, limit, follow, allocationIds, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options)(fetch, basePath); + }, + /** + * + * @summary Stream task log fields. + * @param {string} taskId The ID of the task. + * @param {boolean} [follow] Continue following fields until the task stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + taskLogsFields(taskId: string, follow?: boolean, options?: any) { + return TasksApiFp(configuration).taskLogsFields(taskId, follow, options)(fetch, basePath); + }, + } +}; + +/** + * TasksApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class TasksApi extends BaseAPI { /** - * - * @summary Patch a user's fields. - * @param {number} userId The id of the user. - * @param {V1PatchUser} body The updated user. + * + * @summary Get a count of active tasks. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TasksApi */ - patchUser(userId: number, body: V1PatchUser, options?: any) { - return UsersApiFp(configuration).patchUser(userId, body, options)(fetch, basePath); - }, + public getActiveTasksCount(options?: any) { + return TasksApiFp(this.configuration).getActiveTasksCount(options)(this.fetch, this.basePath) + } + /** - * - * @summary Create a new user. - * @param {V1PostUserRequest} body + * + * @summary Check the status of a requested task. + * @param {string} taskId The requested task id. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TasksApi */ - postUser(body: V1PostUserRequest, options?: any) { - return UsersApiFp(configuration).postUser(body, options)(fetch, basePath); - }, + public getTask(taskId: string, options?: any) { + return TasksApiFp(this.configuration).getTask(taskId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Patch a user's activity - * @param {V1PostUserActivityRequest} body + * + * @summary Get the model definition of a task. + * @param {string} taskId The id of the experiment. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TasksApi */ - postUserActivity(body: V1PostUserActivityRequest, options?: any) { - return UsersApiFp(configuration).postUserActivity(body, options)(fetch, basePath); - }, + public getTaskContextDirectory(taskId: string, options?: any) { + return TasksApiFp(this.configuration).getTaskContextDirectory(taskId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Post a user's settings for website - * @param {V1PostUserSettingRequest} body + * + * @summary Get all tasks. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TasksApi */ - postUserSetting(body: V1PostUserSettingRequest, options?: any) { - return UsersApiFp(configuration).postUserSetting(body, options)(fetch, basePath); - }, + public getTasks(options?: any) { + return TasksApiFp(this.configuration).getTasks(options)(this.fetch, this.basePath) + } + /** - * - * @summary Reset a user's settings for website + * + * @summary Stream task logs. + * @param {string} taskId The id of the task. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [allocationIds] Limit the task logs to particular allocations. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TasksApi */ - resetUserSetting(options?: any) { - return UsersApiFp(configuration).resetUserSetting(options)(fetch, basePath); - }, + public taskLogs(taskId: string, limit?: number, follow?: boolean, allocationIds?: Array, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any) { + return TasksApiFp(this.configuration).taskLogs(taskId, limit, follow, allocationIds, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options)(this.fetch, this.basePath) + } + /** - * - * @summary Set the requested user's password. - * @param {number} userId The id of the user. - * @param {string} body The password of the user. + * + * @summary Stream task log fields. + * @param {string} taskId The ID of the task. + * @param {boolean} [follow] Continue following fields until the task stops. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TasksApi */ - setUserPassword(userId: number, body: string, options?: any) { - return UsersApiFp(configuration).setUserPassword(userId, body, options)(fetch, basePath); - }, - }; -}; + public taskLogsFields(taskId: string, follow?: boolean, options?: any) { + return TasksApiFp(this.configuration).taskLogsFields(taskId, follow, options)(this.fetch, this.basePath) + } + +} /** - * UsersApi - object-oriented interface + * TemplatesApi - fetch parameter creator * @export - * @class - * @extends {BaseAPI} */ -export class UsersApi extends BaseAPI { - /** - * - * @summary Get the current user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public getMe(options?: any) { - return UsersApiFp(this.configuration).getMe(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get the requested user. - * @param {number} userId The id of the user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public getUser(userId: number, options?: any) { - return UsersApiFp(this.configuration).getUser(userId, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get the requested user with username. - * @param {string} username The string of the username. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public getUserByUsername(username: string, options?: any) { - return UsersApiFp(this.configuration).getUserByUsername(username, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get a list of users. - * @param {V1GetUsersRequestSortBy} [sortBy] Sort users by the given field. - SORT_BY_UNSPECIFIED: Returns users in an unsorted list. - SORT_BY_DISPLAY_NAME: Returns users sorted by display name. - SORT_BY_USER_NAME: Returns users sorted by user name. - SORT_BY_ADMIN: Returns users sorted by if they are admin. - SORT_BY_ACTIVE: Returns users sorted by if they are active. - SORT_BY_MODIFIED_TIME: Returns users sorted by modified time. - SORT_BY_NAME: Returns users sorted by username unless display name exist. - SORT_BY_LAST_AUTH_TIME: Returns users sorted by last authenticated time. - SORT_BY_REMOTE: Returns users sorted by local or remote auth. - * @param {V1OrderBy} [orderBy] Order users in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. - * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. - * @param {string} [name] Filter by username or display name. - * @param {boolean} [active] Filter by status. - * @param {boolean} [admin] Filter by roles. - * @param {Array} [roleIdAssignedDirectlyToUser] Filter by roles id assigned directly to user for EE. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public getUsers( - sortBy?: V1GetUsersRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - active?: boolean, - admin?: boolean, - roleIdAssignedDirectlyToUser?: Array, - options?: any, - ) { - return UsersApiFp(this.configuration).getUsers( - sortBy, - orderBy, - offset, - limit, - name, - active, - admin, - roleIdAssignedDirectlyToUser, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a user's settings for website - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public getUserSetting(options?: any) { - return UsersApiFp(this.configuration).getUserSetting(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Patch a user's fields. - * @param {number} userId The id of the user. - * @param {V1PatchUser} body The updated user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public patchUser(userId: number, body: V1PatchUser, options?: any) { - return UsersApiFp(this.configuration).patchUser( - userId, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Create a new user. - * @param {V1PostUserRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public postUser(body: V1PostUserRequest, options?: any) { - return UsersApiFp(this.configuration).postUser(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Patch a user's activity - * @param {V1PostUserActivityRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public postUserActivity(body: V1PostUserActivityRequest, options?: any) { - return UsersApiFp(this.configuration).postUserActivity(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Post a user's settings for website - * @param {V1PostUserSettingRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public postUserSetting(body: V1PostUserSettingRequest, options?: any) { - return UsersApiFp(this.configuration).postUserSetting(body, options)(this.fetch, this.basePath); - } +export const TemplatesApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Delete a template. + * @param {string} templateName The id of the template. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteTemplate(templateName: string, options: any = {}): FetchArgs { + // verify required parameter 'templateName' is not null or undefined + if (templateName === null || templateName === undefined) { + throw new RequiredError('templateName','Required parameter templateName was null or undefined when calling deleteTemplate.'); + } + const localVarPath = `/api/v1/templates/{templateName}` + .replace(`{${"templateName"}}`, encodeURIComponent(String(templateName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested template. + * @param {string} templateName The id of the template. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTemplate(templateName: string, options: any = {}): FetchArgs { + // verify required parameter 'templateName' is not null or undefined + if (templateName === null || templateName === undefined) { + throw new RequiredError('templateName','Required parameter templateName was null or undefined when calling getTemplate.'); + } + const localVarPath = `/api/v1/templates/{templateName}` + .replace(`{${"templateName"}}`, encodeURIComponent(String(templateName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of templates. + * @param {V1GetTemplatesRequestSortBy} [sortBy] Sort templates by the given field. - SORT_BY_UNSPECIFIED: Returns templates in an unsorted list. - SORT_BY_NAME: Returns templates sorted by name. + * @param {V1OrderBy} [orderBy] Order templates in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of templates before returning results. Negative values denote number of templates to skip from the end before returning results. + * @param {number} [limit] Limit the number of templates. A value of 0 denotes no limit. + * @param {string} [name] Limit templates to those that match the name. + * @param {Array} [workspaceIds] Limit templates to those that match the workspace id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTemplates(sortBy?: V1GetTemplatesRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, workspaceIds?: Array, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/templates`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (name !== undefined) { + localVarQueryParameter['name'] = name + } + + if (workspaceIds) { + localVarQueryParameter['workspaceIds'] = workspaceIds + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Patch template config. + * @param {string} templateName The name of the template. + * @param {any} body The template value. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchTemplateConfig(templateName: string, body: any, options: any = {}): FetchArgs { + // verify required parameter 'templateName' is not null or undefined + if (templateName === null || templateName === undefined) { + throw new RequiredError('templateName','Required parameter templateName was null or undefined when calling patchTemplateConfig.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchTemplateConfig.'); + } + const localVarPath = `/api/v1/templates/{templateName}` + .replace(`{${"templateName"}}`, encodeURIComponent(String(templateName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Patch template name. + * @param {V1PatchTemplateNameRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchTemplateName(body: V1PatchTemplateNameRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchTemplateName.'); + } + const localVarPath = `/api/v1/template/rename`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Post a new template. + * @param {string} templateName The name of the template. + * @param {V1Template} body The template to put. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTemplate(templateName: string, body: V1Template, options: any = {}): FetchArgs { + // verify required parameter 'templateName' is not null or undefined + if (templateName === null || templateName === undefined) { + throw new RequiredError('templateName','Required parameter templateName was null or undefined when calling postTemplate.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postTemplate.'); + } + const localVarPath = `/api/v1/templates/{templateName}` + .replace(`{${"templateName"}}`, encodeURIComponent(String(templateName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update or create (upsert) the requested template. + * @param {string} templateName The name of the template. + * @param {V1Template} body The template to put. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putTemplate(templateName: string, body: V1Template, options: any = {}): FetchArgs { + // verify required parameter 'templateName' is not null or undefined + if (templateName === null || templateName === undefined) { + throw new RequiredError('templateName','Required parameter templateName was null or undefined when calling putTemplate.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling putTemplate.'); + } + const localVarPath = `/api/v1/templates/{templateName}` + .replace(`{${"templateName"}}`, encodeURIComponent(String(templateName))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; - /** - * - * @summary Reset a user's settings for website - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public resetUserSetting(options?: any) { - return UsersApiFp(this.configuration).resetUserSetting(options)(this.fetch, this.basePath); - } +/** + * TemplatesApi - functional programming interface + * @export + */ +export const TemplatesApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Delete a template. + * @param {string} templateName The id of the template. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteTemplate(templateName: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).deleteTemplate(templateName, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested template. + * @param {string} templateName The id of the template. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTemplate(templateName: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).getTemplate(templateName, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of templates. + * @param {V1GetTemplatesRequestSortBy} [sortBy] Sort templates by the given field. - SORT_BY_UNSPECIFIED: Returns templates in an unsorted list. - SORT_BY_NAME: Returns templates sorted by name. + * @param {V1OrderBy} [orderBy] Order templates in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of templates before returning results. Negative values denote number of templates to skip from the end before returning results. + * @param {number} [limit] Limit the number of templates. A value of 0 denotes no limit. + * @param {string} [name] Limit templates to those that match the name. + * @param {Array} [workspaceIds] Limit templates to those that match the workspace id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTemplates(sortBy?: V1GetTemplatesRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, workspaceIds?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).getTemplates(sortBy, orderBy, offset, limit, name, workspaceIds, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Patch template config. + * @param {string} templateName The name of the template. + * @param {any} body The template value. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchTemplateConfig(templateName: string, body: any, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).patchTemplateConfig(templateName, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Patch template name. + * @param {V1PatchTemplateNameRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchTemplateName(body: V1PatchTemplateNameRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).patchTemplateName(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Post a new template. + * @param {string} templateName The name of the template. + * @param {V1Template} body The template to put. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTemplate(templateName: string, body: V1Template, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).postTemplate(templateName, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Update or create (upsert) the requested template. + * @param {string} templateName The name of the template. + * @param {V1Template} body The template to put. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putTemplate(templateName: string, body: V1Template, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TemplatesApiFetchParamCreator(configuration).putTemplate(templateName, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; - /** - * - * @summary Set the requested user's password. - * @param {number} userId The id of the user. - * @param {string} body The password of the user. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UsersApi - */ - public setUserPassword(userId: number, body: string, options?: any) { - return UsersApiFp(this.configuration).setUserPassword( - userId, - body, - options, - )(this.fetch, this.basePath); - } -} +/** + * TemplatesApi - factory interface + * @export + */ +export const TemplatesApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Delete a template. + * @param {string} templateName The id of the template. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteTemplate(templateName: string, options?: any) { + return TemplatesApiFp(configuration).deleteTemplate(templateName, options)(fetch, basePath); + }, + /** + * + * @summary Get the requested template. + * @param {string} templateName The id of the template. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTemplate(templateName: string, options?: any) { + return TemplatesApiFp(configuration).getTemplate(templateName, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of templates. + * @param {V1GetTemplatesRequestSortBy} [sortBy] Sort templates by the given field. - SORT_BY_UNSPECIFIED: Returns templates in an unsorted list. - SORT_BY_NAME: Returns templates sorted by name. + * @param {V1OrderBy} [orderBy] Order templates in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of templates before returning results. Negative values denote number of templates to skip from the end before returning results. + * @param {number} [limit] Limit the number of templates. A value of 0 denotes no limit. + * @param {string} [name] Limit templates to those that match the name. + * @param {Array} [workspaceIds] Limit templates to those that match the workspace id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTemplates(sortBy?: V1GetTemplatesRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, workspaceIds?: Array, options?: any) { + return TemplatesApiFp(configuration).getTemplates(sortBy, orderBy, offset, limit, name, workspaceIds, options)(fetch, basePath); + }, + /** + * + * @summary Patch template config. + * @param {string} templateName The name of the template. + * @param {any} body The template value. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchTemplateConfig(templateName: string, body: any, options?: any) { + return TemplatesApiFp(configuration).patchTemplateConfig(templateName, body, options)(fetch, basePath); + }, + /** + * + * @summary Patch template name. + * @param {V1PatchTemplateNameRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchTemplateName(body: V1PatchTemplateNameRequest, options?: any) { + return TemplatesApiFp(configuration).patchTemplateName(body, options)(fetch, basePath); + }, + /** + * + * @summary Post a new template. + * @param {string} templateName The name of the template. + * @param {V1Template} body The template to put. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postTemplate(templateName: string, body: V1Template, options?: any) { + return TemplatesApiFp(configuration).postTemplate(templateName, body, options)(fetch, basePath); + }, + /** + * + * @summary Update or create (upsert) the requested template. + * @param {string} templateName The name of the template. + * @param {V1Template} body The template to put. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putTemplate(templateName: string, body: V1Template, options?: any) { + return TemplatesApiFp(configuration).putTemplate(templateName, body, options)(fetch, basePath); + }, + } +}; /** - * WebhooksApi - fetch parameter creator + * TemplatesApi - object-oriented interface * @export + * @class + * @extends {BaseAPI} */ -export const WebhooksApiFetchParamCreator = function (configuration?: Configuration) { - return { +export class TemplatesApi extends BaseAPI { /** - * - * @summary Delete a webhook. - * @param {number} id The id of the webhook. + * + * @summary Delete a template. + * @param {string} templateName The id of the template. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TemplatesApi */ - deleteWebhook(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling deleteWebhook.', - ); - } - const localVarPath = `/api/v1/webhooks/{id}`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public deleteTemplate(templateName: string, options?: any) { + return TemplatesApiFp(this.configuration).deleteTemplate(templateName, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a list of webhooks. + * + * @summary Get the requested template. + * @param {string} templateName The id of the template. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TemplatesApi */ - getWebhooks(options: any = {}): FetchArgs { - const localVarPath = `/api/v1/webhooks`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getTemplate(templateName: string, options?: any) { + return TemplatesApiFp(this.configuration).getTemplate(templateName, options)(this.fetch, this.basePath) + } + /** - * - * @summary Create a webhook. TODO(???): Simplify req/response structs? - * @param {V1Webhook} body The webhook to store. + * + * @summary Get a list of templates. + * @param {V1GetTemplatesRequestSortBy} [sortBy] Sort templates by the given field. - SORT_BY_UNSPECIFIED: Returns templates in an unsorted list. - SORT_BY_NAME: Returns templates sorted by name. + * @param {V1OrderBy} [orderBy] Order templates in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of templates before returning results. Negative values denote number of templates to skip from the end before returning results. + * @param {number} [limit] Limit the number of templates. A value of 0 denotes no limit. + * @param {string} [name] Limit templates to those that match the name. + * @param {Array} [workspaceIds] Limit templates to those that match the workspace id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TemplatesApi + */ + public getTemplates(sortBy?: V1GetTemplatesRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, workspaceIds?: Array, options?: any) { + return TemplatesApiFp(this.configuration).getTemplates(sortBy, orderBy, offset, limit, name, workspaceIds, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Patch template config. + * @param {string} templateName The name of the template. + * @param {any} body The template value. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TemplatesApi + */ + public patchTemplateConfig(templateName: string, body: any, options?: any) { + return TemplatesApiFp(this.configuration).patchTemplateConfig(templateName, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Patch template name. + * @param {V1PatchTemplateNameRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TemplatesApi + */ + public patchTemplateName(body: V1PatchTemplateNameRequest, options?: any) { + return TemplatesApiFp(this.configuration).patchTemplateName(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Post a new template. + * @param {string} templateName The name of the template. + * @param {V1Template} body The template to put. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TemplatesApi */ - postWebhook(body: V1Webhook, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postWebhook.', - ); - } - const localVarPath = `/api/v1/webhooks`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public postTemplate(templateName: string, body: V1Template, options?: any) { + return TemplatesApiFp(this.configuration).postTemplate(templateName, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary Test a webhook. - * @param {number} id The id of the webhook. + * + * @summary Update or create (upsert) the requested template. + * @param {string} templateName The name of the template. + * @param {V1Template} body The template to put. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TemplatesApi */ - testWebhook(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling testWebhook.', - ); - } - const localVarPath = `/api/v1/webhooks/{id}/test`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + public putTemplate(templateName: string, body: V1Template, options?: any) { + return TemplatesApiFp(this.configuration).putTemplate(templateName, body, options)(this.fetch, this.basePath) + } + +} - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } +/** + * TensorboardsApi - fetch parameter creator + * @export + */ +export const TensorboardsApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the requested tensorboard. + * @param {string} tensorboardId The id of the tensorboard. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTensorboard(tensorboardId: string, options: any = {}): FetchArgs { + // verify required parameter 'tensorboardId' is not null or undefined + if (tensorboardId === null || tensorboardId === undefined) { + throw new RequiredError('tensorboardId','Required parameter tensorboardId was null or undefined when calling getTensorboard.'); + } + const localVarPath = `/api/v1/tensorboards/{tensorboardId}` + .replace(`{${"tensorboardId"}}`, encodeURIComponent(String(tensorboardId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of tensorboards. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort tensorboards by the given field. - SORT_BY_UNSPECIFIED: Returns tensorboards in an unsorted list. - SORT_BY_ID: Returns tensorboards sorted by id. - SORT_BY_DESCRIPTION: Returns tensorboards sorted by description. - SORT_BY_START_TIME: Return tensorboards sorted by start time. - SORT_BY_WORKSPACE_ID: Return tensorboards sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order tensorboards in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of tensorboards before returning results. Negative values denote number of tensorboards to skip from the end before returning results. + * @param {number} [limit] Limit the number of tensorboards. A value of 0 denotes no limit. + * @param {Array} [users] Limit tensorboards to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit tensorboards to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit tensorboards to those that are in a specific workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTensorboards(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/tensorboards`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (users) { + localVarQueryParameter['users'] = users + } + + if (userIds) { + localVarQueryParameter['userIds'] = userIds + } + + if (workspaceId !== undefined) { + localVarQueryParameter['workspaceId'] = workspaceId + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Kill the requested tensorboard. + * @param {string} tensorboardId The id of the tensorboard. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killTensorboard(tensorboardId: string, options: any = {}): FetchArgs { + // verify required parameter 'tensorboardId' is not null or undefined + if (tensorboardId === null || tensorboardId === undefined) { + throw new RequiredError('tensorboardId','Required parameter tensorboardId was null or undefined when calling killTensorboard.'); + } + const localVarPath = `/api/v1/tensorboards/{tensorboardId}/kill` + .replace(`{${"tensorboardId"}}`, encodeURIComponent(String(tensorboardId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Launch a tensorboard. + * @param {V1LaunchTensorboardRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchTensorboard(body: V1LaunchTensorboardRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling launchTensorboard.'); + } + const localVarPath = `/api/v1/tensorboards`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Set the priority of the requested TensorBoard. + * @param {string} tensorboardId The id of the TensorBoard. + * @param {V1SetTensorboardPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setTensorboardPriority(tensorboardId: string, body: V1SetTensorboardPriorityRequest, options: any = {}): FetchArgs { + // verify required parameter 'tensorboardId' is not null or undefined + if (tensorboardId === null || tensorboardId === undefined) { + throw new RequiredError('tensorboardId','Required parameter tensorboardId was null or undefined when calling setTensorboardPriority.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling setTensorboardPriority.'); + } + const localVarPath = `/api/v1/tensorboards/{tensorboardId}/set_priority` + .replace(`{${"tensorboardId"}}`, encodeURIComponent(String(tensorboardId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; +/** + * TensorboardsApi - functional programming interface + * @export + */ +export const TensorboardsApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the requested tensorboard. + * @param {string} tensorboardId The id of the tensorboard. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTensorboard(tensorboardId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TensorboardsApiFetchParamCreator(configuration).getTensorboard(tensorboardId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of tensorboards. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort tensorboards by the given field. - SORT_BY_UNSPECIFIED: Returns tensorboards in an unsorted list. - SORT_BY_ID: Returns tensorboards sorted by id. - SORT_BY_DESCRIPTION: Returns tensorboards sorted by description. - SORT_BY_START_TIME: Return tensorboards sorted by start time. - SORT_BY_WORKSPACE_ID: Return tensorboards sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order tensorboards in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of tensorboards before returning results. Negative values denote number of tensorboards to skip from the end before returning results. + * @param {number} [limit] Limit the number of tensorboards. A value of 0 denotes no limit. + * @param {Array} [users] Limit tensorboards to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit tensorboards to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit tensorboards to those that are in a specific workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTensorboards(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TensorboardsApiFetchParamCreator(configuration).getTensorboards(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Kill the requested tensorboard. + * @param {string} tensorboardId The id of the tensorboard. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killTensorboard(tensorboardId: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TensorboardsApiFetchParamCreator(configuration).killTensorboard(tensorboardId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Launch a tensorboard. + * @param {V1LaunchTensorboardRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchTensorboard(body: V1LaunchTensorboardRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TensorboardsApiFetchParamCreator(configuration).launchTensorboard(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Set the priority of the requested TensorBoard. + * @param {string} tensorboardId The id of the TensorBoard. + * @param {V1SetTensorboardPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setTensorboardPriority(tensorboardId: string, body: V1SetTensorboardPriorityRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TensorboardsApiFetchParamCreator(configuration).setTensorboardPriority(tensorboardId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; +/** + * TensorboardsApi - factory interface + * @export + */ +export const TensorboardsApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Get the requested tensorboard. + * @param {string} tensorboardId The id of the tensorboard. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTensorboard(tensorboardId: string, options?: any) { + return TensorboardsApiFp(configuration).getTensorboard(tensorboardId, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of tensorboards. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort tensorboards by the given field. - SORT_BY_UNSPECIFIED: Returns tensorboards in an unsorted list. - SORT_BY_ID: Returns tensorboards sorted by id. - SORT_BY_DESCRIPTION: Returns tensorboards sorted by description. - SORT_BY_START_TIME: Return tensorboards sorted by start time. - SORT_BY_WORKSPACE_ID: Return tensorboards sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order tensorboards in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of tensorboards before returning results. Negative values denote number of tensorboards to skip from the end before returning results. + * @param {number} [limit] Limit the number of tensorboards. A value of 0 denotes no limit. + * @param {Array} [users] Limit tensorboards to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit tensorboards to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit tensorboards to those that are in a specific workspace, or 0 for all accessible workspaces. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTensorboards(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any) { + return TensorboardsApiFp(configuration).getTensorboards(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options)(fetch, basePath); + }, + /** + * + * @summary Kill the requested tensorboard. + * @param {string} tensorboardId The id of the tensorboard. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killTensorboard(tensorboardId: string, options?: any) { + return TensorboardsApiFp(configuration).killTensorboard(tensorboardId, options)(fetch, basePath); + }, + /** + * + * @summary Launch a tensorboard. + * @param {V1LaunchTensorboardRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + launchTensorboard(body: V1LaunchTensorboardRequest, options?: any) { + return TensorboardsApiFp(configuration).launchTensorboard(body, options)(fetch, basePath); + }, + /** + * + * @summary Set the priority of the requested TensorBoard. + * @param {string} tensorboardId The id of the TensorBoard. + * @param {V1SetTensorboardPriorityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setTensorboardPriority(tensorboardId: string, body: V1SetTensorboardPriorityRequest, options?: any) { + return TensorboardsApiFp(configuration).setTensorboardPriority(tensorboardId, body, options)(fetch, basePath); + }, + } }; /** - * WebhooksApi - functional programming interface + * TensorboardsApi - object-oriented interface * @export + * @class + * @extends {BaseAPI} */ -export const WebhooksApiFp = function (configuration?: Configuration) { - return { +export class TensorboardsApi extends BaseAPI { /** - * - * @summary Delete a webhook. - * @param {number} id The id of the webhook. + * + * @summary Get the requested tensorboard. + * @param {string} tensorboardId The id of the tensorboard. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TensorboardsApi */ - deleteWebhook( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WebhooksApiFetchParamCreator(configuration).deleteWebhook( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of webhooks. + public getTensorboard(tensorboardId: string, options?: any) { + return TensorboardsApiFp(this.configuration).getTensorboard(tensorboardId, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Get a list of tensorboards. + * @param {V1GetTensorboardsRequestSortBy} [sortBy] Sort tensorboards by the given field. - SORT_BY_UNSPECIFIED: Returns tensorboards in an unsorted list. - SORT_BY_ID: Returns tensorboards sorted by id. - SORT_BY_DESCRIPTION: Returns tensorboards sorted by description. - SORT_BY_START_TIME: Return tensorboards sorted by start time. - SORT_BY_WORKSPACE_ID: Return tensorboards sorted by workspace_id. + * @param {V1OrderBy} [orderBy] Order tensorboards in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of tensorboards before returning results. Negative values denote number of tensorboards to skip from the end before returning results. + * @param {number} [limit] Limit the number of tensorboards. A value of 0 denotes no limit. + * @param {Array} [users] Limit tensorboards to those that are owned by users with the specified usernames. + * @param {Array} [userIds] Limit tensorboards to those that are owned by users with the specified userIds. + * @param {number} [workspaceId] Limit tensorboards to those that are in a specific workspace, or 0 for all accessible workspaces. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TensorboardsApi */ - getWebhooks( - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WebhooksApiFetchParamCreator(configuration).getWebhooks(options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, + public getTensorboards(sortBy?: V1GetTensorboardsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, users?: Array, userIds?: Array, workspaceId?: number, options?: any) { + return TensorboardsApiFp(this.configuration).getTensorboards(sortBy, orderBy, offset, limit, users, userIds, workspaceId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Create a webhook. TODO(???): Simplify req/response structs? - * @param {V1Webhook} body The webhook to store. + * + * @summary Kill the requested tensorboard. + * @param {string} tensorboardId The id of the tensorboard. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TensorboardsApi */ - postWebhook( - body: V1Webhook, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WebhooksApiFetchParamCreator(configuration).postWebhook( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Test a webhook. - * @param {number} id The id of the webhook. + public killTensorboard(tensorboardId: string, options?: any) { + return TensorboardsApiFp(this.configuration).killTensorboard(tensorboardId, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Launch a tensorboard. + * @param {V1LaunchTensorboardRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof TensorboardsApi + */ + public launchTensorboard(body: V1LaunchTensorboardRequest, options?: any) { + return TensorboardsApiFp(this.configuration).launchTensorboard(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Set the priority of the requested TensorBoard. + * @param {string} tensorboardId The id of the TensorBoard. + * @param {V1SetTensorboardPriorityRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TensorboardsApi */ - testWebhook( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WebhooksApiFetchParamCreator(configuration).testWebhook( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; + public setTensorboardPriority(tensorboardId: string, body: V1SetTensorboardPriorityRequest, options?: any) { + return TensorboardsApiFp(this.configuration).setTensorboardPriority(tensorboardId, body, options)(this.fetch, this.basePath) + } + +} + +/** + * TrialsApi - fetch parameter creator + * @export + */ +export const TrialsApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the list of trials for an experiment. + * @param {number} experimentId Limit trials to those that are owned by the specified experiments. + * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. + * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. + * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. + * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentTrials(experimentId: number, sortBy?: V1GetExperimentTrialsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options: any = {}): FetchArgs { + // verify required parameter 'experimentId' is not null or undefined + if (experimentId === null || experimentId === undefined) { + throw new RequiredError('experimentId','Required parameter experimentId was null or undefined when calling getExperimentTrials.'); + } + const localVarPath = `/api/v1/experiments/{experimentId}/trials` + .replace(`{${"experimentId"}}`, encodeURIComponent(String(experimentId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (states) { + localVarQueryParameter['states'] = states + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream one or more trial's metrics. + * @param {Array} trialIds Trial IDs to get metrics for. + * @param {string} group The group of metrics to get eg 'training', 'validation', etc. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMetrics(trialIds: Array, group: string, options: any = {}): FetchArgs { + // verify required parameter 'trialIds' is not null or undefined + if (trialIds === null || trialIds === undefined) { + throw new RequiredError('trialIds','Required parameter trialIds was null or undefined when calling getMetrics.'); + } + // verify required parameter 'group' is not null or undefined + if (group === null || group === undefined) { + throw new RequiredError('group','Required parameter group was null or undefined when calling getMetrics.'); + } + const localVarPath = `/api/v1/trials/metrics/trial_metrics`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (trialIds) { + localVarQueryParameter['trialIds'] = trialIds + } + + if (group !== undefined) { + localVarQueryParameter['group'] = group + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream one or more trial's training metrics. + * @param {Array} [trialIds] Trial IDs to get metrics for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrainingMetrics(trialIds?: Array, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/trials/metrics/training_metrics`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (trialIds) { + localVarQueryParameter['trialIds'] = trialIds + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a single trial. + * @param {number} trialId The requested trial's id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrial(trialId: number, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling getTrial.'); + } + const localVarPath = `/api/v1/trials/{trialId}` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the list of workloads for a trial. + * @param {number} trialId Limit workloads to those that are owned by the specified trial. + * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. + * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. + * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. + * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. + * @param {boolean} [includeBatchMetrics] Include per-batch metrics. + * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialWorkloads(trialId: number, orderBy?: V1OrderBy, offset?: number, limit?: number, sortKey?: string, filter?: GetTrialWorkloadsRequestFilterOption, includeBatchMetrics?: boolean, metricType?: V1MetricType, group?: string, removeDeletedCheckpoints?: boolean, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling getTrialWorkloads.'); + } + const localVarPath = `/api/v1/trials/{trialId}/workloads` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (sortKey !== undefined) { + localVarQueryParameter['sortKey'] = sortKey + } + + if (filter !== undefined) { + localVarQueryParameter['filter'] = filter + } + + if (includeBatchMetrics !== undefined) { + localVarQueryParameter['includeBatchMetrics'] = includeBatchMetrics + } + + if (metricType !== undefined) { + localVarQueryParameter['metricType'] = metricType + } + + if (group !== undefined) { + localVarQueryParameter['group'] = group + } + + if (removeDeletedCheckpoints !== undefined) { + localVarQueryParameter['removeDeletedCheckpoints'] = removeDeletedCheckpoints + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream one or more trial's validation metrics. + * @param {Array} [trialIds] Trial IDs to get metrics for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getValidationMetrics(trialIds?: Array, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/trials/metrics/validation_metrics`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (trialIds) { + localVarQueryParameter['trialIds'] = trialIds + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Kill a trial. + * @param {number} id The trial id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killTrial(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling killTrial.'); + } + const localVarPath = `/api/v1/trials/{id}/kill` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Retain logs for a Trial. + * @param {number} trialId The ID of the trial. + * @param {V1PutTrialRetainLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putTrialRetainLogs(trialId: number, body: V1PutTrialRetainLogsRequest, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling putTrialRetainLogs.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling putTrialRetainLogs.'); + } + const localVarPath = `/api/v1/trials/{trialId}/retain_logs` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PUT', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream trial logs. + * @param {number} trialId The id of the trial. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogs(trialId: number, limit?: number, follow?: boolean, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling trialLogs.'); + } + const localVarPath = `/api/v1/trials/{trialId}/logs` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + if (agentIds) { + localVarQueryParameter['agentIds'] = agentIds + } + + if (containerIds) { + localVarQueryParameter['containerIds'] = containerIds + } + + if (rankIds) { + localVarQueryParameter['rankIds'] = rankIds + } + + if (levels) { + localVarQueryParameter['levels'] = levels + } + + if (stdtypes) { + localVarQueryParameter['stdtypes'] = stdtypes + } + + if (sources) { + localVarQueryParameter['sources'] = sources + } + + if (timestampBefore) { + localVarQueryParameter['timestampBefore'] = typeof timestampBefore === "string" ? timestampBefore : timestampBefore.toISOString() + } + + if (timestampAfter) { + localVarQueryParameter['timestampAfter'] = typeof timestampAfter === "string" ? timestampAfter : timestampAfter.toISOString() + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (searchText !== undefined) { + localVarQueryParameter['searchText'] = searchText + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Stream trial log fields. + * @param {number} trialId The ID of the trial. + * @param {boolean} [follow] Continue following fields until the trial stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogsFields(trialId: number, follow?: boolean, options: any = {}): FetchArgs { + // verify required parameter 'trialId' is not null or undefined + if (trialId === null || trialId === undefined) { + throw new RequiredError('trialId','Required parameter trialId was null or undefined when calling trialLogsFields.'); + } + const localVarPath = `/api/v1/trials/{trialId}/logs/fields` + .replace(`{${"trialId"}}`, encodeURIComponent(String(trialId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (follow !== undefined) { + localVarQueryParameter['follow'] = follow + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } }; /** - * WebhooksApi - factory interface + * TrialsApi - functional programming interface * @export */ -export const WebhooksApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { - /** - * - * @summary Delete a webhook. - * @param {number} id The id of the webhook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteWebhook(id: number, options?: any) { - return WebhooksApiFp(configuration).deleteWebhook(id, options)(fetch, basePath); - }, +export const TrialsApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the list of trials for an experiment. + * @param {number} experimentId Limit trials to those that are owned by the specified experiments. + * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. + * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. + * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. + * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentTrials(experimentId: number, sortBy?: V1GetExperimentTrialsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getExperimentTrials(experimentId, sortBy, orderBy, offset, limit, states, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream one or more trial's metrics. + * @param {Array} trialIds Trial IDs to get metrics for. + * @param {string} group The group of metrics to get eg 'training', 'validation', etc. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMetrics(trialIds: Array, group: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getMetrics(trialIds, group, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream one or more trial's training metrics. + * @param {Array} [trialIds] Trial IDs to get metrics for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrainingMetrics(trialIds?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getTrainingMetrics(trialIds, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a single trial. + * @param {number} trialId The requested trial's id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrial(trialId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getTrial(trialId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the list of workloads for a trial. + * @param {number} trialId Limit workloads to those that are owned by the specified trial. + * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. + * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. + * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. + * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. + * @param {boolean} [includeBatchMetrics] Include per-batch metrics. + * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialWorkloads(trialId: number, orderBy?: V1OrderBy, offset?: number, limit?: number, sortKey?: string, filter?: GetTrialWorkloadsRequestFilterOption, includeBatchMetrics?: boolean, metricType?: V1MetricType, group?: string, removeDeletedCheckpoints?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getTrialWorkloads(trialId, orderBy, offset, limit, sortKey, filter, includeBatchMetrics, metricType, group, removeDeletedCheckpoints, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream one or more trial's validation metrics. + * @param {Array} [trialIds] Trial IDs to get metrics for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getValidationMetrics(trialIds?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).getValidationMetrics(trialIds, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Kill a trial. + * @param {number} id The trial id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killTrial(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).killTrial(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Retain logs for a Trial. + * @param {number} trialId The ID of the trial. + * @param {V1PutTrialRetainLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putTrialRetainLogs(trialId: number, body: V1PutTrialRetainLogsRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).putTrialRetainLogs(trialId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream trial logs. + * @param {number} trialId The id of the trial. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogs(trialId: number, limit?: number, follow?: boolean, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).trialLogs(trialId, limit, follow, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Stream trial log fields. + * @param {number} trialId The ID of the trial. + * @param {boolean} [follow] Continue following fields until the trial stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogsFields(trialId: number, follow?: boolean, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = TrialsApiFetchParamCreator(configuration).trialLogsFields(trialId, follow, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * TrialsApi - factory interface + * @export + */ +export const TrialsApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Get the list of trials for an experiment. + * @param {number} experimentId Limit trials to those that are owned by the specified experiments. + * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. + * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. + * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. + * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getExperimentTrials(experimentId: number, sortBy?: V1GetExperimentTrialsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any) { + return TrialsApiFp(configuration).getExperimentTrials(experimentId, sortBy, orderBy, offset, limit, states, options)(fetch, basePath); + }, + /** + * + * @summary Stream one or more trial's metrics. + * @param {Array} trialIds Trial IDs to get metrics for. + * @param {string} group The group of metrics to get eg 'training', 'validation', etc. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMetrics(trialIds: Array, group: string, options?: any) { + return TrialsApiFp(configuration).getMetrics(trialIds, group, options)(fetch, basePath); + }, + /** + * + * @summary Stream one or more trial's training metrics. + * @param {Array} [trialIds] Trial IDs to get metrics for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrainingMetrics(trialIds?: Array, options?: any) { + return TrialsApiFp(configuration).getTrainingMetrics(trialIds, options)(fetch, basePath); + }, + /** + * + * @summary Get a single trial. + * @param {number} trialId The requested trial's id. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrial(trialId: number, options?: any) { + return TrialsApiFp(configuration).getTrial(trialId, options)(fetch, basePath); + }, + /** + * + * @summary Get the list of workloads for a trial. + * @param {number} trialId Limit workloads to those that are owned by the specified trial. + * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. + * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. + * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. + * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. + * @param {boolean} [includeBatchMetrics] Include per-batch metrics. + * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getTrialWorkloads(trialId: number, orderBy?: V1OrderBy, offset?: number, limit?: number, sortKey?: string, filter?: GetTrialWorkloadsRequestFilterOption, includeBatchMetrics?: boolean, metricType?: V1MetricType, group?: string, removeDeletedCheckpoints?: boolean, options?: any) { + return TrialsApiFp(configuration).getTrialWorkloads(trialId, orderBy, offset, limit, sortKey, filter, includeBatchMetrics, metricType, group, removeDeletedCheckpoints, options)(fetch, basePath); + }, + /** + * + * @summary Stream one or more trial's validation metrics. + * @param {Array} [trialIds] Trial IDs to get metrics for. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getValidationMetrics(trialIds?: Array, options?: any) { + return TrialsApiFp(configuration).getValidationMetrics(trialIds, options)(fetch, basePath); + }, + /** + * + * @summary Kill a trial. + * @param {number} id The trial id + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + killTrial(id: number, options?: any) { + return TrialsApiFp(configuration).killTrial(id, options)(fetch, basePath); + }, + /** + * + * @summary Retain logs for a Trial. + * @param {number} trialId The ID of the trial. + * @param {V1PutTrialRetainLogsRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + putTrialRetainLogs(trialId: number, body: V1PutTrialRetainLogsRequest, options?: any) { + return TrialsApiFp(configuration).putTrialRetainLogs(trialId, body, options)(fetch, basePath); + }, + /** + * + * @summary Stream trial logs. + * @param {number} trialId The id of the trial. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogs(trialId: number, limit?: number, follow?: boolean, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any) { + return TrialsApiFp(configuration).trialLogs(trialId, limit, follow, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options)(fetch, basePath); + }, + /** + * + * @summary Stream trial log fields. + * @param {number} trialId The ID of the trial. + * @param {boolean} [follow] Continue following fields until the trial stops. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + trialLogsFields(trialId: number, follow?: boolean, options?: any) { + return TrialsApiFp(configuration).trialLogsFields(trialId, follow, options)(fetch, basePath); + }, + } +}; + +/** + * TrialsApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class TrialsApi extends BaseAPI { /** - * - * @summary Get a list of webhooks. + * + * @summary Get the list of trials for an experiment. + * @param {number} experimentId Limit trials to those that are owned by the specified experiments. + * @param {V1GetExperimentTrialsRequestSortBy} [sortBy] Sort trials by the given field. - SORT_BY_UNSPECIFIED: Returns trials in an unsorted list. - SORT_BY_ID: Returns trials sorted by id. - SORT_BY_START_TIME: Return trials sorted by start time. - SORT_BY_END_TIME: Return trials sorted by end time. Trials without end times are returned after trials that are. - SORT_BY_STATE: Return trials sorted by state. - SORT_BY_BEST_VALIDATION_METRIC: Return the trials sorted by the best metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_LATEST_VALIDATION_METRIC: Return the trials sorted by the latest metric so far, where the metric is specified by `searcher.metric` in the experiment configuration. - SORT_BY_BATCHES_PROCESSED: Return the trials sorted by the number of batches completed. - SORT_BY_DURATION: Return the trials sorted by the total duration. - SORT_BY_RESTARTS: Return the trials sorted by the number of restarts. - SORT_BY_CHECKPOINT_SIZE: Return the trials sorted by checkpoint size. - SORT_BY_LOG_RETENTION_DAYS: Return the trials sorted by number of log retention days. + * @param {V1OrderBy} [orderBy] Order trials in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of trials before returning results. Negative values denote number of trials to skip from the end before returning results. + * @param {number} [limit] Limit the number of trials. A value of 0 denotes no limit. + * @param {Array} [states] Limit trials to those that match the provided state. - STATE_UNSPECIFIED: The state of the experiment is unknown. - STATE_ACTIVE: The experiment is in an active state. - STATE_PAUSED: The experiment is in a paused state - STATE_STOPPING_COMPLETED: The experiment is completed and is shutting down. - STATE_STOPPING_CANCELED: The experiment is canceled and is shutting down. - STATE_STOPPING_ERROR: The experiment is errored and is shutting down. - STATE_COMPLETED: The experiment is completed and is shut down. - STATE_CANCELED: The experiment is canceled and is shut down. - STATE_ERROR: The experiment is errored and is shut down. - STATE_DELETED: The experiment has been deleted. - STATE_DELETING: The experiment is deleting. - STATE_DELETE_FAILED: The experiment failed to delete. - STATE_STOPPING_KILLED: The experiment is killed and is shutting down. - STATE_QUEUED: The experiment is queued (waiting to be run, or job state is still queued). Queued is a substate of the Active state. - STATE_PULLING: The experiment is pulling the image. Pulling is a substate of the Active state. - STATE_STARTING: The experiment is preparing the environment after finishing pulling the image. Starting is a substate of the Active state. - STATE_RUNNING: The experiment has an allocation actively running. Running is a substate of the Active state. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TrialsApi */ - getWebhooks(options?: any) { - return WebhooksApiFp(configuration).getWebhooks(options)(fetch, basePath); - }, + public getExperimentTrials(experimentId: number, sortBy?: V1GetExperimentTrialsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, states?: Array, options?: any) { + return TrialsApiFp(this.configuration).getExperimentTrials(experimentId, sortBy, orderBy, offset, limit, states, options)(this.fetch, this.basePath) + } + /** - * - * @summary Create a webhook. TODO(???): Simplify req/response structs? - * @param {V1Webhook} body The webhook to store. + * + * @summary Stream one or more trial's metrics. + * @param {Array} trialIds Trial IDs to get metrics for. + * @param {string} group The group of metrics to get eg 'training', 'validation', etc. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TrialsApi */ - postWebhook(body: V1Webhook, options?: any) { - return WebhooksApiFp(configuration).postWebhook(body, options)(fetch, basePath); - }, + public getMetrics(trialIds: Array, group: string, options?: any) { + return TrialsApiFp(this.configuration).getMetrics(trialIds, group, options)(this.fetch, this.basePath) + } + /** - * - * @summary Test a webhook. - * @param {number} id The id of the webhook. + * + * @summary Stream one or more trial's training metrics. + * @param {Array} [trialIds] Trial IDs to get metrics for. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TrialsApi */ - testWebhook(id: number, options?: any) { - return WebhooksApiFp(configuration).testWebhook(id, options)(fetch, basePath); - }, - }; -}; - -/** - * WebhooksApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class WebhooksApi extends BaseAPI { - /** - * - * @summary Delete a webhook. - * @param {number} id The id of the webhook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WebhooksApi - */ - public deleteWebhook(id: number, options?: any) { - return WebhooksApiFp(this.configuration).deleteWebhook(id, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get a list of webhooks. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WebhooksApi - */ - public getWebhooks(options?: any) { - return WebhooksApiFp(this.configuration).getWebhooks(options)(this.fetch, this.basePath); - } - - /** - * - * @summary Create a webhook. TODO(???): Simplify req/response structs? - * @param {V1Webhook} body The webhook to store. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WebhooksApi - */ - public postWebhook(body: V1Webhook, options?: any) { - return WebhooksApiFp(this.configuration).postWebhook(body, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Test a webhook. - * @param {number} id The id of the webhook. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WebhooksApi - */ - public testWebhook(id: number, options?: any) { - return WebhooksApiFp(this.configuration).testWebhook(id, options)(this.fetch, this.basePath); - } -} - -/** - * WorkspacesApi - fetch parameter creator - * @export - */ -export const WorkspacesApiFetchParamCreator = function (configuration?: Configuration) { - return { + public getTrainingMetrics(trialIds?: Array, options?: any) { + return TrialsApiFp(this.configuration).getTrainingMetrics(trialIds, options)(this.fetch, this.basePath) + } + /** - * - * @summary Archive a workspace. - * @param {number} id The id of the workspace. + * + * @summary Get a single trial. + * @param {number} trialId The requested trial's id. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TrialsApi */ - archiveWorkspace(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling archiveWorkspace.', - ); - } - const localVarPath = `/api/v1/workspaces/{id}/archive`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getTrial(trialId: number, options?: any) { + return TrialsApiFp(this.configuration).getTrial(trialId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Delete a workspace. - * @param {number} id The id of the workspace. + * + * @summary Get the list of workloads for a trial. + * @param {number} trialId Limit workloads to those that are owned by the specified trial. + * @param {V1OrderBy} [orderBy] Order workloads in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workloads before returning results. Negative values denote number of workloads to skip from the end before returning results. + * @param {number} [limit] Limit the number of workloads. A value of 0 denotes no limit. + * @param {string} [sortKey] Sort workloads by batches, a training metric, or a validation metric. + * @param {GetTrialWorkloadsRequestFilterOption} [filter] Filter workloads with validation and/or checkpoint information. - FILTER_OPTION_UNSPECIFIED: Any workload. - FILTER_OPTION_CHECKPOINT: Only workloads with an associated checkpoint. - FILTER_OPTION_VALIDATION: Only validation workloads. - FILTER_OPTION_CHECKPOINT_OR_VALIDATION: Only validation workloads or ones with an associated checkpoint. + * @param {boolean} [includeBatchMetrics] Include per-batch metrics. + * @param {V1MetricType} [metricType] When sorting workloads by sort_key, specify training or validation form of a metric. - METRIC_TYPE_UNSPECIFIED: Zero-value (not allowed). - METRIC_TYPE_TRAINING: For metrics emitted during training. - METRIC_TYPE_VALIDATION: For metrics emitted during validation. - METRIC_TYPE_PROFILING: For metrics emitted during profiling. + * @param {string} [group] Metric group (training, validation, etc). + * @param {boolean} [removeDeletedCheckpoints] Remove deleted checkpoints. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TrialsApi */ - deleteWorkspace(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling deleteWorkspace.', - ); - } - const localVarPath = `/api/v1/workspaces/{id}`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'DELETE', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getTrialWorkloads(trialId: number, orderBy?: V1OrderBy, offset?: number, limit?: number, sortKey?: string, filter?: GetTrialWorkloadsRequestFilterOption, includeBatchMetrics?: boolean, metricType?: V1MetricType, group?: string, removeDeletedCheckpoints?: boolean, options?: any) { + return TrialsApiFp(this.configuration).getTrialWorkloads(trialId, orderBy, offset, limit, sortKey, filter, includeBatchMetrics, metricType, group, removeDeletedCheckpoints, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get the requested workspace. - * @param {number} id The id of the workspace. + * + * @summary Stream one or more trial's validation metrics. + * @param {Array} [trialIds] Trial IDs to get metrics for. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TrialsApi */ - getWorkspace(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling getWorkspace.', - ); - } - const localVarPath = `/api/v1/workspaces/{id}`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getValidationMetrics(trialIds?: Array, options?: any) { + return TrialsApiFp(this.configuration).getValidationMetrics(trialIds, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get projects associated with a workspace. - * @param {number} id The id of the workspace. When id is set to 0, return all projects across the all workspaces. - * @param {V1GetWorkspaceProjectsRequestSortBy} [sortBy] Sort the projects by the given field. - SORT_BY_UNSPECIFIED: Returns projects in an unsorted list. - SORT_BY_CREATION_TIME: Returns projects sorted by time that they were created. - SORT_BY_LAST_EXPERIMENT_START_TIME: Returns projects sorted by most recent start of an experiment. - SORT_BY_NAME: Returns projects sorted by name. - SORT_BY_DESCRIPTION: Returns projects sorted by description. - SORT_BY_ID: Returns projects sorted by ID. - * @param {V1OrderBy} [orderBy] Order projects in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. - * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. - * @param {string} [name] Limit the projects to those matching the name. - * @param {boolean} [archived] Limit the projects to those with an archived status. - * @param {Array} [users] Limit the projects to those from particular users, by usernames. - * @param {Array} [userIds] Limit the projects to those from particular users, by userIds. + * + * @summary Kill a trial. + * @param {number} id The trial id * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TrialsApi */ - getWorkspaceProjects( - id: number, - sortBy?: V1GetWorkspaceProjectsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - archived?: boolean, - users?: Array, - userIds?: Array, - options: any = {}, - ): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling getWorkspaceProjects.', - ); - } - const localVarPath = `/api/v1/workspaces/{id}/projects`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (name !== undefined) { - localVarQueryParameter['name'] = name; - } - - if (archived !== undefined) { - localVarQueryParameter['archived'] = archived; - } - - if (users) { - localVarQueryParameter['users'] = users; - } - - if (userIds) { - localVarQueryParameter['userIds'] = userIds; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public killTrial(id: number, options?: any) { + return TrialsApiFp(this.configuration).killTrial(id, options)(this.fetch, this.basePath) + } + /** - * - * @summary Get a list of workspaces. - * @param {V1GetWorkspacesRequestSortBy} [sortBy] Sort the workspaces by the given field. - SORT_BY_UNSPECIFIED: Returns workspaces in an unsorted list. - SORT_BY_ID: Returns workspaces sorted by id. - SORT_BY_NAME: Returns workspaces sorted by name. - * @param {V1OrderBy} [orderBy] Order workspaces in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workspaces before returning results. Negative values denote number of workspaces to skip from the end before returning results. - * @param {number} [limit] Limit the number of workspaces. A value of 0 denotes no limit. - * @param {string} [name] Limit the workspaces to those matching the name (case insensitive). - * @param {boolean} [archived] Limit the workspaces to those with an archived status. - * @param {Array} [users] Limit the workspaces to those from particular users, by usernames. - * @param {Array} [userIds] Limit the workspaces to those from particular users, by userIds. - * @param {boolean} [pinned] Limit the workspaces to those with pinned status by the current user. - * @param {string} [nameCaseSensitive] Limit the workspaces to those matching the name (case sensitive). + * + * @summary Retain logs for a Trial. + * @param {number} trialId The ID of the trial. + * @param {V1PutTrialRetainLogsRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TrialsApi */ - getWorkspaces( - sortBy?: V1GetWorkspacesRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - archived?: boolean, - users?: Array, - userIds?: Array, - pinned?: boolean, - nameCaseSensitive?: string, - options: any = {}, - ): FetchArgs { - const localVarPath = `/api/v1/workspaces`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (sortBy !== undefined) { - localVarQueryParameter['sortBy'] = sortBy; - } - - if (orderBy !== undefined) { - localVarQueryParameter['orderBy'] = orderBy; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (name !== undefined) { - localVarQueryParameter['name'] = name; - } - - if (archived !== undefined) { - localVarQueryParameter['archived'] = archived; - } - - if (users) { - localVarQueryParameter['users'] = users; - } - - if (userIds) { - localVarQueryParameter['userIds'] = userIds; - } - - if (pinned !== undefined) { - localVarQueryParameter['pinned'] = pinned; - } - - if (nameCaseSensitive !== undefined) { - localVarQueryParameter['nameCaseSensitive'] = nameCaseSensitive; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public putTrialRetainLogs(trialId: number, body: V1PutTrialRetainLogsRequest, options?: any) { + return TrialsApiFp(this.configuration).putTrialRetainLogs(trialId, body, options)(this.fetch, this.basePath) + } + /** - * - * @summary List all resource pools, bound and unbound, available to a specific workspace - * @param {number} workspaceId Workspace ID. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. + * + * @summary Stream trial logs. + * @param {number} trialId The id of the trial. + * @param {number} [limit] Limit the number of trial logs. A value of 0 denotes no limit. + * @param {boolean} [follow] Continue following logs until the trial stops. + * @param {Array} [agentIds] Limit the trial logs to a subset of agents. + * @param {Array} [containerIds] Limit the trial logs to a subset of containers. + * @param {Array} [rankIds] Limit the trial logs to a subset of ranks. + * @param {Array} [levels] Limit the trial logs to a subset of agents. - LOG_LEVEL_UNSPECIFIED: Unspecified log level. - LOG_LEVEL_TRACE: A log level of TRACE. - LOG_LEVEL_DEBUG: A log level of DEBUG. - LOG_LEVEL_INFO: A log level of INFO. - LOG_LEVEL_WARNING: A log level of WARNING. - LOG_LEVEL_ERROR: A log level of ERROR. - LOG_LEVEL_CRITICAL: A log level of CRITICAL. + * @param {Array} [stdtypes] Limit the trial logs to a subset of output streams. + * @param {Array} [sources] Limit the trial logs to a subset of sources. + * @param {Date | DateString} [timestampBefore] Limit the trial logs to ones with a timestamp before a given time. + * @param {Date | DateString} [timestampAfter] Limit the trial logs to ones with a timestamp after a given time. + * @param {V1OrderBy} [orderBy] Order logs in either ascending or descending order by timestamp. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {string} [searchText] Search the logs by whether the text contains a substring. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TrialsApi */ - listRPsBoundToWorkspace( - workspaceId: number, - offset?: number, - limit?: number, - options: any = {}, - ): FetchArgs { - // verify required parameter 'workspaceId' is not null or undefined - if (workspaceId === null || workspaceId === undefined) { - throw new RequiredError( - 'workspaceId', - 'Required parameter workspaceId was null or undefined when calling listRPsBoundToWorkspace.', - ); - } - const localVarPath = `/api/v1/workspaces/{workspaceId}/available-resource-pools`.replace( - `{${'workspaceId'}}`, - encodeURIComponent(String(workspaceId)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'GET', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - if (offset !== undefined) { - localVarQueryParameter['offset'] = offset; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public trialLogs(trialId: number, limit?: number, follow?: boolean, agentIds?: Array, containerIds?: Array, rankIds?: Array, levels?: Array, stdtypes?: Array, sources?: Array, timestampBefore?: Date | DateString, timestampAfter?: Date | DateString, orderBy?: V1OrderBy, searchText?: string, options?: any) { + return TrialsApiFp(this.configuration).trialLogs(trialId, limit, follow, agentIds, containerIds, rankIds, levels, stdtypes, sources, timestampBefore, timestampAfter, orderBy, searchText, options)(this.fetch, this.basePath) + } + /** - * - * @summary Update a workspace. - * @param {number} id The id of the workspace. - * @param {V1PatchWorkspace} body The desired workspace fields and values to update. + * + * @summary Stream trial log fields. + * @param {number} trialId The ID of the trial. + * @param {boolean} [follow] Continue following fields until the trial stops. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof TrialsApi */ - patchWorkspace(id: number, body: V1PatchWorkspace, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling patchWorkspace.', - ); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling patchWorkspace.', - ); - } - const localVarPath = `/api/v1/workspaces/{id}`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'PATCH', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; + public trialLogsFields(trialId: number, follow?: boolean, options?: any) { + return TrialsApiFp(this.configuration).trialLogsFields(trialId, follow, options)(this.fetch, this.basePath) + } + +} - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } +/** + * UsersApi - fetch parameter creator + * @export + */ +export const UsersApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the current user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMe(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/me`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested user. + * @param {number} userId The id of the user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUser(userId: number, options: any = {}): FetchArgs { + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError('userId','Required parameter userId was null or undefined when calling getUser.'); + } + const localVarPath = `/api/v1/users/{userId}` + .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested user with username. + * @param {string} username The string of the username. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByUsername(username: string, options: any = {}): FetchArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByUsername.'); + } + const localVarPath = `/api/v1/users/{username}/by-username` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of users. + * @param {V1GetUsersRequestSortBy} [sortBy] Sort users by the given field. - SORT_BY_UNSPECIFIED: Returns users in an unsorted list. - SORT_BY_DISPLAY_NAME: Returns users sorted by display name. - SORT_BY_USER_NAME: Returns users sorted by user name. - SORT_BY_ADMIN: Returns users sorted by if they are admin. - SORT_BY_ACTIVE: Returns users sorted by if they are active. - SORT_BY_MODIFIED_TIME: Returns users sorted by modified time. - SORT_BY_NAME: Returns users sorted by username unless display name exist. - SORT_BY_LAST_AUTH_TIME: Returns users sorted by last authenticated time. - SORT_BY_REMOTE: Returns users sorted by local or remote auth. + * @param {V1OrderBy} [orderBy] Order users in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. + * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. + * @param {string} [name] Filter by username or display name. + * @param {boolean} [active] Filter by status. + * @param {boolean} [admin] Filter by roles. + * @param {Array} [roleIdAssignedDirectlyToUser] Filter by roles id assigned directly to user for EE. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUsers(sortBy?: V1GetUsersRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, active?: boolean, admin?: boolean, roleIdAssignedDirectlyToUser?: Array, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/users`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (name !== undefined) { + localVarQueryParameter['name'] = name + } + + if (active !== undefined) { + localVarQueryParameter['active'] = active + } + + if (admin !== undefined) { + localVarQueryParameter['admin'] = admin + } + + if (roleIdAssignedDirectlyToUser) { + localVarQueryParameter['roleIdAssignedDirectlyToUser'] = roleIdAssignedDirectlyToUser + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a user's settings for website + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserSetting(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/users/setting`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Patch a user's fields. + * @param {number} userId The id of the user. + * @param {V1PatchUser} body The updated user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchUser(userId: number, body: V1PatchUser, options: any = {}): FetchArgs { + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError('userId','Required parameter userId was null or undefined when calling patchUser.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchUser.'); + } + const localVarPath = `/api/v1/users/{userId}` + .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create a new user. + * @param {V1PostUserRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postUser(body: V1PostUserRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postUser.'); + } + const localVarPath = `/api/v1/users`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Patch a user's activity + * @param {V1PostUserActivityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postUserActivity(body: V1PostUserActivityRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postUserActivity.'); + } + const localVarPath = `/api/v1/users/activity`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Post a user's settings for website + * @param {V1PostUserSettingRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postUserSetting(body: V1PostUserSettingRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postUserSetting.'); + } + const localVarPath = `/api/v1/users/setting`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Reset a user's settings for website + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resetUserSetting(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/users/setting/reset`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Set the requested user's password. + * @param {number} userId The id of the user. + * @param {string} body The password of the user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setUserPassword(userId: number, body: string, options: any = {}): FetchArgs { + // verify required parameter 'userId' is not null or undefined + if (userId === null || userId === undefined) { + throw new RequiredError('userId','Required parameter userId was null or undefined when calling setUserPassword.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling setUserPassword.'); + } + const localVarPath = `/api/v1/users/{userId}/password` + .replace(`{${"userId"}}`, encodeURIComponent(String(userId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + const needsSerialization = localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body) : body + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; - localVarHeaderParameter['Content-Type'] = 'application/json'; +/** + * UsersApi - functional programming interface + * @export + */ +export const UsersApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Get the current user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMe(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).getMe(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested user. + * @param {number} userId The id of the user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUser(userId: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).getUser(userId, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested user with username. + * @param {string} username The string of the username. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByUsername(username: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).getUserByUsername(username, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of users. + * @param {V1GetUsersRequestSortBy} [sortBy] Sort users by the given field. - SORT_BY_UNSPECIFIED: Returns users in an unsorted list. - SORT_BY_DISPLAY_NAME: Returns users sorted by display name. - SORT_BY_USER_NAME: Returns users sorted by user name. - SORT_BY_ADMIN: Returns users sorted by if they are admin. - SORT_BY_ACTIVE: Returns users sorted by if they are active. - SORT_BY_MODIFIED_TIME: Returns users sorted by modified time. - SORT_BY_NAME: Returns users sorted by username unless display name exist. - SORT_BY_LAST_AUTH_TIME: Returns users sorted by last authenticated time. - SORT_BY_REMOTE: Returns users sorted by local or remote auth. + * @param {V1OrderBy} [orderBy] Order users in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. + * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. + * @param {string} [name] Filter by username or display name. + * @param {boolean} [active] Filter by status. + * @param {boolean} [admin] Filter by roles. + * @param {Array} [roleIdAssignedDirectlyToUser] Filter by roles id assigned directly to user for EE. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUsers(sortBy?: V1GetUsersRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, active?: boolean, admin?: boolean, roleIdAssignedDirectlyToUser?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).getUsers(sortBy, orderBy, offset, limit, name, active, admin, roleIdAssignedDirectlyToUser, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a user's settings for website + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserSetting(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).getUserSetting(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Patch a user's fields. + * @param {number} userId The id of the user. + * @param {V1PatchUser} body The updated user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchUser(userId: number, body: V1PatchUser, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).patchUser(userId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create a new user. + * @param {V1PostUserRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postUser(body: V1PostUserRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).postUser(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Patch a user's activity + * @param {V1PostUserActivityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postUserActivity(body: V1PostUserActivityRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).postUserActivity(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Post a user's settings for website + * @param {V1PostUserSettingRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postUserSetting(body: V1PostUserSettingRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).postUserSetting(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Reset a user's settings for website + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resetUserSetting(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).resetUserSetting(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Set the requested user's password. + * @param {number} userId The id of the user. + * @param {string} body The password of the user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setUserPassword(userId: number, body: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = UsersApiFetchParamCreator(configuration).setUserPassword(userId, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); +/** + * UsersApi - factory interface + * @export + */ +export const UsersApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Get the current user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getMe(options?: any) { + return UsersApiFp(configuration).getMe(options)(fetch, basePath); + }, + /** + * + * @summary Get the requested user. + * @param {number} userId The id of the user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUser(userId: number, options?: any) { + return UsersApiFp(configuration).getUser(userId, options)(fetch, basePath); + }, + /** + * + * @summary Get the requested user with username. + * @param {string} username The string of the username. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByUsername(username: string, options?: any) { + return UsersApiFp(configuration).getUserByUsername(username, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of users. + * @param {V1GetUsersRequestSortBy} [sortBy] Sort users by the given field. - SORT_BY_UNSPECIFIED: Returns users in an unsorted list. - SORT_BY_DISPLAY_NAME: Returns users sorted by display name. - SORT_BY_USER_NAME: Returns users sorted by user name. - SORT_BY_ADMIN: Returns users sorted by if they are admin. - SORT_BY_ACTIVE: Returns users sorted by if they are active. - SORT_BY_MODIFIED_TIME: Returns users sorted by modified time. - SORT_BY_NAME: Returns users sorted by username unless display name exist. - SORT_BY_LAST_AUTH_TIME: Returns users sorted by last authenticated time. - SORT_BY_REMOTE: Returns users sorted by local or remote auth. + * @param {V1OrderBy} [orderBy] Order users in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. + * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. + * @param {string} [name] Filter by username or display name. + * @param {boolean} [active] Filter by status. + * @param {boolean} [admin] Filter by roles. + * @param {Array} [roleIdAssignedDirectlyToUser] Filter by roles id assigned directly to user for EE. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUsers(sortBy?: V1GetUsersRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, active?: boolean, admin?: boolean, roleIdAssignedDirectlyToUser?: Array, options?: any) { + return UsersApiFp(configuration).getUsers(sortBy, orderBy, offset, limit, name, active, admin, roleIdAssignedDirectlyToUser, options)(fetch, basePath); + }, + /** + * + * @summary Get a user's settings for website + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserSetting(options?: any) { + return UsersApiFp(configuration).getUserSetting(options)(fetch, basePath); + }, + /** + * + * @summary Patch a user's fields. + * @param {number} userId The id of the user. + * @param {V1PatchUser} body The updated user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchUser(userId: number, body: V1PatchUser, options?: any) { + return UsersApiFp(configuration).patchUser(userId, body, options)(fetch, basePath); + }, + /** + * + * @summary Create a new user. + * @param {V1PostUserRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postUser(body: V1PostUserRequest, options?: any) { + return UsersApiFp(configuration).postUser(body, options)(fetch, basePath); + }, + /** + * + * @summary Patch a user's activity + * @param {V1PostUserActivityRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postUserActivity(body: V1PostUserActivityRequest, options?: any) { + return UsersApiFp(configuration).postUserActivity(body, options)(fetch, basePath); + }, + /** + * + * @summary Post a user's settings for website + * @param {V1PostUserSettingRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postUserSetting(body: V1PostUserSettingRequest, options?: any) { + return UsersApiFp(configuration).postUserSetting(body, options)(fetch, basePath); + }, + /** + * + * @summary Reset a user's settings for website + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + resetUserSetting(options?: any) { + return UsersApiFp(configuration).resetUserSetting(options)(fetch, basePath); + }, + /** + * + * @summary Set the requested user's password. + * @param {number} userId The id of the user. + * @param {string} body The password of the user. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + setUserPassword(userId: number, body: string, options?: any) { + return UsersApiFp(configuration).setUserPassword(userId, body, options)(fetch, basePath); + }, + } +}; - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, +/** + * UsersApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class UsersApi extends BaseAPI { /** - * - * @summary Pin a workspace. - * @param {number} id The id of the workspace. + * + * @summary Get the current user. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - pinWorkspace(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling pinWorkspace.', - ); - } - const localVarPath = `/api/v1/workspaces/{id}/pin`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getMe(options?: any) { + return UsersApiFp(this.configuration).getMe(options)(this.fetch, this.basePath) + } + /** - * - * @summary Create a workspace. - * @param {V1PostWorkspaceRequest} body + * + * @summary Get the requested user. + * @param {number} userId The id of the user. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - postWorkspace(body: V1PostWorkspaceRequest, options: any = {}): FetchArgs { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError( - 'body', - 'Required parameter body was null or undefined when calling postWorkspace.', - ); - } - const localVarPath = `/api/v1/workspaces`; - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - localVarHeaderParameter['Content-Type'] = 'application/json'; - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - localVarRequestOptions.body = JSON.stringify(body); - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getUser(userId: number, options?: any) { + return UsersApiFp(this.configuration).getUser(userId, options)(this.fetch, this.basePath) + } + /** - * - * @summary Unarchive a workspace. - * @param {number} id The id of the workspace. + * + * @summary Get the requested user with username. + * @param {string} username The string of the username. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - unarchiveWorkspace(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling unarchiveWorkspace.', - ); - } - const localVarPath = `/api/v1/workspaces/{id}/unarchive`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, + public getUserByUsername(username: string, options?: any) { + return UsersApiFp(this.configuration).getUserByUsername(username, options)(this.fetch, this.basePath) + } + /** - * - * @summary Unpin a workspace. - * @param {number} id The id of the workspace. + * + * @summary Get a list of users. + * @param {V1GetUsersRequestSortBy} [sortBy] Sort users by the given field. - SORT_BY_UNSPECIFIED: Returns users in an unsorted list. - SORT_BY_DISPLAY_NAME: Returns users sorted by display name. - SORT_BY_USER_NAME: Returns users sorted by user name. - SORT_BY_ADMIN: Returns users sorted by if they are admin. - SORT_BY_ACTIVE: Returns users sorted by if they are active. - SORT_BY_MODIFIED_TIME: Returns users sorted by modified time. - SORT_BY_NAME: Returns users sorted by username unless display name exist. - SORT_BY_LAST_AUTH_TIME: Returns users sorted by last authenticated time. - SORT_BY_REMOTE: Returns users sorted by local or remote auth. + * @param {V1OrderBy} [orderBy] Order users in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. + * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. + * @param {string} [name] Filter by username or display name. + * @param {boolean} [active] Filter by status. + * @param {boolean} [admin] Filter by roles. + * @param {Array} [roleIdAssignedDirectlyToUser] Filter by roles id assigned directly to user for EE. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - unpinWorkspace(id: number, options: any = {}): FetchArgs { - // verify required parameter 'id' is not null or undefined - if (id === null || id === undefined) { - throw new RequiredError( - 'id', - 'Required parameter id was null or undefined when calling unpinWorkspace.', - ); - } - const localVarPath = `/api/v1/workspaces/{id}/unpin`.replace( - `{${'id'}}`, - encodeURIComponent(String(id)), - ); - const localVarUrlObj = new URL(localVarPath, BASE_PATH); - const localVarRequestOptions = { method: 'POST', ...options }; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - // authentication BearerToken required - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = - typeof configuration.apiKey === 'function' - ? configuration.apiKey('Authorization') - : configuration.apiKey; - localVarHeaderParameter['Authorization'] = localVarApiKeyValue; - } - - objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); - objToSearchParams(options.query || {}, localVarUrlObj.searchParams); - localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; - - return { - url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, - options: localVarRequestOptions, - }; - }, - }; -}; - -/** - * WorkspacesApi - functional programming interface - * @export - */ -export const WorkspacesApiFp = function (configuration?: Configuration) { - return { + public getUsers(sortBy?: V1GetUsersRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, active?: boolean, admin?: boolean, roleIdAssignedDirectlyToUser?: Array, options?: any) { + return UsersApiFp(this.configuration).getUsers(sortBy, orderBy, offset, limit, name, active, admin, roleIdAssignedDirectlyToUser, options)(this.fetch, this.basePath) + } + /** - * - * @summary Archive a workspace. - * @param {number} id The id of the workspace. + * + * @summary Get a user's settings for website * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - archiveWorkspace( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).archiveWorkspace( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Delete a workspace. - * @param {number} id The id of the workspace. + public getUserSetting(options?: any) { + return UsersApiFp(this.configuration).getUserSetting(options)(this.fetch, this.basePath) + } + + /** + * + * @summary Patch a user's fields. + * @param {number} userId The id of the user. + * @param {V1PatchUser} body The updated user. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - deleteWorkspace( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).deleteWorkspace( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get the requested workspace. - * @param {number} id The id of the workspace. + public patchUser(userId: number, body: V1PatchUser, options?: any) { + return UsersApiFp(this.configuration).patchUser(userId, body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Create a new user. + * @param {V1PostUserRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - getWorkspace( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).getWorkspace( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get projects associated with a workspace. - * @param {number} id The id of the workspace. When id is set to 0, return all projects across the all workspaces. - * @param {V1GetWorkspaceProjectsRequestSortBy} [sortBy] Sort the projects by the given field. - SORT_BY_UNSPECIFIED: Returns projects in an unsorted list. - SORT_BY_CREATION_TIME: Returns projects sorted by time that they were created. - SORT_BY_LAST_EXPERIMENT_START_TIME: Returns projects sorted by most recent start of an experiment. - SORT_BY_NAME: Returns projects sorted by name. - SORT_BY_DESCRIPTION: Returns projects sorted by description. - SORT_BY_ID: Returns projects sorted by ID. - * @param {V1OrderBy} [orderBy] Order projects in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. - * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. - * @param {string} [name] Limit the projects to those matching the name. - * @param {boolean} [archived] Limit the projects to those with an archived status. - * @param {Array} [users] Limit the projects to those from particular users, by usernames. - * @param {Array} [userIds] Limit the projects to those from particular users, by userIds. + public postUser(body: V1PostUserRequest, options?: any) { + return UsersApiFp(this.configuration).postUser(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Patch a user's activity + * @param {V1PostUserActivityRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - getWorkspaceProjects( - id: number, - sortBy?: V1GetWorkspaceProjectsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - archived?: boolean, - users?: Array, - userIds?: Array, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).getWorkspaceProjects( - id, - sortBy, - orderBy, - offset, - limit, - name, - archived, - users, - userIds, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Get a list of workspaces. - * @param {V1GetWorkspacesRequestSortBy} [sortBy] Sort the workspaces by the given field. - SORT_BY_UNSPECIFIED: Returns workspaces in an unsorted list. - SORT_BY_ID: Returns workspaces sorted by id. - SORT_BY_NAME: Returns workspaces sorted by name. - * @param {V1OrderBy} [orderBy] Order workspaces in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workspaces before returning results. Negative values denote number of workspaces to skip from the end before returning results. - * @param {number} [limit] Limit the number of workspaces. A value of 0 denotes no limit. - * @param {string} [name] Limit the workspaces to those matching the name (case insensitive). - * @param {boolean} [archived] Limit the workspaces to those with an archived status. - * @param {Array} [users] Limit the workspaces to those from particular users, by usernames. - * @param {Array} [userIds] Limit the workspaces to those from particular users, by userIds. - * @param {boolean} [pinned] Limit the workspaces to those with pinned status by the current user. - * @param {string} [nameCaseSensitive] Limit the workspaces to those matching the name (case sensitive). + public postUserActivity(body: V1PostUserActivityRequest, options?: any) { + return UsersApiFp(this.configuration).postUserActivity(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Post a user's settings for website + * @param {V1PostUserSettingRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - getWorkspaces( - sortBy?: V1GetWorkspacesRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - archived?: boolean, - users?: Array, - userIds?: Array, - pinned?: boolean, - nameCaseSensitive?: string, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).getWorkspaces( - sortBy, - orderBy, - offset, - limit, - name, - archived, - users, - userIds, - pinned, - nameCaseSensitive, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary List all resource pools, bound and unbound, available to a specific workspace - * @param {number} workspaceId Workspace ID. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. + public postUserSetting(body: V1PostUserSettingRequest, options?: any) { + return UsersApiFp(this.configuration).postUserSetting(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Reset a user's settings for website * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - listRPsBoundToWorkspace( - workspaceId: number, - offset?: number, - limit?: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator( - configuration, - ).listRPsBoundToWorkspace(workspaceId, offset, limit, options); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Update a workspace. - * @param {number} id The id of the workspace. - * @param {V1PatchWorkspace} body The desired workspace fields and values to update. + public resetUserSetting(options?: any) { + return UsersApiFp(this.configuration).resetUserSetting(options)(this.fetch, this.basePath) + } + + /** + * + * @summary Set the requested user's password. + * @param {number} userId The id of the user. + * @param {string} body The password of the user. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof UsersApi */ - patchWorkspace( - id: number, - body: V1PatchWorkspace, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).patchWorkspace( - id, - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Pin a workspace. - * @param {number} id The id of the workspace. + public setUserPassword(userId: number, body: string, options?: any) { + return UsersApiFp(this.configuration).setUserPassword(userId, body, options)(this.fetch, this.basePath) + } + +} + +/** + * WebhooksApi - fetch parameter creator + * @export + */ +export const WebhooksApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Delete a webhook. + * @param {number} id The id of the webhook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteWebhook(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling deleteWebhook.'); + } + const localVarPath = `/api/v1/webhooks/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of webhooks. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWebhooks(options: any = {}): FetchArgs { + const localVarPath = `/api/v1/webhooks`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create a webhook. TODO(???): Simplify req/response structs? + * @param {V1Webhook} body The webhook to store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postWebhook(body: V1Webhook, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postWebhook.'); + } + const localVarPath = `/api/v1/webhooks`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Test a webhook. + * @param {number} id The id of the webhook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testWebhook(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling testWebhook.'); + } + const localVarPath = `/api/v1/webhooks/{id}/test` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * WebhooksApi - functional programming interface + * @export + */ +export const WebhooksApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Delete a webhook. + * @param {number} id The id of the webhook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteWebhook(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WebhooksApiFetchParamCreator(configuration).deleteWebhook(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of webhooks. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWebhooks(options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WebhooksApiFetchParamCreator(configuration).getWebhooks(options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create a webhook. TODO(???): Simplify req/response structs? + * @param {V1Webhook} body The webhook to store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postWebhook(body: V1Webhook, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WebhooksApiFetchParamCreator(configuration).postWebhook(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Test a webhook. + * @param {number} id The id of the webhook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testWebhook(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WebhooksApiFetchParamCreator(configuration).testWebhook(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } +}; + +/** + * WebhooksApi - factory interface + * @export + */ +export const WebhooksApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Delete a webhook. + * @param {number} id The id of the webhook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteWebhook(id: number, options?: any) { + return WebhooksApiFp(configuration).deleteWebhook(id, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of webhooks. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWebhooks(options?: any) { + return WebhooksApiFp(configuration).getWebhooks(options)(fetch, basePath); + }, + /** + * + * @summary Create a webhook. TODO(???): Simplify req/response structs? + * @param {V1Webhook} body The webhook to store. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postWebhook(body: V1Webhook, options?: any) { + return WebhooksApiFp(configuration).postWebhook(body, options)(fetch, basePath); + }, + /** + * + * @summary Test a webhook. + * @param {number} id The id of the webhook. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + testWebhook(id: number, options?: any) { + return WebhooksApiFp(configuration).testWebhook(id, options)(fetch, basePath); + }, + } +}; + +/** + * WebhooksApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class WebhooksApi extends BaseAPI { + /** + * + * @summary Delete a webhook. + * @param {number} id The id of the webhook. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WebhooksApi */ - pinWorkspace( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).pinWorkspace( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Create a workspace. - * @param {V1PostWorkspaceRequest} body + public deleteWebhook(id: number, options?: any) { + return WebhooksApiFp(this.configuration).deleteWebhook(id, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Get a list of webhooks. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WebhooksApi */ - postWorkspace( - body: V1PostWorkspaceRequest, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).postWorkspace( - body, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Unarchive a workspace. - * @param {number} id The id of the workspace. + public getWebhooks(options?: any) { + return WebhooksApiFp(this.configuration).getWebhooks(options)(this.fetch, this.basePath) + } + + /** + * + * @summary Create a webhook. TODO(???): Simplify req/response structs? + * @param {V1Webhook} body The webhook to store. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WebhooksApi */ - unarchiveWorkspace( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).unarchiveWorkspace( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - /** - * - * @summary Unpin a workspace. - * @param {number} id The id of the workspace. + public postWebhook(body: V1Webhook, options?: any) { + return WebhooksApiFp(this.configuration).postWebhook(body, options)(this.fetch, this.basePath) + } + + /** + * + * @summary Test a webhook. + * @param {number} id The id of the webhook. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WebhooksApi */ - unpinWorkspace( - id: number, - options?: any, - ): (fetch?: FetchAPI, basePath?: string) => Promise { - const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).unpinWorkspace( - id, - options, - ); - return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then( - (response) => { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }, - ); - }; - }, - }; + public testWebhook(id: number, options?: any) { + return WebhooksApiFp(this.configuration).testWebhook(id, options)(this.fetch, this.basePath) + } + +} + +/** + * WorkspacesApi - fetch parameter creator + * @export + */ +export const WorkspacesApiFetchParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Archive a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveWorkspace(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling archiveWorkspace.'); + } + const localVarPath = `/api/v1/workspaces/{id}/archive` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Delete a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteWorkspace(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling deleteWorkspace.'); + } + const localVarPath = `/api/v1/workspaces/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'DELETE', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get the requested workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkspace(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling getWorkspace.'); + } + const localVarPath = `/api/v1/workspaces/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get projects associated with a workspace. + * @param {number} id The id of the workspace. When id is set to 0, return all projects across the all workspaces. + * @param {V1GetWorkspaceProjectsRequestSortBy} [sortBy] Sort the projects by the given field. - SORT_BY_UNSPECIFIED: Returns projects in an unsorted list. - SORT_BY_CREATION_TIME: Returns projects sorted by time that they were created. - SORT_BY_LAST_EXPERIMENT_START_TIME: Returns projects sorted by most recent start of an experiment. - SORT_BY_NAME: Returns projects sorted by name. - SORT_BY_DESCRIPTION: Returns projects sorted by description. - SORT_BY_ID: Returns projects sorted by ID. + * @param {V1OrderBy} [orderBy] Order projects in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. + * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. + * @param {string} [name] Limit the projects to those matching the name. + * @param {boolean} [archived] Limit the projects to those with an archived status. + * @param {Array} [users] Limit the projects to those from particular users, by usernames. + * @param {Array} [userIds] Limit the projects to those from particular users, by userIds. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkspaceProjects(id: number, sortBy?: V1GetWorkspaceProjectsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, archived?: boolean, users?: Array, userIds?: Array, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling getWorkspaceProjects.'); + } + const localVarPath = `/api/v1/workspaces/{id}/projects` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (name !== undefined) { + localVarQueryParameter['name'] = name + } + + if (archived !== undefined) { + localVarQueryParameter['archived'] = archived + } + + if (users) { + localVarQueryParameter['users'] = users + } + + if (userIds) { + localVarQueryParameter['userIds'] = userIds + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get a list of workspaces. + * @param {V1GetWorkspacesRequestSortBy} [sortBy] Sort the workspaces by the given field. - SORT_BY_UNSPECIFIED: Returns workspaces in an unsorted list. - SORT_BY_ID: Returns workspaces sorted by id. - SORT_BY_NAME: Returns workspaces sorted by name. + * @param {V1OrderBy} [orderBy] Order workspaces in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workspaces before returning results. Negative values denote number of workspaces to skip from the end before returning results. + * @param {number} [limit] Limit the number of workspaces. A value of 0 denotes no limit. + * @param {string} [name] Limit the workspaces to those matching the name (case insensitive). + * @param {boolean} [archived] Limit the workspaces to those with an archived status. + * @param {Array} [users] Limit the workspaces to those from particular users, by usernames. + * @param {Array} [userIds] Limit the workspaces to those from particular users, by userIds. + * @param {boolean} [pinned] Limit the workspaces to those with pinned status by the current user. + * @param {string} [nameCaseSensitive] Limit the workspaces to those matching the name (case sensitive). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkspaces(sortBy?: V1GetWorkspacesRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, archived?: boolean, users?: Array, userIds?: Array, pinned?: boolean, nameCaseSensitive?: string, options: any = {}): FetchArgs { + const localVarPath = `/api/v1/workspaces`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (sortBy !== undefined) { + localVarQueryParameter['sortBy'] = sortBy + } + + if (orderBy !== undefined) { + localVarQueryParameter['orderBy'] = orderBy + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + if (name !== undefined) { + localVarQueryParameter['name'] = name + } + + if (archived !== undefined) { + localVarQueryParameter['archived'] = archived + } + + if (users) { + localVarQueryParameter['users'] = users + } + + if (userIds) { + localVarQueryParameter['userIds'] = userIds + } + + if (pinned !== undefined) { + localVarQueryParameter['pinned'] = pinned + } + + if (nameCaseSensitive !== undefined) { + localVarQueryParameter['nameCaseSensitive'] = nameCaseSensitive + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary List all resource pools, bound and unbound, available to a specific workspace + * @param {number} workspaceId Workspace ID. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRPsBoundToWorkspace(workspaceId: number, offset?: number, limit?: number, options: any = {}): FetchArgs { + // verify required parameter 'workspaceId' is not null or undefined + if (workspaceId === null || workspaceId === undefined) { + throw new RequiredError('workspaceId','Required parameter workspaceId was null or undefined when calling listRPsBoundToWorkspace.'); + } + const localVarPath = `/api/v1/workspaces/{workspaceId}/available-resource-pools` + .replace(`{${"workspaceId"}}`, encodeURIComponent(String(workspaceId))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'GET', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + if (offset !== undefined) { + localVarQueryParameter['offset'] = offset + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update a workspace. + * @param {number} id The id of the workspace. + * @param {V1PatchWorkspace} body The desired workspace fields and values to update. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchWorkspace(id: number, body: V1PatchWorkspace, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling patchWorkspace.'); + } + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling patchWorkspace.'); + } + const localVarPath = `/api/v1/workspaces/{id}` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'PATCH', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Pin a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pinWorkspace(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling pinWorkspace.'); + } + const localVarPath = `/api/v1/workspaces/{id}/pin` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Create a workspace. + * @param {V1PostWorkspaceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postWorkspace(body: V1PostWorkspaceRequest, options: any = {}): FetchArgs { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body','Required parameter body was null or undefined when calling postWorkspace.'); + } + const localVarPath = `/api/v1/workspaces`; + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + localVarRequestOptions.body = JSON.stringify(body) + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Unarchive a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveWorkspace(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling unarchiveWorkspace.'); + } + const localVarPath = `/api/v1/workspaces/{id}/unarchive` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Unpin a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unpinWorkspace(id: number, options: any = {}): FetchArgs { + // verify required parameter 'id' is not null or undefined + if (id === null || id === undefined) { + throw new RequiredError('id','Required parameter id was null or undefined when calling unpinWorkspace.'); + } + const localVarPath = `/api/v1/workspaces/{id}/unpin` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + const localVarUrlObj = new URL(localVarPath, BASE_PATH); + const localVarRequestOptions = { method: 'POST', ...options }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication BearerToken required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("Authorization") + : configuration.apiKey; + localVarHeaderParameter["Authorization"] = localVarApiKeyValue; + } + + objToSearchParams(localVarQueryParameter, localVarUrlObj.searchParams); + objToSearchParams(options.query || {}, localVarUrlObj.searchParams); + localVarRequestOptions.headers = { ...localVarHeaderParameter, ...options.headers }; + + return { + url: `${localVarUrlObj.pathname}${localVarUrlObj.search}`, + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * WorkspacesApi - functional programming interface + * @export + */ +export const WorkspacesApiFp = function (configuration?: Configuration) { + return { + /** + * + * @summary Archive a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveWorkspace(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).archiveWorkspace(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Delete a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteWorkspace(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).deleteWorkspace(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get the requested workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkspace(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).getWorkspace(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get projects associated with a workspace. + * @param {number} id The id of the workspace. When id is set to 0, return all projects across the all workspaces. + * @param {V1GetWorkspaceProjectsRequestSortBy} [sortBy] Sort the projects by the given field. - SORT_BY_UNSPECIFIED: Returns projects in an unsorted list. - SORT_BY_CREATION_TIME: Returns projects sorted by time that they were created. - SORT_BY_LAST_EXPERIMENT_START_TIME: Returns projects sorted by most recent start of an experiment. - SORT_BY_NAME: Returns projects sorted by name. - SORT_BY_DESCRIPTION: Returns projects sorted by description. - SORT_BY_ID: Returns projects sorted by ID. + * @param {V1OrderBy} [orderBy] Order projects in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. + * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. + * @param {string} [name] Limit the projects to those matching the name. + * @param {boolean} [archived] Limit the projects to those with an archived status. + * @param {Array} [users] Limit the projects to those from particular users, by usernames. + * @param {Array} [userIds] Limit the projects to those from particular users, by userIds. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkspaceProjects(id: number, sortBy?: V1GetWorkspaceProjectsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, archived?: boolean, users?: Array, userIds?: Array, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).getWorkspaceProjects(id, sortBy, orderBy, offset, limit, name, archived, users, userIds, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Get a list of workspaces. + * @param {V1GetWorkspacesRequestSortBy} [sortBy] Sort the workspaces by the given field. - SORT_BY_UNSPECIFIED: Returns workspaces in an unsorted list. - SORT_BY_ID: Returns workspaces sorted by id. - SORT_BY_NAME: Returns workspaces sorted by name. + * @param {V1OrderBy} [orderBy] Order workspaces in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workspaces before returning results. Negative values denote number of workspaces to skip from the end before returning results. + * @param {number} [limit] Limit the number of workspaces. A value of 0 denotes no limit. + * @param {string} [name] Limit the workspaces to those matching the name (case insensitive). + * @param {boolean} [archived] Limit the workspaces to those with an archived status. + * @param {Array} [users] Limit the workspaces to those from particular users, by usernames. + * @param {Array} [userIds] Limit the workspaces to those from particular users, by userIds. + * @param {boolean} [pinned] Limit the workspaces to those with pinned status by the current user. + * @param {string} [nameCaseSensitive] Limit the workspaces to those matching the name (case sensitive). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkspaces(sortBy?: V1GetWorkspacesRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, archived?: boolean, users?: Array, userIds?: Array, pinned?: boolean, nameCaseSensitive?: string, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).getWorkspaces(sortBy, orderBy, offset, limit, name, archived, users, userIds, pinned, nameCaseSensitive, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary List all resource pools, bound and unbound, available to a specific workspace + * @param {number} workspaceId Workspace ID. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRPsBoundToWorkspace(workspaceId: number, offset?: number, limit?: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).listRPsBoundToWorkspace(workspaceId, offset, limit, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Update a workspace. + * @param {number} id The id of the workspace. + * @param {V1PatchWorkspace} body The desired workspace fields and values to update. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchWorkspace(id: number, body: V1PatchWorkspace, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).patchWorkspace(id, body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Pin a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pinWorkspace(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).pinWorkspace(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Create a workspace. + * @param {V1PostWorkspaceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postWorkspace(body: V1PostWorkspaceRequest, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).postWorkspace(body, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Unarchive a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveWorkspace(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).unarchiveWorkspace(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + /** + * + * @summary Unpin a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unpinWorkspace(id: number, options?: any): (fetch?: FetchAPI, basePath?: string) => Promise { + const localVarFetchArgs = WorkspacesApiFetchParamCreator(configuration).unpinWorkspace(id, options); + return (fetch: FetchAPI = window.fetch, basePath: string = BASE_PATH) => { + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }; + }, + } }; /** * WorkspacesApi - factory interface * @export */ -export const WorkspacesApiFactory = function ( - configuration?: Configuration, - fetch?: FetchAPI, - basePath?: string, -) { - return { +export const WorkspacesApiFactory = function (configuration?: Configuration, fetch?: FetchAPI, basePath?: string) { + return { + /** + * + * @summary Archive a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + archiveWorkspace(id: number, options?: any) { + return WorkspacesApiFp(configuration).archiveWorkspace(id, options)(fetch, basePath); + }, + /** + * + * @summary Delete a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteWorkspace(id: number, options?: any) { + return WorkspacesApiFp(configuration).deleteWorkspace(id, options)(fetch, basePath); + }, + /** + * + * @summary Get the requested workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkspace(id: number, options?: any) { + return WorkspacesApiFp(configuration).getWorkspace(id, options)(fetch, basePath); + }, + /** + * + * @summary Get projects associated with a workspace. + * @param {number} id The id of the workspace. When id is set to 0, return all projects across the all workspaces. + * @param {V1GetWorkspaceProjectsRequestSortBy} [sortBy] Sort the projects by the given field. - SORT_BY_UNSPECIFIED: Returns projects in an unsorted list. - SORT_BY_CREATION_TIME: Returns projects sorted by time that they were created. - SORT_BY_LAST_EXPERIMENT_START_TIME: Returns projects sorted by most recent start of an experiment. - SORT_BY_NAME: Returns projects sorted by name. - SORT_BY_DESCRIPTION: Returns projects sorted by description. - SORT_BY_ID: Returns projects sorted by ID. + * @param {V1OrderBy} [orderBy] Order projects in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. + * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. + * @param {string} [name] Limit the projects to those matching the name. + * @param {boolean} [archived] Limit the projects to those with an archived status. + * @param {Array} [users] Limit the projects to those from particular users, by usernames. + * @param {Array} [userIds] Limit the projects to those from particular users, by userIds. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkspaceProjects(id: number, sortBy?: V1GetWorkspaceProjectsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, archived?: boolean, users?: Array, userIds?: Array, options?: any) { + return WorkspacesApiFp(configuration).getWorkspaceProjects(id, sortBy, orderBy, offset, limit, name, archived, users, userIds, options)(fetch, basePath); + }, + /** + * + * @summary Get a list of workspaces. + * @param {V1GetWorkspacesRequestSortBy} [sortBy] Sort the workspaces by the given field. - SORT_BY_UNSPECIFIED: Returns workspaces in an unsorted list. - SORT_BY_ID: Returns workspaces sorted by id. - SORT_BY_NAME: Returns workspaces sorted by name. + * @param {V1OrderBy} [orderBy] Order workspaces in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. + * @param {number} [offset] Skip the number of workspaces before returning results. Negative values denote number of workspaces to skip from the end before returning results. + * @param {number} [limit] Limit the number of workspaces. A value of 0 denotes no limit. + * @param {string} [name] Limit the workspaces to those matching the name (case insensitive). + * @param {boolean} [archived] Limit the workspaces to those with an archived status. + * @param {Array} [users] Limit the workspaces to those from particular users, by usernames. + * @param {Array} [userIds] Limit the workspaces to those from particular users, by userIds. + * @param {boolean} [pinned] Limit the workspaces to those with pinned status by the current user. + * @param {string} [nameCaseSensitive] Limit the workspaces to those matching the name (case sensitive). + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWorkspaces(sortBy?: V1GetWorkspacesRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, archived?: boolean, users?: Array, userIds?: Array, pinned?: boolean, nameCaseSensitive?: string, options?: any) { + return WorkspacesApiFp(configuration).getWorkspaces(sortBy, orderBy, offset, limit, name, archived, users, userIds, pinned, nameCaseSensitive, options)(fetch, basePath); + }, + /** + * + * @summary List all resource pools, bound and unbound, available to a specific workspace + * @param {number} workspaceId Workspace ID. + * @param {number} [offset] The offset to use with pagination. + * @param {number} [limit] The maximum number of results to return. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listRPsBoundToWorkspace(workspaceId: number, offset?: number, limit?: number, options?: any) { + return WorkspacesApiFp(configuration).listRPsBoundToWorkspace(workspaceId, offset, limit, options)(fetch, basePath); + }, + /** + * + * @summary Update a workspace. + * @param {number} id The id of the workspace. + * @param {V1PatchWorkspace} body The desired workspace fields and values to update. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + patchWorkspace(id: number, body: V1PatchWorkspace, options?: any) { + return WorkspacesApiFp(configuration).patchWorkspace(id, body, options)(fetch, basePath); + }, + /** + * + * @summary Pin a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + pinWorkspace(id: number, options?: any) { + return WorkspacesApiFp(configuration).pinWorkspace(id, options)(fetch, basePath); + }, + /** + * + * @summary Create a workspace. + * @param {V1PostWorkspaceRequest} body + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + postWorkspace(body: V1PostWorkspaceRequest, options?: any) { + return WorkspacesApiFp(configuration).postWorkspace(body, options)(fetch, basePath); + }, + /** + * + * @summary Unarchive a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unarchiveWorkspace(id: number, options?: any) { + return WorkspacesApiFp(configuration).unarchiveWorkspace(id, options)(fetch, basePath); + }, + /** + * + * @summary Unpin a workspace. + * @param {number} id The id of the workspace. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + unpinWorkspace(id: number, options?: any) { + return WorkspacesApiFp(configuration).unpinWorkspace(id, options)(fetch, basePath); + }, + } +}; + +/** + * WorkspacesApi - object-oriented interface + * @export + * @class + * @extends {BaseAPI} + */ +export class WorkspacesApi extends BaseAPI { /** - * + * * @summary Archive a workspace. * @param {number} id The id of the workspace. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - archiveWorkspace(id: number, options?: any) { - return WorkspacesApiFp(configuration).archiveWorkspace(id, options)(fetch, basePath); - }, + public archiveWorkspace(id: number, options?: any) { + return WorkspacesApiFp(this.configuration).archiveWorkspace(id, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Delete a workspace. * @param {number} id The id of the workspace. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - deleteWorkspace(id: number, options?: any) { - return WorkspacesApiFp(configuration).deleteWorkspace(id, options)(fetch, basePath); - }, + public deleteWorkspace(id: number, options?: any) { + return WorkspacesApiFp(this.configuration).deleteWorkspace(id, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get the requested workspace. * @param {number} id The id of the workspace. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - getWorkspace(id: number, options?: any) { - return WorkspacesApiFp(configuration).getWorkspace(id, options)(fetch, basePath); - }, + public getWorkspace(id: number, options?: any) { + return WorkspacesApiFp(this.configuration).getWorkspace(id, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Get projects associated with a workspace. * @param {number} id The id of the workspace. When id is set to 0, return all projects across the all workspaces. * @param {V1GetWorkspaceProjectsRequestSortBy} [sortBy] Sort the projects by the given field. - SORT_BY_UNSPECIFIED: Returns projects in an unsorted list. - SORT_BY_CREATION_TIME: Returns projects sorted by time that they were created. - SORT_BY_LAST_EXPERIMENT_START_TIME: Returns projects sorted by most recent start of an experiment. - SORT_BY_NAME: Returns projects sorted by name. - SORT_BY_DESCRIPTION: Returns projects sorted by description. - SORT_BY_ID: Returns projects sorted by ID. @@ -42588,34 +35619,14 @@ export const WorkspacesApiFactory = function ( * @param {Array} [userIds] Limit the projects to those from particular users, by userIds. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - getWorkspaceProjects( - id: number, - sortBy?: V1GetWorkspaceProjectsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - archived?: boolean, - users?: Array, - userIds?: Array, - options?: any, - ) { - return WorkspacesApiFp(configuration).getWorkspaceProjects( - id, - sortBy, - orderBy, - offset, - limit, - name, - archived, - users, - userIds, - options, - )(fetch, basePath); - }, - /** - * + public getWorkspaceProjects(id: number, sortBy?: V1GetWorkspaceProjectsRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, archived?: boolean, users?: Array, userIds?: Array, options?: any) { + return WorkspacesApiFp(this.configuration).getWorkspaceProjects(id, sortBy, orderBy, offset, limit, name, archived, users, userIds, options)(this.fetch, this.basePath) + } + + /** + * * @summary Get a list of workspaces. * @param {V1GetWorkspacesRequestSortBy} [sortBy] Sort the workspaces by the given field. - SORT_BY_UNSPECIFIED: Returns workspaces in an unsorted list. - SORT_BY_ID: Returns workspaces sorted by id. - SORT_BY_NAME: Returns workspaces sorted by name. * @param {V1OrderBy} [orderBy] Order workspaces in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. @@ -42629,336 +35640,85 @@ export const WorkspacesApiFactory = function ( * @param {string} [nameCaseSensitive] Limit the workspaces to those matching the name (case sensitive). * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - getWorkspaces( - sortBy?: V1GetWorkspacesRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - archived?: boolean, - users?: Array, - userIds?: Array, - pinned?: boolean, - nameCaseSensitive?: string, - options?: any, - ) { - return WorkspacesApiFp(configuration).getWorkspaces( - sortBy, - orderBy, - offset, - limit, - name, - archived, - users, - userIds, - pinned, - nameCaseSensitive, - options, - )(fetch, basePath); - }, - /** - * + public getWorkspaces(sortBy?: V1GetWorkspacesRequestSortBy, orderBy?: V1OrderBy, offset?: number, limit?: number, name?: string, archived?: boolean, users?: Array, userIds?: Array, pinned?: boolean, nameCaseSensitive?: string, options?: any) { + return WorkspacesApiFp(this.configuration).getWorkspaces(sortBy, orderBy, offset, limit, name, archived, users, userIds, pinned, nameCaseSensitive, options)(this.fetch, this.basePath) + } + + /** + * * @summary List all resource pools, bound and unbound, available to a specific workspace * @param {number} workspaceId Workspace ID. * @param {number} [offset] The offset to use with pagination. * @param {number} [limit] The maximum number of results to return. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - listRPsBoundToWorkspace(workspaceId: number, offset?: number, limit?: number, options?: any) { - return WorkspacesApiFp(configuration).listRPsBoundToWorkspace( - workspaceId, - offset, - limit, - options, - )(fetch, basePath); - }, + public listRPsBoundToWorkspace(workspaceId: number, offset?: number, limit?: number, options?: any) { + return WorkspacesApiFp(this.configuration).listRPsBoundToWorkspace(workspaceId, offset, limit, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Update a workspace. * @param {number} id The id of the workspace. * @param {V1PatchWorkspace} body The desired workspace fields and values to update. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - patchWorkspace(id: number, body: V1PatchWorkspace, options?: any) { - return WorkspacesApiFp(configuration).patchWorkspace(id, body, options)(fetch, basePath); - }, + public patchWorkspace(id: number, body: V1PatchWorkspace, options?: any) { + return WorkspacesApiFp(this.configuration).patchWorkspace(id, body, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Pin a workspace. * @param {number} id The id of the workspace. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - pinWorkspace(id: number, options?: any) { - return WorkspacesApiFp(configuration).pinWorkspace(id, options)(fetch, basePath); - }, + public pinWorkspace(id: number, options?: any) { + return WorkspacesApiFp(this.configuration).pinWorkspace(id, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Create a workspace. * @param {V1PostWorkspaceRequest} body * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - postWorkspace(body: V1PostWorkspaceRequest, options?: any) { - return WorkspacesApiFp(configuration).postWorkspace(body, options)(fetch, basePath); - }, + public postWorkspace(body: V1PostWorkspaceRequest, options?: any) { + return WorkspacesApiFp(this.configuration).postWorkspace(body, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Unarchive a workspace. * @param {number} id The id of the workspace. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - unarchiveWorkspace(id: number, options?: any) { - return WorkspacesApiFp(configuration).unarchiveWorkspace(id, options)(fetch, basePath); - }, + public unarchiveWorkspace(id: number, options?: any) { + return WorkspacesApiFp(this.configuration).unarchiveWorkspace(id, options)(this.fetch, this.basePath) + } + /** - * + * * @summary Unpin a workspace. * @param {number} id The id of the workspace. * @param {*} [options] Override http request option. * @throws {RequiredError} + * @memberof WorkspacesApi */ - unpinWorkspace(id: number, options?: any) { - return WorkspacesApiFp(configuration).unpinWorkspace(id, options)(fetch, basePath); - }, - }; -}; - -/** - * WorkspacesApi - object-oriented interface - * @export - * @class - * @extends {BaseAPI} - */ -export class WorkspacesApi extends BaseAPI { - /** - * - * @summary Archive a workspace. - * @param {number} id The id of the workspace. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public archiveWorkspace(id: number, options?: any) { - return WorkspacesApiFp(this.configuration).archiveWorkspace(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Delete a workspace. - * @param {number} id The id of the workspace. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public deleteWorkspace(id: number, options?: any) { - return WorkspacesApiFp(this.configuration).deleteWorkspace(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Get the requested workspace. - * @param {number} id The id of the workspace. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public getWorkspace(id: number, options?: any) { - return WorkspacesApiFp(this.configuration).getWorkspace(id, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Get projects associated with a workspace. - * @param {number} id The id of the workspace. When id is set to 0, return all projects across the all workspaces. - * @param {V1GetWorkspaceProjectsRequestSortBy} [sortBy] Sort the projects by the given field. - SORT_BY_UNSPECIFIED: Returns projects in an unsorted list. - SORT_BY_CREATION_TIME: Returns projects sorted by time that they were created. - SORT_BY_LAST_EXPERIMENT_START_TIME: Returns projects sorted by most recent start of an experiment. - SORT_BY_NAME: Returns projects sorted by name. - SORT_BY_DESCRIPTION: Returns projects sorted by description. - SORT_BY_ID: Returns projects sorted by ID. - * @param {V1OrderBy} [orderBy] Order projects in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of projects before returning results. Negative values denote number of projects to skip from the end before returning results. - * @param {number} [limit] Limit the number of projects. A value of 0 denotes no limit. - * @param {string} [name] Limit the projects to those matching the name. - * @param {boolean} [archived] Limit the projects to those with an archived status. - * @param {Array} [users] Limit the projects to those from particular users, by usernames. - * @param {Array} [userIds] Limit the projects to those from particular users, by userIds. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public getWorkspaceProjects( - id: number, - sortBy?: V1GetWorkspaceProjectsRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - archived?: boolean, - users?: Array, - userIds?: Array, - options?: any, - ) { - return WorkspacesApiFp(this.configuration).getWorkspaceProjects( - id, - sortBy, - orderBy, - offset, - limit, - name, - archived, - users, - userIds, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Get a list of workspaces. - * @param {V1GetWorkspacesRequestSortBy} [sortBy] Sort the workspaces by the given field. - SORT_BY_UNSPECIFIED: Returns workspaces in an unsorted list. - SORT_BY_ID: Returns workspaces sorted by id. - SORT_BY_NAME: Returns workspaces sorted by name. - * @param {V1OrderBy} [orderBy] Order workspaces in either ascending or descending order. - ORDER_BY_UNSPECIFIED: Returns records in no specific order. - ORDER_BY_ASC: Returns records in ascending order. - ORDER_BY_DESC: Returns records in descending order. - * @param {number} [offset] Skip the number of workspaces before returning results. Negative values denote number of workspaces to skip from the end before returning results. - * @param {number} [limit] Limit the number of workspaces. A value of 0 denotes no limit. - * @param {string} [name] Limit the workspaces to those matching the name (case insensitive). - * @param {boolean} [archived] Limit the workspaces to those with an archived status. - * @param {Array} [users] Limit the workspaces to those from particular users, by usernames. - * @param {Array} [userIds] Limit the workspaces to those from particular users, by userIds. - * @param {boolean} [pinned] Limit the workspaces to those with pinned status by the current user. - * @param {string} [nameCaseSensitive] Limit the workspaces to those matching the name (case sensitive). - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public getWorkspaces( - sortBy?: V1GetWorkspacesRequestSortBy, - orderBy?: V1OrderBy, - offset?: number, - limit?: number, - name?: string, - archived?: boolean, - users?: Array, - userIds?: Array, - pinned?: boolean, - nameCaseSensitive?: string, - options?: any, - ) { - return WorkspacesApiFp(this.configuration).getWorkspaces( - sortBy, - orderBy, - offset, - limit, - name, - archived, - users, - userIds, - pinned, - nameCaseSensitive, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary List all resource pools, bound and unbound, available to a specific workspace - * @param {number} workspaceId Workspace ID. - * @param {number} [offset] The offset to use with pagination. - * @param {number} [limit] The maximum number of results to return. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public listRPsBoundToWorkspace( - workspaceId: number, - offset?: number, - limit?: number, - options?: any, - ) { - return WorkspacesApiFp(this.configuration).listRPsBoundToWorkspace( - workspaceId, - offset, - limit, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Update a workspace. - * @param {number} id The id of the workspace. - * @param {V1PatchWorkspace} body The desired workspace fields and values to update. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public patchWorkspace(id: number, body: V1PatchWorkspace, options?: any) { - return WorkspacesApiFp(this.configuration).patchWorkspace( - id, - body, - options, - )(this.fetch, this.basePath); - } - - /** - * - * @summary Pin a workspace. - * @param {number} id The id of the workspace. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public pinWorkspace(id: number, options?: any) { - return WorkspacesApiFp(this.configuration).pinWorkspace(id, options)(this.fetch, this.basePath); - } - - /** - * - * @summary Create a workspace. - * @param {V1PostWorkspaceRequest} body - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public postWorkspace(body: V1PostWorkspaceRequest, options?: any) { - return WorkspacesApiFp(this.configuration).postWorkspace(body, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Unarchive a workspace. - * @param {number} id The id of the workspace. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public unarchiveWorkspace(id: number, options?: any) { - return WorkspacesApiFp(this.configuration).unarchiveWorkspace(id, options)( - this.fetch, - this.basePath, - ); - } - - /** - * - * @summary Unpin a workspace. - * @param {number} id The id of the workspace. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof WorkspacesApi - */ - public unpinWorkspace(id: number, options?: any) { - return WorkspacesApiFp(this.configuration).unpinWorkspace(id, options)( - this.fetch, - this.basePath, - ); - } + public unpinWorkspace(id: number, options?: any) { + return WorkspacesApiFp(this.configuration).unpinWorkspace(id, options)(this.fetch, this.basePath) + } + } From 94861e1620a31f8c09019b6bb931e192243c8809 Mon Sep 17 00:00:00 2001 From: John Kim Date: Fri, 28 Jun 2024 11:18:24 -0400 Subject: [PATCH 155/161] merge fix --- webui/react/src/services/apiConfig.ts | 50 --------------------------- 1 file changed, 50 deletions(-) diff --git a/webui/react/src/services/apiConfig.ts b/webui/react/src/services/apiConfig.ts index ada020d2138..8a28abd1336 100644 --- a/webui/react/src/services/apiConfig.ts +++ b/webui/react/src/services/apiConfig.ts @@ -1190,56 +1190,6 @@ export const unarchiveRuns: DetApi< request: (params, options) => detApi.Internal.unarchiveRuns(params, options), }; -export const archiveRuns: DetApi< - Api.V1ArchiveRunsRequest, - Api.V1ArchiveRunsResponse, - Type.BulkActionResult -> = { - name: 'archiveRuns', - postProcess: (response) => decoder.mapV1ActionResults(response.results), - request: (params, options) => detApi.Internal.archiveRuns(params, options), -}; - -export const deleteRuns: DetApi< - Api.V1DeleteRunsRequest, - Api.V1DeleteRunsResponse, - Type.BulkActionResult -> = { - name: 'deleteRuns', - postProcess: (response) => decoder.mapV1ActionResults(response.results), - request: (params, options) => detApi.Internal.deleteRuns(params, options), -}; - -export const killRuns: DetApi< - Api.V1KillRunsRequest, - Api.V1KillRunsResponse, - Type.BulkActionResult -> = { - name: 'killRuns', - postProcess: (response) => decoder.mapV1ActionResults(response.results), - request: (params, options) => detApi.Internal.killRuns(params, options), -}; - -export const moveRuns: DetApi< - Api.V1MoveRunsRequest, - Api.V1MoveRunsResponse, - Type.BulkActionResult -> = { - name: 'moveRuns', - postProcess: (response) => decoder.mapV1ActionResults(response.results), - request: (params, options) => detApi.Internal.moveRuns(params, options), -}; - -export const unarchiveRuns: DetApi< - Api.V1UnarchiveRunsRequest, - Api.V1UnarchiveRunsResponse, - Type.BulkActionResult -> = { - name: 'unarchiveRuns', - postProcess: (response) => decoder.mapV1ActionResults(response.results), - request: (params, options) => detApi.Internal.unarchiveRuns(params, options), -}; - /* Tasks */ export const getTask: DetApi< From e26369944bfec787c9ce8596b9e0acf73938ff6a Mon Sep 17 00:00:00 2001 From: John Kim Date: Fri, 28 Jun 2024 15:27:02 -0400 Subject: [PATCH 156/161] add ExperimentActionDropdown tests --- .../ExperimentActionDropdown.test.mock.tsx | 65 ++++++ .../ExperimentActionDropdown.test.tsx | 190 ++++++++++++++++++ .../components/ExperimentActionDropdown.tsx | 2 +- 3 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 webui/react/src/components/ExperimentActionDropdown.test.mock.tsx create mode 100644 webui/react/src/components/ExperimentActionDropdown.test.tsx diff --git a/webui/react/src/components/ExperimentActionDropdown.test.mock.tsx b/webui/react/src/components/ExperimentActionDropdown.test.mock.tsx new file mode 100644 index 00000000000..4dedcb273a1 --- /dev/null +++ b/webui/react/src/components/ExperimentActionDropdown.test.mock.tsx @@ -0,0 +1,65 @@ +import { GridCell, GridCellKind } from '@glideapps/glide-data-grid'; + +import { ProjectExperiment } from 'types'; + +export const cell: GridCell = { + allowOverlay: false, + copyData: 'core-api-stage-3', + cursor: 'pointer', + data: { + kind: 'link-cell', + link: { + href: '/experiments/7261', + title: 'core-api-stage-3', + unmanaged: false, + }, + navigateOn: 'click', + underlineOffset: 6, + }, + kind: GridCellKind.Custom, + readonly: true, +}; + +export const experiment: ProjectExperiment = { + archived: false, + checkpoints: 0, + checkpointSize: 0, + description: 'Continuation of trial 49300, experiment 7229', + duration: 12, + endTime: '2024-06-27T22:35:00.745298Z', + forkedFrom: 7229, + hyperparameters: { + increment_by: { + type: 'const', + val: 1, + }, + irrelevant1: { + type: 'const', + val: 1, + }, + irrelevant2: { + type: 'const', + val: 1, + }, + }, + id: 7261, + jobId: '742ae9dc-e712-4348-9b15-a1b9f652d6d5', + labels: [], + name: 'core-api-stage-3', + notes: '', + numTrials: 1, + parentArchived: false, + progress: 0, + projectId: 1, + projectName: 'Uncategorized', + projectOwnerId: 1, + resourcePool: 'aux-pool', + searcherType: 'single', + startTime: '2024-06-27T22:34:49.194301Z', + state: 'CANCELED', + trialIds: [], + unmanaged: false, + userId: 1288, + workspaceId: 1, + workspaceName: 'Uncategorized', +}; diff --git a/webui/react/src/components/ExperimentActionDropdown.test.tsx b/webui/react/src/components/ExperimentActionDropdown.test.tsx new file mode 100644 index 00000000000..e50913de41a --- /dev/null +++ b/webui/react/src/components/ExperimentActionDropdown.test.tsx @@ -0,0 +1,190 @@ +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import UIProvider, { DefaultTheme } from 'hew/Theme'; +import { ConfirmationProvider } from 'hew/useConfirm'; + +import { handlePath } from 'routes/utils'; +import { + archiveExperiment, + deleteExperiment, + killExperiment, + unarchiveExperiment, +} from 'services/api'; +import { RunState } from 'types'; + +import ExperimentActionDropdown from './ExperimentActionDropdown'; +import { cell, experiment } from './ExperimentActionDropdown.test.mock'; + +const user = userEvent.setup(); + +const mockNavigatorClipboard = () => { + Object.defineProperty(navigator, 'clipboard', { + configurable: true, + value: { + readText: vi.fn(), + writeText: vi.fn(), + }, + writable: true, + }); +}; + +vi.mock('routes/utils', () => ({ + handlePath: vi.fn(), + serverAddress: () => 'http://localhost', +})); + +vi.mock('services/api', () => ({ + archiveExperiment: vi.fn(), + deleteExperiment: vi.fn(), + getWorkspaces: vi.fn(() => Promise.resolve({ workspaces: [] })), + killExperiment: vi.fn(), + unarchiveExperiment: vi.fn(), +})); + +const mocks = vi.hoisted(() => { + return { + canDeleteExperiment: vi.fn(), + canModifyExperiment: vi.fn(), + canModifyExperimentMetadata: vi.fn(), + canMoveExperiment: vi.fn(), + canViewExperimentArtifacts: vi.fn(), + }; +}); + +vi.mock('hooks/usePermissions', () => { + const usePermissions = vi.fn(() => { + return { + canDeleteExperiment: mocks.canDeleteExperiment, + canModifyExperiment: mocks.canModifyExperiment, + canModifyExperimentMetadata: mocks.canModifyExperimentMetadata, + canMoveExperiment: mocks.canMoveExperiment, + canViewExperimentArtifacts: mocks.canViewExperimentArtifacts, + }; + }); + return { + default: usePermissions, + }; +}); + +const setup = (link?: string, state?: RunState, archived?: boolean) => { + const onComplete = vi.fn(); + const onVisibleChange = vi.fn(); + render( + + + +
+ + + , + ); + return { + onComplete, + onVisibleChange, + }; +}; + +describe('ExperimentActionDropdown', () => { + it('should provide Copy Data option', async () => { + setup(); + mockNavigatorClipboard(); + await user.click(screen.getByText('Copy Value')); + expect(navigator.clipboard.writeText).toHaveBeenCalledWith(cell.copyData); + }); + + it('should provide Link option', async () => { + const link = 'https://www.google.com/'; + setup(link); + await user.click(screen.getByText('Open Link in New Tab')); + const tabClick = vi.mocked(handlePath).mock.calls[0]; + expect(tabClick[0]).toMatchObject({ type: 'click' }); + expect(tabClick[1]).toMatchObject({ + path: link, + popout: 'tab', + }); + await user.click(screen.getByText('Open Link in New Window')); + const windowClick = vi.mocked(handlePath).mock.calls[1]; + expect(windowClick[0]).toMatchObject({ type: 'click' }); + expect(windowClick[1]).toMatchObject({ + path: link, + popout: 'window', + }); + }); + + it('should provide Delete option', async () => { + mocks.canDeleteExperiment.mockImplementation(() => true); + setup(); + await user.click(screen.getByText('Delete')); + await user.click(screen.getByRole('button', { name: 'Delete' })); + expect(vi.mocked(deleteExperiment)).toBeCalled(); + }); + + it('should hide Delete option without permissions', () => { + mocks.canDeleteExperiment.mockImplementation(() => false); + setup(); + expect(screen.queryByText('Delete')).not.toBeInTheDocument(); + }); + + it('should provide Kill option', async () => { + mocks.canModifyExperiment.mockImplementation(() => true); + setup(undefined, RunState.Paused, undefined); + await user.click(screen.getByText('Kill')); + await user.click(screen.getByRole('button', { name: 'Kill' })); + expect(vi.mocked(killExperiment)).toBeCalled(); + }); + + it('should hide Kill option without permissions', () => { + mocks.canModifyExperiment.mockImplementation(() => false); + setup(undefined, RunState.Paused, undefined); + expect(screen.queryByText('Kill')).not.toBeInTheDocument(); + }); + + it('should provide Archive option', async () => { + mocks.canModifyExperiment.mockImplementation(() => true); + setup(); + await user.click(screen.getByText('Archive')); + expect(vi.mocked(archiveExperiment)).toBeCalled(); + }); + + it('should hide Archive option without permissions', () => { + mocks.canModifyExperiment.mockImplementation(() => false); + setup(); + expect(screen.queryByText('Archive')).not.toBeInTheDocument(); + }); + + it('should provide Unarchive option', async () => { + mocks.canModifyExperiment.mockImplementation(() => true); + setup(undefined, undefined, true); + await user.click(screen.getByText('Unarchive')); + expect(vi.mocked(unarchiveExperiment)).toBeCalled(); + }); + + it('should hide Unarchive option without permissions', () => { + mocks.canModifyExperiment.mockImplementation(() => false); + setup(undefined, undefined, true); + expect(screen.queryByText('Unarchive')).not.toBeInTheDocument(); + }); + + it('should provide Move option', () => { + mocks.canMoveExperiment.mockImplementation(() => true); + setup(); + expect(screen.getByText('Move')).toBeInTheDocument(); + }); + + it('should hide Move option without permissions', () => { + mocks.canMoveExperiment.mockImplementation(() => false); + setup(); + expect(screen.queryByText('Move')).not.toBeInTheDocument(); + }); +}); diff --git a/webui/react/src/components/ExperimentActionDropdown.tsx b/webui/react/src/components/ExperimentActionDropdown.tsx index 327b48ef8b8..8a03f1cb415 100644 --- a/webui/react/src/components/ExperimentActionDropdown.tsx +++ b/webui/react/src/components/ExperimentActionDropdown.tsx @@ -330,7 +330,7 @@ const ExperimentActionDropdown: React.FC = ({ ], ); - if (menuItems.length === 0) { + if (dropdownMenu.length === 0) { return ( (children as JSX.Element) ?? (
From 344d709e66d71ff6e6411454592bce12a8888c90 Mon Sep 17 00:00:00 2001 From: John Kim Date: Fri, 28 Jun 2024 15:58:25 -0400 Subject: [PATCH 157/161] tests --- .../ExperimentActionDropdown.test.tsx | 70 ++++++++++++++----- .../components/ExperimentActionDropdown.tsx | 2 +- 2 files changed, 55 insertions(+), 17 deletions(-) diff --git a/webui/react/src/components/ExperimentActionDropdown.test.tsx b/webui/react/src/components/ExperimentActionDropdown.test.tsx index e50913de41a..18017598d24 100644 --- a/webui/react/src/components/ExperimentActionDropdown.test.tsx +++ b/webui/react/src/components/ExperimentActionDropdown.test.tsx @@ -12,7 +12,7 @@ import { } from 'services/api'; import { RunState } from 'types'; -import ExperimentActionDropdown from './ExperimentActionDropdown'; +import ExperimentActionDropdown, { Action } from './ExperimentActionDropdown'; import { cell, experiment } from './ExperimentActionDropdown.test.mock'; const user = userEvent.setup(); @@ -43,6 +43,7 @@ vi.mock('services/api', () => ({ const mocks = vi.hoisted(() => { return { + canCreateExperiment: vi.fn(), canDeleteExperiment: vi.fn(), canModifyExperiment: vi.fn(), canModifyExperimentMetadata: vi.fn(), @@ -54,6 +55,7 @@ const mocks = vi.hoisted(() => { vi.mock('hooks/usePermissions', () => { const usePermissions = vi.fn(() => { return { + canCreateExperiment: mocks.canCreateExperiment, canDeleteExperiment: mocks.canDeleteExperiment, canModifyExperiment: mocks.canModifyExperiment, canModifyExperimentMetadata: mocks.canModifyExperimentMetadata, @@ -99,21 +101,21 @@ describe('ExperimentActionDropdown', () => { it('should provide Copy Data option', async () => { setup(); mockNavigatorClipboard(); - await user.click(screen.getByText('Copy Value')); + await user.click(screen.getByText(Action.Copy)); expect(navigator.clipboard.writeText).toHaveBeenCalledWith(cell.copyData); }); it('should provide Link option', async () => { const link = 'https://www.google.com/'; setup(link); - await user.click(screen.getByText('Open Link in New Tab')); + await user.click(screen.getByText(Action.NewTab)); const tabClick = vi.mocked(handlePath).mock.calls[0]; expect(tabClick[0]).toMatchObject({ type: 'click' }); expect(tabClick[1]).toMatchObject({ path: link, popout: 'tab', }); - await user.click(screen.getByText('Open Link in New Window')); + await user.click(screen.getByText(Action.NewWindow)); const windowClick = vi.mocked(handlePath).mock.calls[1]; expect(windowClick[0]).toMatchObject({ type: 'click' }); expect(windowClick[1]).toMatchObject({ @@ -125,66 +127,102 @@ describe('ExperimentActionDropdown', () => { it('should provide Delete option', async () => { mocks.canDeleteExperiment.mockImplementation(() => true); setup(); - await user.click(screen.getByText('Delete')); - await user.click(screen.getByRole('button', { name: 'Delete' })); + await user.click(screen.getByText(Action.Delete)); + await user.click(screen.getByRole('button', { name: Action.Delete })); expect(vi.mocked(deleteExperiment)).toBeCalled(); }); it('should hide Delete option without permissions', () => { mocks.canDeleteExperiment.mockImplementation(() => false); setup(); - expect(screen.queryByText('Delete')).not.toBeInTheDocument(); + expect(screen.queryByText(Action.Delete)).not.toBeInTheDocument(); }); it('should provide Kill option', async () => { mocks.canModifyExperiment.mockImplementation(() => true); setup(undefined, RunState.Paused, undefined); - await user.click(screen.getByText('Kill')); - await user.click(screen.getByRole('button', { name: 'Kill' })); + await user.click(screen.getByText(Action.Kill)); + await user.click(screen.getByRole('button', { name: Action.Kill })); expect(vi.mocked(killExperiment)).toBeCalled(); }); it('should hide Kill option without permissions', () => { mocks.canModifyExperiment.mockImplementation(() => false); setup(undefined, RunState.Paused, undefined); - expect(screen.queryByText('Kill')).not.toBeInTheDocument(); + expect(screen.queryByText(Action.Kill)).not.toBeInTheDocument(); }); it('should provide Archive option', async () => { mocks.canModifyExperiment.mockImplementation(() => true); setup(); - await user.click(screen.getByText('Archive')); + await user.click(screen.getByText(Action.Archive)); expect(vi.mocked(archiveExperiment)).toBeCalled(); }); it('should hide Archive option without permissions', () => { mocks.canModifyExperiment.mockImplementation(() => false); setup(); - expect(screen.queryByText('Archive')).not.toBeInTheDocument(); + expect(screen.queryByText(Action.Archive)).not.toBeInTheDocument(); }); it('should provide Unarchive option', async () => { mocks.canModifyExperiment.mockImplementation(() => true); setup(undefined, undefined, true); - await user.click(screen.getByText('Unarchive')); + await user.click(screen.getByText(Action.Unarchive)); expect(vi.mocked(unarchiveExperiment)).toBeCalled(); }); it('should hide Unarchive option without permissions', () => { mocks.canModifyExperiment.mockImplementation(() => false); setup(undefined, undefined, true); - expect(screen.queryByText('Unarchive')).not.toBeInTheDocument(); + expect(screen.queryByText(Action.Unarchive)).not.toBeInTheDocument(); }); it('should provide Move option', () => { mocks.canMoveExperiment.mockImplementation(() => true); setup(); - expect(screen.getByText('Move')).toBeInTheDocument(); + expect(screen.getByText(Action.Move)).toBeInTheDocument(); }); it('should hide Move option without permissions', () => { mocks.canMoveExperiment.mockImplementation(() => false); setup(); - expect(screen.queryByText('Move')).not.toBeInTheDocument(); + expect(screen.queryByText(Action.Move)).not.toBeInTheDocument(); + }); + + it('should provide Edit option', () => { + mocks.canModifyExperimentMetadata.mockImplementation(() => true); + setup(); + expect(screen.getByText(Action.Edit)).toBeInTheDocument(); + }); + + it('should hide Edit option without permissions', () => { + mocks.canModifyExperimentMetadata.mockImplementation(() => false); + setup(); + expect(screen.queryByText(Action.Edit)).not.toBeInTheDocument(); + }); + + it('should provide Retain Logs option', () => { + mocks.canModifyExperiment.mockImplementation(() => true); + setup(); + expect(screen.getByText(Action.RetainLogs)).toBeInTheDocument(); + }); + + it('should hide Retain Logs option without permissions', () => { + mocks.canModifyExperiment.mockImplementation(() => false); + setup(); + expect(screen.queryByText(Action.RetainLogs)).not.toBeInTheDocument(); + }); + + it('should provide Tensor Board option', () => { + mocks.canViewExperimentArtifacts.mockImplementation(() => true); + setup(); + expect(screen.getByText(Action.OpenTensorBoard)).toBeInTheDocument(); + }); + + it('should hide Tensor Board option without permissions', () => { + mocks.canViewExperimentArtifacts.mockImplementation(() => false); + setup(); + expect(screen.queryByText(Action.OpenTensorBoard)).not.toBeInTheDocument(); }); }); diff --git a/webui/react/src/components/ExperimentActionDropdown.tsx b/webui/react/src/components/ExperimentActionDropdown.tsx index 8a03f1cb415..ed3471e9c33 100644 --- a/webui/react/src/components/ExperimentActionDropdown.tsx +++ b/webui/react/src/components/ExperimentActionDropdown.tsx @@ -57,7 +57,7 @@ interface Props { workspaceId?: number; } -const Action = { +export const Action = { Copy: 'Copy Value', NewTab: 'Open Link in New Tab', NewWindow: 'Open Link in New Window', From c526bb2641dc104f0a7f20afdf75adf1c792ff36 Mon Sep 17 00:00:00 2001 From: John Kim Date: Fri, 28 Jun 2024 16:00:25 -0400 Subject: [PATCH 158/161] refactor --- .../src/components/RunActionDropdown.test.tsx | 32 +++++++++---------- .../src/components/RunActionDropdown.tsx | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/webui/react/src/components/RunActionDropdown.test.tsx b/webui/react/src/components/RunActionDropdown.test.tsx index 3cd2dc3a7f1..2a43008bec9 100644 --- a/webui/react/src/components/RunActionDropdown.test.tsx +++ b/webui/react/src/components/RunActionDropdown.test.tsx @@ -7,7 +7,7 @@ import { handlePath } from 'routes/utils'; import { archiveRuns, deleteRuns, killRuns, unarchiveRuns } from 'services/api'; import { RunState } from 'types'; -import RunActionDropdown from './RunActionDropdown'; +import RunActionDropdown, { Action } from './RunActionDropdown'; import { cell, run } from './RunActionDropdown.test.mock'; const mockNavigatorClipboard = () => { @@ -88,21 +88,21 @@ describe('RunActionDropdown', () => { it('should provide Copy Data option', async () => { setup(); mockNavigatorClipboard(); - await user.click(screen.getByText('Copy Value')); + await user.click(screen.getByText(Action.Copy)); expect(navigator.clipboard.writeText).toHaveBeenCalledWith(cell.copyData); }); it('should provide Link option', async () => { const link = 'https://www.google.com/'; setup(link); - await user.click(screen.getByText('Open Link in New Tab')); + await user.click(screen.getByText(Action.NewTab)); const tabClick = vi.mocked(handlePath).mock.calls[0]; expect(tabClick[0]).toMatchObject({ type: 'click' }); expect(tabClick[1]).toMatchObject({ path: link, popout: 'tab', }); - await user.click(screen.getByText('Open Link in New Window')); + await user.click(screen.getByText(Action.NewWindow)); const windowClick = vi.mocked(handlePath).mock.calls[1]; expect(windowClick[0]).toMatchObject({ type: 'click' }); expect(windowClick[1]).toMatchObject({ @@ -114,66 +114,66 @@ describe('RunActionDropdown', () => { it('should provide Delete option', async () => { mocks.canDeleteFlatRun.mockImplementation(() => true); setup(); - await user.click(screen.getByText('Delete')); - await user.click(screen.getByRole('button', { name: 'Delete' })); + await user.click(screen.getByText(Action.Delete)); + await user.click(screen.getByRole('button', { name: Action.Delete })); expect(vi.mocked(deleteRuns)).toBeCalled(); }); it('should hide Delete option without permissions', () => { mocks.canDeleteFlatRun.mockImplementation(() => false); setup(); - expect(screen.queryByText('Delete')).not.toBeInTheDocument(); + expect(screen.queryByText(Action.Delete)).not.toBeInTheDocument(); }); it('should provide Kill option', async () => { mocks.canModifyFlatRun.mockImplementation(() => true); setup(undefined, RunState.Paused, undefined); - await user.click(screen.getByText('Kill')); - await user.click(screen.getByRole('button', { name: 'Kill' })); + await user.click(screen.getByText(Action.Kill)); + await user.click(screen.getByRole('button', { name: Action.Kill })); expect(vi.mocked(killRuns)).toBeCalled(); }); it('should hide Kill option without permissions', () => { mocks.canModifyFlatRun.mockImplementation(() => false); setup(undefined, RunState.Paused, undefined); - expect(screen.queryByText('Kill')).not.toBeInTheDocument(); + expect(screen.queryByText(Action.Kill)).not.toBeInTheDocument(); }); it('should provide Archive option', async () => { mocks.canModifyFlatRun.mockImplementation(() => true); setup(); - await user.click(screen.getByText('Archive')); + await user.click(screen.getByText(Action.Archive)); expect(vi.mocked(archiveRuns)).toBeCalled(); }); it('should hide Archive option without permissions', () => { mocks.canModifyFlatRun.mockImplementation(() => false); setup(); - expect(screen.queryByText('Archive')).not.toBeInTheDocument(); + expect(screen.queryByText(Action.Archive)).not.toBeInTheDocument(); }); it('should provide Unarchive option', async () => { mocks.canModifyFlatRun.mockImplementation(() => true); setup(undefined, undefined, true); - await user.click(screen.getByText('Unarchive')); + await user.click(screen.getByText(Action.Unarchive)); expect(vi.mocked(unarchiveRuns)).toBeCalled(); }); it('should hide Unarchive option without permissions', () => { mocks.canModifyFlatRun.mockImplementation(() => false); setup(undefined, undefined, true); - expect(screen.queryByText('Unarchive')).not.toBeInTheDocument(); + expect(screen.queryByText(Action.Unarchive)).not.toBeInTheDocument(); }); it('should provide Move option', () => { mocks.canMoveFlatRun.mockImplementation(() => true); setup(); - expect(screen.getByText('Move')).toBeInTheDocument(); + expect(screen.getByText(Action.Move)).toBeInTheDocument(); }); it('should hide Move option without permissions', () => { mocks.canMoveFlatRun.mockImplementation(() => false); setup(); - expect(screen.queryByText('Move')).not.toBeInTheDocument(); + expect(screen.queryByText(Action.Move)).not.toBeInTheDocument(); }); }); diff --git a/webui/react/src/components/RunActionDropdown.tsx b/webui/react/src/components/RunActionDropdown.tsx index fe41c108dd0..4d9f02e0fce 100644 --- a/webui/react/src/components/RunActionDropdown.tsx +++ b/webui/react/src/components/RunActionDropdown.tsx @@ -29,7 +29,7 @@ interface Props { projectId: number; } -const Action = { +export const Action = { Copy: 'Copy Value', NewTab: 'Open Link in New Tab', NewWindow: 'Open Link in New Window', From 45bf3e940cf25bcd9f96d4ed439f766f7ba50ce2 Mon Sep 17 00:00:00 2001 From: John Kim Date: Fri, 28 Jun 2024 16:29:42 -0400 Subject: [PATCH 159/161] tests --- .../ExperimentActionDropdown.test.tsx | 42 +++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/webui/react/src/components/ExperimentActionDropdown.test.tsx b/webui/react/src/components/ExperimentActionDropdown.test.tsx index 18017598d24..27d6ed61a2b 100644 --- a/webui/react/src/components/ExperimentActionDropdown.test.tsx +++ b/webui/react/src/components/ExperimentActionDropdown.test.tsx @@ -6,8 +6,12 @@ import { ConfirmationProvider } from 'hew/useConfirm'; import { handlePath } from 'routes/utils'; import { archiveExperiment, + cancelExperiment, + changeExperimentLogRetention, deleteExperiment, killExperiment, + patchExperiment, + pauseExperiment, unarchiveExperiment, } from 'services/api'; import { RunState } from 'types'; @@ -35,9 +39,12 @@ vi.mock('routes/utils', () => ({ vi.mock('services/api', () => ({ archiveExperiment: vi.fn(), + cancelExperiment: vi.fn(), deleteExperiment: vi.fn(), getWorkspaces: vi.fn(() => Promise.resolve({ workspaces: [] })), killExperiment: vi.fn(), + patchExperiment: vi.fn(), + pauseExperiment: vi.fn(), unarchiveExperiment: vi.fn(), })); @@ -190,10 +197,13 @@ describe('ExperimentActionDropdown', () => { expect(screen.queryByText(Action.Move)).not.toBeInTheDocument(); }); - it('should provide Edit option', () => { + it('should provide Edit option', async () => { mocks.canModifyExperimentMetadata.mockImplementation(() => true); setup(); - expect(screen.getByText(Action.Edit)).toBeInTheDocument(); + await user.click(screen.getByText(Action.Edit)); + await user.type(screen.getByRole('textbox', { name: 'Name' }), 'edit'); + await user.click(screen.getByText('Save')); + expect(vi.mocked(patchExperiment)).toBeCalled(); }); it('should hide Edit option without permissions', () => { @@ -202,10 +212,36 @@ describe('ExperimentActionDropdown', () => { expect(screen.queryByText(Action.Edit)).not.toBeInTheDocument(); }); + it('should provide Pause option', async () => { + mocks.canModifyExperiment.mockImplementation(() => true); + setup(undefined, RunState.Running); + await user.click(screen.getByText(Action.Pause)); + expect(vi.mocked(pauseExperiment)).toBeCalled(); + }); + + it('should hide Pause option without permissions', () => { + mocks.canModifyExperiment.mockImplementation(() => false); + setup(undefined, RunState.Running); + expect(screen.queryByText(Action.Pause)).not.toBeInTheDocument(); + }); + + it('should provide Cancel option', async () => { + mocks.canModifyExperiment.mockImplementation(() => true); + setup(undefined, RunState.Running); + await user.click(screen.getByText(Action.Cancel)); + expect(vi.mocked(cancelExperiment)).toBeCalled(); + }); + + it('should hide Cancel option without permissions', () => { + mocks.canModifyExperiment.mockImplementation(() => false); + setup(undefined, RunState.Running); + expect(screen.queryByText(Action.Cancel)).not.toBeInTheDocument(); + }); + it('should provide Retain Logs option', () => { mocks.canModifyExperiment.mockImplementation(() => true); setup(); - expect(screen.getByText(Action.RetainLogs)).toBeInTheDocument(); + expect(screen.queryByText(Action.RetainLogs)).toBeInTheDocument(); }); it('should hide Retain Logs option without permissions', () => { From ea5ec228a988ba30bbd1ffb604b3fdf02ed97e5e Mon Sep 17 00:00:00 2001 From: John Kim Date: Fri, 28 Jun 2024 16:30:29 -0400 Subject: [PATCH 160/161] lint --- webui/react/src/components/ExperimentActionDropdown.test.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/webui/react/src/components/ExperimentActionDropdown.test.tsx b/webui/react/src/components/ExperimentActionDropdown.test.tsx index 27d6ed61a2b..20e442e319c 100644 --- a/webui/react/src/components/ExperimentActionDropdown.test.tsx +++ b/webui/react/src/components/ExperimentActionDropdown.test.tsx @@ -7,7 +7,6 @@ import { handlePath } from 'routes/utils'; import { archiveExperiment, cancelExperiment, - changeExperimentLogRetention, deleteExperiment, killExperiment, patchExperiment, From 711ef857efe6153a2a39d8017d7bc626ab4c1964 Mon Sep 17 00:00:00 2001 From: John Kim Date: Tue, 2 Jul 2024 10:31:26 -0400 Subject: [PATCH 161/161] feedback --- webui/react/src/components/ExperimentActionDropdown.tsx | 8 ++------ webui/react/src/components/RunActionDropdown.tsx | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/webui/react/src/components/ExperimentActionDropdown.tsx b/webui/react/src/components/ExperimentActionDropdown.tsx index ed3471e9c33..0b152c23cb8 100644 --- a/webui/react/src/components/ExperimentActionDropdown.tsx +++ b/webui/react/src/components/ExperimentActionDropdown.tsx @@ -167,12 +167,8 @@ const ExperimentActionDropdown: React.FC = ({ }); const cellCopyData = useMemo(() => { - if (cell) { - if ('displayData' in cell && isString(cell.displayData)) { - return cell.displayData; - } - if (cell.copyData) return cell.copyData; - } + if (cell && 'displayData' in cell && isString(cell.displayData)) return cell.displayData; + if (cell?.copyData) return cell.copyData; return undefined; }, [cell]); diff --git a/webui/react/src/components/RunActionDropdown.tsx b/webui/react/src/components/RunActionDropdown.tsx index 4d9f02e0fce..647f5d213ef 100644 --- a/webui/react/src/components/RunActionDropdown.tsx +++ b/webui/react/src/components/RunActionDropdown.tsx @@ -62,12 +62,8 @@ const RunActionDropdown: React.FC = ({ ); const cellCopyData = useMemo(() => { - if (cell) { - if ('displayData' in cell && isString(cell.displayData)) { - return cell.displayData; - } - if (cell.copyData) return cell.copyData; - } + if (cell && 'displayData' in cell && isString(cell.displayData)) return cell.displayData; + if (cell?.copyData) return cell.copyData; return undefined; }, [cell]);