pandaPIengine icon indicating copy to clipboard operation
pandaPIengine copied to clipboard

Set exit status based on success/failure?

Open rpgoldman opened this issue 2 years ago • 2 comments

For integrating pandaPIengine into pipelines, scripts, etc. it would be helpful if it was easy to tell whether it had succeeded in finding a plan or not.

For this, it would help if the exit status was set to 2 (or some other designated value) on search failure. Looking at the code, it seems like an exit status of 1 is reserved for an error condition.

I have had a start at trying to make a MR for this. It seems to be straightforward for translation mode, and mostly straightforward for the heuristic search mode, but for the SAT planner option, I can't figure out all of the ways that solve_with_sat_planner and its subsidiary function solve_with_sat_planner_linear_bound_increase can exit (the while(true) loop in the latter I can't figure out -- how does it exit on failure here?)

Any suggestions?

rpgoldman avatar Oct 10 '23 16:10 rpgoldman

Thanks for starting the work!

As for the SAT solver, basically whenever the call returns anything other than 10 or 20, this is an error (except if we set terminations, which we don't). I've just pushed a commit that checks for this and exits the program with code 2 if this happens.

Could you add your PR?

galvusdamor avatar Nov 14 '23 14:11 galvusdamor

I have a shot at it in #14

rpgoldman avatar Nov 18 '23 22:11 rpgoldman