Former-commit-id: 7cad50479b
pull/1161/head
edgarriba 2015-11-17 11:54:56 +00:00
rodzic 5a0e5a7151
commit ae02d756b6
3 zmienionych plików z 26 dodań i 6 usunięć

18
scripts/log.py 100644
Wyświetl plik

@ -0,0 +1,18 @@
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
def ODM_INFO(str):
print '[INFO] ' + str
def ODM_WARNING(str):
print WARNING + '[WARNING] ' + str + ENDC
def ODM_ERROR(str):
print FAIL + '[ERROR] ' + str + ENDC
def ODM_DEBUG(str):
print OKGREEN + '[DEBUG] ' + str + ENDC

Wyświetl plik

@ -2,12 +2,14 @@
import context
import system
import log
from datatypes import ODMApp
if __name__ == '__main__':
print '[INFO] Initializing OpenDroneMap app - %s' % system.now()
log.ODM_INFO('Initializing OpenDroneMap app - %s' % system.now())
# Initialize odm app
# internally configure all tasks
@ -17,10 +19,9 @@ if __name__ == '__main__':
# 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())
log.ODM_INFO('Runnning OpenDroneMap app from state %s - %s' % (init_task_id, system.now()))
# run all tasks
app.run(init_task_id)
print '[INFO] OpenDroneMap app finished - %s' % system.now()
log.ODM_INFO('OpenDroneMap app finished - %s' % system.now())

Wyświetl plik

@ -1,3 +1,4 @@
import log
# Define pipeline tasks
tasks_dict = { '0': 'resize',
@ -95,7 +96,7 @@ class ODMTaskManager(object):
inputs = {}
outputs = {}
else:
print '[ERROR] task_name %s is not valid' % task_name
log.ODM_ERROR('task_name %s is not valid' % task_name)
# setup values
task = tasks[key]
@ -137,7 +138,7 @@ class ODMTask(object):
# Launch task
def run(self):
print '[INFO] Running task %s %s ' % (self.id, self.name)
log.ODM_DEBUG('Running task %s %s ' % (self.id, self.name))
# while doing something
self.state = 1