Straightforward fix to properly execute jobs when they repeat or are duplicated.
While checking the interesting edge case of captures stored in /tmp being immediately deleted, I made sure jobs being evaluated with no repeats remaining, but for some reason still not completed, would properly be re-checked for captures. I also added a safeguard to avoid having the repeats remaining getting unexpectedly negative.
This change also makes sure job completion is evaluated before a batch repeats. Repeats, in conjunction with option 'Remember Job Progress', ensure the proper amount of captures is stored. For the same target, if job A has a repeat count equal to 1 and job B has a repeat count equal to 2, the amount of captures stored after A and B finish will equal 2 sequence items. This also means that if B runs first, A will not run as it will be considered complete.
This change also works around an issue with /tmp, where captures stored are immediately deleted for some odd reason, and uses /var/tmp instead for unitary tests.
This change also introduces test vector 'distant_jobs_no_twlight', which tests the ability of the scheduler to sleep and park the mount between jobs.
Speaking of parking, it seems the Telescope Simulator is unable to handle parking on my setup. The simulator will always initialize unpark, and will never notify parking state. It will however, move and park properly. There is still an issue with the scheduler in a specific edge case, where the scheduler is unable to consider the mount unparked, and will loop until the mount is unparked manually. Because these issues are interleaved, I consider the problem in the Telescope Simulator must be fixed first.
This change also fixes an issue observed with duplicated repeating jobs, where the optimization on step pipelines was preventing the job from completing and also letting the next job execute. On the subject of capturing, there is still a weird problem with the Capture Tab and the CCD Simulator, where sometimes not all captures of a set of sequence jobs are stored. This is visible with test vector 'duplicated_scheduler_jobs_duplicated_sequence_jobs_no_twilight', in which sometimes only 4 captures will store on the first job run instead of the expected 7 RGBLRGB. The scheduler is able to mitigate this by noticing there are missing captures, and rescheduling the job to execute again.
This change also fixes - again - the capture count algorithm. Now capture counts are displayed properly in the scheduler queue! This one was tricky, so I added a large documentation block in updateCompletedJobsCount. It's important to note that while its name doesn't give any hint, this function will also change the behavior of the set of sequence jobs associated to the scheduler job.
Finally this change fixes an issue/regression on scheduler shutdown by rewriting and clarifying how the scheduler decides to stop when evaluating jobs.