Open lcontami opened 4 years ago
I tried to integrate your TimeOut again, not very clear to me what stops the measurement when a stop signal is manually sent but what I was aiming at is:
if timeout, then stop the sweep and turn off sw heater, return a ValueError if the measure is manually stopped, stop and do nothing more
Did not look at Travis error yet...
Why don't you want to close the switch heater when the user interrupt the scan ?
Once again my argument about cancel is not about whether or not to close the switch in the context of this particular case, but that more generally stopping a field sweep does not necessarily imply that the switch heater should be closed.
At the beginning of each task (if the feature has not been disabled) the should_stop event is checked and if set the execution abort, this quickly lead to stopping the measurement.
If the idea of closing the sw heater is to save He when the measurement stop by itself overnight, this is not necessary if I am in front of the computer and I am stopping the measurement. Besides, turning off the sw heater takes some time which is annoying
Honestly Madar I am lost between all these comments, I don't understand what is bothering you but I really don't have a strong opinion on how the code is organised. I just have an opinion on how the measurement should behave so if you want to or want me to move some bits around tell me as long as the behavior stays the same.
I get your argument for not closing the switch heater after a manual stop. Currently there is one issue I believe: when stopping the measurement the job will return false but since it it not cancelled the magnet will keep ramping which seems surprising.
To fix that I believe no matter the reason we stop waiting for you should cancel the job. However cancelling should leave the switch heater alone and you could deal with the switch only in the case of a timeout.
For the test I left a comment.
Thanks, I had not realized I had indeed changed the way a measurement stop was handled, in a bad manner. Tell me if what I have proposed suits you, I have edited mainly the InstrJob but I can also put these edits in the task if you think it best. Correct me if I'm wrong but when the measurement has been stopped manually I don't need to write self.root.should_stop.set() since it is already.
Unfortunately the fridge is not cold anymore so I won't be able to test this code...
This does not work anymore... When the measurement is manually stopped the sweep stops (activity = 'Hold') but the measurement stays in "stopping" and does not stop.
Do you have a log, config file or something similar I could look at ?
I did not stop the measurement stopping in the InstrJob for two reasons;
In the end it seemed more logical to me to stop the measurement in the Task when the job fails rather than in the Job itself, but feel free to change if you want.