recon_fname = ptr.gen_recon_fname(ecats, arda_dir, real_tracer) orig_exists, orig_notes = ptr.glob_file('%s/*notes*.txt'%(arda_dir)) copy = ptr.check_recon_notes(recon_fname, orig_notes) print 'same',same, 'copy reconnotes', copy, arda_dir logging.info(arda_dir) logging.info('Same Files (%s): %s'%(same, arda_dir)) logging.info('%s Copy ReconNotes: %s (exists: %s)'%(subid, copy, has_recon)) if not same: #copy ecats to new dir logging.info('NEW COPY: %s, %s'%(subid, os.path.split(arda_dir)[-1])) ptr.update_outdir(arda_dir, clobber=True) ptr.copy_files_withdate(ecats, arda_dir) if copy and has_recon: ptr.copy_file_withdate(reconnotes_rsync, os.path.join(arda_dir, recon_fname)) # clean out known problem subid ardascans = [ x for x in ardascans if not 'B07-275' in x] if len(ardascans) > 0: logfile = os.path.join(logdir,'logs', 'ARDAERROR-%s_%s%s.log'%(tracer, __file__, cleantime)) fid = open(logfile, 'w+') for item in ardascans: fid.write('%s,\n'%item) fid.close() print logfile
if copy: os.system('rm %s/*'%(outdir)) ptr.copy_files_withdate(tgzs, outdir) logging.info('COPIED TGZ: '%(tgzs)) # check for recon notes in sync recon_notes = bio.check_reconnotes(recon) if recon_notes is None: # nothing to copy continue # check for recon notes in arda _ , rn_fname = os.path.split(recon_notes) globstr = os.path.join(outdir, rn_fname) arda_reconnotes = utils.find_single_file(globstr) # copy recon notes if new or missing if arda_reconnotes is None: ptr.copy_file_withdate(recon_notes, outdir) logging.info('No recon_notes in arda, copy %s'%(recon_notes)) else: same_recon_notes = ptr.check_dates([recon_notes], [arda_reconnotes]) if not same_recon_notes: ptr.copy_file_withdate(recon_notes, outdir) logging.info('DIFFERENT recon notes, copy %s'%(recon_notes)) else: logging.info('%s same in arda, NO COPY'%(recon_notes)) # check for timing file timing_file = bio.check_pib_timing(recon) if not timing_file is None: logging.info('copied %s'%timing_file)