You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/execution-service/README.md
+73-48Lines changed: 73 additions & 48 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,10 +74,10 @@ The following json format will be returned:
74
74
75
75
```json
76
76
[
77
-
{
78
-
"input":"hello",
79
-
"expected":"olleh"
80
-
}
77
+
{
78
+
"input":"hello",
79
+
"expected":"olleh"
80
+
}
81
81
]
82
82
```
83
83
@@ -98,16 +98,16 @@ The following json format will be returned:
98
98
99
99
```json
100
100
{
101
-
"visibleTestResults":[
101
+
"visibleTestResults":[
102
102
{
103
-
"input":"hello",
104
-
"expected":"olleh",
105
-
"actual":"olleh",
106
-
"passed":true,
107
-
"error":""
103
+
"input":"hello",
104
+
"expected":"olleh",
105
+
"actual":"olleh",
106
+
"passed":true,
107
+
"error":""
108
108
}
109
109
],
110
-
"customTestResults":null
110
+
"customTestResults":null
111
111
}
112
112
```
113
113
@@ -127,29 +127,29 @@ The following json format will be returned:
127
127
128
128
```json
129
129
{
130
-
"visibleTestResults":[
130
+
"visibleTestResults":[
131
131
{
132
-
"input":"hello",
133
-
"expected":"olleh",
134
-
"actual":"olleh",
135
-
"passed":true,
136
-
"error":""
132
+
"input":"hello",
133
+
"expected":"olleh",
134
+
"actual":"olleh",
135
+
"passed":true,
136
+
"error":""
137
137
}
138
138
],
139
-
"customTestResults":[
139
+
"customTestResults":[
140
140
{
141
-
"input":"Hannah",
142
-
"expected":"hannaH",
143
-
"actual":"hannaH",
144
-
"passed":true,
145
-
"error":""
141
+
"input":"Hannah",
142
+
"expected":"hannaH",
143
+
"actual":"hannaH",
144
+
"passed":true,
145
+
"error":""
146
146
},
147
147
{
148
-
"input":"abcdefg",
149
-
"expected":"gfedcba",
150
-
"actual":"gfedcba",
151
-
"passed":true,
152
-
"error":""
148
+
"input":"abcdefg",
149
+
"expected":"gfedcba",
150
+
"actual":"gfedcba",
151
+
"passed":true,
152
+
"error":""
153
153
}
154
154
]
155
155
}
@@ -178,40 +178,65 @@ The following json format will be returned:
178
178
179
179
```json
180
180
{
181
-
"visibleTestResults":[
181
+
"visibleTestResults":[
182
182
{
183
-
"input":"hello",
184
-
"expected":"olleh",
185
-
"actual":"olleh",
186
-
"passed":true,
187
-
"error":""
183
+
"input":"hello",
184
+
"expected":"olleh",
185
+
"actual":"olleh",
186
+
"passed":true,
187
+
"error":""
188
188
}
189
189
],
190
-
"hiddenTestResults":{
191
-
"passed":2,
192
-
"total":2
190
+
"hiddenTestResults":{
191
+
"passed":2,
192
+
"total":2
193
193
},
194
-
"status":"Accepted"
194
+
"status":"Accepted"
195
195
}
196
196
```
197
197
198
198
If compilation error exists or any of the tests (visible and hidden) fails, status "Attempted" will be returned:
199
199
200
200
```json
201
201
{
202
-
"visibleTestResults":[
202
+
"visibleTestResults":[
203
203
{
204
-
"input":"hello",
205
-
"expected":"olleh",
206
-
"actual":"",
207
-
"passed":false,
208
-
"error":"Command execution failed: Traceback (most recent call last):\n File \"/tmp/4149249165.py\", line 2, in \u003cmodule\u003e\n prit(name[::-1])\n ^^^^\nNameError: name 'prit' is not defined. Did you mean: 'print'?\n: %!w(*exec.ExitError=\u0026{0x4000364678 []})"
204
+
"input":"hello",
205
+
"expected":"olleh",
206
+
"actual":"",
207
+
"passed":false,
208
+
"error":"Command execution failed: Traceback (most recent call last):\n File \"/tmp/4149249165.py\", line 2, in \u003cmodule\u003e\n prit(name[::-1])\n ^^^^\nNameError: name 'prit' is not defined. Did you mean: 'print'?\n: %!w(*exec.ExitError=\u0026{0x4000364678 []})"
209
209
}
210
210
],
211
-
"hiddenTestResults":{
212
-
"passed":0,
213
-
"total":2
211
+
"hiddenTestResults":{
212
+
"passed":0,
213
+
"total":2
214
214
},
215
-
"status":"Attempted"
215
+
"status":"Attempted"
216
216
}
217
217
```
218
+
219
+
## Setting up message queue with history-service
220
+
221
+
A message queue is used to pass submission results asynchronously from the execution-service to the history-service.
222
+
223
+
1. In order to do so, we can run the following command to set up a docker container for rabbitmq:
224
+
225
+
```bash
226
+
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
227
+
```
228
+
229
+
2. Then we can run the execution-service:
230
+
231
+
```bash
232
+
go run main.go
233
+
```
234
+
235
+
3. We can run the history-service by changing our directory and running the same command:
236
+
237
+
```bash
238
+
cd ../history-service
239
+
go run main.go
240
+
```
241
+
242
+
To view more details on the RabbitMQ queue, we can go to `localhost:15672`.
0 commit comments