Commit Graph

64 Commits

Author SHA1 Message Date
Sebastian Serth
eaa06ee528 DCP: Prevent double deletion of runner 2021-11-01 17:13:13 +01:00
Sebastian Serth
6a902c41db DCP: Refactor container method and usage 2021-11-01 17:13:12 +01:00
Sebastian Serth
537d8bfc95 DCP: Add handling of inactivity timer 2021-11-01 17:13:12 +01:00
Sebastian Serth
dcafbb9d46 DCP: Change HTTP verbs 2021-11-01 17:13:12 +01:00
Sebastian Serth
6209e25ee2 DCP: Move pool location to code_ocean.yml 2021-11-01 17:13:12 +01:00
Sebastian Serth
7bb2ef8588 DCP: Forward data before matching stdout termination 2021-11-01 17:13:12 +01:00
Sebastian Serth
dfdec92c6e Use ping option only for DCP WebSocket
* The Faye::WebSocket library will "buffer" some output of the connection and emit the `on :message` events in the order of the messages. However, when a ping is sent while the connection has already been closed, it will emit the `on :close` event immediately and drop all other messages (in that "buffer"). This is problematic for very short running executions that generate a long output (as this will be cut off without a proper exit message sent by Poseidon).
2021-11-01 17:13:11 +01:00
Sebastian Serth
570809bfe9 Allow whitespace for JSON exit 2021-11-01 17:13:11 +01:00
Sebastian Serth
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
Sebastian Serth
01ec9343cf Remove usage of DockerClient 2021-11-01 17:13:10 +01:00
Sebastian Serth
b13a3b084d Use new available_images routes from DCP 2021-11-01 17:13:10 +01:00
Sebastian Serth
9d833e37b3 Use Net::HTTP::Persistent for requests to Poseidon 2021-11-01 17:13:09 +01:00
Sebastian Serth
ada438b230 Add release and pool_size methods to DCP 2021-11-01 17:13:07 +01:00
Sebastian Serth
6d1b388e3c Reorder methods in strategy classes 2021-11-01 17:13:07 +01:00
Sebastian Serth
e33af5760d Delegate initialization to Runner::Strategy 2021-11-01 17:13:07 +01:00
Sebastian Serth
2b98905acb Remove usage of DockerClient from execution_environments_controller.rb 2021-11-01 17:13:07 +01:00
Sebastian Serth
87c5302336 Switch logging to milliseconds and add more details
* By design, most logging happens in an `ensure` block. This ensures that no return value is modified unexpectedly.
2021-11-01 17:13:06 +01:00
Sebastian Serth
e272fcd19c Add more comments and error logging to connection.rb 2021-11-01 17:13:04 +01:00
Sebastian Serth
e95ad5e26c Add @!attribute comments to connection.rb 2021-11-01 17:13:04 +01:00
Sebastian Serth
2ad4eb7625 DCP: Escape command for RegEx 2021-11-01 17:13:04 +01:00
Sebastian Serth
68c8f1dbdf DCP: Set sticky bit for folder and secure delete 2021-11-01 17:13:04 +01:00
Sebastian Serth
04c896c7de DCP: Listen for Python exit handler 2021-11-01 17:13:03 +01:00
Sebastian Serth
c7ddbd676c Do not forward custom exit handlers to frontend 2021-11-01 17:13:03 +01:00
Sebastian Serth
50b62b5703 Move flush_buffers method in Runner::Connection 2021-11-01 17:13:03 +01:00
Sebastian Serth
696cd6a236 Poseidon: Clean workspace between executions 2021-11-01 17:13:03 +01:00
Sebastian Serth
a6a477e361 Move error handling to else branch in execute_command 2021-11-01 17:13:03 +01:00
Sebastian Serth
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
Sebastian Serth
1891cdd69c Add check whether buffer is empty 2021-11-01 17:13:00 +01:00
Sebastian Serth
58e923abd8 Add custom websocket header to strategy class 2021-11-01 17:12:59 +01:00
Sebastian Serth
08f36a0a7a Destroy runner at management in case of errors 2021-11-01 17:12:59 +01:00
Sebastian Serth
788f6dba20 Specify TLS certificate for Faye::WebSocket::Client 2021-11-01 17:12:59 +01:00
Sebastian Serth
a074a5cb0d Add buffering to output received from runner 2021-11-01 17:12:58 +01:00
Sebastian Serth
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
Sebastian Serth
0f92526494 Remove outdated output callback from Runner::Connection 2021-11-01 17:12:58 +01:00
Sebastian Serth
cc98dc2229 Split WebSocket event in multiple lines before processing 2021-11-01 17:12:58 +01:00
Maximilian Paß
b51a45e9b1 Add token header option for requests to Poseidon 2021-11-01 17:12:57 +01:00
Maximilian Paß
44395b7792 Add ca file option for requests to Poseidon 2021-11-01 17:12:56 +01:00
Sebastian Serth
09b672eb08 DCP strategy: Use stdout for most test results 2021-11-01 17:12:56 +01:00
Sebastian Serth
6c5a5226b8 Preserve locale during Runner::Connections 2021-11-01 17:12:56 +01:00
Sebastian Serth
325720bd3b Improve documentation in Runner::Connection 2021-11-01 17:12:56 +01:00
Sebastian Serth
30603cb7ab Generalize method and constant names for runner management 2021-11-01 17:12:53 +01:00
Felix Auringer
e752df1b3c Move EventMachine initialization to Runner::EventLoop 2021-11-01 17:12:53 +01:00
Felix Auringer
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
Felix Auringer
c7369366d5 Ensure that only one EventMachine is running 2021-11-01 17:12:52 +01:00
Felix Auringer
5cc180d0e9 Fix rubocop, I18n, cleanup rebase 2021-11-01 17:12:52 +01:00
Felix Auringer
2dff81a510 Attach duration information to the exception object 2021-11-01 17:12:52 +01:00
Felix Auringer
36578a2817 Ensure to save Testrun even when an error occurs 2021-11-01 17:12:52 +01:00
Felix Auringer
f98a8b9e7a Resolve error handling todos in dcp strategy 2021-11-01 17:12:52 +01:00
Felix Auringer
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
Felix Auringer
d1a5773e60 Add debug log statements to runner connection 2021-11-01 17:12:51 +01:00