-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solomon/code execute #62
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for implementing the code execution service. Once the comments are addressed you can merge this PR, as we still need to integrate the other changes together.
We probably can work on the message queuing after this week's demo as we don't want to cause potential issues with deployment.
However, there may be an issue when repopulating the questions as it overwrites the questionDocRefId
with random values each time, which affects other services as they depend on this value being the same.
setIsLoadingSubmission(true); | ||
try { | ||
const data = await ExecuteVisibleAndHiddenTestsAndSubmit( | ||
questionDocRefId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may be a potential problem with questionDocRefId
, which is whenever the function in apps/question-service/utils/populate.go
is run, all the questionDocRefId
are reinitialized to random values, which affects the retrieval of records that utilize this field as an index.
We can either ensure that questionDocRefId
remains the same when updating the DB, or use something else to identify a question.
Execution Service
Installation
.env
file from copying the.env.example
, and copy the firebase JSON file into execution-service/ fill in theFIREBASE_CREDENTIAL_PATH
with the path of the firebase credential JSON file.Running the Application
To start the server, run the following command:
The server will be available at http://localhost:8083.
Running the Application via Docker
To run the application via Docker, run the following command:
docker build -t execution-service .
The server will be available at http://localhost:8083.
API Endpoints
POST /tests/populate
GET /tests/{questionDocRefId}/
POST /tests/{questionDocRefId}/execute
POST /tests/{questionDocRefId}/submit
Managing Firebase
To reset and repopulate the database, run the following command:
Repopulate test cases
To repopulate test cases, you need to repopulate the questions in the question-service, which will automatically call the execution-service to populate the test cases.
In question-service, run the following command:
API Documentation
GET /tests/{questionDocRefId}/
To read visible test cases via a question ID, run the following command:
curl -X GET http://localhost:8083/tests/{questioinDocRefId}/ \ -H "Content-Type: application/json"
The following json format will be returned:
POST /tests/{questionDocRefId}/execute
To execute test cases via a question ID without custom test cases, run the following command, with custom code and language:
The following json format will be returned:
To execute visible and custom test cases via a question ID with custom test cases, run the following command, with custom code, language and custom test cases:
The following json format will be returned:
POST /tests/{questionDocRefId}/submit
To submit a solution and execute visible and hidden test cases via a question ID, run the following command, with custom code and language:
The following json format will be returned:
If compilation error exists or any of the tests (visible and hidden) fails, status "Attempted" will be returned:
TODOs