1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 <2021> 2022 2023 2024 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 <2021> 2022 2023 2024 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | RE: Python cothread errors |
From: | "Ha, Kiman via Tech-talk" <tech-talk at aps.anl.gov> |
To: | "Hu, Yong" <yhu at bnl.gov>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Cc: | "Kongtawong, Sukho" <skongtawong at bnl.gov> |
Date: | Tue, 26 Jan 2021 14:51:00 +0000 |
Thanks, Yong, Solved after increase timeout. caget takes ~12 seconds for all waveform readout. From: Hu, Yong <yhu at bnl.gov> Kiman, The default timeout for cothread caget is 5-second. Since you are reading lots of waveforms from lots of different IOCs (and it also depends on the network traffic), you might need to increase the “timeout” to a higher value, i.e. 30-second:
caget(fa_x_pv, timeout=30, count=record_len) From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of "tech-talk at aps.anl.gov"
<tech-talk at aps.anl.gov> Hi All, We were trying to collect waveform data from the single point softIOC, a total of 180 * 100,000 points. Before, it works fine, but recently, we found unexpected cothread error messages. Can someone advise how to fix these errors? $python save_sdi_no_trig.py test2 start: number of data: 100000 burst length: 11 s read data... Traceback (most recent call last): File "save_sdi_no_trig.py", line 83, in <module> faX = caget(fa_x_pv, count=record_len) File "/usr/lib/python2.7/dist-packages/cothread/catools.py", line 739, in caget return caget_array(pvs, **kargs) File "/usr/lib/python2.7/dist-packages/cothread/catools.py", line 636, in caget_array for pv in pvs]) File "/usr/lib/python2.7/dist-packages/cothread/cothread.py", line 1047, in WaitForAll result.append(event.Wait(timeout)) File "/usr/lib/python2.7/dist-packages/cothread/cothread.py", line 661, in __run self.__function(*self.__args, **self.__kargs)) File "/usr/lib/python2.7/dist-packages/cothread/catools.py", line 122, in throw_wrapper return function(pv, *args, **kargs) File "/usr/lib/python2.7/dist-packages/cothread/catools.py", line 624, in caget_one return ca_timeout(done, timeout, pv) File "/usr/lib/python2.7/dist-packages/cothread/catools.py", line 149, in ca_timeout raise ca_nothing(name, cadef.ECA_TIMEOUT) cothread.catools.ca_nothing: SR:SDI2FA:C23{BPM3}ADMA-X: User specified timeout on IO operation expired # Global SDI data collection script import os import sys import h5py import matplotlib.pyplot as plt import time import datetime import cothread #from scipy import * #from numpy import * from cothread.catools import * #from cothread import Timedout # input parameters comment = sys.argv[1] save_dir = 'HLA_result' burst_len_sp = 11 # time to store data in CC buffer [s] record_len = 100000 # number of data to read from PVs update_n_check = 5 update_t_wait = 1 # start t0 = time.time() print('start: number of data: ' + str(record_len)) init_burst_len = caget('SR:SDI2FA{}BurstLen-SP') if (init_burst_len != burst_len_sp): caput('SR:SDI2FA{}BurstLen-SP', burst_len_sp) print(' set new burst length to ' + str(burst_len_sp) + ' s') else: print(' burst length: ' + str(init_burst_len) + ' s') # directories and filename if not(os.path.exists(save_dir)): os.mkdir(save_dir) suffix = datetime.datetime.now().strftime("%Y%m%d_%H%M_%S") filename = 'SR_CCSDI_FA_' + suffix + '_'+ comment + '.h5' # generate PVs # normal BPM prefix_data = [] prefix_bad = [] p_index = ['1','2','3','4','5','6'] Cell_index = ['30','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29'] for i in Cell_index: for j in p_index: prefix_data.append('SR:SDI2FA:C'+i+'{BPM'+j+'}') prefix_bad.append('SR:C'+i+'-APHLA{BPM:'+j+'}') # ID BPM (only upto 8 BPMs max) p_index = ['7','8'] Cell_index = ['02','03','04','05','07','08','10','11','12','16','17','18','19','21','23','28'] for i in Cell_index: for j in p_index: prefix_data.append('SR:SDI2FA:C'+i+'{BPM'+j+'}') prefix_bad.append('SR:C'+i+'-APHLA{BPM:'+j+'}') fa_x_pv = [] fa_y_pv = [] bad_x_pv = [] bad_y_pv = [] for i in range(len(prefix_data)): fa_x_pv.append(prefix_data[i] + 'ADMA-X') fa_y_pv.append(prefix_data[i] + 'ADMA-Y') bad_x_pv.append(prefix_bad[i] + 'PSD:BadX-Cmd') bad_y_pv.append(prefix_bad[i] + 'PSD:BadY-Cmd') # collect data I = caget('SR:C03-BI{DCCT:1}I:Total-I') # beam current fin_cnt = caget('SR:SDI2FA{}TrigCnt-I') # initial trigger count # read data from PVs print(' read data...') t = time.time() faX = caget(fa_x_pv, count=record_len) faY = caget(fa_y_pv, count=record_len) badX = caget(bad_x_pv) badY = caget(bad_y_pv) print(' (lasted ' + str(round(time.time() - t, 2)) + ' s)') # save .h5 file print(' save hdf file...') t = time.time() fid = h5py.File(os.path.join(save_dir, filename), 'w') fid['I'] = I fid['prefix'] = prefix_data fid['faX'] = faX fid['faY'] = faY fid['badX'] = badX fid['badY'] = badY fid['trig_cnt'] = fin_cnt fid.close() print(' (lasted ' + str(round(time.time() - t, 2)) + ' s)') print('complete...(' + str(round(time.time() - t0, 2)) + ' s)') |