add main script

pull/249/head
edgarriba 2015-11-17 11:22:16 +00:00
rodzic c14cf7aa01
commit c211ce2f1b
1 zmienionych plików z 20 dodań i 38 usunięć

Wyświetl plik

@ -1,44 +1,26 @@
#!/usr/bin/python
import context
import system
from datatypes import ODMApp
if __name__ == '__main__':
objODMJob = prepare_objects()
os.chdir(objODMJob.jobDir)
print '[INFO] Initializing OpenDroneMap app - %s' % system.now()
dictSteps = {0:"resize", 1:"getKeypoints", 2:"match",
3:"bundler", 4:"cmvs", 5:"pmvs", 6:"odm_meshing",
7:"odm_texturing", 8:"odm_georeferencing",
9:"odm_orthophoto", 10:"zip_results"}
listJobQueue = []
intStart = -1
intEnd = -2
# Create a dict for holding our steps
# key is step number, val is call
# Construct the calls below in eval by iterating through the composed dict of steps
# --> Allows for running steps in any arbitray sequence, e.g. rebatching certain steps
for keys in dictSteps.keys():
if dictSteps[keys] == objODMJob.args.start_with:
intStart = keys
if dictSteps[keys] == objODMJob.args.end_with:
intEnd = keys
if intStart > intEnd:
sys.stdout.writelines("No Valid Steps - Exitting.")
exit(0)
for i in range(intStart,intEnd,1):
listJobQueue.append(dictSteps[i])
for steps in listJobQueue:
methodCall = steps+"()"
strEval = "objODMJob."+methodCall
# EVAL safety - *only* internally generated strings (no user strings)
eval(strEval)
# Initialize odm app
# internally configure all tasks
app = ODMApp(context.scripts_path)
if args.zip_results:
print "\nCompressing results - " + now()
run("cd " + jobOptions["jobDir"] + "-results/ && tar -czf " +
jobOptions["jobDir"] + "-results.tar.gz *")
# set from where we want to start
# by default we will start from the beginnig
init_task_id = 0
print '[INFO] Runnning OpenDroneMap app from state %s - %s' % (init_task_id, system.now())
# run all tasks
app.run(init_task_id)
print "\n - done - " + now()
print '[INFO] OpenDroneMap app finished - %s' % system.now()