# except: # pass rmngr = RunManager( '../configuration.yaml') # TODO: get conf from EUDAQ pp.Configuring = True # check for start of run cmd from RunControl while not pp.StartingRun and not pp.Terminating: if pp.Configuring: break sleep(1) # check if we are starting: if pp.StartingRun: print "Starting run..." # join = rmngr.run_run(EudaqExtTriggerScan, run_conf=run_conf, use_thread=True) join = rmngr.run_run(EudaqExtTriggerScan, use_thread=True) sleep(5) pp.StartingRun = True # set status and send BORE # starting to run while join(timeout=1) is None: if pp.Error or pp.Terminating: rmngr.abort_current_run() if pp.StoppingRun: rmngr.stop_current_run() status = join() # abort conditions if status is not run_status.finished or pp.Error or pp.Terminating: pp.StoppingRun = False # set status and send EORE # check if the run is stopping regularly if pp.StoppingRun: pp.StoppingRun = True # set status and send EORE
# Each scan has a default configuration, which is defined inside the corresponding scan file in /host/pybar/scans/. It is not necessary to define scan parameters inside primlist file. # # Running single scan and changing scan parameters: join = runmngr.run_run(run=AnalogScan, run_conf={"scan_parameters": [('PlsrDAC', 500)], "n_injections": 1000}, use_thread=True) # run_run returns a function object when use_thread is True status = join() print 'Status:', status # will wait for scan to be finished and returns run status # # Or use a run configuration file: status = runmngr.run_run(run=AnalogScan, run_conf="run_configuration.txt") # using no thread print 'Status:', status # # Example for a loop: for gdac in range(50, 200, 10): join = runmngr.run_run(ExtTriggerGdacScan, run_conf={'scan_parameters': {'GDAC': gdac}}, use_thread=True) # use thread print 'Status:', join(timeout=5) # join has a timeout, return None if run has not yet finished runmngr.abort_current_run() # stopping/aborting run from outside if join() != run_status.finished: # status OK? print 'ERROR!' break # jump out # # After finishing the primlist/run: you will find the module data relative to the configuration.yaml file. # If configuration.yaml is in /host/pybar/ the module data will be /host/pybar/<module_id> (where <module_id> is given from configuration.yaml). # After finishing the first scan, FE configuration can be commented out in configuration.yaml (for that use '#'): # # (from configuration.yaml) # fe_configuration: # configuration : #config/fei4/configs/std_cfg_fei4a.cfg # ... # # The latest FE configuration (highest run number with status 'FINISHED') will be taken from module data folder if no FE configuration is given. # Instead of a path to FE configuration file, a run number (e.g. 5) can be entered to load a specific FE configuration:
# It is not necessary to add run parameters to the primlist file. If not given they are taken from the default run configuration (_default_run_conf). # # Running a single scan and changing default run configuration (_default_run_conf): join = runmngr.run_run(run=AnalogScan, run_conf={"scan_parameters": [('PlsrDAC', 500)], "n_injections": 1000}, use_thread=True) # run_run returns a function object when use_thread is True status = join() # waiting here for finishing the run, press Ctrl-C to abort the run at any time print 'Status:', status # will wait for run to be finished and returns run status # # Or use a run configuration file: status = runmngr.run_run(run=AnalogScan, run_conf="example_run_manager_run_config.txt") # using no thread print 'Status:', status # # Example for a loop of runs, which is failing: for delay in range(14, 50, 16): join = runmngr.run_run(ExtTriggerScan, run_conf={"trigger_delay": delay, "no_data_timeout": 60}, use_thread=True) # use thread print 'Status:', join(timeout=5) # join has a timeout, return None if run has not yet finished runmngr.abort_current_run("Calling abort_current_run(). This scan was aborted by intention") # stopping/aborting run from outside (same effect has Ctrl-C) if join() != run_status.finished: # status OK? print 'ERROR! This error was made by intention!' break # jump out # # The configuration.yaml can be extended to change the default run parameters for each scan: # # (from configuration.yaml) # AnalogScan: # scan_parameters : {'PlsrDAC': 100} # inject 100 PlsrDAC # enable_shift_masks : ["Enable", "C_Low"] # use C_Low only # # It is recommended to keep a copy of configuration.yaml for each module. # # Feel free to modify / change / update the code :-) #
# run_conf[item] = pp.GetConfigParameter(item) # except: # pass rmngr = RunManager("../configuration.yaml") # TODO: get conf from EUDAQ pp.Configuring = True # check for start of run cmd from RunControl while not pp.StartingRun and not pp.Terminating: if pp.Configuring: break sleep(1) # check if we are starting: if pp.StartingRun: print "Starting run..." # join = rmngr.run_run(EudaqExtTriggerScan, run_conf=run_conf, use_thread=True) join = rmngr.run_run(EudaqExtTriggerScan, use_thread=True) sleep(5) pp.StartingRun = True # set status and send BORE # starting to run while join(timeout=1) is None: if pp.Error or pp.Terminating: rmngr.abort_current_run() if pp.StoppingRun: rmngr.stop_current_run() status = join() # abort conditions if status is not run_status.finished or pp.Error or pp.Terminating: pp.StoppingRun = False # set status and send EORE # check if the run is stopping regularly if pp.StoppingRun: pp.StoppingRun = True # set status and send EORE
run_conf="example_run_manager_run_config.txt") # using no thread print 'Status:', status # # Example for a loop of runs, which is failing: for delay in range(14, 50, 16): join = runmngr.run_run(ExtTriggerScan, run_conf={ "trigger_delay": delay, "no_data_timeout": 60 }, use_thread=True) # use thread print 'Status:', join( timeout=5 ) # join has a timeout, return None if run has not yet finished runmngr.abort_current_run( "Calling abort_current_run(). This scan was aborted by intention" ) # stopping/aborting run from outside (same effect has Ctrl-C) if join() != run_status.finished: # status OK? print 'ERROR! This error was made by intention!' break # jump out # # The configuration.yaml can be extended to change the default run parameters for each scan: # # (from configuration.yaml) # AnalogScan: # scan_parameters : {'PlsrDAC': 100} # inject 100 PlsrDAC # enable_shift_masks : ["Enable", "C_Low"] # use C_Low only # # It is recommended to keep a copy of configuration.yaml for each module. # # Feel free to modify / change / update the code :-)
status = runmngr.run_run( run=AnalogScan, run_conf="run_configuration.txt") # using no thread print 'Status:', status # # Example for a loop of scans, which is failing: for delay in range(14, 50, 16): join = runmngr.run_run(ExtTriggerScan, run_conf={ "trigger_delay": delay, "no_data_timeout": 60 }, use_thread=True) # use thread print 'Status:', join( timeout=5 ) # join has a timeout, return None if run has not yet finished runmngr.abort_current_run( ) # stopping/aborting run from outside (same effect has Ctrl-C) if join() != run_status.finished: # status OK? print 'ERROR!' break # jump out # # After finishing the primlist/run: you will find the module data relative to the configuration.yaml file. # If configuration.yaml is in /host/pybar/ the module data will be /host/pybar/<module_id> (where <module_id> is defined inside configuration.yaml). # After finishing the first scan, the FE flavor can be commented out in configuration.yaml (for that use '#'): # # (from configuration.yaml) # fe_configuration : # fei4a # ... # # If fe_configuration is not given, the latest valid FE configuration will be taken (highest run number with status 'FINISHED'). # To load a specific configuration file, a path to FE configuration file or a run number (e.g. 5) can be used: #