Skip to content

Commit e39f43e

Browse files
author
Alex Buchanan
committed
Add get/list/cancel docs
1 parent 6fddc7f commit e39f43e

File tree

1 file changed

+95
-8
lines changed

1 file changed

+95
-8
lines changed

README.md

Lines changed: 95 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ and some other logging and metadata.
99
The schema and APIs is defined [here](./task_execution.proto) in [protocol buffers](https://developers.google.com/protocol-buffers/). Clients may use JSON and REST to communicate
1010
with a service implementing the TES API.
1111

12-
Here's an example task message, defining a task which calculates
13-
an MD5 checksum on an input file and uploads output:
12+
13+
Create a task
14+
---------------------------------
15+
16+
Here's an example of a complete task message, defining a task which calculates
17+
an MD5 checksum on an input file and uploads the output:
1418
```JSON
1519
{
1620
"name": "MD5 example",
@@ -52,12 +56,95 @@ an MD5 checksum on an input file and uploads output:
5256
}
5357
```
5458

55-
This message would be submitted via HTTP Post to `/v1/tasks`.
56-
The return value is a task ID:
59+
A minimal version of the same task, including only the required fields looks like:
5760
```JSON
58-
{ "id": "6E57CA6B-0BC7-44FB-BA2C-0CBFEC629C63" }
61+
{
62+
"inputs": [
63+
{
64+
"url": "/path/to/input_file",
65+
"path": "/container/input",
66+
}
67+
],
68+
"outputs" : [
69+
{
70+
"url" : "/path/to/output_file",
71+
"path" : "/container/output",
72+
}
73+
],
74+
"executors" : [
75+
{
76+
"image_name" : "ubuntu",
77+
"cmd" : ["md5sum", "/container/input"],
78+
"stdout" : "/container/output",
79+
}
80+
]
81+
}
82+
```
83+
84+
To create the task, send an HTTP POST request:
85+
```HTTP
86+
POST /v1/tasks
87+
88+
{ "id": "task-1234" }
5989
```
6090

61-
Then, the task and logs may be retrieve with a HTTP GET.
62-
`GET /v1/tasks/6E57CA6B-0BC7-44FB-BA2C-0CBFEC629C63
63-
`
91+
The return value is a task ID.
92+
93+
94+
Get a task
95+
--------------------------------
96+
97+
To get a task by ID:
98+
99+
```HTTP
100+
GET /v1/tasks/task-1234
101+
102+
{ "id": "task-1234", "state": "RUNNING" }
103+
```
104+
105+
The return value will be a minimal description of the task state.
106+
107+
To get more information, you can change the task view using the `view` URL query parameter.
108+
109+
The `basic` view will include all task fields except a few which might be
110+
large strings (stdout/err logging, input parameter contents).
111+
112+
```HTTP
113+
GET /v1/tasks/task-1234?view=BASIC
114+
115+
{ "id": "task-1234", "state": "RUNNING", "name": "MD5 example", etc... }
116+
```
117+
118+
The `full` view includes stdout/err logs and full input parameters:
119+
120+
```HTTP
121+
GET /v1/tasks/task-1234?view=FULL
122+
123+
{ "id": "task-1234", "state": "RUNNING", "name": "MD5 example",
124+
"logs": [{ "stdout": "stdout content..." }], etc... }
125+
```
126+
127+
List tasks
128+
------------------------------------
129+
130+
To list tasks:
131+
132+
```HTTP
133+
GET /v1/tasks
134+
135+
{ "tasks": [{ "id": "task-1234", "state": "RUNNING"}, etc...] }
136+
```
137+
138+
Similar to getting a task by ID, you may change the task view:
139+
```HTTP
140+
GET /v1/tasks?view=BASIC
141+
```
142+
143+
144+
Cancel a task
145+
-------------------------------------
146+
147+
To cancel a task, send an HTTP POST to the cancel endpoint:
148+
```HTTP
149+
POST /v1/tasks/task-1234:cancel
150+
```

0 commit comments

Comments
 (0)