Skip to content

Commit ff52e97

Browse files
committed
added docs
Signed-off-by: Neil South <[email protected]>
1 parent 7853eb7 commit ff52e97

File tree

3 files changed

+195
-12
lines changed

3 files changed

+195
-12
lines changed
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
<!--
2+
~ Copyright 2022 MONAI Consortium
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
# Task Manager - Argo Template API
18+
19+
The template endpoint provides the following APIs to post a new template to Argo plugin of
20+
the Task Manager.
21+
22+
23+
## POST /argo/template
24+
25+
Posts a new template to Argo and returns the resultant template.
26+
27+
### Parameters
28+
29+
body, json string of the wrapped template
30+
31+
### Responses
32+
33+
Response Content Type: JSON
34+
35+
- the actual Argo resultant template.
36+
37+
| Code | Description |
38+
| ---- | ------------------------------- |
39+
| 200 | template posted sucsessfully. |
40+
| 400 | bad json or template post error |
41+
| 500 | Internal service error. |
42+
43+
### Example Request
44+
45+
file saved locally as workflowtemplate.json
46+
```json
47+
{
48+
"Namespace": "argo",
49+
"serverDryRun": false,
50+
"submitOptions": {
51+
"parameters": [
52+
"name=value"
53+
]
54+
},
55+
"template": {
56+
"metadata": {
57+
"name": "fantastic-tiger",
58+
"namespace": "argo",
59+
"labels": {
60+
"example": "true"
61+
}
62+
},
63+
"spec": {
64+
"workflowMetadata": {
65+
"labels": {
66+
"example": "true"
67+
}
68+
},
69+
"entrypoint": "argosay",
70+
"arguments": {
71+
"parameters": [
72+
{
73+
"name": "message",
74+
"value": "hello argo"
75+
}
76+
]
77+
},
78+
"templates": [
79+
{
80+
"name": "argosay",
81+
"inputs": {
82+
"parameters": [
83+
{
84+
"name": "message",
85+
"value": "{{workflow.parameters.message}}"
86+
}
87+
]
88+
},
89+
"container": {
90+
"name": "main",
91+
"image": "argoproj/argosay:v2",
92+
"command": [
93+
"/argosay"
94+
],
95+
"args": [
96+
"echo",
97+
"{{inputs.parameters.message}}"
98+
]
99+
}
100+
}
101+
],
102+
"ttlStrategy": {
103+
"secondsAfterCompletion": 300
104+
},
105+
"podGC": {
106+
"strategy": "OnPodCompletion"
107+
}
108+
}
109+
}
110+
}
111+
```
112+
113+
```bash
114+
curl -d @workflowtemplate.json 'http://localhost:5000/argo/template'
115+
```
116+
117+
### Example Response
118+
119+
```json
120+
{
121+
"metadata": {
122+
"creationTimestamp": "2023-03-23T17:28:34+00:00",
123+
"generation": 1,
124+
"labels": {
125+
"example": "true",
126+
"workflows.argoproj.io/creator": "system-serviceaccount-argo-argo-argo-workflows-server"
127+
},
128+
"managedFields": [
129+
{
130+
"apiVersion": "argoproj.io/v1alpha1",
131+
"fieldsType": "FieldsV1",
132+
"fieldsV1": {},
133+
"manager": "argo",
134+
"operation": "Update",
135+
"time": "2023-03-23T17:28:34+00:00"
136+
}
137+
],
138+
"name": "fantastic-tiger",
139+
"namespace": "argo",
140+
"resourceVersion": "12030505",
141+
"uid": "e7609791-2d30-4dae-a47e-f1796846068d"
142+
},
143+
"spec": {
144+
"arguments": {
145+
"parameters": [
146+
{
147+
"name": "message",
148+
"value": "hello argo"
149+
}
150+
]
151+
},
152+
"entrypoint": "argosay",
153+
"podGC": {
154+
"strategy": "OnPodCompletion"
155+
},
156+
"templates": [
157+
{
158+
"container": {
159+
"args": [
160+
"echo",
161+
"{{inputs.parameters.message}}"
162+
],
163+
"command": [
164+
"/argosay"
165+
],
166+
"image": "argoproj/argosay:v2",
167+
"name": "main",
168+
"resources": {}
169+
},
170+
"inputs": {
171+
"parameters": [
172+
{
173+
"name": "message",
174+
"value": "{{workflow.parameters.message}}"
175+
}
176+
]
177+
},
178+
"metadata": {},
179+
"name": "argosay",
180+
"outputs": {}
181+
}
182+
],
183+
"ttlStrategy": {
184+
"secondsAfterCompletion": 300
185+
},
186+
"workflowMetadata": {
187+
"labels": {
188+
"example": "true"
189+
}
190+
}
191+
}
192+
}
193+
```

docs/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ Enhanced the ArgoClient -> Argo_Get_WorkflowLogsAsync method to decode the json
2424
Added Mongo Migraions, to allow changes without breaking current stored entries
2525

2626
Added resource constraints to the generated ARGO templates, so these can operate within a Kubernetes cluster with a Resource Quota in the ARGO namespace.
27+
28+
Added ability for plugins (currently Argo) to have controllers, any dll marked with the new Monai.Deploy.WorkflowManager.Shared.PlugInAttribute will have any controllers added to TaskManager

src/TaskManager/Plug-ins/Argo/Controllers/TemplateController.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,14 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
using System.Runtime.InteropServices;
1716
using System.Text;
18-
using Amazon.Runtime.Internal.Util;
1917
using Argo;
2018
using Microsoft.AspNetCore.Authorization;
2119
using Microsoft.AspNetCore.Mvc;
22-
using Microsoft.AspNetCore.Mvc.Formatters;
2320
using Microsoft.Extensions.DependencyInjection;
2421
using Microsoft.Extensions.Logging;
2522
using Microsoft.Extensions.Options;
2623
using Monai.Deploy.WorkflowManager.Configuration;
27-
using MongoDB.Bson.IO;
28-
29-
3024

3125
namespace Monai.Deploy.WorkflowManager.TaskManager.Argo.Controllers
3226
{
@@ -50,12 +44,6 @@ public TemplateController(
5044

5145
}
5246

53-
[HttpGet]
54-
public ActionResult<IEnumerable<int>> Values()
55-
{
56-
return StatusCode(200, new List<int> { 12, 155, 12, 9 });
57-
}
58-
5947
[HttpPost]
6048
public async Task<ActionResult<WorkflowTemplate>> CreateArgoTemplate()
6149
{

0 commit comments

Comments
 (0)