From 6395cf61319777b735bcfd15413d334d96b2db87 Mon Sep 17 00:00:00 2001 From: JustinBonus Date: Thu, 11 Apr 2024 11:08:00 -0700 Subject: [PATCH 1/5] HydroUQ MPM fix for use of maxRunTime (switch on DEV_MODE variable in WorkflowAppHydroUQ to use private tapis app) --- EVENTS/MPM/MPM.cpp | 2 +- WorkflowAppHydroUQ.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/EVENTS/MPM/MPM.cpp b/EVENTS/MPM/MPM.cpp index e1152d4..2f42462 100644 --- a/EVENTS/MPM/MPM.cpp +++ b/EVENTS/MPM/MPM.cpp @@ -1703,7 +1703,7 @@ bool MPM::outputAppDataToJSON(QJsonObject &jsonObject) { // jsonObject["ApplicationData"] = dataObj; jsonObject["programFile"] = "fbar"; // <- ClaymoreUW MPM executable filename on remote machine. Can be changed depending on compiled optimizations, versions, digital twin, etc. - jsonObject["maxRunTime"] = "02:00:00"; // <- Maximum run time for the simulation, timeout if exceeded + jsonObject["maxRunTime"] = "01:02:03"; // <- Maximum run time for the simulation, timeout if exceeded return true; } bool MPM::inputAppDataFromJSON(QJsonObject &jsonObject) { diff --git a/WorkflowAppHydroUQ.cpp b/WorkflowAppHydroUQ.cpp index ece7e1f..2b8f750 100644 --- a/WorkflowAppHydroUQ.cpp +++ b/WorkflowAppHydroUQ.cpp @@ -343,8 +343,16 @@ WorkflowAppHydroUQ::setMainWindow(MainWindowWorkflowApp* window) { miniMPM->initialize(); } - QString appName = "simcenter-claymore-ls6-1.0.0u2"; // Lonestar6 - QList queues; queues << "gpu-a100"; // These are later changed to "normal" and "fast" in the tool based on number of cores/processors? Should fix this + const bool DEV_MODE = false; // Set to true for development mode, false for production mode + QString appName; + QList queues; + if (DEV_MODE) { + appName = "ClaymoreUW-ls6.bonusj-1.0.0"; // Lonestar6 dev app for ClaymoreUW MPM, Justin Bonus (bonusj) + queues << "gpu-a100"; // These are later changed to "normal" and "fast" in the tool based on number of cores/processors? Should fix this + } else { + appName = "simcenter-claymore-ls6-1.0.0u2"; // Lonestar6 public app for ClaymoreUW MPM + queues << "gpu-a100"; // These are later changed to "normal" and "fast" in the tool based on number of cores/processors? Should fix this + } SC_RemoteAppTool *miniMPMTool = new SC_RemoteAppTool(appName, queues, theRemoteService, miniMPM, theToolDialog); // lonestar6 theToolDialog->addTool(miniMPMTool, "Digital Twin (MPM)"); From 5e0841799ddfbb9208bd9be47eac19763a826cb8 Mon Sep 17 00:00:00 2001 From: JustinBonus Date: Thu, 11 Apr 2024 11:28:25 -0700 Subject: [PATCH 2/5] makeDMG --- makeDMG.sh | 87 ++---------------------------------------------------- 1 file changed, 3 insertions(+), 84 deletions(-) mode change 100755 => 100644 makeDMG.sh diff --git a/makeDMG.sh b/makeDMG.sh old mode 100755 new mode 100644 index e0ed33c..9031d76 --- a/makeDMG.sh +++ b/makeDMG.sh @@ -56,84 +56,6 @@ fi macdeployqt ./Hydro_UQ.app -# -# copy files from VTK dir -# - -cp ../../VTK/lib/libvtkgl2ps-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingGL2PSOpenGL2-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkChartsCore-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkCommonColor-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkCommonComputationalGeometry-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkCommonCore-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkCommonDataModel-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkCommonExecutionModel-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkCommonMath-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkCommonMisc-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkCommonSystem-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkCommonTransforms-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkDICOMParser-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersCore-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersExtraction-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersGeneral-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersGeometry-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersHybrid-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersHyperTree-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersImaging-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersModeling-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersSources-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersStatistics-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkFiltersTexture-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkGUISupportQt-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkIOCore-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkIOGeometry-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkIOImage-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkIOLegacy-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkIOXML-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkIOXMLParser-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkImagingColor-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkImagingCore-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkImagingGeneral-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkImagingHybrid-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkImagingSources-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkInfovisCore-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkInfovisLayout-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkInteractionStyle-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkInteractionWidgets-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkParallelCore-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkParallelDIY-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingAnnotation-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingContext2D-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingContextOpenGL2-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingContextOpenGL2-9.2.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingCore-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingFreeType-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingHyperTreeGrid-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingLabel-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingOpenGL2-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingUI-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingVolume-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkRenderingVolume-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkViewsCore-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkViewsInfovis-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkViewsQt-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkdoubleconversion-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkexpat-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkfmt-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkfreetype-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkglew-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkjpeg-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkkissfft-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkloguru-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtklz4-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtklzma-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkmetaio-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkpng-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkpugixml-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtksys-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtktiff-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks -cp ../../VTK/lib/libvtkzlib-9.2.1.dylib ./Hydro_UQ.app/Contents/Frameworks - # copy applications folderm opensees and dakota echo "cp -fR $pathToBackendApps/applications ./$APP_FILE/Contents/MacOS" cp -fR $pathToBackendApps/applications ./$APP_FILE/Contents/MacOS @@ -223,15 +145,12 @@ if [ "${DMG_METHOD}" == "NEW" ]; then --window-size 600 350 \ --no-internet-enable \ --icon-size 125 \ - --icon "../icons/NHERI-WEuq-Icon.ico" 125 130 \ - --hide-extension "${APP_NAME}.app" \ + --icon "${APP_FILE}" 125 130 \ + --hide-extension "${APP_FILE}" \ --app-drop-link 450 130 \ --codesign $appleCredential \ "${DMG_FILENAME}" \ "app" - - # --icon "${APP_NAME}.app" 125 130 \ - # --notarize $appleID $appleAppPassword \ mv ./app/$APP_FILE ./ rm -fr app @@ -271,4 +190,4 @@ echo "To check status" echo "xcrun altool --notarization-info ID -u $appleID -p $appleAppPassword" echo "" echo "Finally staple the dmg" -echo "xcrun stapler staple \"$APP_NAME\" $DMG_FILENAME" +echo "xcrun stapler staple \"$APP_NAME\" $DMG_FILENAME" \ No newline at end of file From d70ac7808c281fe13ed156de2f591e828f7a48c1 Mon Sep 17 00:00:00 2001 From: JustinBonus Date: Thu, 11 Apr 2024 14:42:46 -0700 Subject: [PATCH 3/5] Change ifdef __WIN32 to if defined(__WIN32) and various other defs like __linux__, __WIN32__, __unix__, to allow 3D visualizer on more than just Windows. May require GCC or similar compiler --- EVENTS/MPM/MPM.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/EVENTS/MPM/MPM.cpp b/EVENTS/MPM/MPM.cpp index 2f42462..5a76d77 100644 --- a/EVENTS/MPM/MPM.cpp +++ b/EVENTS/MPM/MPM.cpp @@ -414,8 +414,13 @@ MPM::MPM(RandomVariablesContainer *theRandomVariableIW, QWidget *parent) -#ifdef _WIN32 - //#if defined(Q_OS_WIN) || defined(Q_OS_WIN32) || defined(Q_OS_LINUX) || defined(Q_OS_UNIX) +// #ifdef _WIN32 +// Only allow 3D visualization on Windows and Linux for now, Mac had issues with Qt3D +// Try to check the most reliable set of preprocessor definitions to detect the OS on common OS +// https://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__linux__) || defined(__linux) || defined(__unix__) || defined(__unix) +// Qts definitions are not very reliable +//#if defined(Q_OS_WIN) || defined(Q_OS_WIN32) || defined(Q_OS_LINUX) || defined(Q_OS_UNIX) // ----------------------------------------------------------------------------------- // Create a 3D window and container widget and set the 3D window as its layout // Based on code by Alex44, 2018; https://stackoverflow.com/questions/23231012/how-to-render-in-qt3d-in-standard-gui-application) @@ -1171,8 +1176,8 @@ MPM::MPM(RandomVariablesContainer *theRandomVariableIW, QWidget *parent) horizontalPanelLayout->addWidget(scrollArea); // horizontalPanelLayout->addWidget(visualizationGroup); -#ifdef _WIN32 - //#if defined(Q_OS_WIN) || defined(Q_OS_WIN32) || defined(Q_OS_LINUX) || defined(Q_OS_UNIX) +// #ifdef _WIN32 +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__linux__) || defined(__linux) || defined(__unix__) || defined(__unix) horizontalPanelLayout->addWidget(container); #endif // QVBoxLayout *layout = new QVBoxLayout(); @@ -1186,8 +1191,8 @@ MPM::MPM(RandomVariablesContainer *theRandomVariableIW, QWidget *parent) int index = stackedWidget->currentIndex(); mpmBodies->setDigitalTwin(index); mpmBoundaries->setDigitalTwin(index); -#ifdef _WIN32 - // #if defined(Q_OS_WIN) || defined(Q_OS_WIN32) || defined(Q_OS_LINUX) || defined(Q_OS_UNIX) +// #ifdef _WIN32 +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__linux__) || defined(__linux) || defined(__unix__) || defined(__unix) updateDigitalTwin(index); #endif }); From f9af66cb88dc584a0b4635111cfe8e154dd33db3 Mon Sep 17 00:00:00 2001 From: JustinBonus Date: Thu, 11 Apr 2024 16:58:48 -0700 Subject: [PATCH 4/5] ifdef for 3d vis (now _WIN32 and __linux__ only, no __unix__ as mac has issues). ResultsMPM can now unzip results.zip prior to making plots of sensor time-series --- EVENTS/MPM/MPM.cpp | 14 ++-- EVENTS/MPM/ResultsMPM.cpp | 164 ++++++++++++++++++++++++++++++++++---- 2 files changed, 155 insertions(+), 23 deletions(-) diff --git a/EVENTS/MPM/MPM.cpp b/EVENTS/MPM/MPM.cpp index 5a76d77..198b88a 100644 --- a/EVENTS/MPM/MPM.cpp +++ b/EVENTS/MPM/MPM.cpp @@ -415,12 +415,10 @@ MPM::MPM(RandomVariablesContainer *theRandomVariableIW, QWidget *parent) // #ifdef _WIN32 -// Only allow 3D visualization on Windows and Linux for now, Mac had issues with Qt3D -// Try to check the most reliable set of preprocessor definitions to detect the OS on common OS -// https://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__linux__) || defined(__linux) || defined(__unix__) || defined(__unix) -// Qts definitions are not very reliable -//#if defined(Q_OS_WIN) || defined(Q_OS_WIN32) || defined(Q_OS_LINUX) || defined(Q_OS_UNIX) +#if defined(_WIN32) || defined(__linux__) + // Only allow 3D visualization on Windows and Linux for now, Mac had issues with Qt3D + // Try to check the most reliable set of preprocessor definitions to detect the OS on common OS + // https://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor // ----------------------------------------------------------------------------------- // Create a 3D window and container widget and set the 3D window as its layout // Based on code by Alex44, 2018; https://stackoverflow.com/questions/23231012/how-to-render-in-qt3d-in-standard-gui-application) @@ -1177,7 +1175,7 @@ MPM::MPM(RandomVariablesContainer *theRandomVariableIW, QWidget *parent) // horizontalPanelLayout->addWidget(visualizationGroup); // #ifdef _WIN32 -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__linux__) || defined(__linux) || defined(__unix__) || defined(__unix) +#if defined(_WIN32) || defined(__linux__) horizontalPanelLayout->addWidget(container); #endif // QVBoxLayout *layout = new QVBoxLayout(); @@ -1192,7 +1190,7 @@ MPM::MPM(RandomVariablesContainer *theRandomVariableIW, QWidget *parent) mpmBodies->setDigitalTwin(index); mpmBoundaries->setDigitalTwin(index); // #ifdef _WIN32 -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__linux__) || defined(__linux) || defined(__unix__) || defined(__unix) +#if defined(_WIN32) || defined(__linux__) updateDigitalTwin(index); #endif }); diff --git a/EVENTS/MPM/ResultsMPM.cpp b/EVENTS/MPM/ResultsMPM.cpp index 750047c..2fede44 100644 --- a/EVENTS/MPM/ResultsMPM.cpp +++ b/EVENTS/MPM/ResultsMPM.cpp @@ -491,29 +491,87 @@ ResultsMPM::onPlotPressureClicked(void) { int dialogHeight = 450; int dialogWidth = 850; - QVBoxLayout *plotLayout = new QVBoxLayout(); - QWebEngineView *plotView = new QWebEngineView(); plotView->page()->setBackgroundColor(Qt::transparent); plotLayout->addWidget(plotView); - plotView->setMinimumWidth(dialogWidth); plotView->setMinimumHeight(dialogHeight); - QString ext = ".webp"; - QString plotPath = mainModel->caseDir() + QDir::separator() - + "output" + QDir::separator() - + profileNameP->currentText() - + ext; + QString ext = ".png"; + for (int i=0; i<2; ++i) { + if (i == 0) ext = ".webp"; + if (i == 1) ext = ".html"; + QString intermediateFolder = ""; + for (int j=0; j<3; ++j) + { + if (j == 0) intermediateFolder = ""; + if (j == 1) intermediateFolder = "sensors"; + if (j == 2) intermediateFolder = "results"; + if (j == 3) intermediateFolder = ""; // TODO: Just use the preferences for this. + + QString plotDir = mainModel->caseDir() + QDir::separator() + + "output" + QDir::separator() + + intermediateFolder + QDir::separator(); + // If directory doesn't exist then skip to the next one. + if (!QDir(plotDir).exists()) + { + qDebug() << "ResultsMPM::onPlotPressureClicked - Checked for results.zip in " << plotDir << ", but folder does not exist. Skipping..."; + continue; + } - if(QFileInfo::exists(plotPath)) - { - plotView->load(QUrl::fromLocalFile(plotPath)); - plotView->setWindowFlag(Qt::WindowStaysOnTopHint); - plotView->show(); - plotView->activateWindow(); - plotView->raise(); + QString zipPath = mainModel->caseDir() + QDir::separator() + + "output" + QDir::separator() + + intermediateFolder + QDir::separator() + + "results.zip"; + + if (j == 3) + { + // Remoteworkdir + zipPath = SimCenterPreferences::getInstance()->getRemoteAppDir() + QDir::separator() + + "results.zip"; + } + if (QFileInfo::exists(zipPath)) + { + QString program = "tar"; + QStringList arguments; + // Extract results.zip file from zipPath (either in the GUI set caseDir/output/{'','sensors','results}, variants in brackets, or in RemoteWorkDir when retrieving run from DesignSafe. Extract to plotDir + arguments << "-xzf" << zipPath << "-c" << plotDir; + QProcess *process = new QProcess(); + process->start(program, arguments); + process->waitForStarted(); + process->waitForFinished(-1); + if (process->exitStatus() == QProcess::CrashExit) + { + qDebug() << "ResultsMPM::onPlotPressureClicked - The unzip process has crashed."; + } + else if (process->exitStatus() == QProcess::NormalExit) + { + qDebug() << "ResultsMPM::onPlotPressureClicked - The unzip process has finished running."; + } + else + { + qDebug() << "ResultsMPM::onPlotPressureClicked - The unzip process has finished running with an unknown exit status."; + } + process->deleteLater(); + } + + QString plotPath = mainModel->caseDir() + QDir::separator() + + "output" + QDir::separator() + + intermediateFolder + QDir::separator() + + profileNameP->currentText() + + ext; + if (QFileInfo::exists(plotPath)) + { + // Check if results.zip here, if so, extract it. + + plotView->load(QUrl::fromLocalFile(plotPath)); + plotView->setWindowFlag(Qt::WindowStaysOnTopHint); + plotView->show(); + plotView->activateWindow(); + plotView->raise(); + } + } } } @@ -620,6 +678,82 @@ ResultsMPM::plotSensors(MPM* host) qDebug() << "ResultsMPM::plotSensors - scriptPath: " << scriptPath; qDebug() << "ResultsMPM::plotSensors - scriptName: " << scriptName; + // We want to ensure that results.zip is extracted into individual sensor files for processing + // Check the user specified case director for the results.zip + // Also check most likely local directories for the results.zip file + // Also check the remote work directory for the results.zip file + // Extract to + QString intermediateFolder = ""; + for (int j=0; j<4; ++j) + { + if (j == 0) intermediateFolder = "."; // RemoteWorkDir + if (j == 1) intermediateFolder = "sensors"; // LocalWorkDir + if (j == 2) intermediateFolder = "results"; // LocalWorkDir + if (j == 3) intermediateFolder = "."; // LocalWorkDir + + QString plotDir = sensorsPath; // + intermediateFolder + QDir::separator(); // Save the extracted files to the sensors directory. + // NOTE: The sensors directory is where the sensor time-series files are stored. + // The plots are stored in the output directory once created. + + // If directory doesn't exist then skip to the next one. + if (!QDir(plotDir).exists()) + { + qDebug() << "ResultsMPM::plotSensors - Checked if the folder to extract to exists: " << plotDir << ", but folder does not exist. Skipping..."; + continue; + } + + QString zipDir = SimCenterPreferences::getInstance()->getLocalWorkDir() + QDir::separator(); + if (j == 0) + { + zipDir = SimCenterPreferences::getInstance()->getRemoteWorkDir() + QDir::separator(); + } + else + { + zipDir = mainModel->caseDir() + QDir::separator() + + "output" + QDir::separator() + + intermediateFolder + QDir::separator(); + } + + QString zipPath = zipDir + "results.zip"; + if (!QDir(zipDir).exists()) + { + qDebug() << "ResultsMPM::plotSensors - Checked if folder " << zipDir << " exists, but folder does not exist. Skipping..."; + continue; + } + + if (QFileInfo::exists(zipPath)) + { + QString program = "tar"; // "unzip"; // TODO: consider cross-platform compatibility. + QStringList arguments; + // Extract results.zip file from zipPath (either in the GUI set caseDir/output/{'','sensors','results}, variants in brackets, or in RemoteWorkDir when retrieving run from DesignSafe. Extract to plotDir + // plotDir must exist, and the zipPath must exist. + arguments << "-xzf" << zipPath << "-C" << plotDir; + QProcess *process = new QProcess(); + process->start(program, arguments); + process->waitForStarted(); + process->waitForFinished(-1); + if (process->exitStatus() == QProcess::CrashExit) + { + qDebug() << "ResultsMPM::plotSensors - The unzip process has crashed."; + } + else if (process->exitStatus() == QProcess::NormalExit) + { + qDebug() << "ResultsMPM::plotSensors - The unzip process has finished running."; + process->deleteLater(); + break; + } + else + { + qDebug() << "ResultsMPM::plotSensors - The unzip process has finished running with an unknown exit status."; + } + process->deleteLater(); + } else { + qDebug () << "ERROR - ResultsMPM::plotSensors - Cannot find the results.zip file in the checked directory: " << plotDir; + } + } + + + QString sensorsList = ""; QDir sensorsDir(sensorsPath); if (sensorsDir.exists()) From 23cb037c6c3c35ba923767616b05748d3a331de6 Mon Sep 17 00:00:00 2001 From: JustinBonus Date: Thu, 11 Apr 2024 17:03:50 -0700 Subject: [PATCH 5/5] Change MPM maxRunTime default to 24:00:00 hh:mm:ss. Will be lowered if user requests less time for a job. Check if time-to-duration functions in SimCenterCommon and wrapper work for 2 days+ later --- EVENTS/MPM/MPM.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EVENTS/MPM/MPM.cpp b/EVENTS/MPM/MPM.cpp index 198b88a..d739043 100644 --- a/EVENTS/MPM/MPM.cpp +++ b/EVENTS/MPM/MPM.cpp @@ -1706,7 +1706,7 @@ bool MPM::outputAppDataToJSON(QJsonObject &jsonObject) { // jsonObject["ApplicationData"] = dataObj; jsonObject["programFile"] = "fbar"; // <- ClaymoreUW MPM executable filename on remote machine. Can be changed depending on compiled optimizations, versions, digital twin, etc. - jsonObject["maxRunTime"] = "01:02:03"; // <- Maximum run time for the simulation, timeout if exceeded + jsonObject["maxRunTime"] = "24:00:00"; // <- Maximum run time for the simulation, timeout if exceeded return true; } bool MPM::inputAppDataFromJSON(QJsonObject &jsonObject) {