kopia lustrzana https://github.com/OpenDroneMap/ODM
--copy-to fix, sys.exit fixes
rodzic
f89545ace9
commit
f63da10342
|
@ -57,8 +57,9 @@ class ODMLogger:
|
||||||
'type': level_name.lower()
|
'type': level_name.lower()
|
||||||
})
|
})
|
||||||
|
|
||||||
def init_json_output(self, output_file, args):
|
def init_json_output(self, output_files, args):
|
||||||
self.json_output_file = output_file
|
self.json_output_files = output_files
|
||||||
|
self.json_output_file = output_files[0]
|
||||||
self.json = {}
|
self.json = {}
|
||||||
self.json['odmVersion'] = odm_version()
|
self.json['odmVersion'] = odm_version()
|
||||||
self.json['memory'] = memory()
|
self.json['memory'] = memory()
|
||||||
|
@ -137,8 +138,13 @@ class ODMLogger:
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if self.json is not None and self.json_output_file is not None:
|
if self.json is not None and self.json_output_file is not None:
|
||||||
with open(self.json_output_file, 'w') as f:
|
try:
|
||||||
f.write(json.dumps(self.json, indent=4))
|
with open(self.json_output_file, 'w') as f:
|
||||||
|
f.write(json.dumps(self.json, indent=4))
|
||||||
|
for f in self.json_output_files[1:]:
|
||||||
|
shutil.copy(self.json_output_file, f)
|
||||||
|
except Exception as e:
|
||||||
|
print("Cannot write log.json: %s" % str(e))
|
||||||
|
|
||||||
logger = ODMLogger()
|
logger = ODMLogger()
|
||||||
|
|
||||||
|
|
|
@ -50,13 +50,12 @@ class OSFMContext:
|
||||||
|
|
||||||
# Check that a reconstruction file has been created
|
# Check that a reconstruction file has been created
|
||||||
if not self.reconstructed():
|
if not self.reconstructed():
|
||||||
log.ODM_ERROR("The program could not process this dataset using the current settings. "
|
raise system.ExitException("The program could not process this dataset using the current settings. "
|
||||||
"Check that the images have enough overlap, "
|
"Check that the images have enough overlap, "
|
||||||
"that there are enough recognizable features "
|
"that there are enough recognizable features "
|
||||||
"and that the images are in focus. "
|
"and that the images are in focus. "
|
||||||
"You could also try to increase the --min-num-features parameter."
|
"You could also try to increase the --min-num-features parameter."
|
||||||
"The program will now exit.")
|
"The program will now exit.")
|
||||||
exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(self, args, images_path, reconstruction, append_config = [], rerun=False):
|
def setup(self, args, images_path, reconstruction, append_config = [], rerun=False):
|
||||||
|
|
|
@ -45,8 +45,7 @@ class LocalRemoteExecutor:
|
||||||
log.ODM_WARNING("LRE: The node seems to be offline! We'll still process the dataset, but it's going to run entirely locally.")
|
log.ODM_WARNING("LRE: The node seems to be offline! We'll still process the dataset, but it's going to run entirely locally.")
|
||||||
self.node_online = False
|
self.node_online = False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.ODM_ERROR("LRE: An unexpected problem happened while opening the node connection: %s" % str(e))
|
raise system.ExitException("LRE: An unexpected problem happened while opening the node connection: %s" % str(e))
|
||||||
exit(1)
|
|
||||||
|
|
||||||
def set_projects(self, paths):
|
def set_projects(self, paths):
|
||||||
self.project_paths = paths
|
self.project_paths = paths
|
||||||
|
|
|
@ -27,7 +27,11 @@ class ODMApp:
|
||||||
if args.debug:
|
if args.debug:
|
||||||
log.logger.show_debug = True
|
log.logger.show_debug = True
|
||||||
|
|
||||||
log.logger.init_json_output(os.path.join(args.project_path, "log.json"), args)
|
json_log_paths = [os.path.join(args.project_path, "log.json")]
|
||||||
|
if args.copy_to:
|
||||||
|
json_log_paths.append(args.copy_to)
|
||||||
|
|
||||||
|
log.logger.init_json_output(json_log_paths, args)
|
||||||
|
|
||||||
dataset = ODMLoadDatasetStage('dataset', args, progress=5.0,
|
dataset = ODMLoadDatasetStage('dataset', args, progress=5.0,
|
||||||
verbose=args.verbose)
|
verbose=args.verbose)
|
||||||
|
|
|
@ -198,7 +198,6 @@ class ODMReport(types.ODM_Stage):
|
||||||
octx.export_report(os.path.join(tree.odm_report, "report.pdf"), odm_stats, self.rerun())
|
octx.export_report(os.path.join(tree.odm_report, "report.pdf"), odm_stats, self.rerun())
|
||||||
|
|
||||||
# TODO: does this warrant a new stage?
|
# TODO: does this warrant a new stage?
|
||||||
# TODO: move to pipeline end ?
|
|
||||||
if args.copy_to:
|
if args.copy_to:
|
||||||
try:
|
try:
|
||||||
copy_paths([os.path.join(args.project_path, p) for p in get_processing_results_paths()], args.copy_to, self.rerun())
|
copy_paths([os.path.join(args.project_path, p) for p in get_processing_results_paths()], args.copy_to, self.rerun())
|
||||||
|
|
Ładowanie…
Reference in New Issue