File tree Expand file tree Collapse file tree
nidcpower_source_dc_voltage Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515
1616import ni_measurementlink_service as nims
1717
18-
1918NIDCPOWER_WAIT_FOR_EVENT_TIMEOUT_ERROR_CODE = - 1074116059
2019NIDCPOWER_TIMEOUT_EXCEEDED_ERROR_CODE = - 1074097933
2120
@@ -72,7 +71,10 @@ def measure(
7271 context = measurement_service .context .pin_map_context ,
7372 pin_or_relay_names = pin_names ,
7473 instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_DCPOWER ,
75- timeout = - 1 ,
74+ # If another measurement is using the session, wait for it to complete.
75+ # Specify a timeout to aid in debugging missed unreserve calls.
76+ # Long measurements may require a longer timeout.
77+ timeout = 60 ,
7678 )
7779 )
7880
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ def create_nidcpower_sessions(pin_map_id: str):
3333 with session_management_client .reserve_sessions (
3434 context = pin_map_context ,
3535 instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_DCPOWER ,
36- timeout = - 1 ,
36+ # This code module sets up the sessions, so error immediately if they are in use.
37+ timeout = 0 ,
3738 ) as reservation :
38-
3939 for session_info in reservation .session_info :
4040 grpc_options = nidcpower .GrpcSessionOptions (
4141 grpc_channel_pool .get_grpc_device_channel (
@@ -61,7 +61,9 @@ def destroy_nidcpower_sessions():
6161 )
6262
6363 with session_management_client .reserve_all_registered_sessions (
64- instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_DCPOWER , timeout = - 1
64+ instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_DCPOWER ,
65+ # This code module sets up the sessions, so error immediately if they are in use.
66+ timeout = 0 ,
6567 ) as reservation :
6668 session_management_client .unregister_sessions (reservation .session_info )
6769
Original file line number Diff line number Diff line change @@ -80,7 +80,10 @@ def measure(
8080 context = measurement_service .context .pin_map_context ,
8181 pin_or_relay_names = [pin_name ],
8282 instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_DMM ,
83- timeout = - 1 ,
83+ # If another measurement is using the session, wait for it to complete.
84+ # Specify a timeout to aid in debugging missed unreserve calls.
85+ # Long measurements may require a longer timeout.
86+ timeout = 60 ,
8487 )
8588 )
8689
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ def create_nidmm_sessions(pin_map_id: str):
3333 with session_management_client .reserve_sessions (
3434 context = pin_map_context ,
3535 instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_DMM ,
36- timeout = - 1 ,
36+ # This code module sets up the sessions, so error immediately if they are in use.
37+ timeout = 0 ,
3738 ) as reservation :
38-
3939 for session_info in reservation .session_info :
4040 grpc_options = nidmm .GrpcSessionOptions (
4141 grpc_channel_pool .get_grpc_device_channel (nidmm .GRPC_SERVICE_INTERFACE_NAME ),
@@ -57,7 +57,9 @@ def destroy_nidmm_sessions():
5757 )
5858
5959 with session_management_client .reserve_all_registered_sessions (
60- instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_DMM , timeout = - 1
60+ instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_DMM ,
61+ # This code module sets up the sessions, so error immediately if they are in use.
62+ timeout = 0 ,
6163 ) as reservation :
6264 session_management_client .unregister_sessions (reservation .session_info )
6365
Original file line number Diff line number Diff line change @@ -87,7 +87,10 @@ def cancel_callback():
8787 context = measurement_service .context .pin_map_context ,
8888 pin_or_relay_names = [pin_name ],
8989 instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_FGEN ,
90- timeout = - 1 ,
90+ # If another measurement is using the session, wait for it to complete.
91+ # Specify a timeout to aid in debugging missed unreserve calls.
92+ # Long measurements may require a longer timeout.
93+ timeout = 60 ,
9194 )
9295 )
9396
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ def create_nifgen_sessions(pin_map_id: str):
3333 with session_management_client .reserve_sessions (
3434 context = pin_map_context ,
3535 instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_FGEN ,
36- timeout = - 1 ,
36+ # This code module sets up the sessions, so error immediately if they are in use.
37+ timeout = 0 ,
3738 ) as reservation :
38-
3939 for session_info in reservation .session_info :
4040 grpc_options = nifgen .GrpcSessionOptions (
4141 grpc_channel_pool .get_grpc_device_channel (nifgen .GRPC_SERVICE_INTERFACE_NAME ),
@@ -61,7 +61,9 @@ def destroy_nifgen_sessions():
6161 )
6262
6363 with session_management_client .reserve_all_registered_sessions (
64- instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_FGEN , timeout = - 1
64+ instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_FGEN ,
65+ # This code module sets up the sessions, so error immediately if they are in use.
66+ timeout = 0 ,
6567 ) as reservation :
6668 session_management_client .unregister_sessions (reservation .session_info )
6769
Original file line number Diff line number Diff line change @@ -114,7 +114,10 @@ def cancel_callback():
114114 context = measurement_service .context .pin_map_context ,
115115 pin_or_relay_names = pin_names ,
116116 instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_SCOPE ,
117- timeout = - 1 ,
117+ # If another measurement is using the session, wait for it to complete.
118+ # Specify a timeout to aid in debugging missed unreserve calls.
119+ # Long measurements may require a longer timeout.
120+ timeout = 60 ,
118121 )
119122 )
120123
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ def create_niscope_sessions(pin_map_id: str):
3333 with session_management_client .reserve_sessions (
3434 context = pin_map_context ,
3535 instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_SCOPE ,
36- timeout = - 1 ,
36+ # This code module sets up the sessions, so error immediately if they are in use.
37+ timeout = 0 ,
3738 ) as reservation :
38-
3939 for session_info in reservation .session_info :
4040 grpc_options = niscope .GrpcSessionOptions (
4141 grpc_channel_pool .get_grpc_device_channel (niscope .GRPC_SERVICE_INTERFACE_NAME ),
@@ -57,7 +57,9 @@ def destroy_niscope_sessions():
5757 )
5858
5959 with session_management_client .reserve_all_registered_sessions (
60- instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_SCOPE , timeout = - 1
60+ instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_SCOPE ,
61+ # This code module sets up the sessions, so error immediately if they are in use.
62+ timeout = 0 ,
6163 ) as reservation :
6264 session_management_client .unregister_sessions (reservation .session_info )
6365
Original file line number Diff line number Diff line change @@ -49,7 +49,10 @@ def measure(
4949 context = measurement_service .context .pin_map_context ,
5050 pin_or_relay_names = relay_list ,
5151 instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_RELAY_DRIVER ,
52- timeout = - 1 ,
52+ # If another measurement is using the session, wait for it to complete.
53+ # Specify a timeout to aid in debugging missed unreserve calls.
54+ # Long measurements may require a longer timeout.
55+ timeout = 60 ,
5356 )
5457 )
5558
Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ def create_niswitch_sessions(pin_map_id: str):
3333 with session_management_client .reserve_sessions (
3434 context = pin_map_context ,
3535 instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_RELAY_DRIVER ,
36- timeout = - 1 ,
36+ # This code module sets up the sessions, so error immediately if they are in use.
37+ timeout = 0 ,
3738 ) as reservation :
38-
3939 for session_info in reservation .session_info :
4040 grpc_options = niswitch .GrpcSessionOptions (
4141 grpc_channel_pool .get_grpc_device_channel (niswitch .GRPC_SERVICE_INTERFACE_NAME ),
@@ -59,7 +59,9 @@ def destroy_niswitch_sessions():
5959 )
6060
6161 with session_management_client .reserve_all_registered_sessions (
62- instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_RELAY_DRIVER , timeout = - 1
62+ instrument_type_id = nims .session_management .INSTRUMENT_TYPE_NI_RELAY_DRIVER ,
63+ # This code module sets up the sessions, so error immediately if they are in use.
64+ timeout = 0 ,
6365 ) as reservation :
6466 session_management_client .unregister_sessions (reservation .session_info )
6567
You can’t perform that action at this time.
0 commit comments