Added s3_upload_everything flag

pull/57/head
Piero Toffanin 2018-12-03 21:46:49 -05:00
rodzic 91d78d814e
commit bcbec55c03
3 zmienionych plików z 11 dodań i 4 usunięć

Wyświetl plik

@ -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)
--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)
Log Levels:
error | debug | info | verbose | debug | silly
@ -101,6 +102,7 @@ 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.s3UploadEverything = argv.s3_upload_everything || fromConfigFile("s3UploadEverything", false);
config.maxConcurrency = parseInt(argv.max_concurrency || fromConfigFile("maxConcurrency", 0));
module.exports = config;

Wyświetl plik

@ -66,7 +66,7 @@ module.exports = {
uploadPaths: function(srcFolder, bucket, dstFolder, paths, cb, onOutput){
if (!s3) throw new Error("S3 is not initialized");
const PARALLEL_UPLOADS = 10;
const PARALLEL_UPLOADS = 5;
const q = async.queue((file, done) => {
logger.debug(`Uploading ${file.src} --> ${file.dest}`);

Wyświetl plik

@ -342,9 +342,14 @@ module.exports = class Task{
// Upload to S3 all paths + all.zip file (if config says so)
if (S3.enabled()){
tasks.push((done) => {
const s3Paths = !config.test ?
['all.zip'].concat(allPaths) :
['all.zip']; // During testing only upload all.zip
let s3Paths;
if (config.test){
s3Paths = ['all.zip']; // During testing only upload all.zip
}else if (config.s3UploadEverything){
s3Paths = ['all.zip'].concat(allPaths)
}else{
s3Paths = ['all.zip', 'odm_orthophoto/odm_orthophoto.tif'];
}
S3.uploadPaths(this.getProjectFolderPath(), config.s3Bucket, this.uuid, s3Paths,
err => {