@fnndsc/salsa 4.5.7 → 4.6.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/README.md +0 -2
- package/dist/compute/index.d.ts +0 -9
- package/dist/compute/index.js +0 -16
- package/dist/compute/index.js.map +1 -1
- package/dist/dag/feedData.js +166 -73
- package/dist/dag/feedData.js.map +1 -1
- package/dist/dag/feedLoad.d.ts +1 -1
- package/dist/dag/feedLoad.js +6 -4
- package/dist/dag/feedLoad.js.map +1 -1
- package/dist/dicom/pixels.js +95 -36
- package/dist/dicom/pixels.js.map +1 -1
- package/dist/dicom/series.d.ts +4 -1
- package/dist/dicom/series.js +80 -31
- package/dist/dicom/series.js.map +1 -1
- package/dist/dicom/tags.d.ts +28 -0
- package/dist/dicom/tags.js +30 -0
- package/dist/dicom/tags.js.map +1 -1
- package/dist/files/copy.d.ts +197 -0
- package/dist/files/copy.js +636 -0
- package/dist/files/copy.js.map +1 -0
- package/dist/files/copyFolder.d.ts +103 -0
- package/dist/files/copyFolder.js +199 -0
- package/dist/files/copyFolder.js.map +1 -0
- package/dist/files/create.d.ts +178 -0
- package/dist/files/create.js +444 -0
- package/dist/files/create.js.map +1 -0
- package/dist/files/download.d.ts +188 -0
- package/dist/files/download.js +541 -0
- package/dist/files/download.js.map +1 -0
- package/dist/files/index.d.ts +69 -141
- package/dist/files/index.js +184 -535
- package/dist/files/index.js.map +1 -1
- package/dist/files/listing.d.ts +132 -0
- package/dist/files/listing.js +179 -0
- package/dist/files/listing.js.map +1 -0
- package/dist/files/move.d.ts +125 -0
- package/dist/files/move.js +334 -0
- package/dist/files/move.js.map +1 -0
- package/dist/files/pathMapper.d.ts +24 -1
- package/dist/files/pathMapper.js +108 -47
- package/dist/files/pathMapper.js.map +1 -1
- package/dist/files/proof.d.ts +315 -0
- package/dist/files/proof.js +574 -0
- package/dist/files/proof.js.map +1 -0
- package/dist/files/removal.d.ts +223 -0
- package/dist/files/removal.js +318 -0
- package/dist/files/removal.js.map +1 -0
- package/dist/files/replace.d.ts +175 -0
- package/dist/files/replace.js +582 -0
- package/dist/files/replace.js.map +1 -0
- package/dist/files/upload.d.ts +205 -0
- package/dist/files/upload.js +478 -0
- package/dist/files/upload.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +45 -32
- package/dist/index.js.map +1 -1
- package/dist/jobs/index.d.ts +1 -1
- package/dist/jobs/index.js +1 -2
- package/dist/jobs/index.js.map +1 -1
- package/dist/jobs/jobOps.d.ts +0 -13
- package/dist/jobs/jobOps.js +0 -37
- package/dist/jobs/jobOps.js.map +1 -1
- package/dist/pacs/anonymise.d.ts +17 -36
- package/dist/pacs/anonymise.js +29 -67
- package/dist/pacs/anonymise.js.map +1 -1
- package/dist/pipelines/index.d.ts +1 -13
- package/dist/pipelines/index.js +0 -38
- package/dist/pipelines/index.js.map +1 -1
- package/dist/pipelines/invocation.js +321 -167
- package/dist/pipelines/invocation.js.map +1 -1
- package/dist/pipelines/manifest.js.map +1 -1
- package/dist/pipelines/packages.d.ts +11 -8
- package/dist/pipelines/packages.js +253 -77
- package/dist/pipelines/packages.js.map +1 -1
- package/dist/plugins/adminToken.d.ts +67 -0
- package/dist/plugins/adminToken.js +77 -0
- package/dist/plugins/adminToken.js.map +1 -0
- package/dist/plugins/index.d.ts +0 -7
- package/dist/plugins/index.js +0 -16
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/peer_search.d.ts +0 -15
- package/dist/plugins/peer_search.js +0 -25
- package/dist/plugins/peer_search.js.map +1 -1
- package/dist/plugins/plugin_add.d.ts +14 -2
- package/dist/plugins/plugin_add.js +42 -13
- package/dist/plugins/plugin_add.js.map +1 -1
- package/dist/plugins/plugin_docker.d.ts +25 -0
- package/dist/plugins/plugin_docker.js +33 -0
- package/dist/plugins/plugin_docker.js.map +1 -1
- package/dist/plugins/plugin_register.d.ts +0 -10
- package/dist/plugins/plugin_register.js +3 -54
- package/dist/plugins/plugin_register.js.map +1 -1
- package/dist/plugins/plugin_sync.js +45 -22
- package/dist/plugins/plugin_sync.js.map +1 -1
- package/dist/plugins/plugin_validate.js +47 -13
- package/dist/plugins/plugin_validate.js.map +1 -1
- package/dist/plugins/store_import.d.ts +0 -9
- package/dist/plugins/store_import.js +3 -29
- package/dist/plugins/store_import.js.map +1 -1
- package/dist/retrieve/task.d.ts +137 -0
- package/dist/retrieve/task.js +41 -0
- package/dist/retrieve/task.js.map +1 -0
- package/dist/retrieve/watch.d.ts +2 -118
- package/dist/retrieve/watch.js +452 -321
- package/dist/retrieve/watch.js.map +1 -1
- package/dist/vfs/providers/etc.d.ts +6 -4
- package/dist/vfs/providers/etc.js +12 -4
- package/dist/vfs/providers/etc.js.map +1 -1
- package/dist/vfs/providers/native.d.ts +116 -39
- package/dist/vfs/providers/native.js +291 -347
- package/dist/vfs/providers/native.js.map +1 -1
- package/dist/vfs/providers/pacs.d.ts +29 -3
- package/dist/vfs/providers/pacs.js +303 -73
- package/dist/vfs/providers/pacs.js.map +1 -1
- package/dist/vfs/providers/pacs_content.js +22 -6
- package/dist/vfs/providers/pacs_content.js.map +1 -1
- package/dist/vfs/providers/proc/backfill.d.ts +46 -0
- package/dist/vfs/providers/proc/backfill.js +147 -0
- package/dist/vfs/providers/proc/backfill.js.map +1 -0
- package/dist/vfs/providers/proc/book.d.ts +176 -0
- package/dist/vfs/providers/proc/book.js +73 -0
- package/dist/vfs/providers/proc/book.js.map +1 -0
- package/dist/vfs/providers/proc/catchup.d.ts +69 -0
- package/dist/vfs/providers/proc/catchup.js +125 -0
- package/dist/vfs/providers/proc/catchup.js.map +1 -0
- package/dist/vfs/providers/proc/feedIndex.d.ts +146 -0
- package/dist/vfs/providers/proc/feedIndex.js +354 -0
- package/dist/vfs/providers/proc/feedIndex.js.map +1 -0
- package/dist/vfs/providers/proc/feedTopology.d.ts +85 -0
- package/dist/vfs/providers/proc/feedTopology.js +192 -0
- package/dist/vfs/providers/proc/feedTopology.js.map +1 -0
- package/dist/vfs/providers/proc/locate.d.ts +60 -0
- package/dist/vfs/providers/proc/locate.js +103 -0
- package/dist/vfs/providers/proc/locate.js.map +1 -0
- package/dist/vfs/providers/proc/path.d.ts +50 -0
- package/dist/vfs/providers/proc/path.js +106 -0
- package/dist/vfs/providers/proc/path.js.map +1 -0
- package/dist/vfs/providers/proc/roster.d.ts +95 -0
- package/dist/vfs/providers/proc/roster.js +425 -0
- package/dist/vfs/providers/proc/roster.js.map +1 -0
- package/dist/vfs/providers/proc/rows.d.ts +120 -0
- package/dist/vfs/providers/proc/rows.js +181 -0
- package/dist/vfs/providers/proc/rows.js.map +1 -0
- package/dist/vfs/providers/proc/subtree.d.ts +73 -0
- package/dist/vfs/providers/proc/subtree.js +125 -0
- package/dist/vfs/providers/proc/subtree.js.map +1 -0
- package/dist/vfs/providers/proc/sweep.d.ts +89 -0
- package/dist/vfs/providers/proc/sweep.js +297 -0
- package/dist/vfs/providers/proc/sweep.js.map +1 -0
- package/dist/vfs/providers/proc.d.ts +47 -346
- package/dist/vfs/providers/proc.js +349 -1806
- package/dist/vfs/providers/proc.js.map +1 -1
- package/dist/vfs/providers/share.js +4 -1
- package/dist/vfs/providers/share.js.map +1 -1
- package/package.json +3 -3
- package/dist/pacs/resultDecode.d.ts +0 -13
- package/dist/pacs/resultDecode.js +0 -19
- package/dist/pacs/resultDecode.js.map +0 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file CUBE rows into the /proc cache's model.
|
|
4
|
+
*
|
|
5
|
+
* Converts the feed and plugin-instance rows CUBE lists into the feeds and
|
|
6
|
+
* instances ProcCache keeps, merges a row into what the cache already
|
|
7
|
+
* holds, and reads one feed's row from whichever collection lists it.
|
|
8
|
+
*
|
|
9
|
+
* Key components:
|
|
10
|
+
* - procFeed_create: a feed row as the cache's feed.
|
|
11
|
+
* - procInstance_buildFromRow, instanceMetrics_extract: an instance row as the cache's instance.
|
|
12
|
+
* - procInstanceRow_merge: one instance row into the cache.
|
|
13
|
+
* - isoNewest_pick, outputPath_normalize: the rows' timestamps and output paths.
|
|
14
|
+
* - feedRow_fetch, FeedRow: one feed's row and its collection.
|
|
15
|
+
*
|
|
16
|
+
* Typical usage:
|
|
17
|
+
* ```typescript
|
|
18
|
+
* cache.feed_add(procFeed_create(row));
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Dependencies: `@fnndsc/cumin` (cache model, feed list contract), `./book` (RosterTotals).
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.procFeed_create = procFeed_create;
|
|
27
|
+
exports.instanceMetrics_extract = instanceMetrics_extract;
|
|
28
|
+
exports.procInstance_buildFromRow = procInstance_buildFromRow;
|
|
29
|
+
exports.procInstanceRow_merge = procInstanceRow_merge;
|
|
30
|
+
exports.isoNewest_pick = isoNewest_pick;
|
|
31
|
+
exports.outputPath_normalize = outputPath_normalize;
|
|
32
|
+
exports.feedRow_fetch = feedRow_fetch;
|
|
33
|
+
const cumin_1 = require("@fnndsc/cumin");
|
|
34
|
+
/**
|
|
35
|
+
* Converts a CUBE feed row into the cache's feed model.
|
|
36
|
+
*
|
|
37
|
+
* @param feed - One feed row.
|
|
38
|
+
* @returns The feed as ProcCache stores it.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* cache.feed_add(procFeed_create(row));
|
|
42
|
+
*/
|
|
43
|
+
function procFeed_create(feed) {
|
|
44
|
+
return {
|
|
45
|
+
id: Number(feed.id),
|
|
46
|
+
title: String(feed.name),
|
|
47
|
+
ownerUsername: String(feed.owner_username ?? ''),
|
|
48
|
+
public: Boolean(feed.public ?? false),
|
|
49
|
+
creationDate: String(feed.creation_date ?? ''),
|
|
50
|
+
finishedJobs: Number(feed.finished_jobs ?? 0),
|
|
51
|
+
erroredJobs: Number(feed.errored_jobs ?? 0),
|
|
52
|
+
startedJobs: Number(feed.started_jobs ?? 0),
|
|
53
|
+
scheduledJobs: Number(feed.scheduled_jobs ?? 0),
|
|
54
|
+
cancelledJobs: Number(feed.cancelled_jobs ?? 0),
|
|
55
|
+
createdJobs: Number(feed.created_jobs ?? 0),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Pulls the execution metrics a CUBE list row carries, defined-only.
|
|
60
|
+
*
|
|
61
|
+
* @param inst - One list row.
|
|
62
|
+
* @returns The row's timings, size, compute resource and pipeline run.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* cache.instanceMetrics_set(id, instanceMetrics_extract(row));
|
|
66
|
+
*/
|
|
67
|
+
function instanceMetrics_extract(inst) {
|
|
68
|
+
// Which pipeline run made the job: null is a direct run. The client drops
|
|
69
|
+
// a row's null fields, so a run made by no pipeline arrives without them.
|
|
70
|
+
const row = inst;
|
|
71
|
+
const pipelineName = typeof row.pipeline_name === 'string' && row.pipeline_name !== '' ? row.pipeline_name : null;
|
|
72
|
+
const workflowID = row.workflow_id === null || row.workflow_id === undefined ? null : Number(row.workflow_id);
|
|
73
|
+
return {
|
|
74
|
+
pipelineName,
|
|
75
|
+
workflowID,
|
|
76
|
+
...(typeof inst.start_date === 'string' ? { startedAt: inst.start_date } : {}),
|
|
77
|
+
...(typeof inst.end_date === 'string' ? { finishedAt: inst.end_date } : {}),
|
|
78
|
+
...(typeof inst.size === 'number' ? { outputBytes: inst.size } : {}),
|
|
79
|
+
...(typeof inst.compute_resource_name === 'string' && inst.compute_resource_name !== '' ? { computeResource: inst.compute_resource_name } : {}),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Converts a CUBE plugin-instance list row into the cache's instance model.
|
|
84
|
+
*
|
|
85
|
+
* @param inst - One list row.
|
|
86
|
+
* @returns The instance as ProcCache stores it (params unresolved).
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* cache.instance_add(procInstance_buildFromRow(row));
|
|
90
|
+
*/
|
|
91
|
+
function procInstance_buildFromRow(inst) {
|
|
92
|
+
const prevID = (inst.previous_id !== null && inst.previous_id !== undefined)
|
|
93
|
+
? Number(inst.previous_id)
|
|
94
|
+
: null;
|
|
95
|
+
return {
|
|
96
|
+
id: Number(inst.id),
|
|
97
|
+
feedID: Number(inst.feed_id),
|
|
98
|
+
parentID: prevID,
|
|
99
|
+
pluginName: String(inst.plugin_name),
|
|
100
|
+
pluginType: inst.plugin_type !== undefined ? String(inst.plugin_type) : undefined,
|
|
101
|
+
params: null,
|
|
102
|
+
outputPath: outputPath_normalize(inst.output_path) ?? undefined,
|
|
103
|
+
status: String(inst.status ?? 'unknown'),
|
|
104
|
+
...instanceMetrics_extract(inst),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Merges one CUBE list row into the cache: a known instance takes the row's
|
|
109
|
+
* status and metrics (terminal status never regresses), an unknown one is
|
|
110
|
+
* added to the topology.
|
|
111
|
+
*
|
|
112
|
+
* @param cache - The process cache.
|
|
113
|
+
* @param inst - One list row.
|
|
114
|
+
* @returns True when the row introduced a new instance.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* const added: boolean = procInstanceRow_merge(procCache_get(), row);
|
|
118
|
+
*/
|
|
119
|
+
function procInstanceRow_merge(cache, inst) {
|
|
120
|
+
const id = Number(inst.id);
|
|
121
|
+
if (cache.instance_get(id)) {
|
|
122
|
+
cache.status_update(id, String(inst.status ?? 'unknown'));
|
|
123
|
+
cache.instanceMetrics_set(id, instanceMetrics_extract(inst));
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
cache.instance_add(procInstance_buildFromRow(inst));
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The newer of two ISO timestamps, tolerant of absent values.
|
|
131
|
+
*
|
|
132
|
+
* @param a - A timestamp or null.
|
|
133
|
+
* @param b - A timestamp, or undefined when the row carried none.
|
|
134
|
+
* @returns The later of the two, or whichever exists.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* isoNewest_pick('2026-01-01T00:00:00Z', row.end_date);
|
|
138
|
+
*/
|
|
139
|
+
function isoNewest_pick(a, b) {
|
|
140
|
+
if (typeof b !== 'string' || b === '')
|
|
141
|
+
return a;
|
|
142
|
+
if (a === null)
|
|
143
|
+
return b;
|
|
144
|
+
return Date.parse(b) > Date.parse(a) ? b : a;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Normalizes CUBE's output-path spelling into an absolute CFS path.
|
|
148
|
+
*
|
|
149
|
+
* @param value - Raw `output_path` value from a plugin-instance resource.
|
|
150
|
+
* @returns Absolute CFS path, or null when no usable path was supplied.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* outputPath_normalize('home/chris/feeds/feed_7/pl-dircopy_12/data'); // '/home/chris/...'
|
|
154
|
+
*/
|
|
155
|
+
function outputPath_normalize(value) {
|
|
156
|
+
if (typeof value !== 'string' || value.trim() === '')
|
|
157
|
+
return null;
|
|
158
|
+
const clean = value.trim();
|
|
159
|
+
return clean.startsWith('/') ? clean : `/${clean}`;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Reads one feed's row, from the owned-and-shared collection first and the
|
|
163
|
+
* public one after.
|
|
164
|
+
*
|
|
165
|
+
* @param client - Connected chrisapi client.
|
|
166
|
+
* @param feedID - The feed to read.
|
|
167
|
+
* @returns The row and its collection, or null when neither lists the feed for this identity.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* const row: FeedRow | null = await feedRow_fetch(client, 7);
|
|
171
|
+
*/
|
|
172
|
+
async function feedRow_fetch(client, feedID) {
|
|
173
|
+
const own = await (0, cumin_1.feedsPage_get)(client, { id: feedID, limit: 1, offset: 0 });
|
|
174
|
+
const ownRow = own.data[0];
|
|
175
|
+
if (ownRow)
|
|
176
|
+
return { feed: ownRow, collection: 'owned' };
|
|
177
|
+
const pub = (await (0, cumin_1.publicFeedsPage_get)(client, { id: feedID, limit: 1, offset: 0 })) ?? { data: [], totalCount: 0 };
|
|
178
|
+
const pubRow = pub.data[0];
|
|
179
|
+
return pubRow ? { feed: pubRow, collection: 'public' } : null;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rows.js","sourceRoot":"","sources":["../../../../src/vfs/providers/proc/rows.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAyBH,0CAcC;AAWD,0DAgBC;AAWD,8DAeC;AAcD,sDASC;AAYD,wCAIC;AAWD,oDAIC;AA0BD,sCAUC;AApLD,yCAUuB;AAIvB;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAAC,IAAc;IAC5C,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC;QAChD,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;QACrC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC;QAC9C,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,CAAC;QAC7C,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;QAC3C,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;QAC3C,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC;QAC/C,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC;QAC/C,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,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AAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;IACxI,MAAM,MAAM,GAAyB,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The walk of a /proc subtree from the cache.
|
|
3
|
+
*
|
|
4
|
+
* `find` under `/proc/jobs` is answered from the cache, asking CUBE
|
|
5
|
+
* nothing: a feed's `status`, `title` and `note` and its root jobs; a job's
|
|
6
|
+
* `status`, `params`, `log`, its `data` link when it has output space, and
|
|
7
|
+
* its children; each job carrying its status, plugin and pipeline run for a
|
|
8
|
+
* test to ask. A feed whose jobs are not indexed yet is left to the walk.
|
|
9
|
+
*
|
|
10
|
+
* Key components:
|
|
11
|
+
* - SubtreeWalk: one walk's cache and what it has gathered.
|
|
12
|
+
* - subtreeFeed_add: a feed's files and jobs, or the feed left to the walk.
|
|
13
|
+
* - subtreeJobInside_add: a job's files, its data link and its children.
|
|
14
|
+
*
|
|
15
|
+
* Typical usage:
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const walk: SubtreeWalk = { cache: procCache_get(), entries: [], unanswered: [] };
|
|
18
|
+
* subtreeFeed_add(walk, 5, '', 1);
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Dependencies: `@fnndsc/cumin` (the cache), `@fnndsc/fond` (the subtree's shape).
|
|
22
|
+
*
|
|
23
|
+
* @module
|
|
24
|
+
*/
|
|
25
|
+
import type { ProcCache } from '@fnndsc/cumin';
|
|
26
|
+
import type { VFSSubtreeEntry } from '@fnndsc/fond';
|
|
27
|
+
/**
|
|
28
|
+
* One subtree walk: the cache it reads and what it has gathered, in
|
|
29
|
+
* listing order.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const walk: SubtreeWalk = { cache: procCache_get(), entries: [], unanswered: [] };
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export interface SubtreeWalk {
|
|
37
|
+
/** The cache the walk reads. */
|
|
38
|
+
readonly cache: ProcCache;
|
|
39
|
+
/** Every entry found, in the order its listings give it. */
|
|
40
|
+
readonly entries: VFSSubtreeEntry[];
|
|
41
|
+
/** Folders (`rel` paths) whose contents must be walked instead. */
|
|
42
|
+
readonly unanswered: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Adds what is inside a job: its files, its `data` link when it has output
|
|
46
|
+
* space, and its children; nothing for a job the cache lacks.
|
|
47
|
+
*
|
|
48
|
+
* @param walk - The walk.
|
|
49
|
+
* @param id - The job's id.
|
|
50
|
+
* @param rel - The job's own folder, relative to the subtree's root.
|
|
51
|
+
* @param depth - The depth of what is inside it.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* subtreeJobInside_add({ cache: procCache_get(), entries: [], unanswered: [] }, 10, '', 1);
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function subtreeJobInside_add(walk: SubtreeWalk, id: number, rel: string, depth: number): void;
|
|
59
|
+
/**
|
|
60
|
+
* Adds what is inside a feed: its files and its root jobs; a feed whose
|
|
61
|
+
* jobs are not indexed yet is left to the walk.
|
|
62
|
+
*
|
|
63
|
+
* @param walk - The walk.
|
|
64
|
+
* @param id - The feed's id.
|
|
65
|
+
* @param rel - The feed's own folder, relative to the subtree's root.
|
|
66
|
+
* @param depth - The depth of what is inside it.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* subtreeFeed_add({ cache: procCache_get(), entries: [], unanswered: [] }, 5, 'feed_5', 2);
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function subtreeFeed_add(walk: SubtreeWalk, id: number, rel: string, depth: number): void;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file The walk of a /proc subtree from the cache.
|
|
4
|
+
*
|
|
5
|
+
* `find` under `/proc/jobs` is answered from the cache, asking CUBE
|
|
6
|
+
* nothing: a feed's `status`, `title` and `note` and its root jobs; a job's
|
|
7
|
+
* `status`, `params`, `log`, its `data` link when it has output space, and
|
|
8
|
+
* its children; each job carrying its status, plugin and pipeline run for a
|
|
9
|
+
* test to ask. A feed whose jobs are not indexed yet is left to the walk.
|
|
10
|
+
*
|
|
11
|
+
* Key components:
|
|
12
|
+
* - SubtreeWalk: one walk's cache and what it has gathered.
|
|
13
|
+
* - subtreeFeed_add: a feed's files and jobs, or the feed left to the walk.
|
|
14
|
+
* - subtreeJobInside_add: a job's files, its data link and its children.
|
|
15
|
+
*
|
|
16
|
+
* Typical usage:
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const walk: SubtreeWalk = { cache: procCache_get(), entries: [], unanswered: [] };
|
|
19
|
+
* subtreeFeed_add(walk, 5, '', 1);
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* Dependencies: `@fnndsc/cumin` (the cache), `@fnndsc/fond` (the subtree's shape).
|
|
23
|
+
*
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.subtreeJobInside_add = subtreeJobInside_add;
|
|
28
|
+
exports.subtreeFeed_add = subtreeFeed_add;
|
|
29
|
+
/**
|
|
30
|
+
* Adds one virtual file.
|
|
31
|
+
*
|
|
32
|
+
* @param walk - The walk.
|
|
33
|
+
* @param rel - Its folder, relative to the subtree's root ('' for the root).
|
|
34
|
+
* @param name - The file's name.
|
|
35
|
+
* @param depth - Its depth below the root.
|
|
36
|
+
*/
|
|
37
|
+
function subtreeFile_add(walk, rel, name, depth) {
|
|
38
|
+
walk.entries.push({ rel: rel === '' ? name : `${rel}/${name}`, depth, item: { name, type: 'file', size: 0, owner: '', date: '' } });
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A job's attributes for a test to ask: its status, its plugin, and which
|
|
42
|
+
* pipeline run made it ('' for a direct run; absent until a row said).
|
|
43
|
+
*
|
|
44
|
+
* @param inst - The job.
|
|
45
|
+
* @returns The attributes.
|
|
46
|
+
*/
|
|
47
|
+
function jobAttrs_build(inst) {
|
|
48
|
+
return {
|
|
49
|
+
status: inst.status ?? 'unknown',
|
|
50
|
+
plugin: inst.pluginName,
|
|
51
|
+
...(inst.pipelineName !== undefined ? { pipeline: inst.pipelineName ?? '' } : {}),
|
|
52
|
+
...(inst.workflowID !== undefined ? { workflow: inst.workflowID === null ? '' : String(inst.workflowID) } : {}),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Adds one job, and everything inside it; nothing for a job the cache lacks.
|
|
57
|
+
*
|
|
58
|
+
* @param walk - The walk.
|
|
59
|
+
* @param id - The job's id.
|
|
60
|
+
* @param rel - Its folder, relative to the subtree's root.
|
|
61
|
+
* @param depth - Its depth below the root.
|
|
62
|
+
*/
|
|
63
|
+
function subtreeJob_add(walk, id, rel, depth) {
|
|
64
|
+
const inst = walk.cache.instance_get(id);
|
|
65
|
+
if (inst === undefined)
|
|
66
|
+
return;
|
|
67
|
+
const name = `${inst.pluginName}_${id}`;
|
|
68
|
+
const here = rel === '' ? name : `${rel}/${name}`;
|
|
69
|
+
walk.entries.push({
|
|
70
|
+
rel: here, depth,
|
|
71
|
+
item: { name, type: 'job', size: 0, owner: '', date: inst.startedAt ?? '', status: inst.status ?? 'unknown' },
|
|
72
|
+
attrs: jobAttrs_build(inst),
|
|
73
|
+
});
|
|
74
|
+
subtreeJobInside_add(walk, id, here, depth + 1);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Adds what is inside a job: its files, its `data` link when it has output
|
|
78
|
+
* space, and its children; nothing for a job the cache lacks.
|
|
79
|
+
*
|
|
80
|
+
* @param walk - The walk.
|
|
81
|
+
* @param id - The job's id.
|
|
82
|
+
* @param rel - The job's own folder, relative to the subtree's root.
|
|
83
|
+
* @param depth - The depth of what is inside it.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* subtreeJobInside_add({ cache: procCache_get(), entries: [], unanswered: [] }, 10, '', 1);
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
function subtreeJobInside_add(walk, id, rel, depth) {
|
|
91
|
+
const inst = walk.cache.instance_get(id);
|
|
92
|
+
if (inst === undefined)
|
|
93
|
+
return;
|
|
94
|
+
for (const name of ['status', 'params', 'log'])
|
|
95
|
+
subtreeFile_add(walk, rel, name, depth);
|
|
96
|
+
if (inst.outputPath !== null)
|
|
97
|
+
walk.entries.push({ rel: `${rel}/data`, depth, item: { name: 'data', type: 'link', size: 0, owner: '', date: '' } });
|
|
98
|
+
for (const child of walk.cache.children_get(id))
|
|
99
|
+
subtreeJob_add(walk, child, rel, depth);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Adds what is inside a feed: its files and its root jobs; a feed whose
|
|
103
|
+
* jobs are not indexed yet is left to the walk.
|
|
104
|
+
*
|
|
105
|
+
* @param walk - The walk.
|
|
106
|
+
* @param id - The feed's id.
|
|
107
|
+
* @param rel - The feed's own folder, relative to the subtree's root.
|
|
108
|
+
* @param depth - The depth of what is inside it.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* subtreeFeed_add({ cache: procCache_get(), entries: [], unanswered: [] }, 5, 'feed_5', 2);
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
function subtreeFeed_add(walk, id, rel, depth) {
|
|
116
|
+
if (!walk.cache.topologyLoaded_has(id)) {
|
|
117
|
+
walk.unanswered.push(rel);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
for (const name of ['status', 'title', 'note'])
|
|
121
|
+
subtreeFile_add(walk, rel, name, depth);
|
|
122
|
+
for (const root of walk.cache.feedRoots_get(id))
|
|
123
|
+
subtreeJob_add(walk, root, rel, depth);
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=subtree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subtree.js","sourceRoot":"","sources":["../../../../src/vfs/providers/proc/subtree.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAsFH,oDAMC;AAgBD,0CAIC;AAzFD;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,IAAiB,EAAE,GAAW,EAAE,IAAY,EAAE,KAAa;IAClF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACtI,CAAC;AAED;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,IAAkB;IACxC,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,SAAS;QAChC,MAAM,EAAE,IAAI,CAAC,UAAU;QACvB,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,KAAK,IAAI,CA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*
|
|
4
|
+
* One paginated walk of every plugin instance across all feeds, reconciling
|
|
5
|
+
* the cache to the instance set it reads. A failed sweep keeps where it
|
|
6
|
+
* stopped for `proc retry`, and a finished one starts the quiet settlement
|
|
7
|
+
* tails (join edges, data facts, pipeline packages).
|
|
8
|
+
*
|
|
9
|
+
* Key components:
|
|
10
|
+
* - procTopology_warmup, procTopology_retry: start, resume.
|
|
11
|
+
* - procTopology_status, procTopology_await, ProcTopologyStatus: its lifecycle.
|
|
12
|
+
* - procCache_refresh: the cache rebuilt, whole or for one feed.
|
|
13
|
+
* - procDataFacts_start: the data facts of every feed that has none.
|
|
14
|
+
* - procVisitState_reset: all visit bookkeeping forgotten.
|
|
15
|
+
*
|
|
16
|
+
* Typical usage:
|
|
17
|
+
* ```typescript
|
|
18
|
+
* void procTopology_warmup();
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Dependencies: `@fnndsc/cumin` (cache, instance list contract), `../../../dag/feedJoins`,
|
|
22
|
+
* `../../../dag/feedData`, `../../../pipelines/packages`, `./book`, `./rows`, `./feedTopology`,
|
|
23
|
+
* `./catchup`, `./feedIndex`.
|
|
24
|
+
*
|
|
25
|
+
* @module
|
|
26
|
+
*/
|
|
27
|
+
/** Lifecycle states for the session's global topology sweep. */
|
|
28
|
+
export type ProcTopologyState = 'idle' | 'running' | 'complete' | 'failed';
|
|
29
|
+
/**
|
|
30
|
+
* Observable lifecycle of the session's global topology sweep.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const status: ProcTopologyStatus = procTopology_status();
|
|
34
|
+
*/
|
|
35
|
+
export interface ProcTopologyStatus {
|
|
36
|
+
/** Current topology sweep lifecycle state. */
|
|
37
|
+
state: ProcTopologyState;
|
|
38
|
+
/** Failure reason when `state` is `failed`. */
|
|
39
|
+
failure?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Forgets all visit bookkeeping (tests, and a cache cleared underneath us).
|
|
43
|
+
*/
|
|
44
|
+
export declare function procVisitState_reset(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Reads the data facts of every feed that has none yet (see
|
|
47
|
+
* `dag/feedData.ts`): the index's tail after a sweep, and the one a daemon
|
|
48
|
+
* that restored its checkpoint starts itself, since no sweep runs then.
|
|
49
|
+
*
|
|
50
|
+
* @returns How many feeds were read; zero when a sweep is already under way.
|
|
51
|
+
*/
|
|
52
|
+
export declare function procDataFacts_start(): Promise<number>;
|
|
53
|
+
/**
|
|
54
|
+
* Starts or joins the session's global plugin-instance topology sweep.
|
|
55
|
+
*
|
|
56
|
+
* @returns The single in-flight sweep promise.
|
|
57
|
+
*/
|
|
58
|
+
export declare function procTopology_warmup(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Continues a failed topology sweep from its retained global page.
|
|
61
|
+
*
|
|
62
|
+
* @returns The resumed sweep promise, or the active sweep when one is running.
|
|
63
|
+
* @throws {Error} When there is no failed sweep continuation to retry.
|
|
64
|
+
*/
|
|
65
|
+
export declare function procTopology_retry(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Reports the session topology sweep lifecycle.
|
|
68
|
+
*
|
|
69
|
+
* @returns A snapshot of the lifecycle state and any failure reason.
|
|
70
|
+
*/
|
|
71
|
+
export declare function procTopology_status(): ProcTopologyStatus;
|
|
72
|
+
/**
|
|
73
|
+
* Waits for the active topology sweep without starting another.
|
|
74
|
+
*
|
|
75
|
+
* @returns A promise that resolves when the active sweep finishes, or
|
|
76
|
+
* immediately when no sweep is running.
|
|
77
|
+
*/
|
|
78
|
+
export declare function procTopology_await(): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Rebuilds the ProcCache, optionally scoped to one feed.
|
|
81
|
+
*
|
|
82
|
+
* A full refresh returns feeds whose topology merits reload after the feed-index
|
|
83
|
+
* comparison. Callers performing an explicit `proc refresh` can ignore that
|
|
84
|
+
* result and run a global topology sweep.
|
|
85
|
+
*
|
|
86
|
+
* @param feedID - One feed to force-refresh, or undefined for the full feed index.
|
|
87
|
+
* @returns IDs whose topology is new, changed, or currently active.
|
|
88
|
+
*/
|
|
89
|
+
export declare function procCache_refresh(feedID?: number): Promise<number[]>;
|