@milaboratories/pl-model-middle-layer 1.35.0 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/instance_stats.cjs +6 -0
- package/dist/instance_stats.cjs.map +1 -0
- package/dist/instance_stats.d.ts +48 -0
- package/dist/instance_stats.d.ts.map +1 -0
- package/dist/instance_stats.js +6 -0
- package/dist/instance_stats.js.map +1 -0
- package/package.json +8 -7
- package/src/index.ts +1 -0
- package/src/instance_stats.ts +48 -0
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_block_settings = require("./block_settings.cjs");
|
|
3
|
+
const require_instance_stats = require("./instance_stats.cjs");
|
|
3
4
|
const require_project = require("./project.cjs");
|
|
4
5
|
const require_document = require("./folders/document.cjs");
|
|
5
6
|
const require_decode = require("./folders/decode.cjs");
|
|
@@ -85,6 +86,7 @@ exports.SemVer = require_semver.SemVer;
|
|
|
85
86
|
exports.Sha256Schema = require_block_manifest.Sha256Schema;
|
|
86
87
|
exports.SingleBlockPackOverview = require_overview.SingleBlockPackOverview;
|
|
87
88
|
exports.StableChannel = require_overview.StableChannel;
|
|
89
|
+
exports.UnsupportedInstanceStats = require_instance_stats.UnsupportedInstanceStats;
|
|
88
90
|
exports.VersionWithChannels = require_overview.VersionWithChannels;
|
|
89
91
|
exports.WorkflowSchemaV1 = require_block_components.WorkflowSchemaV1;
|
|
90
92
|
exports.addPrefixToRelative = require_content_conversion.addPrefixToRelative;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { AuthorMarker } from "./author_marker.js";
|
|
|
2
2
|
import { BlockSettings, InitialBlockSettings, VersionLock } from "./block_settings.js";
|
|
3
3
|
import { StorageDebugView } from "./storage_debug_view.js";
|
|
4
4
|
import { BlockStateInternal, BlockStateInternalV3 } from "./block_state.js";
|
|
5
|
+
import { InstanceStats, InstanceStatsAvailability, InstanceStatsCapacity, UnsupportedInstanceStats } from "./instance_stats.js";
|
|
5
6
|
import { ProjectMeta, normalizeDescription, normalizeProjectMeta } from "./project.js";
|
|
6
7
|
import { ProjectListEntry } from "./project_list.js";
|
|
7
8
|
import { BlockPackDevV1, BlockPackDevV2, BlockPackFromPackV2, BlockPackFromRegistryV1, BlockPackFromRegistryV2, BlockPackSpec } from "./block_registry/block_pack_spec.js";
|
|
@@ -33,4 +34,4 @@ import "./block_meta/index.js";
|
|
|
33
34
|
import { index_d_exports } from "./pframe/internal_api/index.js";
|
|
34
35
|
import "./pframe/index.js";
|
|
35
36
|
import { HashedJson, hashJson, readJson, readJsonSync } from "./json.js";
|
|
36
|
-
export { AnyChannel, type AuthorMarker, BlockCalculationStatus, BlockComponents, BlockComponentsDescriptionRaw, BlockComponentsManifest, BlockKindRef, BlockPackDescription, BlockPackDescriptionFromPackageJsonRaw, BlockPackDescriptionManifest, BlockPackDescriptionRaw, BlockPackDevV1, BlockPackDevV2, BlockPackFromPackV2, BlockPackFromRegistryV1, BlockPackFromRegistryV2, BlockPackId, BlockPackIdNoVersion, BlockPackListing, BlockPackManifest, BlockPackManifestFile, BlockPackMeta, BlockPackMetaDescriptionRaw, BlockPackMetaEmbeddedBase64, BlockPackMetaEmbeddedBytes, BlockPackMetaManifest, BlockPackOverview, BlockPackOverviewLegacy, BlockPackOverviewNoRegistryId, BlockPackOverviewRaw, BlockPackSpec, BlockPlatform, BlockSettings, BlockStateInternal, BlockStateInternalV3, BlockStateOverview, Content, ContentAbsoluteBinaryLocal, ContentAbsoluteFile, ContentAbsoluteFolder, ContentAbsoluteTextLocal, ContentAbsoluteUrl, ContentAnyBinaryLocal, ContentAnyLocal, ContentAnyTextLocal, ContentExplicitBase64, ContentExplicitBytes, ContentExplicitOrRelative, ContentExplicitString, ContentRelative, ContentRelativeBinary, ContentRelativeText, ContentType, ContextType, CreateBlockPackDescriptionSchema, DescriptionContentBinary, DescriptionContentText, FOLDERS_SCHEMA_VERSION, FeatureFlags, FolderEntry, FolderId, FolderView, FoldersDecoded, FoldersDocument, FoldersDocumentProblem, FoldersEdit, FoldersItem, FoldersItemInput, FoldersItemView, FoldersLabelRename, FoldersLeafItem, FoldersMoveApplication, FoldersMoveEntry, FoldersMoveIssue, FoldersMoveOutcome, FoldersMovePlan, FoldersMovePlanResult, FoldersPlacement, FoldersProjectInput, FoldersProjectView, FoldersRemoval, FoldersRemovalIssue, FoldersRemovalOutcome, FoldersRemovalPlanResult, FoldersStoredDocument, FoldersTemplateInput, FoldersTemplateView, FoldersView, FoldersViolation, HashedJson, InitialBlockSettings, LocalDevFolder, ManifestFileInfo, index_d_exports as PFrameInternal, ProjectListEntry, ProjectMeta, ProjectOverview, RegistryEntry, RegistryList, RegistrySpec, RegistryStatus, RemoteRegistryV1Spec, RemoteRegistryV2Spec, SemVer, Sha256Schema, SingleBlockPackOverview, StableChannel, StorageDebugView, UpdateSuggestion, UpdateSuggestions, VersionLock, VersionWithChannels, Workflow, WorkflowSchemaV1, WorkflowV1, addPrefixToRelative, applyFoldersMove, applyFoldersRemoval, asFolderId, blockPackIdEquals, blockPackIdNoVersionEquals, blockPackIdNoVersionToString, blockPackIdToString, blockPackOverviewToLegacy, commitFoldersMove, commitFoldersRemoval, decodeFoldersDocument, decodeStoredFoldersDocument, emptyFoldersDocument, encodeFoldersDocument, foldersChildren, foldersDocumentFromView, foldersMovePlansEqual, foldersNameBlank, foldersNameTaken, foldersRemovalsEqual, foldersSiblingNames, foldersSubtree, foldersUniqueName, foldersViewFromDocument, formatFoldersViolation, hashJson, healFolders, inheritedFolder, mapRemoteToAbsolute, normalizeDescription, normalizeProjectMeta, overrideDescriptionVersion, overrideManifestVersion, planFoldersMove, planFoldersRemoval, readJson, readJsonSync, validateFoldersDocument };
|
|
37
|
+
export { AnyChannel, type AuthorMarker, BlockCalculationStatus, BlockComponents, BlockComponentsDescriptionRaw, BlockComponentsManifest, BlockKindRef, BlockPackDescription, BlockPackDescriptionFromPackageJsonRaw, BlockPackDescriptionManifest, BlockPackDescriptionRaw, BlockPackDevV1, BlockPackDevV2, BlockPackFromPackV2, BlockPackFromRegistryV1, BlockPackFromRegistryV2, BlockPackId, BlockPackIdNoVersion, BlockPackListing, BlockPackManifest, BlockPackManifestFile, BlockPackMeta, BlockPackMetaDescriptionRaw, BlockPackMetaEmbeddedBase64, BlockPackMetaEmbeddedBytes, BlockPackMetaManifest, BlockPackOverview, BlockPackOverviewLegacy, BlockPackOverviewNoRegistryId, BlockPackOverviewRaw, BlockPackSpec, BlockPlatform, BlockSettings, BlockStateInternal, BlockStateInternalV3, BlockStateOverview, Content, ContentAbsoluteBinaryLocal, ContentAbsoluteFile, ContentAbsoluteFolder, ContentAbsoluteTextLocal, ContentAbsoluteUrl, ContentAnyBinaryLocal, ContentAnyLocal, ContentAnyTextLocal, ContentExplicitBase64, ContentExplicitBytes, ContentExplicitOrRelative, ContentExplicitString, ContentRelative, ContentRelativeBinary, ContentRelativeText, ContentType, ContextType, CreateBlockPackDescriptionSchema, DescriptionContentBinary, DescriptionContentText, FOLDERS_SCHEMA_VERSION, FeatureFlags, FolderEntry, FolderId, FolderView, FoldersDecoded, FoldersDocument, FoldersDocumentProblem, FoldersEdit, FoldersItem, FoldersItemInput, FoldersItemView, FoldersLabelRename, FoldersLeafItem, FoldersMoveApplication, FoldersMoveEntry, FoldersMoveIssue, FoldersMoveOutcome, FoldersMovePlan, FoldersMovePlanResult, FoldersPlacement, FoldersProjectInput, FoldersProjectView, FoldersRemoval, FoldersRemovalIssue, FoldersRemovalOutcome, FoldersRemovalPlanResult, FoldersStoredDocument, FoldersTemplateInput, FoldersTemplateView, FoldersView, FoldersViolation, HashedJson, InitialBlockSettings, InstanceStats, InstanceStatsAvailability, InstanceStatsCapacity, LocalDevFolder, ManifestFileInfo, index_d_exports as PFrameInternal, ProjectListEntry, ProjectMeta, ProjectOverview, RegistryEntry, RegistryList, RegistrySpec, RegistryStatus, RemoteRegistryV1Spec, RemoteRegistryV2Spec, SemVer, Sha256Schema, SingleBlockPackOverview, StableChannel, StorageDebugView, UnsupportedInstanceStats, UpdateSuggestion, UpdateSuggestions, VersionLock, VersionWithChannels, Workflow, WorkflowSchemaV1, WorkflowV1, addPrefixToRelative, applyFoldersMove, applyFoldersRemoval, asFolderId, blockPackIdEquals, blockPackIdNoVersionEquals, blockPackIdNoVersionToString, blockPackIdToString, blockPackOverviewToLegacy, commitFoldersMove, commitFoldersRemoval, decodeFoldersDocument, decodeStoredFoldersDocument, emptyFoldersDocument, encodeFoldersDocument, foldersChildren, foldersDocumentFromView, foldersMovePlansEqual, foldersNameBlank, foldersNameTaken, foldersRemovalsEqual, foldersSiblingNames, foldersSubtree, foldersUniqueName, foldersViewFromDocument, formatFoldersViolation, hashJson, healFolders, inheritedFolder, mapRemoteToAbsolute, normalizeDescription, normalizeProjectMeta, overrideDescriptionVersion, overrideManifestVersion, planFoldersMove, planFoldersRemoval, readJson, readJsonSync, validateFoldersDocument };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InitialBlockSettings } from "./block_settings.js";
|
|
2
|
+
import { UnsupportedInstanceStats } from "./instance_stats.js";
|
|
2
3
|
import { normalizeDescription, normalizeProjectMeta } from "./project.js";
|
|
3
4
|
import { FOLDERS_SCHEMA_VERSION, FolderEntry, FoldersDocument, asFolderId, emptyFoldersDocument } from "./folders/document.js";
|
|
4
5
|
import { decodeFoldersDocument, decodeStoredFoldersDocument, encodeFoldersDocument } from "./folders/decode.js";
|
|
@@ -25,4 +26,4 @@ import { AnyChannel, BlockPackListing, BlockPackOverview, BlockPackOverviewLegac
|
|
|
25
26
|
import "./block_registry/index.js";
|
|
26
27
|
import { internal_api_exports } from "./pframe/internal_api/index.js";
|
|
27
28
|
import { hashJson, readJson, readJsonSync } from "./json.js";
|
|
28
|
-
export { AnyChannel, BlockComponentsDescriptionRaw, BlockComponentsManifest, BlockKindRef, BlockPackDescriptionFromPackageJsonRaw, BlockPackDescriptionManifest, BlockPackDescriptionRaw, BlockPackDevV1, BlockPackDevV2, BlockPackFromPackV2, BlockPackFromRegistryV1, BlockPackFromRegistryV2, BlockPackId, BlockPackIdNoVersion, BlockPackListing, BlockPackManifest, BlockPackManifestFile, BlockPackMeta, BlockPackMetaDescriptionRaw, BlockPackMetaEmbeddedBase64, BlockPackMetaEmbeddedBytes, BlockPackMetaManifest, BlockPackOverview, BlockPackOverviewLegacy, BlockPackOverviewNoRegistryId, BlockPackOverviewRaw, BlockPackSpec, BlockPlatform, ContentExplicitBase64, ContentExplicitBytes, ContentRelative, ContentRelativeBinary, ContentRelativeText, CreateBlockPackDescriptionSchema, DescriptionContentBinary, DescriptionContentText, FOLDERS_SCHEMA_VERSION, FeatureFlags, FolderEntry, FoldersDocument, InitialBlockSettings, LocalDevFolder, ManifestFileInfo, internal_api_exports as PFrameInternal, RegistryEntry, RegistryList, RegistrySpec, RegistryStatus, RemoteRegistryV1Spec, RemoteRegistryV2Spec, SemVer, Sha256Schema, SingleBlockPackOverview, StableChannel, VersionWithChannels, WorkflowSchemaV1, addPrefixToRelative, applyFoldersMove, applyFoldersRemoval, asFolderId, blockPackIdEquals, blockPackIdNoVersionEquals, blockPackIdNoVersionToString, blockPackIdToString, blockPackOverviewToLegacy, commitFoldersMove, commitFoldersRemoval, decodeFoldersDocument, decodeStoredFoldersDocument, emptyFoldersDocument, encodeFoldersDocument, foldersChildren, foldersDocumentFromView, foldersMovePlansEqual, foldersNameBlank, foldersNameTaken, foldersRemovalsEqual, foldersSiblingNames, foldersSubtree, foldersUniqueName, foldersViewFromDocument, formatFoldersViolation, hashJson, healFolders, inheritedFolder, mapRemoteToAbsolute, normalizeDescription, normalizeProjectMeta, overrideDescriptionVersion, overrideManifestVersion, planFoldersMove, planFoldersRemoval, readJson, readJsonSync, validateFoldersDocument };
|
|
29
|
+
export { AnyChannel, BlockComponentsDescriptionRaw, BlockComponentsManifest, BlockKindRef, BlockPackDescriptionFromPackageJsonRaw, BlockPackDescriptionManifest, BlockPackDescriptionRaw, BlockPackDevV1, BlockPackDevV2, BlockPackFromPackV2, BlockPackFromRegistryV1, BlockPackFromRegistryV2, BlockPackId, BlockPackIdNoVersion, BlockPackListing, BlockPackManifest, BlockPackManifestFile, BlockPackMeta, BlockPackMetaDescriptionRaw, BlockPackMetaEmbeddedBase64, BlockPackMetaEmbeddedBytes, BlockPackMetaManifest, BlockPackOverview, BlockPackOverviewLegacy, BlockPackOverviewNoRegistryId, BlockPackOverviewRaw, BlockPackSpec, BlockPlatform, ContentExplicitBase64, ContentExplicitBytes, ContentRelative, ContentRelativeBinary, ContentRelativeText, CreateBlockPackDescriptionSchema, DescriptionContentBinary, DescriptionContentText, FOLDERS_SCHEMA_VERSION, FeatureFlags, FolderEntry, FoldersDocument, InitialBlockSettings, LocalDevFolder, ManifestFileInfo, internal_api_exports as PFrameInternal, RegistryEntry, RegistryList, RegistrySpec, RegistryStatus, RemoteRegistryV1Spec, RemoteRegistryV2Spec, SemVer, Sha256Schema, SingleBlockPackOverview, StableChannel, UnsupportedInstanceStats, VersionWithChannels, WorkflowSchemaV1, addPrefixToRelative, applyFoldersMove, applyFoldersRemoval, asFolderId, blockPackIdEquals, blockPackIdNoVersionEquals, blockPackIdNoVersionToString, blockPackIdToString, blockPackOverviewToLegacy, commitFoldersMove, commitFoldersRemoval, decodeFoldersDocument, decodeStoredFoldersDocument, emptyFoldersDocument, encodeFoldersDocument, foldersChildren, foldersDocumentFromView, foldersMovePlansEqual, foldersNameBlank, foldersNameTaken, foldersRemovalsEqual, foldersSiblingNames, foldersSubtree, foldersUniqueName, foldersViewFromDocument, formatFoldersViolation, hashJson, healFolders, inheritedFolder, mapRemoteToAbsolute, normalizeDescription, normalizeProjectMeta, overrideDescriptionVersion, overrideManifestVersion, planFoldersMove, planFoldersRemoval, readJson, readJsonSync, validateFoldersDocument };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// src/instance_stats.ts
|
|
2
|
+
/** Stats for a backend without the instance statistics context. */
|
|
3
|
+
const UnsupportedInstanceStats = { availability: "unsupported" };
|
|
4
|
+
exports.UnsupportedInstanceStats = UnsupportedInstanceStats;
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=instance_stats.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance_stats.cjs","names":[],"sources":["../src/instance_stats.ts"],"sourcesContent":["/**\n * The load of the whole Platforma instance, as the Desktop App shows it in its top bar.\n *\n * The backend keeps one instance statistics context per instance, and its executor runner writes\n * the scheduler's readings into it every few seconds. The middle layer reads them; the numbers are\n * what the scheduler has allocated, not measured use.\n */\n\n/** CPU or RAM: what is allocated now, out of the configured capacity when the backend knows it. */\nexport type InstanceStatsCapacity = {\n /** Configured capacity, undefined when the source does not know it. */\n readonly total?: number;\n /** Allocated now. Can exceed `total`: local CPU can be overcommitted. */\n readonly current: number;\n};\n\n/** Why the stats carry no numbers. */\nexport type InstanceStatsAvailability =\n /** Read from the instance statistics context. */\n | \"read\"\n /** The backend has no instance statistics context. */\n | \"unsupported\"\n /** The context exists but could not be read. */\n | \"unreadable\";\n\n/** One sample of the instance statistics. */\nexport type InstanceStats = {\n readonly availability: InstanceStatsAvailability;\n /** In millicores. */\n readonly cpu?: InstanceStatsCapacity;\n /** In bytes. */\n readonly ram?: InstanceStatsCapacity;\n /**\n * GPUs. On Kueue, devices held by jobs out of the quota. Locally, jobs that use a GPU on the\n * detected cards; jobs share cards, so `current` can exceed `total`. Undefined when no GPU count\n * is known: a local install without a GPU, or Kubernetes without a GPU pool.\n */\n readonly gpu?: InstanceStatsCapacity;\n /** GPU memory allocated to jobs, in bytes. Set only on a local install with a detected GPU. */\n readonly gpuMemory?: InstanceStatsCapacity;\n /** Jobs holding an allocation, and jobs waiting for one. */\n readonly jobs?: { readonly running: number; readonly queued: number };\n /** Where the numbers come from, `scheduler` or `kueue`. A label only. */\n readonly source?: string;\n};\n\n/** Stats for a backend without the instance statistics context. */\nexport const UnsupportedInstanceStats: InstanceStats = { availability: \"unsupported\" };\n"],"mappings":";;AA+CA,MAAa,2BAA0C,EAAE,cAAc,cAAc"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The load of the whole Platforma instance, as the Desktop App shows it in its top bar.
|
|
3
|
+
*
|
|
4
|
+
* The backend keeps one instance statistics context per instance, and its executor runner writes
|
|
5
|
+
* the scheduler's readings into it every few seconds. The middle layer reads them; the numbers are
|
|
6
|
+
* what the scheduler has allocated, not measured use.
|
|
7
|
+
*/
|
|
8
|
+
/** CPU or RAM: what is allocated now, out of the configured capacity when the backend knows it. */
|
|
9
|
+
export type InstanceStatsCapacity = {
|
|
10
|
+
/** Configured capacity, undefined when the source does not know it. */
|
|
11
|
+
readonly total?: number;
|
|
12
|
+
/** Allocated now. Can exceed `total`: local CPU can be overcommitted. */
|
|
13
|
+
readonly current: number;
|
|
14
|
+
};
|
|
15
|
+
/** Why the stats carry no numbers. */
|
|
16
|
+
export type InstanceStatsAvailability =
|
|
17
|
+
/** Read from the instance statistics context. */
|
|
18
|
+
"read" |
|
|
19
|
+
/** The backend has no instance statistics context. */
|
|
20
|
+
"unsupported" |
|
|
21
|
+
/** The context exists but could not be read. */
|
|
22
|
+
"unreadable";
|
|
23
|
+
/** One sample of the instance statistics. */
|
|
24
|
+
export type InstanceStats = {
|
|
25
|
+
readonly availability: InstanceStatsAvailability;
|
|
26
|
+
/** In millicores. */
|
|
27
|
+
readonly cpu?: InstanceStatsCapacity;
|
|
28
|
+
/** In bytes. */
|
|
29
|
+
readonly ram?: InstanceStatsCapacity;
|
|
30
|
+
/**
|
|
31
|
+
* GPUs. On Kueue, devices held by jobs out of the quota. Locally, jobs that use a GPU on the
|
|
32
|
+
* detected cards; jobs share cards, so `current` can exceed `total`. Undefined when no GPU count
|
|
33
|
+
* is known: a local install without a GPU, or Kubernetes without a GPU pool.
|
|
34
|
+
*/
|
|
35
|
+
readonly gpu?: InstanceStatsCapacity;
|
|
36
|
+
/** GPU memory allocated to jobs, in bytes. Set only on a local install with a detected GPU. */
|
|
37
|
+
readonly gpuMemory?: InstanceStatsCapacity;
|
|
38
|
+
/** Jobs holding an allocation, and jobs waiting for one. */
|
|
39
|
+
readonly jobs?: {
|
|
40
|
+
readonly running: number;
|
|
41
|
+
readonly queued: number;
|
|
42
|
+
};
|
|
43
|
+
/** Where the numbers come from, `scheduler` or `kueue`. A label only. */
|
|
44
|
+
readonly source?: string;
|
|
45
|
+
};
|
|
46
|
+
/** Stats for a backend without the instance statistics context. */
|
|
47
|
+
export declare const UnsupportedInstanceStats: InstanceStats;
|
|
48
|
+
//# sourceMappingURL=instance_stats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance_stats.d.ts","names":[],"sources":["../src/instance_stats.ts"],"mappings":";;;;;;;;YASY;;WAED;;WAEA;;;YAIC;;;;;;;;YASA;WACD,cAAc;;WAEd,MAAM;;WAEN,MAAM;;;;;;WAMN,MAAM;;WAEN,YAAY;;WAEZ;aAAkB;aAA0B;;;WAE5C;;;qBAIE,0BAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance_stats.js","names":[],"sources":["../src/instance_stats.ts"],"sourcesContent":["/**\n * The load of the whole Platforma instance, as the Desktop App shows it in its top bar.\n *\n * The backend keeps one instance statistics context per instance, and its executor runner writes\n * the scheduler's readings into it every few seconds. The middle layer reads them; the numbers are\n * what the scheduler has allocated, not measured use.\n */\n\n/** CPU or RAM: what is allocated now, out of the configured capacity when the backend knows it. */\nexport type InstanceStatsCapacity = {\n /** Configured capacity, undefined when the source does not know it. */\n readonly total?: number;\n /** Allocated now. Can exceed `total`: local CPU can be overcommitted. */\n readonly current: number;\n};\n\n/** Why the stats carry no numbers. */\nexport type InstanceStatsAvailability =\n /** Read from the instance statistics context. */\n | \"read\"\n /** The backend has no instance statistics context. */\n | \"unsupported\"\n /** The context exists but could not be read. */\n | \"unreadable\";\n\n/** One sample of the instance statistics. */\nexport type InstanceStats = {\n readonly availability: InstanceStatsAvailability;\n /** In millicores. */\n readonly cpu?: InstanceStatsCapacity;\n /** In bytes. */\n readonly ram?: InstanceStatsCapacity;\n /**\n * GPUs. On Kueue, devices held by jobs out of the quota. Locally, jobs that use a GPU on the\n * detected cards; jobs share cards, so `current` can exceed `total`. Undefined when no GPU count\n * is known: a local install without a GPU, or Kubernetes without a GPU pool.\n */\n readonly gpu?: InstanceStatsCapacity;\n /** GPU memory allocated to jobs, in bytes. Set only on a local install with a detected GPU. */\n readonly gpuMemory?: InstanceStatsCapacity;\n /** Jobs holding an allocation, and jobs waiting for one. */\n readonly jobs?: { readonly running: number; readonly queued: number };\n /** Where the numbers come from, `scheduler` or `kueue`. A label only. */\n readonly source?: string;\n};\n\n/** Stats for a backend without the instance statistics context. */\nexport const UnsupportedInstanceStats: InstanceStats = { availability: \"unsupported\" };\n"],"mappings":";;AA+CA,MAAa,2BAA0C,EAAE,cAAc,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-model-middle-layer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.0",
|
|
4
4
|
"description": "Common model between middle layer and non-block UI code",
|
|
5
5
|
"files": [
|
|
6
6
|
"./dist/**/*",
|
|
@@ -17,18 +17,19 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@milaboratories/helpers": "1.14.
|
|
21
|
-
"@milaboratories/pl-model-common": "1.55.
|
|
20
|
+
"@milaboratories/helpers": "1.14.7",
|
|
21
|
+
"@milaboratories/pl-model-common": "1.55.1",
|
|
22
22
|
"es-toolkit": "^1.39.10",
|
|
23
23
|
"utility-types": "^3.11.0",
|
|
24
24
|
"zod": "~3.25.76"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@milaboratories/build-configs": "2.0.
|
|
28
|
-
"@milaboratories/ts-builder": "1.7.
|
|
29
|
-
"@milaboratories/ts-configs": "1.4.
|
|
27
|
+
"@milaboratories/build-configs": "2.0.3",
|
|
28
|
+
"@milaboratories/ts-builder": "1.7.4",
|
|
29
|
+
"@milaboratories/ts-configs": "1.4.1",
|
|
30
30
|
"@types/node": "~24.19.2",
|
|
31
31
|
"@vitest/coverage-istanbul": "^4.1.12",
|
|
32
|
+
"shx": "^0.4.0",
|
|
32
33
|
"typescript": "7.0.2",
|
|
33
34
|
"vitest": "^4.1.12"
|
|
34
35
|
},
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
"formatter:check": "ts-builder formatter --check",
|
|
46
47
|
"linter:check": "ts-builder linter --check",
|
|
47
48
|
"types:check": "ts-builder type-check --target node",
|
|
48
|
-
"do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz",
|
|
49
|
+
"do-pack": "shx rm -f *.tgz && pnpm pack && shx mv *.tgz package.tgz",
|
|
49
50
|
"fmt": "ts-builder format"
|
|
50
51
|
}
|
|
51
52
|
}
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The load of the whole Platforma instance, as the Desktop App shows it in its top bar.
|
|
3
|
+
*
|
|
4
|
+
* The backend keeps one instance statistics context per instance, and its executor runner writes
|
|
5
|
+
* the scheduler's readings into it every few seconds. The middle layer reads them; the numbers are
|
|
6
|
+
* what the scheduler has allocated, not measured use.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** CPU or RAM: what is allocated now, out of the configured capacity when the backend knows it. */
|
|
10
|
+
export type InstanceStatsCapacity = {
|
|
11
|
+
/** Configured capacity, undefined when the source does not know it. */
|
|
12
|
+
readonly total?: number;
|
|
13
|
+
/** Allocated now. Can exceed `total`: local CPU can be overcommitted. */
|
|
14
|
+
readonly current: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** Why the stats carry no numbers. */
|
|
18
|
+
export type InstanceStatsAvailability =
|
|
19
|
+
/** Read from the instance statistics context. */
|
|
20
|
+
| "read"
|
|
21
|
+
/** The backend has no instance statistics context. */
|
|
22
|
+
| "unsupported"
|
|
23
|
+
/** The context exists but could not be read. */
|
|
24
|
+
| "unreadable";
|
|
25
|
+
|
|
26
|
+
/** One sample of the instance statistics. */
|
|
27
|
+
export type InstanceStats = {
|
|
28
|
+
readonly availability: InstanceStatsAvailability;
|
|
29
|
+
/** In millicores. */
|
|
30
|
+
readonly cpu?: InstanceStatsCapacity;
|
|
31
|
+
/** In bytes. */
|
|
32
|
+
readonly ram?: InstanceStatsCapacity;
|
|
33
|
+
/**
|
|
34
|
+
* GPUs. On Kueue, devices held by jobs out of the quota. Locally, jobs that use a GPU on the
|
|
35
|
+
* detected cards; jobs share cards, so `current` can exceed `total`. Undefined when no GPU count
|
|
36
|
+
* is known: a local install without a GPU, or Kubernetes without a GPU pool.
|
|
37
|
+
*/
|
|
38
|
+
readonly gpu?: InstanceStatsCapacity;
|
|
39
|
+
/** GPU memory allocated to jobs, in bytes. Set only on a local install with a detected GPU. */
|
|
40
|
+
readonly gpuMemory?: InstanceStatsCapacity;
|
|
41
|
+
/** Jobs holding an allocation, and jobs waiting for one. */
|
|
42
|
+
readonly jobs?: { readonly running: number; readonly queued: number };
|
|
43
|
+
/** Where the numbers come from, `scheduler` or `kueue`. A label only. */
|
|
44
|
+
readonly source?: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** Stats for a backend without the instance statistics context. */
|
|
48
|
+
export const UnsupportedInstanceStats: InstanceStats = { availability: "unsupported" };
|