Commit Graph

33 Commits

Author SHA1 Message Date
e9efb5bc2b Add exit_code and status to Testruns, create model for TestrunMessages
* This is the first step to migrate the `output` column from Testruns to a dedicated table TestrunMessages
2022-04-28 15:18:51 +02:00
19bd742bc9 Show a localized message if the program was killed.
* This will most likely happen by the OOM killer, thus we inform the user about the memory restriction.
2022-04-15 21:29:55 +02:00
ea85519163 Update bundle (with newest rubocop version) and fix offenses 2022-01-04 09:42:37 +01:00
5aee2aaba8 Add more logging for execution requests 2021-11-18 14:18:41 +01:00
ecf470bddd Refactor sync_environment methods
* Add delete_environment method
* Change return value to allow raising an exception
2021-11-04 20:06:40 +01:00
4cd70f2bad Add comment for retries to Runner#execute_command 2021-11-04 18:43:16 +01:00
2c10b48b70 Execute Command: Guard requesting new runner
* If any exception is thrown, these will be caught now and handled appropriately
2021-11-01 17:13:15 +01:00
bdfcb0da19 Reset previous exception if retrying command execution 2021-11-01 17:13:14 +01:00
b62a7ad129 Prevent non-existing runner_management config to be read 2021-11-01 17:13:11 +01:00
1609bd2e0e Change default of raise_exception for execute_command 2021-11-01 17:13:11 +01:00
4f1a7cde27 Add null strategy for runners
* This is the default strategy used when the runner management is disabled. It might be replaced with a generic Docker strategy in the future (without pooling). For now, it allows normal "operation" of CodeOcean without any runner management. However, as no runner system is configured, no command can be executed.
2021-11-01 17:13:10 +01:00
28c74bc9a5 Improve memoization of @strategy_class 2021-11-01 17:13:08 +01:00
9cc4394296 Allow editing an Execution Environment with active runner management 2021-11-01 17:13:05 +01:00
d87e23b9a3 Add execute_command method to runner.rb
* This is now used by the score and test runs
* This also re-enables the interactive shell for execution environments
2021-11-01 17:13:05 +01:00
a1db30c288 Clarify EnvironmentNotFound error handling 2021-11-01 17:13:02 +01:00
352e5f4329 Clarify strategy creation in runner.rb with comment 2021-11-01 17:13:01 +01:00
f77e6d9df8 Simplify code in runner model 2021-11-01 17:12:54 +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
c7369366d5 Ensure that only one EventMachine is running 2021-11-01 17:12:52 +01:00
2dff81a510 Attach duration information to the exception object 2021-11-01 17:12:52 +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
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
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
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
b762c73ddd Update usage of Poseidon API to newest API version (0.2.2)
copy file, create and execute command had to be adapted.
2021-11-01 17:12:47 +01:00
8d968e01e6 Move RunnerConnection into class Runner
The old approach was to require the runner connection. This did
not work anymore with Zeitwerk in Rails 6. @sebastian.serth and I
moved the Connection class in `lib` into the ActiveRecord class
`Runner`. This will also work with future changes like specific
error classes. Furthermore the config was fixed and simplified.

Co-authored-by: Sebastian Serth <Sebastian.Serth@hpi.de>
2021-11-01 17:12:47 +01:00
63d997a7e3 Fix Rubocop offenses after Rubocop was reconfigured 2021-11-01 17:12:47 +01:00
fc6aa12b0a Remove handling of runner timeouts 2021-11-01 17:12:47 +01:00
286a3f394d Fix autocorrectable rubocop offences and implement suggestions 2021-11-01 17:12:46 +01:00
17bd2d8726 Reuse runners per user and execution environment
Co-authored-by: Jan-Eric Hellenberg <jan-eric.hellenberg@student.hpi.uni-potsdam.de>
Co-authored-by: Maximilian Pass <maximilian.pass@student.hpi.uni-potsdam.de>
2021-11-01 17:12:46 +01:00