Skip to content
Merged
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
9 changes: 9 additions & 0 deletions app/app/project/modalServerToolsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ export class ModalServerToolsController {
}
if (vm.Message.showDebug()) vm.$log.debug('Project dir: ', vm.$scope.projectDir);

vm.$scope.numCores = vm.OsServer.getNumberCores();
vm.$scope.numWorkers = vm.Project.getNumberWorkers();

}

setNumWorkers(numWkrs){
// set this so OsServer can access it when starting local server
const vm = this;
vm.Project.setNumberWorkers(numWkrs);
}

getLocalServer() {
Expand Down
18 changes: 11 additions & 7 deletions app/app/project/osServerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
vm.$translate = $translate;
vm.toastr = toastr;

// set number of workers
// set number of workers from project.
vm.numCores = os.cpus().length;
vm.numWorkers = 1;
if (vm.numCores) {
vm.numWorkers = vm.numCores == 1 ? 1 : (vm.numCores - 1);
}
vm.numWorkers = vm.Project.getNumberWorkers();
// if (vm.numCores) {
// vm.numWorkers = vm.numCores == 1 ? 1 : (vm.numCores - 1);
// }
vm.$log.info('Number of cores: ', vm.numCores);
vm.$log.info('Number of workers set to: ', vm.numWorkers);

Expand Down Expand Up @@ -84,6 +84,7 @@
initializeServer() {
const vm = this;
vm.numberDPsToDisplay = vm.Project.getNumberDPsToDisplay();
vm.numWorkers = vm.Project.getNumberWorkers();
vm.localServerURL = 'http://localhost:8080'; // default URL. will be reset when starting server
vm.serverStatuses = {local: 'stopped', remote: 'stopped'}; // started, stopped, error?
vm.analysisStatus = ''; // '', starting, started, in progress, queued, completed, error, canceled
Expand Down Expand Up @@ -182,7 +183,7 @@
const vm = this;
const deferred = vm.$q.defer();

const command = '\"' + vm.cliPath + '\" openstudio_version';

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"

Check failure on line 186 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"
vm.$log.info('get openstudio version command: ', command);

const child = vm.exec(command,
Expand Down Expand Up @@ -263,9 +264,9 @@

}

getNumWorkers() {
getNumberCores() {
const vm = this;
return vm.numWorkers;
return vm.numCores;
}

getSelectedServerURL() {
Expand Down Expand Up @@ -535,10 +536,13 @@
// See "https://github.com/NREL/OpenStudio-server/tree/dockerize-osw/server/spec/files/batch_datapoints" for test files
const deferred = vm.$q.defer();

// refetch numWorkers in case it has changed in serverTools modal
vm.numWorkers = vm.Project.getNumberWorkers();

// run META CLI will return status code: 0 = success, 1 = failure
// start local server needs path to oscli (vm.cliPath)
if (vm.platform == 'win32')
vm.startServerCommand = '\"' + vm.rubyPath + '\" \"' + vm.metaCLIPath + '\"' + ' start_local --worker-number=' + vm.numWorkers + ' --energyplus-exe-path=' + '\"' + vm.energyplusEXEPath + '\"' + ' --openstudio-exe-path=' + '\"' + vm.cliPath + '\"' + ' --ruby-lib-path=' + '\"' + vm.openstudioBindingsDirPath + '\"' + ' --mongo-dir=' + '\"' + vm.mongoDirPath + '\" --debug \"' + vm.Project.projectDir.path() + '\"';

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Ubuntu

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / test

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build Windows_2022

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"

Check failure on line 545 in app/app/project/osServerService.js

View workflow job for this annotation

GitHub Actions / Build macOS

Unnecessary escape character: \"
else
vm.startServerCommand = '\"' + vm.rubyPath + '\" \"' + vm.metaCLIPath + '\"' + ' start_local --worker-number=' + vm.numWorkers + ' --energyplus-exe-path=' + '\"' + vm.energyplusEXEPath + '\"' + ' --openstudio-exe-path=' + '\"' + vm.cliPath + '\"' + ' --ruby-lib-path=' + '\"' + vm.openstudioBindingsDirPath + '\"' + ' --mongo-dir=' + '\"' + vm.mongoDirPath + '\" --debug \"' + vm.Project.projectDir.path() + '\"';
vm.$log.info('start server command: ', vm.startServerCommand);
Expand Down
14 changes: 14 additions & 0 deletions app/app/project/projectService.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export class Project {
vm.reportType = null;
vm.runType = vm.runTypes[0];
vm.samplingMethod = vm.samplingMethods[0];
vm.numberWorkers = null;
vm.rubyMD5 = null;
vm.mongoMD5 = null;
vm.openstudioServerMD5 = null;
Expand Down Expand Up @@ -182,6 +183,7 @@ export class Project {
vm.downloadOSM = true;
vm.downloadZIP = true;
vm.gemfile = false;
vm.numberWorkers = 1;
vm.timeoutWorkflow = 28800;
vm.timeoutUploadResults = 28800;
vm.timeoutInitWorker = 28800;
Expand Down Expand Up @@ -284,6 +286,7 @@ export class Project {
vm.datapoints = vm.pat.datapoints ? vm.pat.datapoints : vm.datapoints;
vm.remoteSettings = vm.pat.remoteSettings ? vm.pat.remoteSettings : vm.remoteSettings;
vm.serverScripts = vm.pat.serverScripts ? vm.pat.serverScripts : vm.serverScripts;
vm.numberWorkers = vm.pat.numberWorkers ? vm.pat.numberWorkers : vm.numberWorkers;

// filesToInclude
// convert paths to platform-specific delimiters
Expand Down Expand Up @@ -1562,6 +1565,7 @@ export class Project {
vm.pat.openstudioServerMD5 = vm.openstudioServerMD5;
vm.pat.openstudioCLIMD5 = vm.openstudioCLIMD5;
vm.pat.openstudioMD5 = vm.openstudioMD5;
vm.pat.numberWorkers = vm.numberWorkers;

// measures and options
vm.pat.measures = vm.measures;
Expand Down Expand Up @@ -1782,6 +1786,16 @@ export class Project {
return vm.numberDPsToDisplay;
}

getNumberWorkers() {
const vm = this;
return vm.numberWorkers;
}

setNumberWorkers(num) {
const vm = this;
vm.numberWorkers = num;
}

getSeedDir() {
const vm = this;
return vm.seedDir;
Expand Down
5 changes: 5 additions & 0 deletions app/app/project/serverTools.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ <h3 class="modal-title" translate>serverTools.title</h3>
</div>

<div class="modal-body">
<div class="col-sm-8 modal-text pad-bot-20">
<label class="medium-label" translate>serverTools.numberWorkers</label>
<input class="form-control" type="number" ng-model="numWorkers" ng-change="modal.setNumWorkers(numWorkers)">
<span translate>serverTools.numberCores</span>: {{numCores}}</span>
</div>
<div class="row pad-bot-20">
<div class="col-sm-12 modal-text" ng-if="projectDir != null">
<button type="button" class="btn btn-success" ng-click="modal.startLocalServer()" translate>serverTools.start</button>
Expand Down
4 changes: 3 additions & 1 deletion app/app/translations/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export default {
stop: 'Stop Local Server',
ping: 'Ping Server and Set Status',
viewServer: 'View Local Server',
noProject: 'You must open a project first'
noProject: 'You must open a project first',
numberWorkers: 'Number of Workers to use for Server',
numberCores: 'Total number of cores available on machine'
},
setMeasuresDir: {
title: 'Set MyMeasures Directory',
Expand Down
4 changes: 3 additions & 1 deletion app/app/translations/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export default {
stop: 'Arrêter le serveur local',
ping: 'Requête Ping au Serveur et définir l\'état',
viewServer: 'View Local Server',
noProject: 'Vous devez d\'abord ouvrir un projet'
noProject: 'Vous devez d\'abord ouvrir un projet',
numberWorkers: 'Nombre de travailleurs à utiliser pour le serveur',
numberCores: 'Nombre total de coeurs disponibles sur la machine'
},
setMeasuresDir: {
title: 'Répertoire de MesMesures',
Expand Down
Loading