Commit Graph

627 Commits

Author SHA1 Message Date
d033f71ae3 Catch Runner::Error in RemoteEvaluationController 2021-11-04 18:43:16 +01:00
d7e515f1c6 Fix rubocop offense 2021-11-02 10:46:48 +01:00
620dac935a Fix bug that prevented binary file uploads 2021-11-02 10:31:50 +01:00
c3642b5d0c Add an empty line before printing exit message
* The empty line is only added if the output is not empty
2021-11-01 17:52:44 +01:00
1e7cf1c622 Prevent parallel execution of run and test during RfC creation
* Otherwise, the output of both might be mixed and saved incorrectly for the RfC
2021-11-01 17:13:14 +01:00
447860892a Always remove exposed_ports_list if present 2021-11-01 17:13:13 +01:00
de83843496 Combine no_output and exit_status messages 2021-11-01 17:13:13 +01:00
1609bd2e0e Change default of raise_exception for execute_command 2021-11-01 17:13:11 +01:00
288c7693f7 Remove dump_docker method for admins 2021-11-01 17:13:08 +01:00
2b98905acb Remove usage of DockerClient from execution_environments_controller.rb 2021-11-01 17:13:07 +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
06ef4430f5 Change exposed_ports to array 2021-11-01 17:13:02 +01:00
7285978ea3 Re-add test method for SubmissionsController 2021-11-01 17:13:01 +01:00
56a1d78793 Use correct embed_option to disable_score 2021-11-01 17:13:01 +01:00
2377f8370c Clarify set_file and set_files in SubmissionsController 2021-11-01 17:13:00 +01:00
345860c779 Adapt output buffering to Poseidon and DCP
* Refactor flushing of messages
* Introduce two separate buffers for stdout and stderr
2021-11-01 17:13:00 +01:00
7e7b7ebdfa Allow flushing the WebSocket connection
* This will prevent the current thread from crashing when a single newline character is received.
2021-11-01 17:12:59 +01:00
f4c806fe43 Forward JSON from runner to client if possible 2021-11-01 17:12:59 +01:00
3240ea7076 Forward input as raw_event to runner
* Also, rename #send to #send_data in order to prevent debugging issues in RubyMine
2021-11-01 17:12:58 +01:00
f896d041f8 Restructure submissions_controller and remove outdated copy_comments method 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
4ad898ad8b Remove set_docker_client method from submissions_controller.rb 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
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
d1a5773e60 Add debug log statements to runner connection 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
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
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
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
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
90fac7b94c Copy execution environment to Poseidon on create and update
When creating or updating an execution environment, an API call to
Poseidon is made with the necessary information to create the
corresponding Nomad job.

If runner management is configured, his will display a warning
(currently in the same color as if it were a success) in the UI, if the
API call fails. The environment is saved even if it fails.
If runner management is not configured, this warning will not be created.
2021-11-01 17:12:48 +01:00
63d997a7e3 Fix Rubocop offenses after Rubocop was reconfigured 2021-11-01 17:12:47 +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
2404c1c36c Rename variables from container to runner 2021-11-01 17:12:45 +01:00
575057acd3 Fix some non-autocorrectable linting issues
Many functions in submission_controller.rb still are very long and have
a high complexity. Because the logic for handling execution of
submissions will probably move elsewhere (when switching to
ActionCable), this is fine for now.
2021-11-01 17:12:45 +01:00
80932c0c40 Auto-correct linting issues 2021-11-01 17:12:45 +01:00
cf1e4d6edf Rename API routes 2021-11-01 17:12:44 +01:00
28f8de1a93 Implement workaroud for double render error
Co-authored-by: Felix Auringer <felix.auringer@student.hpi.uni-potsdam.de>
2021-11-01 17:12:44 +01:00
347e4728a0 Rework protocol inside websocket
Co-authored-by Felix Auringer <felix.auringer@student.hpi.uni-potsdam.de>
2021-11-01 17:12:44 +01:00
6a4e302f4e Fix socket handling and add configuration option
Co-authored-by: Felix Auringer <felix.auringer@student.hpi.uni-potsdam.de>
2021-11-01 17:12:43 +01:00
92b249e7b3 Reimplement scoring and create connection abstraction
Co-authored-by: Felix Auringer <felix.auringer@student.hpi.uni-potsdam.de>
2021-11-01 17:12:43 +01:00
1546f70818 Begin to refactor websocket handling and implement test
Co-authored-by: Felix Auringer <felix.auringer@student.hpi.uni-potsdam.de>
2021-11-01 17:12:43 +01:00
3cf70a33d8 Integrate new API with websocket (run only)
Co-authored-by: Felix Auringer <felix.auringer@student.hpi.uni-potsdam.de>
2021-11-01 17:12:43 +01:00