Skip to content

Commit e2633b7

Browse files
authored
Merge pull request #237 from lucadelu/new_outputs
added new files to export
2 parents e23c2b9 + ab7bf88 commit e2633b7

File tree

1 file changed

+32
-29
lines changed

1 file changed

+32
-29
lines changed

libs/Task.js

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ module.exports = class Task{
148148
}
149149

150150
static CreateFromSerialized(taskJson, done){
151-
const task = new Task(taskJson.uuid,
152-
taskJson.name,
151+
const task = new Task(taskJson.uuid,
152+
taskJson.name,
153153
taskJson.options,
154-
taskJson.webhook,
154+
taskJson.webhook,
155155
taskJson.skipPostProcessing,
156156
taskJson.outputs,
157157
taskJson.dateCreated);
@@ -200,7 +200,7 @@ module.exports = class Task{
200200
}else{
201201
return false; // Invalid
202202
}
203-
203+
204204
return path.join(this.getProjectFolderPath(), filename);
205205
}
206206

@@ -223,7 +223,7 @@ module.exports = class Task{
223223

224224
updateProgress(globalProgress){
225225
globalProgress = Math.min(100, Math.max(0, globalProgress));
226-
226+
227227
// Progress updates are asynchronous (via UDP)
228228
// so things could be out of order. We ignore all progress
229229
// updates that are lower than what we might have previously received.
@@ -279,7 +279,7 @@ module.exports = class Task{
279279
// the process will immediately terminate.
280280
// For eaxmple in the case of the ODM process, the process will continue running for a while
281281
// This might need to be fixed on ODM's end.
282-
282+
283283
// During testing, proc is undefined
284284
if (proc) kill(proc.pid);
285285
});
@@ -301,15 +301,15 @@ module.exports = class Task{
301301
this.stopTrackingProcessingTime();
302302
done(err);
303303
};
304-
304+
305305
const postProcess = () => {
306306
const createZipArchive = (outputFilename, files) => {
307307
return (done) => {
308308
this.output.push(`Compressing ${outputFilename}\n`);
309309

310310
const zipFile = path.resolve(this.getAssetsArchivePath(outputFilename));
311-
const sourcePath = !config.test ?
312-
this.getProjectFolderPath() :
311+
const sourcePath = !config.test ?
312+
this.getProjectFolderPath() :
313313
path.join("tests", "processing_results");
314314

315315
const pathsToArchive = [];
@@ -359,15 +359,15 @@ module.exports = class Task{
359359

360360
archive.pipe(output);
361361
let globs = [];
362-
363-
const sourcePath = !config.test ?
364-
this.getProjectFolderPath() :
362+
363+
const sourcePath = !config.test ?
364+
this.getProjectFolderPath() :
365365
path.join("tests", "processing_results");
366366

367367
// Process files and directories first
368368
files.forEach(file => {
369369
let filePath = path.join(sourcePath, file);
370-
370+
371371
// Skip non-existing items
372372
if (!fs.existsSync(filePath)) return;
373373

@@ -415,7 +415,7 @@ module.exports = class Task{
415415
return (done) => {
416416
this.runningProcesses.push(
417417
processRunner.runPostProcessingScript({
418-
projectFolderPath: this.getProjectFolderPath()
418+
projectFolderPath: this.getProjectFolderPath()
419419
}, (err, code, _) => {
420420
if (err) done(err);
421421
else{
@@ -441,25 +441,28 @@ module.exports = class Task{
441441
}
442442

443443
// All paths are relative to the project directory (./data/<uuid>/)
444-
let allPaths = ['odm_orthophoto/odm_orthophoto.tif',
444+
let allPaths = ['odm_orthophoto/odm_orthophoto.tif',
445+
'odm_orthophoto/odm_orthophoto.tfw',
445446
'odm_orthophoto/odm_orthophoto.png',
447+
'odm_orthophoto/odm_orthophoto.wld',
446448
'odm_orthophoto/odm_orthophoto.mbtiles',
447449
'odm_orthophoto/odm_orthophoto.kmz',
450+
'odm_orthophoto/odm_orthophoto_extent.dxf',
448451
'odm_orthophoto/cutline.gpkg',
449452
'odm_georeferencing', 'odm_texturing',
450453
'odm_dem/dsm.tif', 'odm_dem/dtm.tif', 'dsm_tiles', 'dtm_tiles',
451454
'odm_dem/dsm.euclideand.tif', 'odm_dem/dtm.euclideand.tif',
452-
'orthophoto_tiles', 'potree_pointcloud', 'entwine_pointcloud',
455+
'orthophoto_tiles', 'potree_pointcloud', 'entwine_pointcloud',
453456
'3d_tiles',
454457
'images.json', 'cameras.json',
455458
'task_output.txt', 'log.json',
456459
'odm_report'];
457-
460+
458461
// Did the user request different outputs than the default?
459462
if (this.outputs.length > 0) allPaths = this.outputs;
460463

461464
let tasks = [];
462-
465+
463466
if (config.test){
464467
if (config.testSkipOrthophotos){
465468
logger.info("Test mode will skip orthophoto generation");
@@ -469,7 +472,7 @@ module.exports = class Task{
469472
allPaths.splice(allPaths.indexOf(dir), 1);
470473
});
471474
}
472-
475+
473476
if (config.testSkipDems){
474477
logger.info("Test mode will skip DEMs generation");
475478

@@ -490,7 +493,7 @@ module.exports = class Task{
490493
}
491494

492495
}
493-
496+
494497
// postprocess.sh is still here for legacy/backward compatibility
495498
// purposes, but we might remove it in the future. The new logic
496499
// instructs the processing engine to do the necessary processing
@@ -500,13 +503,13 @@ module.exports = class Task{
500503
if (os.platform() !== "win32" && !this.skipPostProcessing){
501504
tasks.push(runPostProcessingScript());
502505
}
503-
506+
504507
const taskOutputFile = path.join(this.getProjectFolderPath(), 'task_output.txt');
505508
tasks.push(saveTaskOutput(taskOutputFile));
506509

507510
const archiveFunc = config.has7z ? createZipArchive : createZipArchiveLegacy;
508511
tasks.push(archiveFunc('all.zip', allPaths));
509-
512+
510513
// Upload to S3 all paths + all.zip file (if config says so)
511514
if (S3.enabled()){
512515
tasks.push((done) => {
@@ -516,8 +519,8 @@ module.exports = class Task{
516519
}else{
517520
s3Paths = ['all.zip'];
518521
}
519-
520-
S3.uploadPaths(this.getProjectFolderPath(), config.s3Bucket, this.uuid, s3Paths,
522+
523+
S3.uploadPaths(this.getProjectFolderPath(), config.s3Bucket, this.uuid, s3Paths,
521524
err => {
522525
if (!err) this.output.push("Done uploading to S3!");
523526
done(err);
@@ -664,14 +667,14 @@ module.exports = class Task{
664667
getOutput(startFromLine = 0){
665668
return this.output.slice(startFromLine, this.output.length);
666669
}
667-
668-
// Reads the contents of the tasks's
670+
671+
// Reads the contents of the tasks's
669672
// images.json and returns its JSON representation
670673
readImagesDatabase(callback){
671-
const imagesDbPath = !config.test ?
674+
const imagesDbPath = !config.test ?
672675
path.join(this.getProjectFolderPath(), 'images.json') :
673676
path.join('tests', 'processing_results', 'images.json');
674-
677+
675678
fs.readFile(imagesDbPath, 'utf8', (err, data) => {
676679
if (err) callback(err);
677680
else{
@@ -686,7 +689,7 @@ module.exports = class Task{
686689
}
687690

688691
callWebhooks(){
689-
// Hooks can be passed via command line
692+
// Hooks can be passed via command line
690693
// or for each individual task
691694
const hooks = [this.webhook, config.webhook];
692695

0 commit comments

Comments
 (0)