Callbacks

Callbacks methods are optional methods that can be implemented within a scan. These methods are then called by the scan framework at certain points within the life cycle of a scan which allows you to execute code at predefined stages of the scan.

User Callbacks

User callbacks can be implemented in any scan that you write. The most commonly used callbacks are prepare_scan(), initialize_devices(), set_scan_point(), and cleanup(). These callbacks should allow you to accomplish what what is needed the majority of the time. Additional callbacks are available for more advanced usage. Below is a list of all available callbacks listed in order of execution.

Notes:
  • Names below wrapped in [] are in fact iterface methods, and not strictly callbacks. They are included here to show the complete order of execution of both interface methods and callback methods. See Methods Available to a Scan for additional information on interface methods.

  • Callbacks indicated as “Runs On: portable” run on the core device unless run_on_core is set to False, or _run_scan_host is called manually.

In order of execution, all callbacks available to a scan are:

Callback
Has Default
Behavior?
Runs On
Scan Stage
Runs When
Scan is Resumed?

[create_logger]

yes

host

__init__

no

[build]

yes

host

__init__

no

[get_scan_points]

sometimes

host

initialization

no

[get_warmup_points]

yes

host

initialization

no

[report]

yes

host

initialization

yes

prepare_scan

no

host

initialization

yes

lab_prepare_scan

no

host

initialization

yes

before_scan

no

host

initialization

yes

lab_before_scan_core

no

core device

scan loop

yes

initialize_devices

no

portable

scan loop

yes

before_pass

no

portable

scan loop

no

[warmup]

yes

portable

scan loop

yes

offset_point

no

portable

scan loop

yes

set_scan_point

no

portable

scan loop

yes

before_measure

no

portable

scan loop

yes

lab_before_measure

no

portable

scan loop

yes

[measure]

no

portable

scan loop

yes

after_measure

no

portable

scan loop

yes

lab_after_measure

no

portable

scan loop

yes

[mutate_datasets]

yes

host

scan loop

yes

before_calculate

no

host (via RPC)

scan loop

yes

after_scan_point

no

portable

scan loop

yes

[_set_counts]

yes

host (via RPC)

scan loop

yes

cleanup

no

portable

scan loop

yes

after_scan_core

no

core device

scan loop

yes

lab_after_scan_core

no

core device

scan loop

yes

after_scan

no

host

analysis

yes

[_analyze]

yes

host

analysis

yes

before_analyze

no

host

analysis

yes

before_fit

no

host

analysis

yes

after_fit

no

host

analysis

yes

report_fit

yes

host

analysis

yes

lab_after_scan

no

host

analysis

yes

Extension Callbacks

Extension callbacks are implemented by scan extension class of the scan framework and should not be implmented in user scan classes.

Callback
Has Default
Behavior?
Runs On
Scan Stage
Runs When
Scan is Resumed?

_add_processors

no

host

initialization

no

_scan_arguments

no

host

initialization

no

_map_arguments

no

host

initialization

no

_before_loop

no

portable

scan loop

yes

_after_scan_point

no

portable

scan loop

yes

_analyze_data

no

portable

scan loop

yes