Merge pull request #1258 from pierotofy/friendlyerror

Show more friendly error logs
pull/1260/head
Piero Toffanin 2021-04-05 10:07:09 -04:00 zatwierdzone przez GitHub
commit fbd61963d5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 41 dodań i 9 usunięć

Wyświetl plik

@ -1 +1 @@
2.4.8
2.4.9

Wyświetl plik

@ -10,6 +10,10 @@ import signal
from opendm import context
from opendm import log
class SubprocessException(Exception):
def __init__(self, msg, errorCode):
super().__init__(msg)
self.errorCode = errorCode
def get_ccd_widths():
"""Return the CCD Width of the camera listed in the JSON defs file."""
@ -58,7 +62,6 @@ def run(cmd, env_paths=[context.superbuild_bin_path], env_vars={}, packages_path
global running_subprocesses
log.ODM_INFO('running %s' % cmd)
env = os.environ.copy()
if len(env_paths) > 0:
env["PATH"] = env["PATH"] + ":" + ":".join(env_paths)
@ -74,9 +77,9 @@ def run(cmd, env_paths=[context.superbuild_bin_path], env_vars={}, packages_path
retcode = p.wait()
running_subprocesses.remove(p)
if retcode < 0:
raise Exception("Child was terminated by signal {}".format(-retcode))
raise SubprocessException("Child was terminated by signal {}".format(-retcode), -retcode)
elif retcode > 0:
raise Exception("Child returned {}".format(retcode))
raise SubprocessException("Child returned {}".format(retcode), retcode)
def now():

8
run.py
Wyświetl plik

@ -65,10 +65,10 @@ if __name__ == '__main__':
]))
app = ODMApp(args)
app.execute()
retcode = app.execute()
# Do not show ASCII art for local submodels runs
if not "submodels/submodel_" in args.project_path:
if retcode == 0 and not "submodels/submodel_" in args.project_path:
log.ODM_INFO('MMMMMMMMMMMNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNMMMMMMMMMMM')
log.ODM_INFO('MMMMMMdo:..---../sNMMMMMMMMMMMMMMMMMMMMMMMMMMNs/..---..:odMMMMMM')
log.ODM_INFO('MMMMy-.odNMMMMMNy/`/mMMMMMMMMMMMMMMMMMMMMMMm/`/hNMMMMMNdo.-yMMMM')
@ -110,4 +110,6 @@ if __name__ == '__main__':
log.ODM_INFO('MMMMMMMMMMMN- smNm/ +MMm :NNdo` .mMM` oMM+/yMM/ MMMMMMMMMMMM')
log.ODM_INFO('MMMMMMMMMMMMNo- `:yMMMm `:sNMMM` sMMMMMMM+ NMMMMMMMMMMM')
log.ODM_INFO('MMMMMMMMMMMMMMMNmmNMMMMMMMNmmmmNMMMMMMMNNMMMMMMMMMNNMMMMMMMMMMMM')
log.ODM_INFO('ODM app finished - %s' % system.now())
log.ODM_INFO('ODM app finished - %s' % system.now())
else:
exit(retcode)

Wyświetl plik

@ -1,4 +1,4 @@
import os
import os, traceback
from opendm import context
from opendm import types
@ -79,4 +79,31 @@ class ODMApp:
.connect(report)
def execute(self):
self.first_stage.run()
try:
self.first_stage.run()
return 0
except system.SubprocessException as e:
print("")
print("===== Dumping Info for Geeks (developers need this to fix bugs) =====")
print(str(e))
traceback.print_exc()
print("===== Done, human-readable information to follow... =====")
print("")
code = e.errorCode
if code == 139 or code == 134 or code == 1:
# Segfault
log.ODM_ERROR("Uh oh! Processing stopped because of strange values in the reconstruction. This is often a sign that the input data has some issues or the software cannot deal with it. Have you followed best practices for data acquisition? See https://docs.opendronemap.org/flying.html")
elif code == 137:
log.ODM_ERROR("Whoops! You ran out of memory! Add more RAM to your computer, if you're using docker configure it to use more memory (unless you are using the WSL2 backend, nothing you can do there), resize your images, lower the quality settings or process the images using a cloud provider (e.g. https://webodm.net).")
elif code == 132:
log.ODM_ERROR("Oh no! It looks like your CPU is not supported (is it fairly old?). You can still use ODM, but you will need to build your own docker image. See https://github.com/OpenDroneMap/ODM#build-from-source")
elif code == 3:
log.ODM_ERROR("ODM can't find a program that is required for processing to run! Did you do a custom build of ODM? (cool!) Make sure that all programs required by ODM are in the right place and are built correctly.")
else:
log.ODM_ERROR("The program exited with a strange error code. Please report it at https://community.opendronemap.org")
# TODO: more?
return code