kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Upgraded code to be compatible with latest OpenDroneMap changes, added preliminary support for enum options
rodzic
f981c402f2
commit
74ecbcc0cc
|
@ -22,6 +22,8 @@ import imp
|
|||
import argparse
|
||||
import json
|
||||
|
||||
sys.path.append(sys.argv[2])
|
||||
|
||||
imp.load_source('context', sys.argv[2] + '/opendm/context.py')
|
||||
odm = imp.load_source('config', sys.argv[2] + '/opendm/config.py')
|
||||
|
||||
|
|
|
@ -397,14 +397,14 @@ module.exports = class Task{
|
|||
return result;
|
||||
}, {});
|
||||
|
||||
runnerOptions["project-path"] = fs.realpathSync(this.getProjectFolderPath());
|
||||
runnerOptions["project-path"] = fs.realpathSync(Directories.data);
|
||||
runnerOptions["pmvs-num-cores"] = os.cpus().length;
|
||||
|
||||
if (this.gpcFiles.length > 0){
|
||||
runnerOptions.gcp = fs.realpathSync(path.join(this.getGpcFolderPath(), this.gpcFiles[0]));
|
||||
}
|
||||
|
||||
this.runningProcesses.push(odmRunner.run(runnerOptions, (err, code, signal) => {
|
||||
this.runningProcesses.push(odmRunner.run(runnerOptions, this.uuid, (err, code, signal) => {
|
||||
if (err){
|
||||
this.setStatus(statusCodes.FAILED, {errorMessage: `Could not start process (${err.message})`});
|
||||
finished(err);
|
||||
|
|
|
@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
"use strict";
|
||||
let odmRunner = require('./odmRunner');
|
||||
let assert = require('assert');
|
||||
let logger = require('./logger');
|
||||
|
||||
let odmOptions = null;
|
||||
|
||||
|
@ -84,6 +85,20 @@ module.exports = {
|
|||
value = false;
|
||||
}
|
||||
|
||||
// If 'choices' is specified, try to convert it to array
|
||||
if (values.choices){
|
||||
try{
|
||||
values.choices = JSON.parse(values.choices.replace(/'/g, '"')); // Convert ' to "
|
||||
}catch(e){
|
||||
logger.warn(`Cannot parse choices: ${values.choices}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(values.choices)){
|
||||
type = "string"; // TODO: change to enum
|
||||
domain = values.choices;
|
||||
}
|
||||
|
||||
help = help.replace(/\%\(default\)s/g, value);
|
||||
|
||||
// In the end, all values must be converted back
|
||||
|
@ -186,7 +201,9 @@ module.exports = {
|
|||
validate: function(){
|
||||
return true; // All strings/paths are fine
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: handle enum
|
||||
];
|
||||
|
||||
let checkDomain = function(domain, value){
|
||||
|
|
|
@ -25,7 +25,8 @@ let logger = require('./logger');
|
|||
|
||||
|
||||
module.exports = {
|
||||
run: function(options, done, outputReceived){
|
||||
run: function(options, projectName, done, outputReceived){
|
||||
assert(projectName !== undefined, "projectName must be specified");
|
||||
assert(options["project-path"] !== undefined, "project-path must be defined");
|
||||
|
||||
let command = [path.join(config.odm_path, "run.py")];
|
||||
|
@ -43,6 +44,8 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
command.push(projectName);
|
||||
|
||||
logger.info(`About to run: python ${command.join(" ")}`);
|
||||
|
||||
if (config.test){
|
||||
|
@ -102,7 +105,7 @@ module.exports = {
|
|||
|
||||
// Launch
|
||||
let childProcess = spawn("python", [path.join(__dirname, "..", "helpers", "odmOptionsToJson.py"),
|
||||
"--project-path", config.odm_path]);
|
||||
"--project-path", config.odm_path, "bogusname"]);
|
||||
let output = [];
|
||||
|
||||
childProcess
|
||||
|
|
Ładowanie…
Reference in New Issue