if not has_ecats: print recondir, 'no ecats' logging.error('NO ECATS: %s'%recondir) continue ## generate string of arda output directory arda_dir = ptr.make_outdirname(ecats, tracer=real_tracer.upper(), arda=arda) if os.path.isdir(arda_dir): try: ardascans.remove(arda_dir) except: ardascans.append(recondir) exists, orig_ecats = ptr.glob_file('%s/*.v'%arda_dir, single=False) same = ptr.check_dates(ecats, orig_ecats) has_recon, reconnotes_rsync = ptr.get_reconnotes_fromsync(recondir, real_tracer) 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)
continue scandate = bio.check_scandates(tgzs) # generate full output directory name real_tracer = bio.get_real_tracer(recon) dirnme = bio.make_dirname(scandate, real_tracer) outdir, exists = utils.make_rec_dir(os.path.join(arda, subid), dirname = dirnme) if not exists: # directory didnt exist, copy files logging.info('%s is NEW, copy date'%outdir) copy = True else: biographs.remove(outdir) arda_tgz, arda_ntgz=bio.tgz_in_recon(outdir, subid) same_file = ptr.check_dates(tgzs, arda_tgz) if same_file: logging.info('%s exists, files are the same'%(outdir)) copy = False else: copy = True logging.info('%s exists, files NOT same'%(outdir)) 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