OSC / osc-machete

High level interface to submitting and checking the status of batch jobs (currently OSC specific)
MIT License
1 stars 0 forks source link

TorqueHelper qdel exception handling. #83

Closed brianmcmichael closed 8 years ago

brianmcmichael commented 8 years ago

Currently, the qdel command returns true or throws an exception. https://github.com/AweSim-OSC/osc-machete/blob/master/lib/osc/machete/torque_helper.rb#L106

PBS raises exception here. https://github.com/AweSim-OSC/pbs-ruby/blob/c1586a2e7815d8ca6ab3e98bd3a1016ccc1dcfc5/lib%2Fpbs%2Ftorque.rb#L60

I've kept with the return true convention, but realized that it's entirely possible that a user will try to qdel a job that's already completed and an exception will be raised.

I can handle this exception to prevent the app from breaking, but the question is, should I continue returning 'true', or modify the qdel to return false on fail? I lean toward the latter, but I'm not sure if that would cause unexpected behavior in existing apps.

brianmcmichael commented 8 years ago

Clarification:

qdel using shell always returns true.

qdel using PBS returns true or throws exception.

I propose qdel using PBS return true or false.

nickjer commented 8 years ago

I think osc-machete always returning true on #qdel was because Eric never tested for errors. I am fine with you catching the errors received from pbs-ruby and returning false instead.

nickjer commented 8 years ago

In vncsim I just do...

begin
  osc_session.job.delete
end

So I ignore any errors raised by PBS and move on.

brianmcmichael commented 8 years ago

Added at this commit. https://github.com/AweSim-OSC/osc-machete/commit/745908c990c04c440eb17ef51358db705cc7a824

brianmcmichael commented 8 years ago

Solution merged into release/1.0