-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprocess.py
executable file
·64 lines (51 loc) · 2.13 KB
/
process.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
'''
Created on Jun 20, 2012
@author: Alex Ip ([email protected])
Main script to be invoked from the command line
Replaces ULA nbar.py
'''
import logging, sys, os, traceback
import image_processor
import ULA3.image_processor as process_manager
from ULA3.image_processor import ProcessorConfig
from ULA3 import DataManager
from ULA3.utils import log_multiline
#if __name__ == '__main__':
# Set top logging level settings explicitly
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setLevel(logging.DEBUG)
console_formatter = logging.Formatter('%(name)s : %(message)s')
console_handler.setFormatter(console_formatter)
root_logger = logging.getLogger('root')
if not root_logger.level:
root_logger.setLevel(logging.INFO)
root_logger.addHandler(console_handler)
def main():
CONFIG = ProcessorConfig()
DATA = DataManager()
root_logger.info('process started with args %s', CONFIG._args)
try:
assert CONFIG.input, 'Input path for scene(s) must be specified'
# Subprocess list specified (in order) by:
# 1. Individual subprocess
# 2. Custom subprocess list file
# 3. Specified process level (e.g. 'nbar', 'pqa')
# 4. Default (nbar) - uses __init__.txt
subprocess = (process_manager.get_process_list_from_text(CONFIG.subprocess) or
process_manager.get_process_list_from_file(CONFIG.subprocess_file) or
process_manager.get_process_list_from_file(
os.path.join(CONFIG.code_root, 'image_processor', CONFIG.process_level + '.txt')) or
[])
image_processor.process(subprocess, CONFIG.resume)
root_logger.info('process completed successfully')
if CONFIG.debug:
DATA.save_all() # Save all in-memory data for debugging
sys.exit(0)
except (Exception), e:
root_logger.info('process failed')
log_multiline(root_logger.error, traceback.format_exc(), 'process failed: ' + e.message, '\t')
DATA.save_all() # Save all in-memory data for debugging or resuming
sys.exit(1)
if __name__ == '__main__':
main()