Skip to content

Commit

Permalink
Tech Debt : Display proper error message when update pin map step is… (
Browse files Browse the repository at this point in the history
…#719)

* Tech Debt : Display proper error message when update pin map step is missing

* Rectify pipeline errors

* Fix :Update generator file

* Add : Efficient check

* Modify generator files

* Remove unwanted XML files

* Redo the sequence file

* Fix ;PR Comments

* Remove XML

* Fix:PR Isssues

* Add constants

* Change the cases

* Add example DAQmx

* CHange the variable name

* Rename python local variable
  • Loading branch information
prat-mahendran authored May 14, 2024
1 parent 89351d4 commit 437d4a5
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 45 deletions.
11 changes: 8 additions & 3 deletions examples/game_of_life/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nidaqmx_analog_input/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nidcpower_source_dc_voltage/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nidigital_spi/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nidmm_measurement/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nifgen_standard_function/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/niscope_acquire_waveform/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/niswitch_control_relays/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/nivisa_dmm_measurement/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/output_voltage_measurement/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
11 changes: 8 additions & 3 deletions examples/sample_measurement/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import click
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.

Expand All @@ -26,9 +28,12 @@ class TestStandSupport(object):
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
class TestStandSupport(object):
"""Class that communicates with TestStand."""

_PIN_MAP_ID_VAR = "NI.MeasurementLink.PinMapId"

def __init__(self, sequence_context: Any) -> None:
"""Initialize the TestStandSupport object.
Expand All @@ -26,9 +28,12 @@ def get_active_pin_map_id(self) -> str:
Returns:
The resource id of the pin map that is registered to the pin map service.
"""
return self._sequence_context.Execution.RunTimeVariables.GetValString(
"NI.MeasurementLink.PinMapId", 0x0
)
run_time_variables = self._sequence_context.Execution.RunTimeVariables
if not run_time_variables.Exists(self._PIN_MAP_ID_VAR, 0x0):
raise RuntimeError(
"Failed to retrieve the registered pin map ID. Possible reason: The sequence might not include an 'Update Pin Map' step."
)
return run_time_variables.GetValString(self._PIN_MAP_ID_VAR, 0x0)

def resolve_file_path(self, file_path: str) -> str:
"""Resolve the absolute path to a file using the TestStand search directories.
Expand Down

0 comments on commit 437d4a5

Please sign in to comment.