@elaraai/e3-api-client 1.0.103 → 1.0.105
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 +122 -1
- package/dist/src/datasets.d.ts +72 -0
- package/dist/src/datasets.d.ts.map +1 -1
- package/dist/src/datasets.js +117 -1
- package/dist/src/datasets.js.map +1 -1
- package/dist/src/datasets.spec.js +136 -12
- package/dist/src/datasets.spec.js.map +1 -1
- package/dist/src/functions.d.ts +340 -23
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +469 -25
- package/dist/src/functions.js.map +1 -1
- package/dist/src/functions.spec.d.ts +6 -0
- package/dist/src/functions.spec.d.ts.map +1 -0
- package/dist/src/functions.spec.js +205 -0
- package/dist/src/functions.spec.js.map +1 -0
- package/dist/src/http.d.ts +19 -2
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +18 -3
- package/dist/src/http.js.map +1 -1
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/split-calls.spec.d.ts +6 -0
- package/dist/src/split-calls.spec.d.ts.map +1 -0
- package/dist/src/split-calls.spec.js +109 -0
- package/dist/src/split-calls.spec.js.map +1 -0
- package/dist/src/types.d.ts +295 -3
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +13 -2
- package/dist/src/types.js.map +1 -1
- package/dist/src/uuid.d.ts +21 -0
- package/dist/src/uuid.d.ts.map +1 -0
- package/dist/src/uuid.js +70 -0
- package/dist/src/uuid.js.map +1 -0
- package/package.json +4 -4
package/dist/src/functions.d.ts
CHANGED
|
@@ -11,13 +11,27 @@
|
|
|
11
11
|
* workspace-scoped; the server says who may run what: a caller who may read
|
|
12
12
|
* the workspace runs a platform-free one, and only an elevated grant any other.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* A call through a package is answered within its request, and nothing of it
|
|
15
|
+
* is kept. A call through a workspace is kept by the server for its lifetime,
|
|
16
|
+
* and outlives the request that starts it: {@link workspaceFunctionCall}
|
|
17
|
+
* starts it and polls it to its end, and the server's workspace keeps it —
|
|
18
|
+
* who made it, its arguments, the versions of the inputs it read, its value
|
|
19
|
+
* and its logs — which {@link workspaceCallList} and {@link workspaceCallGet}
|
|
20
|
+
* read. A one-shot is run within its request by {@link oneShotExecute}, or
|
|
21
|
+
* started as such a call by {@link oneShotCall}, kept among the workspace's
|
|
22
|
+
* calls naming no function. A split call — a caller's program over a
|
|
23
|
+
* dataset's pieces — runs as a job, launched under one-shot's grant and polled
|
|
24
|
+
* for its result.
|
|
18
25
|
*/
|
|
19
|
-
import type { FunctionSignature, FunctionCallRequest, ExecuteResult, OneShotRequest, SplitCallPlan, SplitCallProgress, SplitCallRequest, SplitCallStatus } from './types.js';
|
|
26
|
+
import type { FunctionSignature, FunctionCall, FunctionCallAnswer, FunctionCallPage, FunctionCallRequest, FunctionCallState, FunctionCallStatus, ExecuteResult, OneShotRequest, SplitCallPlan, SplitCallProgress, SplitCallReport, SplitCallRequest, SplitCallStatus } from './types.js';
|
|
20
27
|
import { type RequestOptions } from './http.js';
|
|
28
|
+
/**
|
|
29
|
+
* How long each poll of a call {@link workspaceFunctionCall} makes asks the
|
|
30
|
+
* server to wait for it to end, in milliseconds. A server holds a poll at
|
|
31
|
+
* most as long as it allows — the local server 20 s, a host whose held
|
|
32
|
+
* requests cost it less — and answers as soon as the call ends.
|
|
33
|
+
*/
|
|
34
|
+
export declare const CALL_POLL_WAIT_MS = 20000;
|
|
21
35
|
/** List a package's functions with their signatures. */
|
|
22
36
|
export declare function functionList(url: string, repo: string, pkg: string, version: string, options: RequestOptions): Promise<FunctionSignature[]>;
|
|
23
37
|
/** Get a single function's signature (for encoding arguments). */
|
|
@@ -75,16 +89,47 @@ export declare function workspaceFunctionList(url: string, repo: string, ws: str
|
|
|
75
89
|
* @throws {AuthError} On 401 Unauthorized
|
|
76
90
|
*/
|
|
77
91
|
export declare function workspaceFunctionDescribe(url: string, repo: string, ws: string, fn: string, options: RequestOptions): Promise<FunctionSignature>;
|
|
92
|
+
/** Options for {@link workspaceFunctionCall}. */
|
|
93
|
+
export interface WorkspaceFunctionCallOptions {
|
|
94
|
+
/**
|
|
95
|
+
* Stops the call: the client stops waiting for it at once, and asks the
|
|
96
|
+
* server to stop it, which ends it `cancelled`. The client names the call
|
|
97
|
+
* itself, so aborted while the call's start waits, the call is asked to stop
|
|
98
|
+
* at once, by that id, and again once its start answers.
|
|
99
|
+
*/
|
|
100
|
+
signal?: AbortSignal;
|
|
101
|
+
/** Told the call's id once its start has answered and the call runs on
|
|
102
|
+
* past it: what the call is polled, cancelled and read by elsewhere */
|
|
103
|
+
onStarted?: (id: string) => void;
|
|
104
|
+
/**
|
|
105
|
+
* How long the call's start waits for it to end before it answers with the
|
|
106
|
+
* call's id, in milliseconds: at most the server's window, which it waits
|
|
107
|
+
* when unset. A call that ends within it costs one request; a shorter wait
|
|
108
|
+
* tells `onStarted` of a longer one sooner, at the cost of polling it.
|
|
109
|
+
*/
|
|
110
|
+
startWaitMs?: number;
|
|
111
|
+
}
|
|
78
112
|
/**
|
|
79
|
-
* Call a function of the deployed package
|
|
113
|
+
* Call a function of the deployed package, and wait for its result: the call
|
|
114
|
+
* is started, kept by the server for its lifetime, and polled to its end.
|
|
80
115
|
*
|
|
81
116
|
* @remarks
|
|
82
117
|
* A runner the request names is held to the caller's grant, as
|
|
83
118
|
* {@link functionCall} says. An argument is a value, or a dataset of the
|
|
84
119
|
* workspace (`variant('dataset', path)`), pinned by its hash at launch as a
|
|
85
|
-
* one-shot's is: the result's `inputs` names each
|
|
86
|
-
* the hash it was pinned at, in
|
|
87
|
-
* `invalid`.
|
|
120
|
+
* one-shot's is: the result's `inputs` names each input the function reads and
|
|
121
|
+
* each dataset argument, with the hash it was pinned at, in parameter order,
|
|
122
|
+
* and an unassigned one is `invalid`.
|
|
123
|
+
*
|
|
124
|
+
* A call is held to its own timeout, never to a request's, so it may run for
|
|
125
|
+
* as long as its limits allow: its start waits up to the server's window
|
|
126
|
+
* ({@link workspaceFunctionStart}), and a call still running is polled — each
|
|
127
|
+
* poll held by the server until the call ends or a while passes — 250 ms
|
|
128
|
+
* apart at first, backing off to 2 s. The client names the call, an id of its
|
|
129
|
+
* own ({@link FunctionCallStartOptions.id}), so an abort reaches the call
|
|
130
|
+
* however soon it comes. A server that keeps no calls, one that predates
|
|
131
|
+
* them, has no route to start one, and the call is made through
|
|
132
|
+
* {@link workspaceFunctionCallSync} instead.
|
|
88
133
|
*
|
|
89
134
|
* @param url - Base URL of the e3 API server
|
|
90
135
|
* @param repo - Repository name
|
|
@@ -94,13 +139,186 @@ export declare function workspaceFunctionDescribe(url: string, repo: string, ws:
|
|
|
94
139
|
* @param req - The arguments (values or dataset paths), a runner to run on
|
|
95
140
|
* instead of the function's own, and the limits
|
|
96
141
|
* @param options - Request options including auth token
|
|
142
|
+
* @param call - The signal that stops the call, and who is told its id once
|
|
143
|
+
* it runs on past its start
|
|
97
144
|
* @returns The call's terminal result
|
|
98
145
|
* @throws {ApiError} `permission_denied` (`path` `runner`) when the caller may
|
|
99
|
-
* not run the function on the runner the request names,
|
|
100
|
-
* `workspace_not_found` / `workspace_not_deployed`
|
|
146
|
+
* not run the function on the runner the request names,
|
|
147
|
+
* `workspace_not_found` / `workspace_not_deployed`, and `internal` for a
|
|
148
|
+
* call someone cancelled, or the server lost, which has no result
|
|
149
|
+
* @throws {AuthError} On 401 Unauthorized
|
|
150
|
+
* @throws The abort's reason, once `call.signal` aborts
|
|
151
|
+
*/
|
|
152
|
+
export declare function workspaceFunctionCall(url: string, repo: string, ws: string, fn: string, req: FunctionCallRequest, options: RequestOptions, call?: WorkspaceFunctionCallOptions): Promise<ExecuteResult>;
|
|
153
|
+
/** Options for {@link workspaceFunctionStart}. */
|
|
154
|
+
export interface FunctionCallStartOptions {
|
|
155
|
+
/** How long the start waits for the call to end before it answers
|
|
156
|
+
* `running`, in milliseconds: at most the server's window, which it waits
|
|
157
|
+
* when unset; 0 answers at once */
|
|
158
|
+
waitMs?: number;
|
|
159
|
+
/**
|
|
160
|
+
* The id to file the call under: a UUIDv7 of now, which names the call
|
|
161
|
+
* before the start answers, so it can be cancelled at once. A server sets
|
|
162
|
+
* aside one far from its clock for an id of its own, which the answer
|
|
163
|
+
* names, and refuses one it keeps a call under already. Unset, the server
|
|
164
|
+
* names the call.
|
|
165
|
+
*/
|
|
166
|
+
id?: string;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Start a call of a function of the deployed package: the server files it,
|
|
170
|
+
* runs it where its calls run, and waits a while for it to end.
|
|
171
|
+
*
|
|
172
|
+
* @remarks
|
|
173
|
+
* The call is kept by the server from now until the lifetime its end gives
|
|
174
|
+
* it: an hour for a success or a cancel, a week for any other end, unless the
|
|
175
|
+
* server says otherwise. Its timeout is the server's ceiling unless the
|
|
176
|
+
* request asks for less, since it answers no request. The answer is the
|
|
177
|
+
* call's id and how it stood when the wait ended: `completed` with its
|
|
178
|
+
* result for a call that ended within it — a call found wrong among them,
|
|
179
|
+
* `invalid` — or `running`, which {@link workspaceFunctionCallStatus} polls.
|
|
180
|
+
* A start is never sent twice, so a call is never filed twice.
|
|
181
|
+
*
|
|
182
|
+
* @param url - Base URL of the e3 API server
|
|
183
|
+
* @param repo - Repository name
|
|
184
|
+
* @param ws - The workspace whose deployed package holds the function
|
|
185
|
+
* @param fn - Function name
|
|
186
|
+
* @param req - The arguments, a runner to run on instead of the function's
|
|
187
|
+
* own, and the limits
|
|
188
|
+
* @param options - Request options including auth token
|
|
189
|
+
* @param start - How long the start waits for the call to end, and the id to
|
|
190
|
+
* file it under
|
|
191
|
+
* @returns The call's id and status
|
|
192
|
+
* @throws {ApiError} As {@link workspaceFunctionCall} does; `not_found` from a
|
|
193
|
+
* server that keeps no calls
|
|
194
|
+
* @throws {AuthError} On 401 Unauthorized
|
|
195
|
+
*/
|
|
196
|
+
export declare function workspaceFunctionStart(url: string, repo: string, ws: string, fn: string, req: FunctionCallRequest, options: RequestOptions, start?: FunctionCallStartOptions): Promise<FunctionCallAnswer>;
|
|
197
|
+
/** Options for {@link workspaceFunctionCallStatus}. */
|
|
198
|
+
export interface FunctionCallPollOptions {
|
|
199
|
+
/** How long the server waits for the call to end before it answers
|
|
200
|
+
* `running`, in milliseconds: at most as long as it allows; 0, the
|
|
201
|
+
* default, answers at once */
|
|
202
|
+
waitMs?: number;
|
|
203
|
+
/** Aborts the poll */
|
|
204
|
+
signal?: AbortSignal;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* A call's status: `running`; its result once it ended, its value inline up
|
|
208
|
+
* to its `maxResultBytes`; `cancelled`, naming who asked; or `lost`, and why.
|
|
209
|
+
*
|
|
210
|
+
* @param url - Base URL of the e3 API server
|
|
211
|
+
* @param repo - Repository name
|
|
212
|
+
* @param ws - The workspace the call was made through
|
|
213
|
+
* @param id - The call's id
|
|
214
|
+
* @param options - Request options including auth token
|
|
215
|
+
* @param poll - How long the server waits for the call to end, and the signal
|
|
216
|
+
* that aborts the poll
|
|
217
|
+
* @returns The status
|
|
218
|
+
* @throws {ApiError} `internal` when the workspace keeps no such call — none
|
|
219
|
+
* was made, or its lifetime has ended — and `permission_denied` (`path`
|
|
220
|
+
* `call`) for a caller the server does not let read it
|
|
221
|
+
* @throws {AuthError} On 401 Unauthorized
|
|
222
|
+
* @throws The abort's reason, once `poll.signal` aborts
|
|
223
|
+
*/
|
|
224
|
+
export declare function workspaceFunctionCallStatus(url: string, repo: string, ws: string, id: string, options: RequestOptions, poll?: FunctionCallPollOptions): Promise<FunctionCallStatus>;
|
|
225
|
+
/**
|
|
226
|
+
* Ask a running call to stop: the server stops its runner, and the call ends
|
|
227
|
+
* `cancelled`, naming who asked. A call that has ended is left as it is.
|
|
228
|
+
*
|
|
229
|
+
* @remarks
|
|
230
|
+
* The request is sent `keepalive`, so it reaches the server though the page
|
|
231
|
+
* that sends it is closing: a page that stops its calls as it goes away is
|
|
232
|
+
* heard.
|
|
233
|
+
*
|
|
234
|
+
* @param url - Base URL of the e3 API server
|
|
235
|
+
* @param repo - Repository name
|
|
236
|
+
* @param ws - The workspace the call was made through
|
|
237
|
+
* @param id - The call's id
|
|
238
|
+
* @param options - Request options including auth token
|
|
239
|
+
* @returns The call's status once it stopped, or `running` while it stops
|
|
240
|
+
* @throws {ApiError} As {@link workspaceFunctionCallStatus} does, and
|
|
241
|
+
* `permission_denied` (`path` `call`) for a caller the server does not let
|
|
242
|
+
* cancel it
|
|
243
|
+
* @throws {AuthError} On 401 Unauthorized
|
|
244
|
+
*/
|
|
245
|
+
export declare function workspaceFunctionCallCancel(url: string, repo: string, ws: string, id: string, options: RequestOptions): Promise<FunctionCallStatus>;
|
|
246
|
+
/** Which of a workspace's calls {@link workspaceCallList} answers. */
|
|
247
|
+
export interface FunctionCallListQuery {
|
|
248
|
+
/** Only the calls of the function of this name */
|
|
249
|
+
function?: string;
|
|
250
|
+
/** Only the calls in the state of this tag */
|
|
251
|
+
state?: FunctionCallState['type'];
|
|
252
|
+
/** Only the calls before it: the last page's `next` */
|
|
253
|
+
before?: string;
|
|
254
|
+
/** At most this many: the server's page unless set, and never more than
|
|
255
|
+
* `FUNCTION_CALLS_PAGE_MAX` */
|
|
256
|
+
limit?: number;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* A page of the calls a workspace keeps, the latest first: each by who made
|
|
260
|
+
* it, when, and how it stands or ended.
|
|
261
|
+
*
|
|
262
|
+
* @remarks
|
|
263
|
+
* A call is kept for its lifetime, an hour for a success or a cancel and a
|
|
264
|
+
* week for any other end unless the server says otherwise, so the list holds
|
|
265
|
+
* what is recent however many calls are made. A page's `next` is the next
|
|
266
|
+
* page's `before`, `none` on the last. A page may hold fewer calls than its
|
|
267
|
+
* limit, or none, and name a next all the same: a server that reads a bounded
|
|
268
|
+
* number of calls a request, as the cloud's does, stops where its reads
|
|
269
|
+
* stopped, which a list of a function's calls, or a state's, may reach first.
|
|
270
|
+
*
|
|
271
|
+
* @param url - Base URL of the e3 API server
|
|
272
|
+
* @param repo - Repository name
|
|
273
|
+
* @param ws - The workspace
|
|
274
|
+
* @param options - Request options including auth token
|
|
275
|
+
* @param query - Only a function's calls, or only those in a state, and the
|
|
276
|
+
* page's cursor and size
|
|
277
|
+
* @returns The page
|
|
278
|
+
* @throws {ApiError} `workspace_not_found`, and `bad_request` for a query
|
|
279
|
+
* given wrong
|
|
280
|
+
* @throws {AuthError} On 401 Unauthorized
|
|
281
|
+
*/
|
|
282
|
+
export declare function workspaceCallList(url: string, repo: string, ws: string, options: RequestOptions, query?: FunctionCallListQuery): Promise<FunctionCallPage>;
|
|
283
|
+
/**
|
|
284
|
+
* A kept call, whole: the package it ran from, its arguments — values by the
|
|
285
|
+
* objects they were stored as, datasets by the hashes they were pinned at —
|
|
286
|
+
* the versions of the inputs it read, its limits, its value by hash once it
|
|
287
|
+
* succeeded, its log tails, and when it is forgotten.
|
|
288
|
+
*
|
|
289
|
+
* @param url - Base URL of the e3 API server
|
|
290
|
+
* @param repo - Repository name
|
|
291
|
+
* @param ws - The workspace the call was made through
|
|
292
|
+
* @param id - The call's id
|
|
293
|
+
* @param options - Request options including auth token
|
|
294
|
+
* @returns The call
|
|
295
|
+
* @throws {ApiError} As {@link workspaceFunctionCallStatus} does
|
|
101
296
|
* @throws {AuthError} On 401 Unauthorized
|
|
102
297
|
*/
|
|
103
|
-
export declare function
|
|
298
|
+
export declare function workspaceCallGet(url: string, repo: string, ws: string, id: string, options: RequestOptions): Promise<FunctionCall>;
|
|
299
|
+
/**
|
|
300
|
+
* Call a function of the deployed package within one request: the sync route,
|
|
301
|
+
* which a server that keeps no calls answers alone.
|
|
302
|
+
*
|
|
303
|
+
* @remarks
|
|
304
|
+
* The call's timeout defaults as a sync call's does, and is clamped under the
|
|
305
|
+
* server's sync deadline, so a call that runs past it is answered `timed_out`.
|
|
306
|
+
* A server that keeps calls keeps this one too. {@link workspaceFunctionCall}
|
|
307
|
+
* is held to no request's deadline, and is what a caller makes unless it
|
|
308
|
+
* wants a single request.
|
|
309
|
+
*
|
|
310
|
+
* @param url - Base URL of the e3 API server
|
|
311
|
+
* @param repo - Repository name
|
|
312
|
+
* @param ws - The workspace whose deployed package holds the function
|
|
313
|
+
* @param fn - Function name
|
|
314
|
+
* @param req - The arguments, a runner to run on instead of the function's
|
|
315
|
+
* own, and the limits
|
|
316
|
+
* @param options - Request options including auth token
|
|
317
|
+
* @returns The call's terminal result
|
|
318
|
+
* @throws {ApiError} As {@link workspaceFunctionCall} does
|
|
319
|
+
* @throws {AuthError} On 401 Unauthorized
|
|
320
|
+
*/
|
|
321
|
+
export declare function workspaceFunctionCallSync(url: string, repo: string, ws: string, fn: string, req: FunctionCallRequest, options: RequestOptions): Promise<ExecuteResult>;
|
|
104
322
|
/**
|
|
105
323
|
* Run an anonymous IR synchronously against a workspace.
|
|
106
324
|
*
|
|
@@ -113,6 +331,10 @@ export declare function workspaceFunctionCall(url: string, repo: string, ws: str
|
|
|
113
331
|
* path and the hash it was pinned at, in argument order, so an answer can be
|
|
114
332
|
* reproduced and a stale one noticed.
|
|
115
333
|
*
|
|
334
|
+
* The call runs within the request, its timeout clamped under the server's
|
|
335
|
+
* sync deadline, so one that runs past it is answered `timed_out`, and
|
|
336
|
+
* nothing of it is kept. {@link oneShotCall} is held to no request's deadline.
|
|
337
|
+
*
|
|
116
338
|
* @param url - Base URL of the e3 API server
|
|
117
339
|
* @param repo - Repository name
|
|
118
340
|
* @param ws - The workspace whose datasets the call reads
|
|
@@ -125,6 +347,65 @@ export declare function workspaceFunctionCall(url: string, repo: string, ws: str
|
|
|
125
347
|
* @throws {AuthError} On 401 Unauthorized
|
|
126
348
|
*/
|
|
127
349
|
export declare function oneShotExecute(url: string, repo: string, ws: string, req: OneShotRequest, options: RequestOptions): Promise<ExecuteResult>;
|
|
350
|
+
/**
|
|
351
|
+
* Run an anonymous IR against a workspace, and wait for its result: the call
|
|
352
|
+
* is started, kept by the server for its lifetime among the workspace's calls
|
|
353
|
+
* — naming no function, its program being the caller's — and polled to its
|
|
354
|
+
* end.
|
|
355
|
+
*
|
|
356
|
+
* @remarks
|
|
357
|
+
* Held to the caller's grant as {@link oneShotExecute} is. A call is held to
|
|
358
|
+
* its own timeout, never to a request's, so it may run for as long as its
|
|
359
|
+
* limits allow — its timeout is the server's ceiling unless the request asks
|
|
360
|
+
* for less — and is started, polled and stopped as {@link workspaceFunctionCall}
|
|
361
|
+
* says: its start waits up to the server's window, a call still running is
|
|
362
|
+
* polled, and an abort asks the server to stop it, by the id the client named
|
|
363
|
+
* it with. The server keeps it, as it keeps a function's call — who made it,
|
|
364
|
+
* its arguments, the versions of the datasets it read, its value and its logs
|
|
365
|
+
* — which {@link workspaceCallList} and {@link workspaceCallGet} read. A
|
|
366
|
+
* server that keeps no one-shot calls, one that predates them, has no route
|
|
367
|
+
* to start one, and the call is made through {@link oneShotExecute} instead.
|
|
368
|
+
*
|
|
369
|
+
* @param url - Base URL of the e3 API server
|
|
370
|
+
* @param repo - Repository name
|
|
371
|
+
* @param ws - The workspace whose datasets the call reads
|
|
372
|
+
* @param req - The body IR, its arguments (values or dataset paths), its
|
|
373
|
+
* runner and its limits
|
|
374
|
+
* @param options - Request options including auth token
|
|
375
|
+
* @param call - The signal that stops the call, and who is told its id once
|
|
376
|
+
* it runs on past its start
|
|
377
|
+
* @returns The call's terminal result
|
|
378
|
+
* @throws {ApiError} As {@link oneShotExecute} does, and `internal` for a call
|
|
379
|
+
* someone cancelled, or the server lost, which has no result
|
|
380
|
+
* @throws {AuthError} On 401 Unauthorized
|
|
381
|
+
* @throws The abort's reason, once `call.signal` aborts
|
|
382
|
+
*/
|
|
383
|
+
export declare function oneShotCall(url: string, repo: string, ws: string, req: OneShotRequest, options: RequestOptions, call?: WorkspaceFunctionCallOptions): Promise<ExecuteResult>;
|
|
384
|
+
/**
|
|
385
|
+
* Start a one-shot as a call: the server files it, runs it where its calls
|
|
386
|
+
* run, and waits a while for it to end.
|
|
387
|
+
*
|
|
388
|
+
* @remarks
|
|
389
|
+
* Answered as {@link workspaceFunctionStart} answers a function's start: the
|
|
390
|
+
* call's id and how it stood when the wait ended, `completed` with its result
|
|
391
|
+
* for a call that ended within it — one found wrong among them, `invalid` — or
|
|
392
|
+
* `running`, which {@link workspaceFunctionCallStatus} polls and
|
|
393
|
+
* {@link workspaceFunctionCallCancel} stops. A start is never sent twice, so a
|
|
394
|
+
* call is never filed twice.
|
|
395
|
+
*
|
|
396
|
+
* @param url - Base URL of the e3 API server
|
|
397
|
+
* @param repo - Repository name
|
|
398
|
+
* @param ws - The workspace whose datasets the call reads
|
|
399
|
+
* @param req - The body IR, its arguments, its runner and its limits
|
|
400
|
+
* @param options - Request options including auth token
|
|
401
|
+
* @param start - How long the start waits for the call to end, and the id to
|
|
402
|
+
* file it under
|
|
403
|
+
* @returns The call's id and status
|
|
404
|
+
* @throws {ApiError} As {@link oneShotExecute} does; `not_found` from a server
|
|
405
|
+
* that keeps no one-shot calls
|
|
406
|
+
* @throws {AuthError} On 401 Unauthorized
|
|
407
|
+
*/
|
|
408
|
+
export declare function oneShotStart(url: string, repo: string, ws: string, req: OneShotRequest, options: RequestOptions, start?: FunctionCallStartOptions): Promise<FunctionCallAnswer>;
|
|
128
409
|
/**
|
|
129
410
|
* Launch a split call: a program run over a dataset's pieces as a job, which
|
|
130
411
|
* {@link splitCallStatus} polls.
|
|
@@ -136,6 +417,16 @@ export declare function oneShotExecute(url: string, repo: string, ws: string, re
|
|
|
136
417
|
* grant any other. A request found wrong is answered by the poll, as an
|
|
137
418
|
* `invalid` result.
|
|
138
419
|
*
|
|
420
|
+
* The output kinds are a task's — `array`, `set`, `dict`, `fold` — and
|
|
421
|
+
* `first`, an array's first `limit` elements in input order, whose pieces run
|
|
422
|
+
* in order and stop once they hold them (#1110). The final function, `then`,
|
|
423
|
+
* runs once over the assembled output and then the arguments not partitioned,
|
|
424
|
+
* in their order: the partitioned ones are the pieces' to read, and are never
|
|
425
|
+
* staged for it. One that takes any other count
|
|
426
|
+
* is `invalid`, naming its count and the call's. A client of this release and
|
|
427
|
+
* a server of an earlier one disagree on what `then` is given: keep them in
|
|
428
|
+
* step.
|
|
429
|
+
*
|
|
139
430
|
* @param url - Base URL of the e3 API server
|
|
140
431
|
* @param repo - Repository name
|
|
141
432
|
* @param ws - The workspace whose datasets the call reads
|
|
@@ -151,8 +442,8 @@ export declare function splitCallLaunch(url: string, repo: string, ws: string, r
|
|
|
151
442
|
id: string;
|
|
152
443
|
}>;
|
|
153
444
|
/**
|
|
154
|
-
* A split call's status: how far its job has got, its result,
|
|
155
|
-
*
|
|
445
|
+
* A split call's status: how far its job has got, its result, why the server
|
|
446
|
+
* could not run it, or that it was cancelled.
|
|
156
447
|
*
|
|
157
448
|
* @param url - Base URL of the e3 API server
|
|
158
449
|
* @param repo - Repository name
|
|
@@ -167,6 +458,23 @@ export declare function splitCallLaunch(url: string, repo: string, ws: string, r
|
|
|
167
458
|
* @throws {AuthError} On 401 Unauthorized
|
|
168
459
|
*/
|
|
169
460
|
export declare function splitCallStatus(url: string, repo: string, ws: string, id: string, options: RequestOptions): Promise<SplitCallStatus>;
|
|
461
|
+
/**
|
|
462
|
+
* Cancel a split call: a job still running ends `cancelled`, and the server
|
|
463
|
+
* stops its units; one that has ended is left as it is. The units that
|
|
464
|
+
* finished stay cached, so a relaunch is served them.
|
|
465
|
+
*
|
|
466
|
+
* @param url - Base URL of the e3 API server
|
|
467
|
+
* @param repo - Repository name
|
|
468
|
+
* @param ws - The workspace the call was launched in
|
|
469
|
+
* @param id - The job's id
|
|
470
|
+
* @param options - Request options including auth token
|
|
471
|
+
* @returns The job's status after the cancel, as a poll answers it:
|
|
472
|
+
* `cancelled`, or the status it had already ended with
|
|
473
|
+
* @throws {ApiError} As {@link splitCallStatus} does: whoever may poll a job
|
|
474
|
+
* may cancel it
|
|
475
|
+
* @throws {AuthError} On 401 Unauthorized
|
|
476
|
+
*/
|
|
477
|
+
export declare function splitCallCancel(url: string, repo: string, ws: string, id: string, options: RequestOptions): Promise<SplitCallStatus>;
|
|
170
478
|
/**
|
|
171
479
|
* What a split call's pieces would be: launched as an explain, a job the
|
|
172
480
|
* server plans them in, as the call's run would, running no unit, and polled
|
|
@@ -177,28 +485,35 @@ export declare function splitCallStatus(url: string, repo: string, ws: string, i
|
|
|
177
485
|
* @param ws - The workspace whose datasets the call reads
|
|
178
486
|
* @param req - The call
|
|
179
487
|
* @param options - Request options including auth token
|
|
180
|
-
* @param callOptions - The signal that
|
|
488
|
+
* @param callOptions - The signal that gives the explain up, and cancels its
|
|
489
|
+
* job
|
|
181
490
|
* @returns The piece count, the argument they are cut over, and what it weighs
|
|
182
491
|
* @throws {ApiError} `permission_denied` as for {@link splitCallLaunch}
|
|
183
492
|
* @throws {AuthError} On 401 Unauthorized
|
|
184
493
|
* @throws {Error} When the call is found wrong, naming what is wrong, or the
|
|
185
494
|
* server could not plan it
|
|
495
|
+
* @throws The signal's reason once it aborts
|
|
186
496
|
*/
|
|
187
497
|
export declare function splitCallExplain(url: string, repo: string, ws: string, req: SplitCallRequest, options: RequestOptions, callOptions?: SplitCallOptions): Promise<SplitCallPlan>;
|
|
188
498
|
/** Options for {@link splitCall}. */
|
|
189
499
|
export interface SplitCallOptions {
|
|
190
500
|
/** Called with the job's progress each time a poll finds it running. */
|
|
191
501
|
onProgress?: (progress: SplitCallProgress) => void;
|
|
192
|
-
/**
|
|
193
|
-
*
|
|
502
|
+
/** Gives the call up: polling stops, and the job is cancelled
|
|
503
|
+
* ({@link splitCallCancel}), so the server stops its units. Its next
|
|
504
|
+
* launch is served the units that finished from the server's execution
|
|
505
|
+
* cache. */
|
|
194
506
|
signal?: AbortSignal;
|
|
195
507
|
}
|
|
196
|
-
/** A split call's answer: its result
|
|
197
|
-
*
|
|
198
|
-
*
|
|
508
|
+
/** A split call's answer: its result; the assembled output's hash once the
|
|
509
|
+
* pieces ran — what the caller reads by the object route when the result is
|
|
510
|
+
* `too_large`, or passes on as the next call's `object` argument; and how it
|
|
511
|
+
* ran — its pieces, the units it ran and was served from the cache, and its
|
|
512
|
+
* peak — when the server reports it. */
|
|
199
513
|
export interface SplitCallAnswer {
|
|
200
514
|
result: ExecuteResult;
|
|
201
515
|
output: string | null;
|
|
516
|
+
report: SplitCallReport | null;
|
|
202
517
|
}
|
|
203
518
|
/**
|
|
204
519
|
* Run a split call: launch it and poll it to its end, 100 ms apart at first,
|
|
@@ -209,11 +524,13 @@ export interface SplitCallAnswer {
|
|
|
209
524
|
* @param ws - The workspace whose datasets the call reads
|
|
210
525
|
* @param req - The call
|
|
211
526
|
* @param options - Request options including auth token
|
|
212
|
-
* @param callOptions - Its progress, and the signal that
|
|
213
|
-
*
|
|
527
|
+
* @param callOptions - Its progress, and the signal that gives it up and
|
|
528
|
+
* cancels its job
|
|
529
|
+
* @returns The call's result, the assembled output's hash, and how it ran
|
|
214
530
|
* @throws {ApiError} As {@link splitCallLaunch} does
|
|
215
531
|
* @throws {AuthError} On 401 Unauthorized
|
|
216
|
-
* @throws {Error} When the server could not run the call
|
|
532
|
+
* @throws {Error} When the server could not run the call, or it was cancelled
|
|
533
|
+
* @throws The signal's reason once it aborts
|
|
217
534
|
*/
|
|
218
535
|
export declare function splitCall(url: string, repo: string, ws: string, req: SplitCallRequest, options: RequestOptions, callOptions?: SplitCallOptions): Promise<SplitCallAnswer>;
|
|
219
536
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,E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