Skip to content

Commit 8bd3d10

Browse files
committed
feat: update readme
1 parent fbd3a4d commit 8bd3d10

File tree

2 files changed

+98
-48
lines changed

2 files changed

+98
-48
lines changed

apps/execution-service/README.md

Lines changed: 73 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ The following json format will be returned:
7474

7575
```json
7676
[
77-
{
78-
"input":"hello",
79-
"expected":"olleh"
80-
}
77+
{
78+
"input": "hello",
79+
"expected": "olleh"
80+
}
8181
]
8282
```
8383

@@ -98,16 +98,16 @@ The following json format will be returned:
9898

9999
```json
100100
{
101-
"visibleTestResults":[
101+
"visibleTestResults": [
102102
{
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": ""
108108
}
109109
],
110-
"customTestResults":null
110+
"customTestResults": null
111111
}
112112
```
113113

@@ -127,29 +127,29 @@ The following json format will be returned:
127127

128128
```json
129129
{
130-
"visibleTestResults":[
130+
"visibleTestResults": [
131131
{
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": ""
137137
}
138138
],
139-
"customTestResults":[
139+
"customTestResults": [
140140
{
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": ""
146146
},
147147
{
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": ""
153153
}
154154
]
155155
}
@@ -178,40 +178,65 @@ The following json format will be returned:
178178

179179
```json
180180
{
181-
"visibleTestResults":[
181+
"visibleTestResults": [
182182
{
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": ""
188188
}
189189
],
190-
"hiddenTestResults":{
191-
"passed":2,
192-
"total":2
190+
"hiddenTestResults": {
191+
"passed": 2,
192+
"total": 2
193193
},
194-
"status":"Accepted"
194+
"status": "Accepted"
195195
}
196196
```
197197

198198
If compilation error exists or any of the tests (visible and hidden) fails, status "Attempted" will be returned:
199199

200200
```json
201201
{
202-
"visibleTestResults":[
202+
"visibleTestResults": [
203203
{
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 []})"
209209
}
210210
],
211-
"hiddenTestResults":{
212-
"passed":0,
213-
"total":2
211+
"hiddenTestResults": {
212+
"passed": 0,
213+
"total": 2
214214
},
215-
"status":"Attempted"
215+
"status": "Attempted"
216216
}
217217
```
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`.

apps/history-service/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,28 @@ The server will be available at http://localhost:8082.
7373
```bash
7474
go run main.go
7575
```
76+
77+
## Setting up message queue with history-service
78+
79+
A message queue is used to pass submission results asynchronously from the execution-service to the history-service.
80+
81+
1. In order to do so, we can run the following command to set up a docker container for rabbitmq:
82+
83+
```bash
84+
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
85+
```
86+
87+
2. Then we can run the history-service:
88+
89+
```bash
90+
go run main.go
91+
```
92+
93+
3. We can run the execution-service by changing our directory and running the same command:
94+
95+
```bash
96+
cd ../execution-service
97+
go run main.go
98+
```
99+
100+
To view more details on the RabbitMQ queue, we can go to `localhost:15672`.

0 commit comments

Comments
 (0)