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 issues with MeasureManager #720

Merged
merged 41 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fd8611d
Merge pull request #710 from openstudiocoalition/develop
macumber Apr 14, 2024
64121ee
Add loading tab to discourage selecting another measure which argumen…
macumber Jul 5, 2024
7ed4df8
Fix clang format
macumber Jul 5, 2024
7fc6f69
Merge remote-tracking branch 'remotes/origin/develop' into measure_fixes
macumber Jul 11, 2024
57d0a60
Update openstudio_results to version compatible with OS CLI 3.8.0
macumber Jul 12, 2024
2ddc96e
Add Example->Shoebox Model
macumber Jul 12, 2024
d242c14
Add model and measures for shoebox example
macumber Jul 12, 2024
05f8f2c
Catch exceptions if measures in upgraded model have measures that no …
macumber Jul 12, 2024
3eac9db
Clang format
macumber Jul 12, 2024
cd2ac09
Do not automatically update the results measure from BCL
macumber Jul 13, 2024
b10bf89
Measure in local bcl might not work either
macumber Jul 13, 2024
ee7d527
Update sha for OS 3.8.0 tag
macumber Jul 13, 2024
94f2cf1
Correct sha for 3.7.0 release
macumber Jul 13, 2024
d198bcf
Bump after changing merge base to master
macumber Jul 13, 2024
b12bd77
Update to SHA of assets for 3.7.0
macumber Jul 14, 2024
23b0ca3
Download latest (unreleased) conan.cmake file, try boost 1.84 on ARM …
macumber Jul 14, 2024
255f4cb
Temporarily limit to mac arm
macumber Jul 14, 2024
c1df727
Try latest version of boost 1.79 recipe
macumber Jul 14, 2024
d677d83
Also comment out these matrix items
macumber Jul 14, 2024
e6c8beb
Looks like the only option is to fork the boost recipe and delete thi…
macumber Jul 14, 2024
f11f20b
Set XCode SDK version
macumber Jul 14, 2024
a6efa4f
Test changes on all runners
macumber Jul 14, 2024
243ea30
Update measures from BCL
macumber Jul 14, 2024
6ae468f
Remove unused/duplicate method downloadUpdatedBCLMeasures
macumber Jul 14, 2024
65d6505
Move standardReportMeasure to MeasureManager, test updates to measure…
macumber Jul 14, 2024
223964d
Clang format
macumber Jul 14, 2024
65af11b
Remove unused m_useClassicCLI, cannot use classic CLI for MeasureMana…
macumber Jul 14, 2024
5f8d3b9
Merge remote-tracking branch 'origin/v1.7.2-patch' into measure_fixes
macumber Jul 14, 2024
ddc371f
Update translations
macumber Jul 14, 2024
df63e23
Remove measure from disk when deleting last step using it
macumber Jul 14, 2024
10eb8f7
Merge pull request #723 from openstudiocoalition/v1.7.2-patch
jmarrec Jul 15, 2024
c670790
Merge remote-tracking branch 'remotes/origin/master' into measure_fixes
macumber Jul 15, 2024
0feb782
Remove workarounds now that https://github.com/NREL/OpenStudio/pull/5…
macumber Jul 20, 2024
f83e1cb
Remove Shoebox Model from repo, fetch at configure time
macumber Jul 21, 2024
49e8cc2
Remove openstudio_results measure from repo, install from the openstu…
macumber Jul 21, 2024
06a3a6b
Find openstudio_results and ShoeboxModel when running in build dir
macumber Jul 21, 2024
53cfba1
Add measure type badges to workflow steps
macumber Jul 21, 2024
ba11995
Measure manager changed argument to update_measures from measure_dir …
macumber Jul 21, 2024
94e5e12
Merge remote-tracking branch 'origin/develop' into measure_fixes
macumber Jul 21, 2024
dcbdb87
Merge remote-tracking branch 'origin/develop' into measure_fixes
macumber Jul 21, 2024
da2d1ed
Clang format
macumber Jul 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/app_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
BINARY_PKG_PATH: _CPack_Packages/Darwin/IFW
COMPRESSED_PKG_PATH: _CPack_Packages/Darwin/TGZ
MACOSX_DEPLOYMENT_TARGET: 11.0
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
SDKROOT: /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
QT_OS_NAME: mac
QT_ARCH: clang_64
- os: macos-arm64
Expand All @@ -77,7 +77,7 @@ jobs:
BINARY_PKG_PATH: _CPack_Packages/Darwin/IFW
COMPRESSED_PKG_PATH: _CPack_Packages/Darwin/TGZ
MACOSX_DEPLOYMENT_TARGET: 12.1
SDKROOT: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
SDKROOT: /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
QT_OS_NAME: mac
QT_ARCH: arm_64

