Skip to content

Restructure test_ekos_scheduler_ops to allow for multiple job testing

Hy Murveit requested to merge murveit/kstars:scheduler9 into master

Keeping the old description below so we can get back to it later. Now this change only affects testing.

test_ekos_scheduler_ops has been refactored to allow for multiple jobs run by the scheduler. No changes to non-testing runtime.

The only changes in scheduler and scheduler_job are methods to convert enums to QStrings.

Plan is to submit this, extend scheduler unit testing, and then re-visit the ideas below.


Old description

This is a 1-liner in the scheduler, but a significant addition to testing.

When I implemented the horizon constraints, I had hoped that scheduler jobs could be setup such that several jobs could be added to the scheduler list, and when the 1st job hit altitude constraints on the way down, the 2nd could take over, and so on. Unfortunately, when a scheduler job is running and then gets interrupted because of altitude constraints, it is stopped, but its status is set to JOB_IDLE. Thus the job gets rescheduled for the next night, but, even though there may be many hours left in the night, the other scheduler jobs stay will not run.

I've fixed this by setting the interrupted job's state to JOB_ABORTED instead of JOB_IDLE. Given that, other jobs can then run, and this job can be run the next day if the scheduler is set to retry aborted jobs (though that isn't included in the current unit test...yet).

The test added to test_ekos_scheduler_ops runs the above scenario, making sure the first job gets suspended and the second job runs until dawn.

@mutlaqja @wreissenberger @edejouhanet -- input is welcome!

Edited by Hy Murveit

Merge request reports