Commit Graph

43 Commits

Author SHA1 Message Date
17c1e379c2 Fix busy waiting on stdin
When running an execution, Nomad continuously reads from the stdin
reader. Because the readers we implemented (codeOceanToRawReader and
nullReader) return zero if there is no input available, this leads to
busy waiting and a high CPU load on Poseidon. By waiting indefinitely in
case of the nullReader and for at least one byte on case of the
codeOceanToRawReader before returning, we prevent this issue.
2021-06-21 08:20:04 +00:00
87f823756b Implement merge request comments 2021-06-15 11:37:47 +02:00
25d78df557 Restore existing jobs and fix rebase (7c99eff3) issues 2021-06-15 11:37:35 +02:00
c7d59810e5 Use Nomad jobs as runners instead of allocations
As we can't control which allocations are destroyed when downscaling a job, we decided
to use Nomad jobs as our runners. Thus for each runner we prewarm for an environment,
a corresponding job is created in Nomad. We create a default job that serves as a template
for the runners. Using this, already existing execution environments can easily be restored,
once Poseidon is restarted.
2021-06-15 11:35:54 +02:00
d3300e839e Add unit tests for separate stdout and stderr on execution 2021-06-11 08:47:25 +00:00
61bc7d0143 Add unit tests for provide runner route 2021-06-10 06:11:31 +00:00
32fe47d669 Implement linting issues and merge request comments 2021-06-09 08:35:20 +00:00
ce2b82d43d Copy files with relative path to active workspace directory of container 2021-06-09 10:24:29 +02:00
b990df7b9d Add route to create or update execution environments 2021-06-03 13:21:49 +00:00
02b3f52a11 Add ability to copy files to and delete files from runner 2021-06-02 14:54:54 +02:00
242d0175a2 Add tests and end-to-end tests for websocket execution
For unit tests, this mocks the runners Execute method with a
customizable function that operates on the request, streams and exit
channel to simulate a real execution.

End-to-end tests are moved to the tests/e2e_tests folder. The tests
folder allows us to have shared helper functions for all tests in a
separate package (tests) that is not included in the non-test build.

This also adds one second of delay before each end-to-end test case by
using the TestSetup method of suite. By slowing down test execution,
this gives Nomad time to create new allocations when a test requested a
runner. Another solution could be to increase the scale of the job to
have enough allocations for all end-to-end tests.

Co-authored-by: Maximilian Paß <maximilian.pass@student.hpi.uni-potsdam.de>
2021-05-31 12:32:51 +02:00
3afcdeaba8 Execute commands in runner via WebSocket
This enables executing commands in runners and forwarding input and
output between the runner and the websocket to the client.

Co-authored-by: Maximilian Paß <maximilian.pass@student.hpi.uni-potsdam.de>
2021-05-31 12:32:51 +02:00
619cd40fb6 Refactor EntityStore interface to multiple interfaces of specific type 2021-05-27 09:56:07 +00:00
17c9839fac Refactor runners and websocket tests 2021-05-19 14:52:03 +02:00
fe2ec4df35 Incorporate review comments 2021-05-19 14:52:03 +02:00
83ea552cf7 Refactor interfaces to use a runner manager and an environment manager.
See https://gitlab.hpi.de/codeocean/codemoon/poseidon/-/issues/44.
2021-05-19 14:52:03 +02:00
5a5ab8f02b Implement merge request review comments 2021-05-12 09:01:25 +02:00
ed735f284f Add tests for websocket connection
Co-authored-by: Konrad Hanff <konrad.hanff@student.hpi.uni-potsdam.de>
2021-05-12 09:01:25 +02:00
465577fea6 Add basic websocket structure and request upgrader 2021-05-12 09:01:25 +02:00
94f02fad02 Add tests for LoadAvailableRunners method 2021-05-11 14:26:05 +02:00
035d1eb795 Remove error handling for fetching runner from /execute 2021-05-10 16:28:35 +02:00
ba51956ec3 Add destroy runner route 2021-05-10 16:28:35 +02:00
e45cd92557 Fix bad import rebase artifacts 2021-05-10 12:59:18 +00:00
0dc4d28c1b Add e2e tests in ci stage 2021-05-07 12:54:15 +02:00
77f84ccf56 Fix execute response 2021-05-06 10:30:27 +02:00
52b80583b5 Implement review suggestions
Improve logging, constants for routes, RWMutex for ExerciseRunners,
use url.URL for websocket url building
2021-05-06 09:38:00 +02:00
07cdf17eb4 Move execution request map to runners 2021-05-06 08:03:48 +02:00
612bc55bdd Add tests for runners execute route
Co-authored-by: Tobias Kantusch <tobias.kantusch@student.hpi.uni-potsdam.de>
2021-05-06 08:03:48 +02:00
6a00ea3165 Implement runners execute route
Co-authored-by: Tobias Kantusch <tobias.kantusch@student.hpi.uni-potsdam.de>
2021-05-06 08:03:48 +02:00
e230ea854c Properly reset global state in auth tests 2021-05-05 13:56:42 +02:00
971074613e Add tests for authenticated router 2021-05-04 15:22:36 +02:00
456ad4333d Make health route unauthenticated 2021-05-04 15:11:37 +02:00
5891a8c48b Use authentication middleware 2021-05-04 15:10:43 +02:00
99ee8c6dfb Add authentication middleware 2021-05-04 15:08:06 +02:00
c092199693 Add basic nomad integration and runner provider 2021-05-04 13:08:04 +02:00
5182873137 Add structured logging 2021-04-30 08:25:40 +02:00
e14e9c9229 Remove unnessary early header write 2021-04-28 08:49:20 +00:00
ad9aa6fd6d Split up the NewRouter function to ease the creation of versioned routers 2021-04-27 10:05:30 +02:00
40aff301d8 Add function to write json to http response writer 2021-04-27 09:47:08 +02:00
712d0e6420 Cleanup code
This changes variable names that were abbreviations, uses more constants
from the net/http package and improves the json decoding / encoding.
2021-04-27 08:57:31 +02:00
38434cef27 Add tests for health route 2021-04-26 14:20:01 +02:00
f8e864efdd Add health route 2021-04-26 12:46:38 +02:00
38ecc02a79 Add api package serving our api routes using gorilla/mux 2021-04-26 12:46:38 +02:00