Commit Graph

3606 Commits

Author SHA1 Message Date
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
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
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
7ff65135b5 Add runner management configuration to ci 2021-11-01 17:12:46 +01:00
286a3f394d Fix autocorrectable rubocop offences and implement suggestions 2021-11-01 17:12:46 +01:00
b29bc5e70f Apply 3 suggestion(s) to 3 file(s) 2021-11-01 17:12:46 +01:00
c14cf99a96 Don't cleanup runners during precompile 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
3017e46006 Add newline to end of json schema 2021-11-01 17:12:45 +01:00
2404c1c36c Rename variables from container to runner 2021-11-01 17:12:45 +01:00
3e6534567d Move copy_submission_files from runner to submission 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
6e9562c9e1 Validate json 2021-11-01 17:12:44 +01:00
cf1e4d6edf Rename API routes 2021-11-01 17:12:44 +01:00
c36ec447ff Fix faulty API data format 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
2e2cd1855e Add Container abstration with new API calls and adapt running a submission
Co-authored-by: Felix Auringer <felix.auringer@student.hpi.uni-potsdam.de>
2021-11-01 17:12:43 +01:00
78893ba1a5 Merge pull request #1075 from openHPI/dependabot/bundler/rubocop-performance-1.12.0
Bump rubocop-performance from 1.11.5 to 1.12.0
2021-11-01 14:22:59 +01:00
66955e1f25 Bump rubocop-performance from 1.11.5 to 1.12.0
Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.11.5 to 1.12.0.
- [Release notes](https://github.com/rubocop/rubocop-performance/releases)
- [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.11.5...v1.12.0)

---
updated-dependencies:
- dependency-name: rubocop-performance
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-01 03:01:24 +00:00
95cddd3039 Merge pull request #1072 from openHPI/dependabot/bundler/newrelic_rpm-8.1.0
Bump newrelic_rpm from 8.0.0 to 8.1.0
2021-10-30 12:33:51 +02:00
c28af6220e Merge pull request #1074 from openHPI/dependabot/npm_and_yarn/bootstrap-4.6.1 2021-10-29 03:10:46 +00:00
5e78d4419f Bump bootstrap from 4.6.0 to 4.6.1
Bumps [bootstrap](https://github.com/twbs/bootstrap) from 4.6.0 to 4.6.1.
- [Release notes](https://github.com/twbs/bootstrap/releases)
- [Commits](https://github.com/twbs/bootstrap/compare/v4.6.0...v4.6.1)

---
updated-dependencies:
- dependency-name: bootstrap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-29 03:02:59 +00:00
a54ef45624 Merge pull request #1071 from openHPI/dependabot/bundler/rubocop-1.22.3 2021-10-28 03:08:49 +00:00
07faa89d18 Bump newrelic_rpm from 8.0.0 to 8.1.0
Bumps [newrelic_rpm](https://github.com/newrelic/newrelic-ruby-agent) from 8.0.0 to 8.1.0.
- [Release notes](https://github.com/newrelic/newrelic-ruby-agent/releases)
- [Changelog](https://github.com/newrelic/newrelic-ruby-agent/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/newrelic/newrelic-ruby-agent/compare/8.0.0...8.1.0)

---
updated-dependencies:
- dependency-name: newrelic_rpm
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-28 03:01:19 +00:00
588898fc88 Bump rubocop from 1.22.2 to 1.22.3
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.22.2 to 1.22.3.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.22.2...v1.22.3)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-28 03:00:44 +00:00
c646a19fe6 Merge pull request #1070 from openHPI/dependabot/bundler/capybara-3.36.0
Bump capybara from 3.35.3 to 3.36.0
2021-10-26 09:46:48 +02:00
2c1d0d8aa1 Bump capybara from 3.35.3 to 3.36.0
Bumps [capybara](https://github.com/teamcapybara/capybara) from 3.35.3 to 3.36.0.
- [Release notes](https://github.com/teamcapybara/capybara/releases)
- [Changelog](https://github.com/teamcapybara/capybara/blob/master/History.md)
- [Commits](https://github.com/teamcapybara/capybara/compare/3.35.3...3.36.0)

---
updated-dependencies:
- dependency-name: capybara
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-26 03:00:59 +00:00