The osc-machete
gem's Statusable
module provides post-job validation which is automatically called when a job status is updated to "Completed".
Use this method to inspect the job output and validate whether the job has completed successfully.
If the method returns true
, the module will set the status value of the object to OSC::Machete::Status.passed
. If the method is false
it will use OSC::Machete::Status.failed
. The default value if a method is not provided is true
As a rule, the result validation method name will be the name of the job's batch script in underscore case appended with _results_valid?
. See OscMacheteRails::Statusable for implementation.
For example, if you are validating a job with the script title "Main.sh", you should create the following method signature:
def main_results_valid?
# VALIDATION CODE HERE
end
For a script with the filename "SimulationJob.sh", be sure to convert to underscore case. Example:
def simulation_job_results_valid?
# VALIDATION CODE HERE
end
If you aren't sure what to name your validation method, you can open up a rails console
instance on the command line and call the results_validation_method_name
method on your Statusable object. This will return the method name that will be called for that particular object after the job is run.