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

Fix #5030 - C++ CLI: run.log is huge and missing the runner.registerWarning messages #5035

Merged
merged 11 commits into from
Nov 15, 2023

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Nov 14, 2023

Pull request overview

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@jmarrec jmarrec added component - CLI Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labs labels Nov 14, 2023
@jmarrec jmarrec self-assigned this Nov 14, 2023
@jmarrec jmarrec requested a review from kbenne November 14, 2023 01:14
Comment on lines +187 to +195
if not is_labs:
pytest.skip("classic (Ruby) CLI just ignored the top level --verbose flag for run.log")
assert 50 < len(run_log.splitlines()) < 100
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you did openstudio --verbose run -w workflow.osw , would you expect the run.log to contain Debug log messages?

As a reminder, we have ALL these ways of callling the CLI

openstudio --verbose ...
openstudio run --debug ...
openstudio run -w workflow.osw with workflow.osw having "run_options" > debug in there
# Labs only
openstudio --loglevel Debug ...

Follow up question: knowing that the Ruby CLI just didn’t set the run.log to Debug in that case (it only cares about run --debug ), would you:

  • A) Use the historical behavior.
  • B) Change it to respect the top level log level flag.
    • if --debug is passed, it will increase the log level to Debug if not already, but for openstudio --loglevel Trace run --debug -w in.osw , the Log Level for stdout and run.log would stay at Trace)

Copy link
Contributor

@kbenne kbenne Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is going to be merged into our imminent release, then I think we need to take option A and mirror the historical behavior (plus now the --loglevel option).

However, I think post release (and early in the cycle) we should make a change to remove the logging option under the run subcommand.

@brianlball @shorowit @joseph-robertson @DavidGoldwasser

Comment on lines +277 to +280
/** Whether registerInfo, registerWarning, registerError, registerInitialCondition, registerFinalCondition and registerAsNotApplicable
* also LOG an actual message */
bool registerMsgAlsoLogs() const;
void setRegisterMsgAlsoLogs(bool registerMsgAlsoLogs);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like option like this is just punting on making a decision. I think I would prefer that we just make a call one way or the other and avoid giving an option like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until we remove the Ruby CLI (classic), we need an option, otherwise if always enabled, it'll log TWICE int he ruby cli

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok.

@@ -78,6 +80,8 @@ OSWorkflow::OSWorkflow(const WorkflowRunOptions& t_workflowRunOptions, ScriptEng
m_add_timings(t_workflowRunOptions.add_timings),
m_style_stdout(t_workflowRunOptions.style_stdout) {

runner.setRegisterMsgAlsoLogs(true);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…ow log level

```
openstudio --verbose
openstudio --loglevel Debug
openstudio run --debug ...
openstudio run -w workflow.osw with workflow.osw having “run_options” > debug in there
```
Address some of @shorowit's reports:
* Remove debug print for numArs
* stdout-energyplus is a one-liner on windows
* EnergyPlus <status> is printed twice (one by E+, one by us after parsing), so alter message
…`No valid weather file defined in either the osm or osw.`

> The old CLI always used to print warnings (e.g., `[17:21:45.141997 WARN] No valid weather file defined in either the osm or osw.`) to stdout, though I don't know if that's important. Just pointing it out as a difference. Some users might expect that behavior?

Reported by @shorowit
…amples is installed, and I don't want these tests
…code=1

@shorowit reported:
> One of our unit tests is failing because the OS CLI is returning an exit code of 0 instead of 1 for a case where a reporting measure returns false.
Copy link
Contributor

@kbenne kbenne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this need to merge before release, but after release I think we should gather togethor and talk about the big picture of logging. Perhaps a wiki document or something to outline the design of logging in OpenStudio CLI and Workflow would be helpful. It is getting hard for me to track the options and I'm guessing I'm not the only one.

@brianlball
Copy link
Contributor

yeah, it would also be good to do a quick study on the performance impact of logging. I've seen performance go to sh*t when there is too much logging going on, espically with runner.registerINFO etc

@jmarrec jmarrec merged commit dc35f3e into develop Nov 15, 2023
5 of 6 checks passed
@jmarrec jmarrec deleted the 5030-logger_issues branch November 15, 2023 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - CLI labs Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C++ CLI: run.log is huge and missing the runner.registerWarning messages
4 participants