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

Off by one error in measure step_values when _SKIP_ is true #5140

Closed
macumber opened this issue Apr 9, 2024 · 5 comments
Closed

Off by one error in measure step_values when _SKIP_ is true #5140

macumber opened this issue Apr 9, 2024 · 5 comments

Comments

@macumber
Copy link
Contributor

macumber commented Apr 9, 2024

Issue overview

When adding measures to a workflow, there is a special SKIP argument that can be used to skip running a measure. Setting SKIP to true results in step_values being added to the wrong measure in the out.osw file for subsequent measures in the workflow.

Current Behavior

step_values are associated with the wrong measure in out.osw when a measure is skipped

Expected Behavior

step_values should be associated with the correct measure in out.osw when a measure is skipped

Steps to Reproduce

  1. Unzip MixedUpStepsSkip.zip
  2. openstudio.exe run -w workflow.osw
  3. The step_results should be associated with the correct measure indexes but they are off by one when a measure is skipped
  4. Additionally, [openstudio.measure.OSRunner] <Error> Not prepared for step is shown when measure is skipped

Possible Solution

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version): Windows 11
  • Version of OpenStudio (if using an intermediate build, include SHA): 3.7.0

Context

Parsing of results in out.osw file broken for test suite

@macumber macumber added the Triage Issue needs to be assessed and labeled, further information on reported might be needed label Apr 9, 2024
@macumber
Copy link
Contributor Author

macumber commented Apr 9, 2024

This does not affect the classic CLI.

@DavidGoldwasser DavidGoldwasser added this to the OpenStudio SDK 3.8.0 milestone Apr 11, 2024
@DavidGoldwasser DavidGoldwasser added component - Measures component - Workflow and removed Triage Issue needs to be assessed and labeled, further information on reported might be needed labels Apr 11, 2024
@jmarrec
Copy link
Collaborator

jmarrec commented Apr 12, 2024

Aren't TODOs a great way to remind you to finish something and never actually do it?

// TODO: handling of SKIP is incomplete here, will need to increment the runner and co, and not process the measure

Edit: hem, I thought I did it though here:

const bool skip_measure = isStepMarkedSkip(stepArgs);
if (skip_measure || runner.halted()) { // TODO: or halted
if (!energyplus_output_requests) {
if (runner.halted()) {
LOG(Info, fmt::format("Skipping measure '{}' because simulation halted", measureDirName));
} else {
LOG(Info, fmt::format("Skipping measure '{}'", measureDirName));
WorkflowStepResult result = runner.result();
runner.incrementStep();
// addResultMeasureInfo(result, bclMeasure); // TODO: Should I really instantiate the BCLMeasure just for this?
result.setStepResult(StepResult::Skip);
}

@jmarrec
Copy link
Collaborator

jmarrec commented Apr 12, 2024

Ok yeah, I need to prepareForMeasureRun before I can set the step Result and increment the step

jmarrec added a commit that referenced this issue Apr 12, 2024
…true

* Move logic to Variant::isTruish to determine if a variant is trueish (whether that's bool true, str = "true", int != 0, double != 0.0
* Add  a OSRunner::prepareForMeasureRun() that takes no arg, protected, and friend OSWorkflow so we can use it without the penatly of instantiating an OSMeasure
* In Apply Measure, when __SKIP__, correctly call prepareForMEasureRun before incrementing the step. And do load the BCLMeasure to write the resultInfo like the workflow-gem was doing
@jmarrec
Copy link
Collaborator

jmarrec commented Apr 12, 2024

c6ff09c fixes it. I tested locally.

image

@macumber
Copy link
Contributor Author

Thanks @jmarrec !

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

No branches or pull requests

3 participants