#!/usr/bin/env python # # $Id$ # $HeadURL$ # import sys import coolutils coolutils.GetCODAconfig() if '-h' in sys.argv : print '' print ' Usage:' print ' coda_get_info.py [options]' print '' print ' This will look into the CODA COOL configuration as determined' print 'by the EXPID and COOL_HOME environment variables. It will extract' print 'various pieces of information specified by the command-line' print 'options given and print them to the screen. It is intended as' print 'an easy means for other scripts to get at the current run' print 'parameters.' print ' For most cases, only a single argument will be needed needed' print 'but if more than one are given, then the specified values will' print 'be printed one per line, in the order specified on the command' print 'line. The "-v" option will print a summary of all values.' print '' print ' options:' print ' -e Print current EXPID' print ' -s Print current SESSION' print ' -c Print current CODA Configuration' print ' -r Print current Run Number' print ' -f Print current output file (full path)' print ' -d Print current output directory' print '' sys.exit(0) if not coolutils.configDataValid : print 'ERROR: Invalid CODA configuration!' print 'ERROR: This probably means you ran coda_get_info.py with' print 'ERROR: bad settings for your EXPID or COOL_HOME' print 'ERROR: environment variables.' sys.exit(-1) for arg in sys.argv[1:] : if arg == '-e' : print coolutils.EXPID if arg == '-s' : print coolutils.SESSION if arg == '-c' : print coolutils.CONFIG if arg == '-r' : print coolutils.RUN_NUMBER if arg == '-f' : print coolutils.OUTPUT_FILE if arg == '-d' : print coolutils.OUTPUT_DIR if '-v' in sys.argv or len(sys.argv)==1 : print ' EXPID: %s' % coolutils.EXPID print ' SESSION: %s' % coolutils.SESSION print ' CONFIG: %s' % coolutils.CONFIG print ' RUN_NUMBER: %d' % coolutils.RUN_NUMBER print 'OUTPUT_FILE: %s' % coolutils.OUTPUT_FILE print ' OUTPUT_DIR: %s' % coolutils.OUTPUT_DIR