NSLS-II / Bug-Reports

Unified issue-tracker for bugs in the data acquisition, management, and analysis software at NSLS-II
BSD 3-Clause "New" or "Revised" License
2 stars 5 forks source link

ctrl+c not always effective #159

Closed cmazzoli closed 7 years ago

cmazzoli commented 7 years ago

I think that I saw ctrl+C not working if it is called before the last point of a scan like this

|        20 | 02:56:37.3 |    714.428 |             714.500 |                      0 |      37260 |
|        21 | 02:56:47.3 |    714.886 |             715.000 |                      0 |      36664 |
+-----------+------------+------------+---------------------+------------------------+------------+
generator ascan ['8a2bc2'] (scan num: 74169)
Transient Scan ID: 74170 @ 2017/02/13 02:56:48
Persistent Unique Scan ID: '0be04ae5-5465-4525-a3a3-012fd2f664bc'
+-----------+------------+------------+---------------------+------------------------+------------+
|   seq_num |       time |     energy | pgm_energy_setpoint | pgm_energy_stop_signal |   sclr_ch2 |
+-----------+------------+------------+---------------------+------------------------+------------+
|         1 | 02:57:03.8 |    704.953 |             705.000 |                      0 |      27512 |
|         2 | 02:57:14.6 |    705.498 |             705.500 |                      0 |      31062 |
|         3 | 02:57:25.2 |    706.016 |             706.000 |                      0 |      48252 |
|         4 | 02:57:35.0 |    706.552 |             706.500 |                      0 |      79285 |
|         5 | 02:57:45.2 |    706.900 |             707.000 |                      0 |      74643 |
|         6 | 02:57:55.3 |    707.338 |             707.500 |                      0 |      70215 |
|         7 | 02:58:05.0 |    707.945 |             708.000 |                      0 |     134201 |
|         8 | 02:58:15.8 |    708.947 |             708.500 |                      0 |     116444 |
|         9 | 02:58:25.7 |    708.884 |             709.000 |                      0 |      90134 |
|        10 | 02:58:35.8 |    709.549 |             709.500 |                      0 |      70281 |
|        11 | 02:58:45.6 |    709.954 |             710.000 |                      0 |      60523 |
|        12 | 02:58:56.8 |    710.546 |             710.500 |                      0 |      56438 |
|        13 | 02:59:07.0 |    710.978 |             711.000 |                      0 |      54218 |
|        14 | 02:59:16.7 |    711.462 |             711.500 |                      0 |      48565 |
|        15 | 02:59:26.7 |    712.008 |             712.000 |                      0 |      44180 |
|        16 | 02:59:36.6 |    712.542 |             712.500 |                      0 |      40166 |
|        17 | 02:59:46.8 |    713.118 |             713.000 |                      0 |      38786 |
|        18 | 02:59:56.7 |    713.422 |             713.500 |                      0 |      38883 |
|        19 | 03:00:07.2 |    713.865 |             714.000 |                      0 |      38396 |
|        20 | 03:00:17.0 |    714.522 |             714.500 |                      0 |      35274 |
^CA 'deferred pause' has been requested. The RunEngine will pause at the next checkpoint. To pause immediately, hit Ctrl+C again in the next 10 seconds.
Deferred pause acknowledged. Continuing to checkpoint.
|        21 | 03:00:26.7 |    715.095 |             715.000 |                      0 |      35893 |
+-----------+------------+------------+---------------------+------------------------+------------+
generator ascan ['0be04a'] (scan num: 74170)
Transient Scan ID: 74171 @ 2017/02/13 03:00:27
Persistent Unique Scan ID: 'f3b1654f-d6ee-4a9f-95b4-c529a90ea137'
+-----------+------------+------------+---------------------+------------------------+------------+
|   seq_num |       time |     energy | pgm_energy_setpoint | pgm_energy_stop_signal |   sclr_ch2 |
+-----------+------------+------------+---------------------+------------------------+------------+
|         1 | 03:00:40.4 |    705.009 |             705.000 |                      0 |      26266 |
^CA 'deferred pause' has been requested. The RunEngine will pause at the next checkpoint. To pause immediately, hit Ctrl+C again in the next 10 seconds.
Deferred pause acknowledged. Continuing to checkpoint.
|         2 | 03:00:50.7 |    705.476 |             705.500 |                      0 |      31268 |
Pausing...
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/home/xf23id1/Beamline/Commissioning/2017_02/20170212_night.py in <module>()
----> 1 while(True):RE(ascan(pgm_en,705,715,20))

/opt/conda_envs/collection-17Q1.0/lib/python3.5/site-packages/bluesky/run_engine.py in __call__(self, plan, subs, raise_if_interrupted, **metadata_kw)
    541         # If we are in the wrong state, raise.
    542         if not self.state.is_idle:
--> 543             raise RuntimeError("The RunEngine is in a %s state" % self.state)
    544 
    545         futs = []

RuntimeError: The RunEngine is in a paused state

In [176]: RE.stop()
Stopping: running cleanup and marking exit_status as 'success'...

Useless to say, it was not in a plan but in a stupid loop as I was quickly checking for stability while at the keyboard

while(True): RE(ascan(pgm_en,705,715,20))

however normally it stops no problem at the next iteration, thing that this was not happening...

tacaswell commented 7 years ago

If you hit ctl-c 11 times it will kill a tight inner loop like this.