-
Notifications
You must be signed in to change notification settings - Fork 29
/
task_execution.swagger.json
596 lines (596 loc) · 21.1 KB
/
task_execution.swagger.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
{
"swagger": "2.0",
"info": {
"title": "Task Execution Service",
"version": "0.3.0"
},
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/v1/tasks": {
"get": {
"summary": "List tasks.\nTaskView is requested as such: \"v1/tasks?view=BASIC\"",
"operationId": "ListTasks",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/tesListTasksResponse"
}
}
},
"parameters": [
{
"name": "name_prefix",
"description": "OPTIONAL. Filter the list to include tasks where the name matches this prefix.\nIf unspecified, no task name filtering is done.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "page_size",
"description": "OPTIONAL. Number of tasks to return in one page.\nMust be less than 2048. Defaults to 256.",
"in": "query",
"required": false,
"type": "integer",
"format": "int64"
},
{
"name": "page_token",
"description": "OPTIONAL. Page token is used to retrieve the next page of results.\nIf unspecified, returns the first page of results.\nSee ListTasksResponse.next_page_token",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "view",
"description": "OPTIONAL. Affects the fields included in the returned Task messages.\nSee TaskView below.\n\n - MINIMAL: Task message will include ONLY the fields:\n Task.Id\n Task.State\n - BASIC: Task message will include all fields EXCEPT:\n Task.ExecutorLog.stdout\n Task.ExecutorLog.stderr\n Input.content\n TaskLog.system_logs\n - FULL: Task message includes all fields.",
"in": "query",
"required": false,
"type": "string",
"enum": [
"MINIMAL",
"BASIC",
"FULL"
],
"default": "MINIMAL"
}
],
"tags": [
"TaskService"
]
},
"post": {
"summary": "Create a new task.",
"operationId": "CreateTask",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/tesCreateTaskResponse"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/tesTask"
}
}
],
"tags": [
"TaskService"
]
}
},
"/v1/tasks/service-info": {
"get": {
"summary": "GetServiceInfo provides information about the service,\nsuch as storage details, resource availability, and \nother documentation.",
"operationId": "GetServiceInfo",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/tesServiceInfo"
}
}
},
"tags": [
"TaskService"
]
}
},
"/v1/tasks/{id}": {
"get": {
"summary": "Get a task.\nTaskView is requested as such: \"v1/tasks/{id}?view=FULL\"",
"operationId": "GetTask",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/tesTask"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "view",
"description": "OPTIONAL. Affects the fields included in the returned Task messages.\nSee TaskView below.\n\n - MINIMAL: Task message will include ONLY the fields:\n Task.Id\n Task.State\n - BASIC: Task message will include all fields EXCEPT:\n Task.ExecutorLog.stdout\n Task.ExecutorLog.stderr\n Input.content\n TaskLog.system_logs\n - FULL: Task message includes all fields.",
"in": "query",
"required": false,
"type": "string",
"enum": [
"MINIMAL",
"BASIC",
"FULL"
],
"default": "MINIMAL"
}
],
"tags": [
"TaskService"
]
}
},
"/v1/tasks/{id}:cancel": {
"post": {
"summary": "Cancel a task.",
"operationId": "CancelTask",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/tesCancelTaskResponse"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
}
],
"tags": [
"TaskService"
]
}
}
},
"definitions": {
"tesCancelTaskResponse": {
"type": "object",
"description": "CancelTaskResponse describes a response from the CancelTask endpoint.",
"title": "OUTPUT ONLY"
},
"tesCreateTaskResponse": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Task identifier assigned by the server.",
"title": "REQUIRED"
}
},
"description": "CreateTaskResponse describes a response from the CreateTask endpoint.",
"title": "OUTPUT ONLY"
},
"tesExecutor": {
"type": "object",
"properties": {
"image": {
"type": "string",
"description": "Name of the container image, for example:\nubuntu\nquay.io/aptible/ubuntu\ngcr.io/my-org/my-image\netc...",
"title": "REQUIRED"
},
"command": {
"type": "array",
"items": {
"type": "string"
},
"description": "A sequence of program arguments to execute, where the first argument\nis the program to execute (i.e. argv).",
"title": "REQUIRED"
},
"workdir": {
"type": "string",
"description": "The working directory that the command will be executed in.\nDefaults to the directory set by the container image.",
"title": "OPTIONAL"
},
"stdin": {
"type": "string",
"description": "Path inside the container to a file which will be piped\nto the executor's stdin. Must be an absolute path.",
"title": "OPTIONAL"
},
"stdout": {
"type": "string",
"description": "Path inside the container to a file where the executor's\nstdout will be written to. Must be an absolute path.",
"title": "OPTIONAL"
},
"stderr": {
"type": "string",
"description": "Path inside the container to a file where the executor's\nstderr will be written to. Must be an absolute path.",
"title": "OPTIONAL"
},
"env": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Enviromental variables to set within the container.",
"title": "OPTIONAL"
}
},
"description": "Executor describes a command to be executed, and its environment."
},
"tesExecutorLog": {
"type": "object",
"properties": {
"start_time": {
"type": "string",
"description": "Time the executor started, in RFC 3339 format.",
"title": "OPTIONAL"
},
"end_time": {
"type": "string",
"description": "Time the executor ended, in RFC 3339 format.",
"title": "OPTIONAL"
},
"stdout": {
"type": "string",
"description": "Stdout content.\n\nThis is meant for convenience. No guarantees are made about the content.\nImplementations may chose different approaches: only the head, only the tail,\na URL reference only, etc.\n\nIn order to capture the full stdout users should set Executor.stdout\nto a container file path, and use Task.outputs to upload that file\nto permanent storage.",
"title": "OPTIONAL"
},
"stderr": {
"type": "string",
"description": "Stderr content.\n\nThis is meant for convenience. No guarantees are made about the content.\nImplementations may chose different approaches: only the head, only the tail,\na URL reference only, etc.\n\nIn order to capture the full stderr users should set Executor.stderr\nto a container file path, and use Task.outputs to upload that file\nto permanent storage.",
"title": "OPTIONAL"
},
"exit_code": {
"type": "integer",
"format": "int32",
"description": "Exit code.",
"title": "REQUIRED"
}
},
"description": "ExecutorLog describes logging information related to an Executor.",
"title": "OUTPUT ONLY"
},
"tesFileType": {
"type": "string",
"enum": [
"FILE",
"DIRECTORY"
],
"default": "FILE"
},
"tesInput": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "OPTIONAL"
},
"description": {
"type": "string",
"title": "OPTIONAL"
},
"url": {
"type": "string",
"description": "REQUIRED, unless \"content\" is set.\n\nURL in long term storage, for example:\ns3://my-object-store/file1\ngs://my-bucket/file2\nfile:///path/to/my/file\n/path/to/my/file\netc..."
},
"path": {
"type": "string",
"description": "Path of the file inside the container.\nMust be an absolute path.",
"title": "REQUIRED"
},
"type": {
"$ref": "#/definitions/tesFileType",
"description": "Type of the file, FILE or DIRECTORY",
"title": "REQUIRED"
},
"content": {
"type": "string",
"description": "File content literal. \nImplementations should support a minimum of 128 KiB in this field and may define its own maximum.\nUTF-8 encoded\n\nIf content is not empty, \"url\" must be ignored.",
"title": "OPTIONAL"
}
},
"description": "Input describes Task input files."
},
"tesListTasksResponse": {
"type": "object",
"properties": {
"tasks": {
"type": "array",
"items": {
"$ref": "#/definitions/tesTask"
},
"description": "List of tasks.",
"title": "REQUIRED"
},
"next_page_token": {
"type": "string",
"description": "Token used to return the next page of results.\nSee TaskListRequest.next_page_token",
"title": "OPTIONAL"
}
},
"description": "ListTasksResponse describes a response from the ListTasks endpoint.",
"title": "OUTPUT ONLY"
},
"tesOutput": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "OPTIONAL"
},
"description": {
"type": "string",
"title": "OPTIONAL"
},
"url": {
"type": "string",
"description": "URL in long term storage, for example:\ns3://my-object-store/file1\ngs://my-bucket/file2\nfile:///path/to/my/file\n/path/to/my/file\netc...",
"title": "REQUIRED"
},
"path": {
"type": "string",
"description": "Path of the file inside the container.\nMust be an absolute path.",
"title": "REQUIRED"
},
"type": {
"$ref": "#/definitions/tesFileType",
"description": "Type of the file, FILE or DIRECTORY",
"title": "REQUIRED"
}
},
"description": "Output describes Task output files."
},
"tesOutputFileLog": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "URL of the file in storage, e.g. s3://bucket/file.txt",
"title": "REQUIRED"
},
"path": {
"type": "string",
"description": "Path of the file inside the container. Must be an absolute path.",
"title": "REQUIRED"
},
"size_bytes": {
"type": "string",
"format": "int64",
"description": "Size of the file in bytes.",
"title": "REQUIRED"
}
},
"description": "OutputFileLog describes a single output file. This describes\nfile details after the task has completed successfully,\nfor logging purposes.",
"title": "OUTPUT ONLY"
},
"tesResources": {
"type": "object",
"properties": {
"cpu_cores": {
"type": "integer",
"format": "int64",
"description": "Requested number of CPUs",
"title": "OPTIONAL"
},
"preemptible": {
"type": "boolean",
"format": "boolean",
"description": "Is the task allowed to run on preemptible compute instances (e.g. AWS Spot)?",
"title": "OPTIONAL"
},
"ram_gb": {
"type": "number",
"format": "double",
"description": "Requested RAM required in gigabytes (GB)",
"title": "OPTIONAL"
},
"disk_gb": {
"type": "number",
"format": "double",
"description": "Requested disk size in gigabytes (GB)",
"title": "OPTIONAL"
},
"zones": {
"type": "array",
"items": {
"type": "string"
},
"description": "Request that the task be run in these compute zones.",
"title": "OPTIONAL"
}
},
"description": "Resources describes the resources requested by a task."
},
"tesServiceInfo": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Returns the name of the service, e.g. \"ohsu-compbio-funnel\"."
},
"doc": {
"type": "string",
"description": "Returns a documentation string, e.g. \"Hey, we're OHSU Comp. Bio!\"."
},
"storage": {
"type": "array",
"items": {
"type": "string"
},
"description": "Lists some, but not necessarily all, storage locations supported by the service.\n\nMust be in a valid URL format.\ne.g. \nfile:///path/to/local/funnel-storage\ns3://ohsu-compbio-funnel/storage\netc."
}
},
"description": "ServiceInfo describes information about the service,\nsuch as storage details, resource availability,\nand other documentation.",
"title": "OUTPUT ONLY"
},
"tesState": {
"type": "string",
"enum": [
"UNKNOWN",
"QUEUED",
"INITIALIZING",
"RUNNING",
"PAUSED",
"COMPLETE",
"EXECUTOR_ERROR",
"SYSTEM_ERROR",
"CANCELED"
],
"default": "UNKNOWN",
"description": "Task states.\n\n - UNKNOWN: The state of the task is unknown.\n\nThis provides a safe default for messages where this field is missing,\nfor example, so that a missing field does not accidentally imply that\nthe state is QUEUED.\n - QUEUED: The task is queued.\n - INITIALIZING: The task has been assigned to a worker and is currently preparing to run.\nFor example, the worker may be turning on, downloading input files, etc.\n - RUNNING: The task is running. Input files are downloaded and the first Executor\nhas been started.\n - PAUSED: The task is paused.\n\nAn implementation may have the ability to pause a task, but this is not required.\n - COMPLETE: The task has completed running. Executors have exited without error\nand output files have been successfully uploaded.\n - EXECUTOR_ERROR: The task encountered an error in one of the Executor processes. Generally,\nthis means that an Executor exited with a non-zero exit code.\n - SYSTEM_ERROR: The task was stopped due to a system error, but not from an Executor,\nfor example an upload failed due to network issues, the worker's ran out\nof disk space, etc.\n - CANCELED: The task was canceled by the user.",
"title": "OUTPUT ONLY"
},
"tesTask": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Task identifier assigned by the server.",
"title": "OUTPUT ONLY"
},
"state": {
"$ref": "#/definitions/tesState",
"title": "OUTPUT ONLY"
},
"name": {
"type": "string",
"title": "OPTIONAL"
},
"description": {
"type": "string",
"title": "OPTIONAL"
},
"inputs": {
"type": "array",
"items": {
"$ref": "#/definitions/tesInput"
},
"description": "Input files.\nInputs will be downloaded and mounted into the executor container.",
"title": "OPTIONAL"
},
"outputs": {
"type": "array",
"items": {
"$ref": "#/definitions/tesOutput"
},
"description": "Output files.\nOutputs will be uploaded from the executor container to long-term storage.",
"title": "OPTIONAL"
},
"resources": {
"$ref": "#/definitions/tesResources",
"description": "Request that the task be run with these resources.",
"title": "OPTIONAL"
},
"executors": {
"type": "array",
"items": {
"$ref": "#/definitions/tesExecutor"
},
"description": "A list of executors to be run, sequentially. Execution stops\non the first error.",
"title": "REQUIRED"
},
"volumes": {
"type": "array",
"items": {
"type": "string"
},
"description": "Volumes are directories which may be used to share data between\nExecutors. Volumes are initialized as empty directories by the\nsystem when the task starts and are mounted at the same path\nin each Executor.\n\nFor example, given a volume defined at \"/vol/A\",\nexecutor 1 may write a file to \"/vol/A/exec1.out.txt\", then\nexecutor 2 may read from that file.\n\n(Essentially, this translates to a `docker run -v` flag where\nthe container path is the same for each executor).",
"title": "OPTIONAL"
},
"tags": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "A key-value map of arbitrary tags.",
"title": "OPTIONAL"
},
"logs": {
"type": "array",
"items": {
"$ref": "#/definitions/tesTaskLog"
},
"description": "Task logging information.\nNormally, this will contain only one entry, but in the case where\na task fails and is retried, an entry will be appended to this list.",
"title": "OUTPUT ONLY"
},
"creation_time": {
"type": "string",
"description": "Date + time the task was created, in RFC 3339 format.\nThis is set by the system, not the client.",
"title": "OUTPUT ONLY, REQUIRED"
}
},
"description": "Task describes an instance of a task."
},
"tesTaskLog": {
"type": "object",
"properties": {
"logs": {
"type": "array",
"items": {
"$ref": "#/definitions/tesExecutorLog"
},
"description": "Logs for each executor",
"title": "REQUIRED"
},
"metadata": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Arbitrary logging metadata included by the implementation.",
"title": "OPTIONAL"
},
"start_time": {
"type": "string",
"description": "When the task started, in RFC 3339 format.",
"title": "OPTIONAL"
},
"end_time": {
"type": "string",
"description": "When the task ended, in RFC 3339 format.",
"title": "OPTIONAL"
},
"outputs": {
"type": "array",
"items": {
"$ref": "#/definitions/tesOutputFileLog"
},
"description": "Information about all output files. Directory outputs are\nflattened into separate items.",
"title": "REQUIRED"
},
"system_logs": {
"type": "array",
"items": {
"type": "string"
},
"description": "System logs are any logs the system decides are relevant,\nwhich are not tied directly to an Executor process.\nContent is implementation specific: format, size, etc.\n\nSystem logs may be collected here to provide convenient access.\n\nFor example, the system may include the name of the host\nwhere the task is executing, an error message that caused\na SYSTEM_ERROR state (e.g. disk is full), etc.\n\nSystem logs are only included in the FULL task view.",
"title": "OPTIONAL"
}
},
"description": "TaskLog describes logging information related to a Task.",
"title": "OUTPUT ONLY"
}
}
}