Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions py/LSS/common_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@ def convert_fits2h5(filename):
write_LSShdf5_scratchcp(ff, filename.replace('.fits', '.h5'))


def write_LSShdf5_scratchcp(ff, outf, logger=None):
def write_LSShdf5_scratchcp(ff, outf, logger=None, mode=0o664):
import h5py
import hdf5plugin # need to be in the cosmodesi test environment, as of Sep 4th 25

Expand Down Expand Up @@ -1897,7 +1897,8 @@ def write_LSShdf5_scratchcp(ff, outf, logger=None):
shutil.copy2(tmpfn, outftmp)
os.rename(outftmp, outf)
# os.system('chmod 775 ' + outf) #this should fix permissions for the group
os.chmod(outf, 0o775)
shutil.chown(outf, group='desi') # essentially chgrp desi. good to ensure at NERSC, but may fail elsewhere, do we need to account for that?
os.chmod(outf, mode) # now that the file's group is desi, could set permissions to 660 for more security
printlog('moved output to ' + outf, logger)
df = 0
# printlog('checking read of column ' + testcol, logger)
Expand Down Expand Up @@ -1941,7 +1942,7 @@ def read_hdf5_blosc(filename, columns=None, extname='LSS'):
return data


def write_LSS_scratchcp(ff, outf, comments=None, extname='LSS', logger=None):
def write_LSS_scratchcp(ff, outf, comments=None, extname='LSS', logger=None, mode=0o664):
'''
ff is the structured array/Table to be written out as an LSS catalog
outf is the full path to write out
Expand Down Expand Up @@ -1979,7 +1980,8 @@ def write_LSS_scratchcp(ff, outf, comments=None, extname='LSS', logger=None):
shutil.copy2(tmpfn, outftmp)
os.rename(outftmp, outf)
# os.system('chmod 775 ' + outf) #this should fix permissions for the group
os.chmod(outf, 0o775)
shutil.chown(outf, group='desi') # essentially chgrp desi. good to ensure at NERSC, but may fail elsewhere, do we need to account for that?
os.chmod(outf, mode) # now that the file's group is desi, could set permissions to 660 for more security

# os.system('cp ' + tmpfn + ' ' + outf)
# os.system('chmod 775 ' + outf) #this should fix permissions for the group
Expand Down