diff --git a/.github/workflows/build_pat.yaml b/.github/workflows/build_pat.yaml index 4a6efdc5..c731dcd2 100755 --- a/.github/workflows/build_pat.yaml +++ b/.github/workflows/build_pat.yaml @@ -8,7 +8,7 @@ on: branches: - '*' tags: - - '*' + - '*' jobs: pat_build: @@ -39,10 +39,10 @@ jobs: steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Node ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} @@ -60,7 +60,7 @@ jobs: sudo ./qtfiw_installer/QtInstallerFramework-macOS-x64-4.3.0.app/Contents/MacOS/QtInstallerFramework-macOS-x64-4.3.0 --verbose --script ./ci/install_script_qtifw.qs ls ~/Qt/QtIFW-4.3.0 || true echo "~/Qt/QtIFW-4.3.0/bin/" >> $GITHUB_PATH - echo MACOSX_DEPLOYMENT_TARGET=${{ matrix.MACOSX_DEPLOYMENT_TARGET }} >> $GITHUB_ENV + echo MACOSX_DEPLOYMENT_TARGET=${{ matrix.MACOSX_DEPLOYMENT_TARGET }} >> $GITHUB_ENV # echo CMAKE_MACOSX_DEPLOYMENT_TARGET='-DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET' >> $GITHUB_ENV elif [ "$RUNNER_OS" == "Windows" ]; then curl -L -O https://download.qt.io/archive/qt-installer-framework/4.3.0/QtInstallerFramework-windows-x86-4.3.0.exe @@ -71,7 +71,7 @@ jobs: #echo CMAKE_GENERATOR='Visual Studio 16 2019' >> $GITHUB_ENV #echo CMAKE_GENERATOR_PLATFORM=x64 >> $GITHUB_ENV # C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise - # Command below no longer working and returning the version number. + # Command below no longer working and returning the version number. # MSVC_DIR=$(cmd.exe /c "vswhere -products * -requires Microsoft.Component.MSBuild -property installationPath -latest") MSVC_DIR="C:\Program Files\Microsoft Visual Studio\2022\Enterprise" echo "Latest is: $MSVC_DIR" @@ -80,6 +80,10 @@ jobs: echo "$MSVC_DIR\VC\Auxiliary\Build" >> $GITHUB_PATH fi; + N=$(nproc 2>/dev/null || sysctl -n hw.logicalcpu) + echo "There are $N threads available" + echo "N=$N" >> $GITHUB_ENV + - name: Create Build Directory run: cmake -E make_directory ./build/ @@ -92,8 +96,8 @@ jobs: echo "Using vcvarsall to initialize the development environment" call vcvarsall.bat x64 cmake -G "Visual Studio 17 2022" -A x64 .. - cmake --build . --target package -j 2 --config Release - + cmake --build . --target package -j ${{ env.N }} --config Release + - name: Configure CMake & build (Linux) working-directory: ./build if: runner.os == 'Linux' @@ -108,7 +112,7 @@ jobs: -DCPACK_BINARY_STGZ=OFF \ -DCPACK_BINARY_TBZ2=OFF \ ../ - cmake --build . --target package -j 2 + cmake --build . --target package -j $N - name: Configure CMake & build (macOS) working-directory: ./build @@ -120,12 +124,13 @@ jobs: -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ -DCMAKE_BUILD_TYPE=Release \ ../ - cmake --build . --target package -j 2 + cmake --build . --target package -j $N - name: Save artifact uses: actions/upload-artifact@v4 with: name: PAT-Installer-${{ matrix.name }} path: ./build/ParametricAnalysisTool-* + #name: OpenStudio-PAT-{{ matrix.name }}-${{ github.sha }} + - diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 48f8322e..6cb8243e 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -8,10 +8,10 @@ on: jobs: test: timeout-minutes: 60 - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: 17 cache: npm @@ -23,7 +23,7 @@ jobs: run: npm ci - name: Cache runtime dependencies id: cache-runtime-deps - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: depend/ key: ${{ runner.os }}-${{ hashFiles('manifest.json') }} @@ -35,7 +35,7 @@ jobs: - name: Prepare tmp test files run: npm run test:tmpFiles - name: Run playwright tests - uses: GabrielBB/xvfb-action@v1 + uses: coactions/setup-xvfb@v1 with: run: | npm run test:parallel diff --git a/app/app/main/measureManagerService.js b/app/app/main/measureManagerService.js index 7d3c3699..184b9317 100644 --- a/app/app/main/measureManagerService.js +++ b/app/app/main/measureManagerService.js @@ -61,7 +61,6 @@ export class MeasureManager { startMeasureManager() { const vm = this; - // find an open port portfinder.getPortPromise({ port: 3100, @@ -70,12 +69,11 @@ export class MeasureManager { vm.port = port; vm.$log.info('Measure Manager port: ', vm.port); - vm.$log.info('Start Measure Manager Server: ', vm.cliPath, ' measure -s ', vm.port); - vm.cli = vm.spawn(vm.cliPath, ['classic', 'measure', '-s', vm.port]); + vm.$log.info('Start Measure Manager Server: ', vm.cliPath, 'measure -s ', vm.port); + vm.cli = vm.spawn(vm.cliPath, ['measure', '-s', vm.port], { cwd: '.', stdio : 'pipe' }); vm.cli.stdout.on('data', (data) => { // record errors if (data.indexOf('<0>') !== -1) { - // WARNING vm.$log.warn(`MeasureManager WARNING: ${data}`); vm.Message.appendMeasureManagerError({type: 'warning', data: data.toString()}); } else if (data.indexOf('<1>') !== -1) { @@ -83,54 +81,49 @@ export class MeasureManager { vm.$log.error(`MeasureManager ERROR: ${data}`); vm.Message.appendMeasureManagerError({type: 'error', data: data.toString()}); } else if(data.indexOf('<2>') !== -1) { - // ERROR + // FATAL vm.$log.error(`MeasureManager ERROR: ${data}`); vm.Message.appendMeasureManagerError({type: 'fatal', data: data.toString()}); + } else { + if (vm.Message.showDebug()) { + vm.$log.debug(`MeasureManager: ${data}`); + } } - else { - if (vm.Message.showDebug()) vm.$log.debug(`MeasureManager: ${data}`); - } + // check that the mm was started correctly: resolve readyDeferred const str = data.toString(); - if (str.indexOf('WEBrick::HTTPServer#start: pid=') !== -1) { - if (vm.Message.showDebug()) vm.$log.debug('Found WEBrick Start!, resolve promise'); - vm.mmReadyDeferred.resolve(); - } - // TODO: THIS IS TEMPORARY (windows): - else if (str.indexOf('Only one usage of each socket address') !== -1) { - if (vm.Message.showDebug()) vm.$log.debug('WEBrick already running...assuming MeasureManager is already up'); + if ((str.indexOf('Accepting requests on:') !== -1) || + (str.indexOf('MeasureManager Ready') !== -1)) { + vm.$log.info('Found MeasureManager Start, MeasureManager is running'); vm.mmReadyDeferred.resolve(); } - // TODO: THIS IS TEMPORARY (mac): - else if (str.indexOf('Error: Address already in use') !== -1) { - if (vm.Message.showDebug()) vm.$log.debug('WEBrick already running...assuming MeasureManager is already up'); - vm.mmReadyDeferred.resolve(); - } - }); vm.cli.stderr.on('data', (data) => { - vm.$log.info(`MeasureManager: ${data}`); - // check that the mm was started correctly: resolve readyDeferred - const str = data.toString(); - if (str.indexOf('WEBrick::HTTPServer#start: pid=') !== -1) { - if (vm.Message.showDebug()) vm.$log.debug('Found WEBrick Start!, resolve promise'); - vm.mmReadyDeferred.resolve(); - } - // TODO: THIS IS TEMPORARY (windows): - else if (str.indexOf('Only one usage of each socket address') !== -1) { - if (vm.Message.showDebug()) vm.$log.debug('WEBrick already running...using tempMeasureManager'); - vm.mmReadyDeferred.resolve(); - } - // TODO: THIS IS TEMPORARY (mac): - else if (str.indexOf('Error: Address already in use') !== -1) { - if (vm.Message.showDebug()) vm.$log.debug('WEBrick already running...using tempMeasureManager'); - vm.mmReadyDeferred.resolve(); - } + // C++ CLI printing errors when requests fail on stderr, eg when post + // data is missing: + // [2024-11-14T13:32:17+01:00] "POST /compute_arguments HTTP/1.1" 400 + vm.$log.error(`MeasureManager: ${data}`); + }); + vm.cli.on('error', (err) => { + console.log('Failed to start measure manager'); }); + vm.cli.on('message', (msg) => { + console.log(`child message due to receipt of signal ${msg}`); + }); + vm.cli.on('close', (code) => { vm.$log.info(`Measure Manager exited with code ${code}`); }); - }).catch(() => vm.$log.error('Error locating an open port for measure manager.')); + vm.cli.on('exit', (code) => { + if (code !== 0) { + const msg = `Failed with code = ${code}`; + console.log(msg); + } + }); + + }).catch((err) => { + vm.$log.error('Error locating an open port for measure manager.'); + }); } stopMeasureManager() { @@ -249,7 +242,6 @@ export class MeasureManager { // reset MeasureManagerErrors when a new action vm.Message.resetMeasureManagerErrors(); - return vm.$http.post(`${vm.url}:${vm.port}/set`, params) .then(res => { vm.$log.info('Measure Manager setMyMeasuresDir Success!, status: ', res.status); @@ -289,7 +281,10 @@ export class MeasureManager { .then(res => { vm.$log.info('Measure Manager download_bcl_measure Success!, status: ', res.status); vm.$log.info('Data: ', res.data); - return res.data[0]; + // Classic (Ruby) CLI uses to return a single-element list + // C++ CLI returns the element directly + //return res.data[0]; + return res.data }) .catch(res => { vm.$log.error('Measure Manager download_bcl_measure Error: ', res.data); diff --git a/copyright.txt b/copyright.txt index 22166f0d..164a6e2f 100644 --- a/copyright.txt +++ b/copyright.txt @@ -1,5 +1,5 @@ OpenStudio -Copyright (c) 2008-2020, Alliance for Sustainable Energy +Copyright (c) 2008-2025, Alliance for Sustainable Energy All Rights Reserved. diff --git a/license.txt b/license.txt index 8152cae1..28b9d31b 100644 --- a/license.txt +++ b/license.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008-2020, Alliance for Sustainable Energy. +Copyright (c) 2008-2025, Alliance for Sustainable Energy. All rights reserved. NOTICE