--test_seconds option

pull/85/head
Piero Toffanin 2019-05-28 09:26:17 -04:00
rodzic 2cb3cc0996
commit 434b84bf7c
2 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -39,6 +39,7 @@ Options:
--test_skip_dems If test mode is enabled, skip dems results when generating assets. (default: false)
--test_drop_uploads If test mode is enabled, drop /task/new/upload requests with 50% probability. (default: false)
--test_fail_tasks If test mode is enabled, mark tasks as failed. (default: false)
--test_seconds If test mode is enabled, sleep these many seconds before finishing processing a test task. (default: 0)
--powercycle When set, the application exits immediately after powering up. Useful for testing launch and compilation issues.
--token <token> Sets a token that needs to be passed for every request. This can be used to limit access to the node only to token holders. (default: none)
--max_images <number> Specify the maximum number of images that this processing node supports. (default: unlimited)
@ -99,6 +100,7 @@ config.testSkipOrthophotos = argv.test_skip_orthophotos || fromConfigFile("testS
config.testSkipDems = argv.test_skip_dems || fromConfigFile("testSkipDems", false);
config.testDropUploads = argv.test_drop_uploads || fromConfigFile("testDropUploads", false);
config.testFailTasks = argv.test_fail_tasks || fromConfigFile("testFailTasks", false);
config.testSeconds = parseInt(argv.test_seconds || fromConfigFile("testSeconds", 0));
config.powercycle = argv.powercycle || fromConfigFile("powercycle", false);
config.token = argv.token || fromConfigFile("token", "");
config.maxImages = parseInt(argv.max_images || fromConfigFile("maxImages", "")) || null;

Wyświetl plik

@ -367,10 +367,16 @@ module.exports = class Task{
});
}
if (config.testSeconds){
logger.info(`Test mode will sleep for ${config.testSeconds} seconds before finishing processing`);
tasks.push(done => setTimeout(done, config.testSeconds * 1000));
}
if (config.testFailTasks){
logger.info("Test mode will fail the task");
tasks.push(done => done(new Error("Test fail")));
}
}
if (!this.skipPostProcessing) tasks.push(runPostProcessingScript());