Exopy / exopy_hqc_legacy

Transition package to smooth transition from HQCMeas to Exopy.
BSD 3-Clause "New" or "Revised" License
0 stars 10 forks source link

Task does not fail when communication is lost during InstrJob.wait_for_completion #60

Open lcontami opened 4 years ago

lcontami commented 4 years ago

On the apply_magnetic_field task, the waiting time for ramping the field is dealt with by an InstrJob (so that the measure can be stopped mid ramp).

Right now the instrument brutally restarts during the ramp. The connection to the instrument is restarted, but the task continue without failing (as if the target value had been reached) or rerunning the ramp.

lcontami commented 4 years ago

The origin of the issue is the following;

when the job fails, job.cancel() is run, and the perform method returns a False. However, this does not cause the task to fail !

Would the command self.root.should_stop = True stop the task ?

MatthieuDartiailh commented 4 years ago

To stop the measurement you can replace return False by self.root.should_stop.set(). I would also suggest logging a message explaining the reason. Actually the cleaner way to proceed would be to have InstrJob raise an exception on a timeout since this is I believe what is happening here. I may have time tonight to put a PR together if you don't do it first.