def start(): # RECORD START TIME g.times['start'] = time.time() now = datetime.datetime.now() date_time = now.strftime("%m/%d/%Y, %H:%M:%S") print(date_time) # OPEN LOG main.log_start() if (len(sys.argv) > 1): run_program = False try: g.inp = read_config.read_file(sys.argv[1]) main.log('Loaded: ' + str(sys.argv[1])) run_program = True # Copy input #std.copy(sys.argv[0], g.dirs['input']) #std.copy(sys.argv[1], g.dirs['input']) except: main.log('Unable to load, exiting\n') # RUN if (run_program): eampa.run() # End and close log main.end()
def main(): # RECORD START TIME g.times['start'] = time.time() # MAKE DIRS for d in g.dirs.keys(): dir = g.dirs[d] std.make_dir(dir) # OPEN LOG g.log_fh = open(g.dirs['log'] + '/main.log', 'w') g.log_fh.write( '###########################################################################\n' ) g.log_fh.write( time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) + '\n') g.log_fh.write( '###########################################################################\n' ) g.log_fh.write('\n') g.log_fh.write('Script: ' + str(sys.argv[0]) + '\n') if (len(sys.argv) > 1): shutil.copyfile(sys.argv[1], g.dirs['log'] + '/input.log') run_program = False try: g.inp = read_config.read_file(sys.argv[1]) g.log_fh.write('Loaded: ' + str(sys.argv[1]) + '\n') run_program = True except: g.log_fh.write('Unable to load, exiting\n') ####################################################################### ####################################################################### # RUN if (run_program): g.log_fh.write('\n') for_fit.run() ####################################################################### ####################################################################### # CLOSE LOG g.times['end'] = time.time() g.log_fh.write('\n') g.log_fh.write( '###########################################################################\n' ) g.log_fh.write('Duration: ' + str(g.times['end'] - g.times['start']) + '\n') g.log_fh.write( '###########################################################################\n' ) g.log_fh.close()
def main(): # g.args = sys.argv # RECORD START TIME g.times['start'] = time.time() # SET UP DIRS now = datetime.datetime.now() date_time = now.strftime("%m/%d/%Y, %H:%M:%S") #print(date_time) #wd_prefix = now.strftime('wd/%Y%m%d_%H%M%S') wd_prefix = os.getcwd() + '/wd' # Set wd g.dirs['wd'] = wd_prefix # Set sub dirs if ('input' not in g.sub_dirs.keys()): g.sub_dirs['input'] = 'input' for sd in g.sub_dirs.keys(): g.dirs[sd] = g.dirs['wd'] + '/' + g.sub_dirs[sd] # MAKE DIRS for d in g.dirs.keys(): dir = g.dirs[d] std.make_dir(dir) # OPEN LOG g.log_fh = open(g.dirs['log'] + '/main.log', 'w') g.log_fh.write( '###########################################################################\n' ) g.log_fh.write( time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) + '\n') g.log_fh.write( '###########################################################################\n' ) g.log_fh.write('\n') g.log_fh.write('Script: ' + str(sys.argv[0]) + '\n') if (len(sys.argv) > 1): run_program = False try: g.inp_raw = read_config.read_file(sys.argv[1]) g.log_fh.write('Loaded: ' + str(sys.argv[1]) + '\n') run_program = True # Copy input std.copy(sys.argv[0], g.dirs['input']) std.copy(sys.argv[1], g.dirs['input']) except: g.log_fh.write('Unable to load, exiting\n') # RUN if (run_program): qeeos.run() # CLOSE LOG g.times['end'] = time.time() g.log_fh.write('\n') g.log_fh.write( '###########################################################################\n' ) g.log_fh.write('Duration: ' + str(g.times['end'] - g.times['start']) + '\n') g.log_fh.write( '###########################################################################\n' ) g.log_fh.close()