9f13a83c45f20774ba2f749cc0ce25ba9c64aa73 max Fri Jun 27 08:20:16 2025 -0700 removing temp file after ucscDataset diffs run, because of perms problems diff --git ucsc/datasetDiffs ucsc/datasetDiffs index 4d1bd03..ff04dc9 100755 --- ucsc/datasetDiffs +++ ucsc/datasetDiffs @@ -145,49 +145,50 @@ for dname in cb_datasets: cb_loc[dname] = cb_base + dname + "/dataset.json" threader(cb_loc, cb_djson, cb_hide) # dicts/sets to hold everything rr_hide = set() # holds hidden rr datasets rr_djson = dict() # holds contents of json files for each rr dataset rr_datasets = set() # holds names of all datasets on rr rr_paths = dict() # file paths to process via multithreading # Get list of dataset.json files for rr cmd = ['ssh', 'qateam@hgw0.soe.ucsc.edu', 'find', ct_base, '-name',\ 'dataset.json', '|', 'cut', '-f', '6-', '-d', '"/"'] p = Popen(cmd, shell=False, stdout=PIPE, stderr=PIPE) cmdout, cmderr = p.communicate() rr_files = set(cmdout.decode().rstrip().split('\n')) - #with tempfile.NamedTemporaryFile(prefix='cb_', delete=False) as tmp: - #tmp.write(cmdout) - tmp = open("/data/tmp/filesForRsync.txt", "wb") + with tempfile.NamedTemporaryFile(prefix='cb_', delete=False) as tmp: tmp.write(cmdout) - tmp.close() + #tmp = open("/data/tmp/filesForRsync.txt", "wb") + tmp.write(cmdout) + tmp.flush() # Wanted to use TemporaryDirectory here but couldn't get it to work rr_base = '/data/tmp/cb_tmp_new' # Make the new directory, continue on if dir already exists try: mkdir(rr_base) except OSError: pass rsync_cmd = ['rsync', '--files-from=' + tmp.name, \ 'qateam@hgw0.soe.ucsc.edu:/usr/local/apache/htdocs-cells/', rr_base] print("running ", rsync_cmd) #rsync_p = Popen(rsync_cmd, shell=True, stdout=PIPE, stderr=PIPE) #rsync_cmdout, rsync_cmderr = p.communicate() subprocess.run(rsync_cmd, check=True) + tmp.close() #if p.returncode != 0: #logging.error("error when running: "+repr(" ".join(rsync_cmd))) #assert(False) # go through rr_files for fname in rr_files: # turn full path name into a simple dataset name fsplit = fname.strip().split('/') # from https://stackoverflow.com/questions/12453580/how-do-i-concatenate-items-in-a-list-to-a-single-string dname = '/'.join(fsplit[:-1]) if dname != '': # now turn dataset name into url dpath = rr_base + '/' + dname + '/dataset.json' # add that url to a dict rr_paths[dname] = dpath