Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 15 additions & 10 deletions .github/workflows/build_pat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches:
- '*'
tags:
- '*'
- '*'

jobs:
pat_build:
Expand Down Expand Up @@ -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 }}

Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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/

Expand All @@ -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'
Expand All @@ -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
Expand All @@ -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 }}



8 changes: 4 additions & 4 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-20.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
Expand All @@ -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') }}
Expand All @@ -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
Expand Down
77 changes: 21 additions & 56 deletions app/app/main/measureManagerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,8 @@ export class MeasureManager {
return vm.mmReadyDeferred.promise;
}

sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
break;
}
}
}

Comment on lines -62 to -70
Copy link
Owner Author

Choose a reason for hiding this comment

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

Unused

startMeasureManager() {
const vm = this;
let str = '';
// find an open port
portfinder.getPortPromise({
port: 3100,
Expand All @@ -79,9 +69,8 @@ export class MeasureManager {
vm.port = port;
vm.$log.info('Measure Manager port: ', vm.port);

vm.$log.info('Start Measure Manager Server: ', vm.cliPath, 'labs measure -s ', vm.port);
let the_cmd = vm.cliPath + ' labs';
Copy link
Owner Author

Choose a reason for hiding this comment

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

Unused

vm.cli = vm.spawn(vm.cliPath, ['labs', 'measure', '-s', vm.port], { cwd: '.', stdio : 'pipe' });
vm.$log.info('Start Measure Manager Server: ', vm.cliPath, 'measure -s ', vm.port);
Copy link
Owner Author

Choose a reason for hiding this comment

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

C++ CLI is default now

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) {
Expand All @@ -92,58 +81,32 @@ 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
str = data.toString();
if (str.indexOf('WEBrick::HTTPServer#start: pid=') !== -1) {
vm.$log.info('Found WEBrick Start, MeasureManager is running');
vm.mmReadyDeferred.resolve();
}
// TODO: THIS IS TEMPORARY (windows):
else if (str.indexOf('Only one usage of each socket address') !== -1) {
vm.$log.info('WEBrick already running...assuming MeasureManager is already up');
vm.mmReadyDeferred.resolve();
}
// TODO: THIS IS TEMPORARY (mac):
else if (str.indexOf('Error: Address already in use') !== -1) {
vm.$log.info('WEBrick already running...assuming MeasureManager is already running');
vm.mmReadyDeferred.resolve();
}
else if (str.indexOf('MeasureManager Ready') !== -1) {
// New labs command MeasureManager
vm.$log.info("LABS command 'MeasureManagerReady' detected. MeasureManager is running!");
const str = data.toString();
if ((str.indexOf('Accepting requests on:') !== -1) ||
(str.indexOf('MeasureManager Ready') !== -1)) {
Comment on lines +95 to +96
Copy link
Owner Author

Choose a reason for hiding this comment

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

Feebdack saying it's running is limited to this

vm.$log.info('Found MeasureManager Start, MeasureManager is running');
vm.mmReadyDeferred.resolve();
}
});
vm.cli.stderr.on('data', (data) => {
vm.$log.info(`MeasureManager: ${data}`);
// check that the mm was started correctly: resolve readyDeferred
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}`);
});
Expand All @@ -154,11 +117,12 @@ export class MeasureManager {
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.')
vm.$log.error('Error locating an open port for measure manager.');
});
}

Expand Down Expand Up @@ -317,7 +281,8 @@ export class MeasureManager {
.then(res => {
vm.$log.info('Measure Manager download_bcl_measure Success!, status: ', res.status);
vm.$log.info('Data: ', res.data);
// KAF: format of res.data has changed with labs MM
// Classic (Ruby) CLI uses to return a single-element list
// C++ CLI returns the element directly
//return res.data[0];
return res.data
})
Expand Down
2 changes: 1 addition & 1 deletion copyright.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OpenStudio
Copyright (c) 2008-2023, Alliance for Sustainable Energy
Copyright (c) 2008-2024, Alliance for Sustainable Energy
All Rights Reserved.


Expand Down
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2008-2023, Alliance for Sustainable Energy.
Copyright (c) 2008-2024, Alliance for Sustainable Energy.
All rights reserved.

NOTICE
Expand Down
Loading