Class: Lemans::Agents::Oracle
- Inherits:
-
Lemans::Agent
- Object
- Lemans::Agent
- Lemans::Agents::Oracle
- Defined in:
- lib/lemans/agents/oracle.rb
Overview
Runs the task's own solution instead of a model. A task whose oracle does not score full marks is broken, not hard.
Constant Summary collapse
- NAME =
"oracle"- REMOTE_DIR =
"/solution"- SOLVE =
"solve"- ENTRYPOINT =
"solve.sh"- PATCH =
"solution.patch"
Instance Attribute Summary
Attributes inherited from Lemans::Agent
Instance Method Summary collapse
Methods inherited from Lemans::Agent
Constructor Details
This class inherits a constructor from Lemans::Agent
Instance Method Details
#run(task, environment) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lemans/agents/oracle.rb', line 16 def run(task, environment) raise ConfigError, "#{task.name}: no solution/ to run — the oracle has nothing to prove" unless task.solution? upload_solution(environment, task) outcome = environment.exec(command_for(task), timeout:) unless outcome.success? raise InfrastructureError, "#{task.name}: the solution itself failed (exit #{outcome.exit_code}): " \ "#{outcome.output.to_s[0, 500]}" end Response.new(outcome: Result::Outcome.new(:completed), usage: Result::Usage.zero) end |