Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_simulation_option cmd line option in examples has no effect #395

Closed
synesthetize opened this issue Sep 21, 2023 · 4 comments · Fixed by #442 or #446
Closed

use_simulation_option cmd line option in examples has no effect #395

synesthetize opened this issue Sep 21, 2023 · 4 comments · Fixed by #442 or #446
Assignees
Labels
bug Something isn't working

Comments

@synesthetize
Copy link
Collaborator

synesthetize commented Sep 21, 2023

Bug Report

The use_simulation_option (aka --use-simulation/--no-use-simulation) cmd line option has no effect on scope example, and possibly other examples. Even when the --no-use-simulation option was specified when starting up the measurement service IO Trace showed session initialization was specifying Simulate=1, and the captured data from the scope was clearly simulated data. This would occur as long as USE_SIMULATION in _constants.py was true.

Repro or Code Sample

The main culprit from what I can gather is that this line in the _niscope_helpers.py which relies solely on a value defined in _constants.py. Since this doesn't check the values coming from the cmd line there's no way for it to be accounted for during session creation.

Expected Behavior

I would expect --use-simulation/--no-use-simulation to either affect the session behavior, or to not exist as a cmd line arg since this behavior appears to be controlled by the USE_SIMULATION value in _constants.py

Current Behavior

py measurement.py --help will list --use-simulation/--no-use-simulation as potential args but these args don't have any affect on the session creation behavior.

e.g.
USE_SIMULATION = true + --no-use-simulation will create simulated sessions
USE_SIMULATION = false + --use-simulation will create real hw sessions

Possible Solution

Remove use_simulation_option as a cmd line arg since this behavior is already controlled by a value in another file.

Context

Your Environment

  • OS & Device: Windows PC
  • ni-measurementlink-service version [e.g. 0.12.3]
  • MeasurementLink version =>23.8.0d697
  • Python version => 3.11

AB#2529511

@synesthetize synesthetize added the bug Something isn't working label Sep 21, 2023
@bkeryan
Copy link
Collaborator

bkeryan commented Sep 21, 2023

This issue was introduced when the _nifoo_helpers.py files were introduced in #284

I don't recommend fixing the command line option now, because the driver-specific helper functions will be deleted when we retrofit to use the updated session management API. I guess deleting the command line option is ok, though.

@dixonjoel
Copy link
Collaborator

#348 updated all the readmes for examples to instruct using _constants.py to change the behavior of simulation. I don't know of any instructions to use the command-line option. So I think I'll create a PR just removing the decorator for the command-line option.

@bkeryan
Copy link
Collaborator

bkeryan commented Sep 28, 2023

My current plan is to move this configuration into the .env file.

@bkeryan
Copy link
Collaborator

bkeryan commented Oct 13, 2023

The command line option was removed in #442 #446

We will remove the code from _helpers.py in AB#2552336

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment