kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Added configuration to set a max-concurrency cap
rodzic
c9d82e13bd
commit
1a274d55f7
|
@ -45,6 +45,7 @@ Options:
|
|||
--s3_access_key <key> S3 access key, required if --s3_endpoint is set. (default: none)
|
||||
--s3_secret_key <secret> S3 secret key, required if --s3_endpoint is set. (default: none)
|
||||
--s3_signature_version <version> S3 signature version. (default: 4)
|
||||
--max_concurrency <number> Place a cap on the max-concurrency option to use for each task. (default: no limit)
|
||||
Log Levels:
|
||||
error | debug | info | verbose | debug | silly
|
||||
`);
|
||||
|
@ -100,4 +101,6 @@ config.s3Bucket = argv.s3_bucket || fromConfigFile("s3Bucket", "");
|
|||
config.s3AccessKey = argv.s3_access_key || fromConfigFile("s3AccessKey", process.env.AWS_ACCESS_KEY_ID || "")
|
||||
config.s3SecretKey = argv.s3_secret_key || fromConfigFile("s3SecretKey", process.env.AWS_SECRET_ACCESS_KEY || "")
|
||||
config.s3SignatureVersion = argv.s3_signature_version || fromConfigFile("s3SignatureVersion", "4")
|
||||
config.maxConcurrency = parseInt(argv.max_concurrency || fromConfigFile("maxConcurrency", 0));
|
||||
|
||||
module.exports = config;
|
||||
|
|
2
index.js
2
index.js
|
@ -680,7 +680,7 @@ app.get('/info', authCheck, (req, res) => {
|
|||
res.json({
|
||||
version: packageJson.version,
|
||||
taskQueueCount: taskManager.getQueueCount(),
|
||||
totalMemory: mem.total,
|
||||
totalMemory: mem.total,
|
||||
availableMemory: mem.available,
|
||||
cpuCores: cpu.cores,
|
||||
maxImages: config.maxImages,
|
||||
|
|
|
@ -16,10 +16,11 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
"use strict";
|
||||
let odmRunner = require('./odmRunner');
|
||||
let async = require('async');
|
||||
let assert = require('assert');
|
||||
let logger = require('./logger');
|
||||
const odmRunner = require('./odmRunner');
|
||||
const config = require('../config');
|
||||
const async = require('async');
|
||||
const assert = require('assert');
|
||||
const logger = require('./logger');
|
||||
|
||||
let odmOptions = null;
|
||||
let odmVersion = null;
|
||||
|
@ -245,7 +246,12 @@ module.exports = {
|
|||
};
|
||||
|
||||
// Scan through all possible options
|
||||
let maxConcurrencyFound = false;
|
||||
let maxConcurrencyIsAnOption = false;
|
||||
|
||||
for (let odmOption of odmOptions){
|
||||
if (odmOption.name === 'max-concurrency') maxConcurrencyIsAnOption = true;
|
||||
|
||||
// Was this option selected by the user?
|
||||
/*jshint loopfunc: true */
|
||||
let opt = options.find(o => o.name === odmOption.name);
|
||||
|
@ -258,6 +264,16 @@ module.exports = {
|
|||
if (odmOption.domain){
|
||||
checkDomain(odmOption.domain, value);
|
||||
}
|
||||
|
||||
// Max concurrency check
|
||||
if (maxConcurrencyIsAnOption){
|
||||
maxConcurrencyFound = true;
|
||||
|
||||
// Cap
|
||||
if (config.maxConcurrency){
|
||||
value = Math.min(value, config.maxConcurrency);
|
||||
}
|
||||
}
|
||||
|
||||
result.push({
|
||||
name: odmOption.name,
|
||||
|
@ -269,6 +285,15 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
// If no max concurrency was passed by the user
|
||||
// but our configuration sets a limit, pass it.
|
||||
if (!maxConcurrencyFound && maxConcurrencyIsAnOption && config.maxConcurrency){
|
||||
result.push({
|
||||
name: "max-concurrency",
|
||||
value: config.maxConcurrency
|
||||
});
|
||||
}
|
||||
|
||||
if (errors.length > 0) done(new Error(JSON.stringify(errors)));
|
||||
else done(null, result);
|
||||
}catch(e){
|
||||
|
|
Ładowanie…
Reference in New Issue