Expand Down Expand Up @@ -174,6 +174,9 @@ jobs:
echo "Using previously installed ninja and IFW"
echo "/Users/irvinemac/Qt/Tools/QtInstallerFramework/4.3/bin/" >> $GITHUB_PATH
else
echo "Setting Xcode version"
sudo xcode-select -s "/Applications/Xcode_15.0.1.app/Contents/Developer/"

echo "Using brew to install ninja"
brew install ninja md5sha1sum ccache

Expand Down
78 changes: 48 additions & 30 deletions src/openstudio_app/OpenStudioApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ OpenStudioApp::OpenStudioApp(int& argc, char** argv)
waitDialog->show();
emit resetWaitDialog();

measureManager().setResourcesPath(resourcesPath());

// Non blocking
startMeasureManagerProcess();

Expand Down Expand Up @@ -266,14 +268,11 @@ void OpenStudioApp::onMeasureManagerAndLibraryReady() {
msgBox.setText(tr("Failed to start the Measure Manager. Would you like to keep waiting?"));
msgBox.setStandardButtons(QMessageBox::Retry | QMessageBox::Close);
if (msgBox.exec() == QMessageBox::Close) {
// this is a fatal error, application will close
showFailedMeasureManagerDialog();
QCoreApplication::exit();
return;
} else {
measureManager().waitForStarted(10000);
++currentTry;
// user can cancel out of this quit, turns into retry
quit();
}
measureManager().waitForStarted(10000);
++currentTry;
}
LOG(Info, "Recovered from Measure Manager problem, managed to start it on try " << currentTry
<< " at: " << toString(measureManager().url().toString()));
Expand Down Expand Up @@ -1174,8 +1173,9 @@ void OpenStudioApp::readSettings() {
setLastPath(settings.value("lastPath", QDir::homePath()).toString());
setDviewPath(openstudio::toPath(settings.value("dviewPath", "").toString()));
m_currLang = settings.value("language", "en").toString();
m_useClassicCLI = settings.value("useClassicCLI", false).toBool();
LOG_FREE(Debug, "OpenStudioApp", "\n\n\nm_currLang=[" << m_currLang.toStdString() << "], m_useClassicCLI=" << m_useClassicCLI << "\n\n\n");
LOG_FREE(Debug, "OpenStudioApp",
"\n\n\nm_currLang=[" << m_currLang.toStdString() << "]"
<< "\n\n\n");
if (m_currLang.isEmpty()) {
m_currLang = "en";
}
Expand Down Expand Up @@ -1246,6 +1246,7 @@ void OpenStudioApp::connectOSDocumentSignals() {
connect(m_osDocument.get(), &OSDocument::changeLanguageClicked, this, &OpenStudioApp::changeLanguage);
connect(m_osDocument.get(), &OSDocument::loadLibraryClicked, this, &OpenStudioApp::loadLibrary);
connect(m_osDocument.get(), &OSDocument::loadExampleModelClicked, this, &OpenStudioApp::loadExampleModel);
connect(m_osDocument.get(), &OSDocument::loadShoeboxModelClicked, this, &OpenStudioApp::loadShoeboxModel);
connect(m_osDocument.get(), &OSDocument::newClicked, this, &OpenStudioApp::newModel);
connect(m_osDocument.get(), &OSDocument::helpClicked, this, &OpenStudioApp::showHelp);
connect(m_osDocument.get(), &OSDocument::checkForUpdateClicked, this, &OpenStudioApp::checkForUpdate);
Expand All @@ -1267,6 +1268,7 @@ void OpenStudioApp::disconnectOSDocumentSignals() {
disconnect(m_osDocument.get(), &OSDocument::configureExternalToolsClicked, this, &OpenStudioApp::configureExternalTools);
disconnect(m_osDocument.get(), &OSDocument::loadLibraryClicked, this, &OpenStudioApp::loadLibrary);
disconnect(m_osDocument.get(), &OSDocument::loadExampleModelClicked, this, &OpenStudioApp::loadExampleModel);
disconnect(m_osDocument.get(), &OSDocument::loadShoeboxModelClicked, this, &OpenStudioApp::loadShoeboxModel);
disconnect(m_osDocument.get(), &OSDocument::newClicked, this, &OpenStudioApp::newModel);
disconnect(m_osDocument.get(), &OSDocument::helpClicked, this, &OpenStudioApp::showHelp);
disconnect(m_osDocument.get(), &OSDocument::checkForUpdateClicked, this, &OpenStudioApp::checkForUpdate);
Expand All @@ -1286,19 +1288,18 @@ void OpenStudioApp::measureManagerProcessFinished() {
QByteArray stdErr = m_measureManagerProcess->readAllStandardError();
QByteArray stdOut = m_measureManagerProcess->readAllStandardOutput();

QString text = tr("Measure Manager has crashed, attempting to restart. Do you want to reset Measure Manager settings?");
QString text = tr("Measure Manager has crashed. Do you want to retry?");
QString detailedText;
detailedText += stdErr;
detailedText += stdOut;

QMessageBox messageBox(QMessageBox::Warning, tr("Measure Manager Crashed"), text, QMessageBox::RestoreDefaults | QMessageBox::Close, mainWidget(),
QMessageBox messageBox(QMessageBox::Critical, tr("Measure Manager Crashed"), text, QMessageBox::Retry | QMessageBox::Close, mainWidget(),
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
messageBox.setDetailedText(detailedText);

if (messageBox.exec() == QMessageBox::RestoreDefaults) {
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
settings.setValue("useClassicCLI", true);
m_useClassicCLI = true;
if (messageBox.exec() == QMessageBox::Close) {
// user can cancel out of quit, turns into retry
quit();
}

startMeasureManagerProcess();
Expand Down Expand Up @@ -1351,9 +1352,7 @@ void OpenStudioApp::startMeasureManagerProcess() {
const QString program = toQString(openstudioCLIPath());
QStringList arguments;

if (m_useClassicCLI) {
arguments << "classic";
}
// MeasureManager does not work in classic CLI https://github.com/NREL/OpenStudio/issues/5212
arguments << "measure";
arguments << "-s";
arguments << portString;
Expand Down Expand Up @@ -1561,6 +1560,37 @@ void OpenStudioApp::loadExampleModel() {
OpenStudioApp::setQuitOnLastWindowClosed(wasQuitOnLastWindowClosed);
}

void OpenStudioApp::loadShoeboxModel() {

bool wasQuitOnLastWindowClosed = OpenStudioApp::quitOnLastWindowClosed();
OpenStudioApp::setQuitOnLastWindowClosed(false);

if (m_osDocument) {
if (!closeDocument()) {
OpenStudioApp::setQuitOnLastWindowClosed(wasQuitOnLastWindowClosed);
return;
}
processEvents();
}

osversion::VersionTranslator versionTranslator;
versionTranslator.setAllowNewerVersions(false);

auto filePath = resourcesPath() / toPath("ShoeboxModel/ShoeboxExample.osm");
boost::optional<openstudio::model::Model> model = versionTranslator.loadModel(filePath);
if (model) {
m_osDocument = std::make_shared<OSDocument>(componentLibrary(), resourcesPath(), model, toQString(filePath), false, startTabIndex());
m_osDocument->setSavePath("");
connectOSDocumentSignals();

QTimer::singleShot(0, m_osDocument.get(), &OSDocument::markAsModified);
}

waitDialog()->hide();

OpenStudioApp::setQuitOnLastWindowClosed(wasQuitOnLastWindowClosed);
}

void OpenStudioApp::changeDefaultLibraries() {
auto defaultPaths = defaultLibraryPaths();
auto paths = libraryPaths();
Expand Down Expand Up @@ -1590,18 +1620,6 @@ void OpenStudioApp::removeLibraryFromsSettings(const openstudio::path& path) {
writeLibraryPaths(paths);
}

void OpenStudioApp::showFailedMeasureManagerDialog() {

QString text = tr("The OpenStudio Application must close. Do you want to reset Measure Manager settings?\n\n");
QMessageBox::StandardButton reply = QMessageBox::critical(mainWidget(), QString("Failed to connect to Measure Manager"), text,
QMessageBox::RestoreDefaults | QMessageBox::Close, QMessageBox::RestoreDefaults);
if (reply == QMessageBox::RestoreDefaults) {
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName());
settings.setValue("useClassicCLI", true);
settings.sync();
}
}

void OpenStudioApp::showFailedLibraryDialog(const std::vector<std::string>& failedPaths) {
if (!failedPaths.empty()) {
QString text = tr("Failed to load the following libraries...\n\n");
Expand Down
6 changes: 3 additions & 3 deletions src/openstudio_app/OpenStudioApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ class OpenStudioApp : public OSAppBase
// Loads the result of openstudio::model::exampleModel()
void loadExampleModel();

// Creates a skeleton measure based model
void loadShoeboxModel();

// Checks what happened in the LibraryDialog preference panes, and calls writeLibraryPaths to set the user settings
void changeDefaultLibraries();

Expand Down Expand Up @@ -225,8 +228,6 @@ class OpenStudioApp : public OSAppBase
GBXML
};

void showFailedMeasureManagerDialog();

void showFailedLibraryDialog(const std::vector<std::string>& failedPaths);

void import(fileType type);
Expand Down Expand Up @@ -275,7 +276,6 @@ class OpenStudioApp : public OSAppBase
QTranslator m_qtTranslator;
QTranslator m_qtBaseTranslator;
QString m_currLang;
bool m_useClassicCLI;
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Remove unused m_useClassicCLI, cannot use classic CLI for MeasureManager any more" (65af11b)

why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This issue prevents using the classic CLI for the measure manager now: NREL/OpenStudio#5212

I figure it's probably not really worth supporting using classic for the measure manager in the future either, what do you think? You can still use the classic option for the run though.


// Try to find DView (or DView.exe) inside the PATH env variable. Will return an *empty* path if couldn't infer it
openstudio::path inferredDViewPath() const;
Expand Down
5 changes: 5 additions & 0 deletions src/openstudio_app/Resources/ShoeboxModel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
stdout
stderr
out.osw
run/
reports/
16 changes: 16 additions & 0 deletions src/openstudio_app/Resources/ShoeboxModel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# OpenStudio Coalition Example Models

Collection of OpenStudio Coalition Example Models

## ShoeboxExample

A simple model that creates a test building. The OSM only has the weather file and design days, the model is created via a collection of measures.

Third party measures:

- Model Articulation Measures:
- create_bar_from_space_type_ratios - https://github.com/NREL/openstudio-model-articulation-gem
- create_typical_building_from_model - https://github.com/NREL/openstudio-model-articulation-gem
- Reporting Measures:
- openstudio_results - https://github.com/NREL/openstudio-common-measures-gem
- view_data - https://github.com/NREL/openstudio-common-measures-gem
Loading
Loading