@datalayer/core
Version:
[](https://datalayer.io)
94 lines (93 loc) • 3.93 kB
TypeScript
import type { Constructor } from '../utils/mixins';
import { EnvironmentDTO } from '../../models/EnvironmentDTO';
import { RuntimeDTO } from '../../models/RuntimeDTO';
import { RuntimeSnapshotDTO } from '../../models/RuntimeSnapshotDTO';
import { HealthCheck } from '../../models/HealthCheck';
/** Options for ensuring a runtime is available. */
export interface EnsureRuntimeOptions {
/** Name of the environment to use */
environmentName?: string;
/** Maximum credits to allocate */
creditsLimit?: number;
/** Whether to wait for runtime to be ready */
waitForReady?: boolean;
/** Maximum time to wait for ready state (ms) */
maxWaitTime?: number;
/** Whether to reuse existing suitable runtime */
reuseExisting?: boolean;
/** Snapshot ID to create runtime from */
snapshotId?: string;
}
/** Runtimes mixin providing computational environment and runtime management. */
export declare function RuntimesMixin<TBase extends Constructor>(Base: TBase): {
new (...args: any[]): {
_extractRuntimePodName(runtimePodNameOrInstance: string | RuntimeDTO): string;
_extractSnapshotId(snapshotIdOrInstance: string | RuntimeSnapshotDTO): string;
/**
* List all available computational environments.
* @returns Array of Environment model instances
*/
listEnvironments(): Promise<EnvironmentDTO[]>;
/**
* Create a new computational runtime.
* @param environmentName - Name of the environment to use
* @param type - Type of runtime
* @param givenName - User-friendly name for the runtime
* @param creditsLimit - Credits limit
* @returns Created runtime
*/
createRuntime(environmentName: string, type: "notebook" | "terminal" | "job", givenName: string, minutesLimit: number, fromSnapshotId?: string): Promise<RuntimeDTO>;
/**
* List all runtimes.
* @returns Array of runtimes
*/
listRuntimes(): Promise<RuntimeDTO[]>;
/**
* Get details for a specific runtime by pod name.
* @param podName - Runtime pod name
* @returns Runtime details
*/
getRuntime(podName: string): Promise<RuntimeDTO>;
/**
* Delete a runtime permanently.
* @param podName - Runtime pod name
*/
deleteRuntime(podName: string): Promise<void>;
/**
* Terminate all runtimes.
* Lists all runtimes and deletes them in parallel.
* @returns Array of results for each deletion (fulfilled or rejected)
*/
terminateAllRuntimes(): Promise<PromiseSettledResult<void>[]>;
/**
* Create a snapshot of a runtime.
* @param podName - Pod name of the runtime to snapshot
* @param name - Name for the snapshot
* @param description - Description of the snapshot
* @param stop - Whether to stop the runtime after creating snapshot (defaults to false)
* @returns Created snapshot
*/
createSnapshot(podName: string, name: string, description: string, stop?: boolean): Promise<RuntimeSnapshotDTO>;
/**
* List all runtime snapshots.
* @returns Array of snapshots
*/
listSnapshots(): Promise<RuntimeSnapshotDTO[]>;
/**
* Get details for a specific snapshot by ID.
* @param id - Snapshot ID
* @returns Snapshot details
*/
getSnapshot(id: string): Promise<RuntimeSnapshotDTO>;
/**
* Delete a snapshot permanently.
* @param id - Snapshot ID
*/
deleteSnapshot(id: string): Promise<void>;
/**
* Check the health status of the Runtimes service.
* @returns Health check result with status and response time
*/
checkRuntimesHealth(): Promise<HealthCheck>;
};
} & TBase;