Skip to content

Commit

Permalink
add s3_acl option for synced results and default to public-read
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrammer committed Dec 16, 2024
1 parent 9c639bd commit dd0a46f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions grizli/aws/visit_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,7 @@ def check_jwst_assoc_guiding(assoc):
ALL_FILTERS = ['F410M', 'F467M', 'F547M', 'F550M', 'F621M', 'F689M', 'F763M', 'F845M', 'F200LP', 'F350LP', 'F435W', 'F438W', 'F439W', 'F450W', 'F475W', 'F475X', 'F555W', 'F569W', 'F600LP', 'F606W', 'F622W', 'F625W', 'F675W', 'F702W', 'F775W', 'F791W', 'F814W', 'F850LP', 'G800L', 'F098M', 'F127M', 'F139M', 'F153M', 'F105W', 'F110W', 'F125W', 'F140W', 'F160W', 'G102', 'G141']


def process_visit(assoc, clean=True, sync=True, max_dt=4, combine_same_pa=False, visit_split_shift=1.2, blue_align_params=blue_align_params, ref_catalogs=['LS_DR9', 'PS1', 'DES', 'NSC', 'GAIA'], filters=None, prep_args={}, fetch_args={}, get_wcs_guess_from_table=True, master_radec='astrometry_db', align_guess=None, with_db=True, global_miri_skyflat=None, miri_tweak_align=False, tab=None, other_args={}, do_make_visit_mosaic=True, visit_mosaic_kwargs={}, expinfo_kwargs={}, **kwargs):
def process_visit(assoc, clean=True, sync=True, s3_acl="public-read", max_dt=4, combine_same_pa=False, visit_split_shift=1.2, blue_align_params=blue_align_params, ref_catalogs=['LS_DR9', 'PS1', 'DES', 'NSC', 'GAIA'], filters=None, prep_args={}, fetch_args={}, get_wcs_guess_from_table=True, master_radec='astrometry_db', align_guess=None, with_db=True, global_miri_skyflat=None, miri_tweak_align=False, tab=None, other_args={}, do_make_visit_mosaic=True, visit_mosaic_kwargs={}, expinfo_kwargs={}, **kwargs):
"""
Run the `grizli.pipeline.auto_script.go` pipeline on an association defined
in the `grizli` database.
Expand All @@ -1590,7 +1590,11 @@ def process_visit(assoc, clean=True, sync=True, max_dt=4, combine_same_pa=False,
sync : bool
Sync results to `grizli` S3 buckets and database (requires write
permissions).
s3_acl : str
S3 access control list (ACL) type for synced files (e.g., "public-read",
"private")
prep_args : dict
Keyword arguments to pass in `visit_prep_args`
Expand Down Expand Up @@ -1815,7 +1819,7 @@ def process_visit(assoc, clean=True, sync=True, max_dt=4, combine_same_pa=False,
--include "Prep/*skyflat.*" \
--include "Prep/*angles.*" \
--include "*fail*" \
--include "RAW/*[nx][tg]" """
--include "RAW/*[nx][tg]" --acl {s3_acl}"""

os.system(cmd)
print('\n# Sync\n' + cmd.replace(' ', '') + '\n')
Expand All @@ -1824,7 +1828,7 @@ def process_visit(assoc, clean=True, sync=True, max_dt=4, combine_same_pa=False,
files = glob.glob(f'{assoc}*.*')
for file in files:
os.system(f'aws s3 cp {file} ' +
f' s3://grizli-v2/HST/Pipeline/{assoc}/')
f' s3://grizli-v2/HST/Pipeline/{assoc}/ --acl {s3_acl}')

if (clean & 2) > 0:
print(f'rm -rf {assoc}*')
Expand Down

0 comments on commit dd0a46f

Please sign in to comment.