Commit Graph

3641 Commits

Author SHA1 Message Date
f896d041f8 Restructure submissions_controller and remove outdated copy_comments method 2021-11-01 17:12:58 +01:00
0f92526494 Remove outdated output callback from Runner::Connection 2021-11-01 17:12:58 +01:00
cc98dc2229 Split WebSocket event in multiple lines before processing 2021-11-01 17:12:58 +01:00
1403fc03c4 Remove outdated lines from #download method 2021-11-01 17:12:57 +01:00
601e1fab5c Remove all occurrences of server-sent events 2021-11-01 17:12:57 +01:00
82cab390ad Remove outdated run method from turtle.js 2021-11-01 17:12:57 +01:00
3fa6ba6c72 Use instance_double for Poseidon Strategy specs 2021-11-01 17:12:57 +01:00
b51a45e9b1 Add token header option for requests to Poseidon 2021-11-01 17:12:57 +01:00
44395b7792 Add ca file option for requests to Poseidon 2021-11-01 17:12:56 +01:00
09b672eb08 DCP strategy: Use stdout for most test results 2021-11-01 17:12:56 +01:00
6c5a5226b8 Preserve locale during Runner::Connections 2021-11-01 17:12:56 +01:00
325720bd3b Improve documentation in Runner::Connection 2021-11-01 17:12:56 +01:00
cc17736bf5 Add CPU limit to Execution Environment index 2021-11-01 17:12:56 +01:00
ee1751debf Fix rubocop offenses 2021-11-01 17:12:55 +01:00
8bd9a93944 Add NOT NULL constraint on cpu_limit 2021-11-01 17:12:55 +01:00
0cc1c7a396 Combine runner waiting_time migrations 2021-11-01 17:12:55 +01:00
0c22e1392a Remove outdated mnemosyne traces 2021-11-01 17:12:55 +01:00
13c378b980 Remove concurrent ruby gem no longer needed 2021-11-01 17:12:55 +01:00
fd9e243064 Disable DCP if other strategy class is chosen 2021-11-01 17:12:54 +01:00
4ad898ad8b Remove set_docker_client method from submissions_controller.rb 2021-11-01 17:12:54 +01:00
5037a73f36 Mock runner management settings for spec 2021-11-01 17:12:54 +01:00
f77e6d9df8 Simplify code in runner model 2021-11-01 17:12:54 +01:00
1bf92d8c90 Fix sentry error capturing in submissions controller 2021-11-01 17:12:53 +01:00
30603cb7ab Generalize method and constant names for runner management 2021-11-01 17:12:53 +01:00
e752df1b3c Move EventMachine initialization to Runner::EventLoop 2021-11-01 17:12:53 +01:00
9e2cff7558 Attach connection errors to socket
Raising the errors would crash the current thread. As this thread
contains the Eventmachine, that would influence other connections
as well. Attaching the errors to the connection and reading them
after the connection was closed ensures that the thread stays
alive while handling the errors in the main thread of the current
request.
2021-11-01 17:12:53 +01:00
c8e1a0bbcb Fix tests for Runner#attach_to_execution
These tests were blocking because of the newly introduced
EventLoop. The messages sent to the EventLoop are now mocked
and the EventLoop isn't blocking anymore in the tests.
2021-11-01 17:12:53 +01:00
c7369366d5 Ensure that only one EventMachine is running 2021-11-01 17:12:52 +01:00
5cc180d0e9 Fix rubocop, I18n, cleanup rebase 2021-11-01 17:12:52 +01:00
2dff81a510 Attach duration information to the exception object 2021-11-01 17:12:52 +01:00
36578a2817 Ensure to save Testrun even when an error occurs 2021-11-01 17:12:52 +01:00
f98a8b9e7a Resolve error handling todos in dcp strategy 2021-11-01 17:12:52 +01:00
5608d61b3a Replace metaprogramming in Runner::Connection
This prevents someone who is controlling the websocket connection
to send messages starting with 'handle_' to the connection object.
2021-11-01 17:12:51 +01:00
d1a5773e60 Add debug log statements to runner connection 2021-11-01 17:12:51 +01:00
cc412b73bc Introduce more error types 2021-11-01 17:12:51 +01:00
db2d1e3164 Add tests for DockerContainerPool strategy 2021-11-01 17:12:51 +01:00
704407b9fc Add strategy for DockerContainerPool
In order to provide an alternative to Poseidon, a strategy for the
DockerContainerPool is added that is used by the runner model.

Co-authored-by: Sebastian Serth <Sebastian.Serth@hpi.de>
2021-11-01 17:12:51 +01:00
1d3f0d7ad8 Handle Faraday errors 2021-11-01 17:12:50 +01:00
b48b45de9f Refactor error classes
All runner errors are now in a single file. The not found error
has been splitted into an error for runner not found and for
environment not found.
2021-11-01 17:12:50 +01:00
413f9b2705 Improve error resilience and handling
Timeouts are now handled correctly and the Runner automatically
creates the execution environment if it could not be found in
Poseidon. The runner is deleted locally if Poseidon returns
a bad request error.
2021-11-01 17:12:50 +01:00
b6bc578aea Move submission scoring from controller concern to submission model
Localization and markdown formatting is now done in a controller
spec in order to bring this logic away from the data and towards
the view.
2021-11-01 17:12:50 +01:00
b847daf823 Remove waiting_time from runner model
After removing the logic that stores the duration that has been
waited for a runner in the runner, this now also removes the column
from the database as it is not used anymore.
2021-11-01 17:12:49 +01:00
d0d1b1bffd Introduce strategy for runner behavior
The runner model is only a class responsible for storing information
now. Based on the configuration it picks a strategy for the runner
management. The Poseidon strategy is already implemented and tested.
The Docker strategy will follow.
2021-11-01 17:12:49 +01:00
cf58be97ee Fix 17 previously failing specs 2021-11-01 17:12:49 +01:00
0280c0282e Add tests for synchronizing all execution environments
This adds policy tests to ensure only an admin can synchronize all
execution environments. It also adds controller tests that check that
all execution environments get synchronized.
2021-11-01 17:12:49 +01:00
598de3bcff Add button to synchronize all execution environments
This adds a button to the execution environment index page that, when
clicked, causes all execution environments to be synchronized to the
runner management (Poseidon) by creating or replacing them.

CodeOcean does not synchronize it's execution environments on startup or
when a new runner management configuration is used for the first time.
The administrator has to manually start this process by pressing this
button.

The equivalent for syncing just one execution environment is updating
it.
2021-11-01 17:12:49 +01:00
0978a3be83 Add tests for the different runner errors 2021-11-01 17:12:48 +01:00
d5b274c9f2 Introduce new error types for runners
The errors are raised in the runner model and in the runner connection
class. In the submission controller the errors are rescued and,
depending on the error, the status timeout / container depleted is
sent to the client.
2021-11-01 17:12:48 +01:00
5e913c8a1a Skip failing tests
17 tests are always failing, due to changes introduced when adding the
Runner abstraction. To know only these fail, they now get skipped in
order to make it apparent if tests that should not fail do fail in the
pipeline.
2021-11-01 17:12:48 +01:00
d22d24df4d Add tests for execution environment copy to Poseidon 2021-11-01 17:12:48 +01:00