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>
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.
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.
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.
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>
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.