kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Added timeout option
rodzic
77de93476e
commit
e206fc7dba
|
@ -51,6 +51,7 @@ Options:
|
|||
--s3_signature_version <version> S3 signature version. (default: 4)
|
||||
--s3_upload_everything Upload all task results to S3. (default: upload only .zip archive and orthophoto)
|
||||
--max_concurrency <number> Place a cap on the max-concurrency option to use for each task. (default: no limit)
|
||||
--max_runtime <number> Number of minutes that a task is allowed to run before being forcibly canceled (timeout). (default: no limit)
|
||||
Log Levels:
|
||||
error | debug | info | verbose | debug | silly
|
||||
`);
|
||||
|
@ -112,5 +113,6 @@ config.s3SecretKey = argv.s3_secret_key || fromConfigFile("s3SecretKey", process
|
|||
config.s3SignatureVersion = argv.s3_signature_version || fromConfigFile("s3SignatureVersion", "4")
|
||||
config.s3UploadEverything = argv.s3_upload_everything || fromConfigFile("s3UploadEverything", false);
|
||||
config.maxConcurrency = parseInt(argv.max_concurrency || fromConfigFile("maxConcurrency", 0));
|
||||
config.maxRuntime = parseInt(argv.max_runtime || fromConfigFile("maxRuntime", -1));
|
||||
|
||||
module.exports = config;
|
||||
|
|
|
@ -59,6 +59,13 @@ class TaskManager{
|
|||
this.dumpTaskList();
|
||||
this.removeStaleUploads();
|
||||
});
|
||||
|
||||
if (config.maxRuntime > 0){
|
||||
// Every minute
|
||||
schedule.scheduleJob('* * * * *', () => {
|
||||
this.checkTimeouts();
|
||||
});
|
||||
}
|
||||
|
||||
cb();
|
||||
}
|
||||
|
@ -306,6 +313,21 @@ class TaskManager{
|
|||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
checkTimeouts(){
|
||||
if (config.maxRuntime > 0){
|
||||
for (let uuid in this.tasks){
|
||||
let task = this.tasks[uuid];
|
||||
|
||||
if (task.processingTime > config.maxRuntime * 60 * 1000){
|
||||
task.output.push(`Task timed out after ${task.processingTime / 60 / 1000} seconds.\n`);
|
||||
this.cancel(uuid, () => {
|
||||
logger.warn(`Task ${uuid} timed out`);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Ładowanie…
Reference in New Issue