Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change move bucket #87

Merged
merged 8 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions configs/config-pgf-runner-leap-dataflow-pr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
},
"DataflowBakery": {
"use_public_ips": true,
"service_account_email": "julius-leap-dataflow@leap-pangeo.iam.gserviceaccount.com",
"service_account_email": "public-cmip-google-cloud@leap-pangeo.iam.gserviceaccount.com",
"project_id": "leap-pangeo",
"temp_gcs_location": "gs://leap-scratch/data-library/temp",
"use_dataflow_prime": true,
"max_num_workers": 10
},
"TargetStorage": {
"fsspec_class": "gcsfs.GCSFileSystem",
"root_path": "gs://leap-scratch/data-library/cmip6-pr/{job_name}"
"root_path": "gs://leap-scratch/data-library/cmip6-pgf-ingestion/pr/{job_name}"
},
"InputCacheStorage": {
"fsspec_class": "gcsfs.GCSFileSystem",
"root_path": "gs://leap-scratch/data-library/cache"
"root_path": "gs://leap-scratch/data-library/cmip6-pgf-ingestion/cache"
}
}
6 changes: 3 additions & 3 deletions configs/config-pgf-runner-leap-dataflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
},
"DataflowBakery": {
"use_public_ips": true,
"service_account_email": "julius-leap-dataflow@leap-pangeo.iam.gserviceaccount.com",
"service_account_email": "public-cmip-google-cloud@leap-pangeo.iam.gserviceaccount.com",
"project_id": "leap-pangeo",
"temp_gcs_location": "gs://leap-scratch/data-library/temp",
"use_dataflow_prime": true,
"max_num_workers": 20
},
"TargetStorage": {
"fsspec_class": "gcsfs.GCSFileSystem",
"root_path": "gs://leap-persistent-ro/data-library/cmip6-testing/{job_name}"
"root_path": "gs://leap-scratch/data-library/cmip6-pgf-ingestion/{job_name}"
},
"InputCacheStorage": {
"fsspec_class": "gcsfs.GCSFileSystem",
"root_path": "gs://leap-scratch/data-library/cache"
"root_path": "gs://leap-scratch/data-library/cmip6-pgf-ingestion/cache"
}
}
88 changes: 44 additions & 44 deletions feedstock/iids.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
# from https://github.com/Timh37/CMIP6cex/issues/2
- 'CMIP6.*.*.*.historical.*.day.psl.*.*' #inline comment
- 'CMIP6.*.*.*.historical.*.day.sfcWind.*.*'
- 'CMIP6.*.*.*.historical.*.day.pr.*.*'
- 'CMIP6.*.*.*.ssp245.*.day.psl.*.*'
- 'CMIP6.*.*.*.ssp245.*.day.sfcWind.*.*'
- 'CMIP6.*.*.*.ssp245.*.day.pr.*.*'
- 'CMIP6.*.*.*.ssp585.*.day.psl.*.*'
- 'CMIP6.*.*.*.ssp585.*.day.sfcWind.*.*'
- 'CMIP6.*.*.*.ssp585.*.day.pr.*.*'
# from https://github.com/pangeo-forge/cmip6-feedstock/issues/22
- 'CMIP6.*.*.*.historical.*.Omon.zmeso.*.*'
- 'CMIP6.*.*.*.ssp126.*.Omon.zmeso.*.*'
- 'CMIP6.*.*.*.ssp245.*.Omon.zmeso.*.*'
- 'CMIP6.*.*.*.ssp585.*.Omon.zmeso.*.*'
# PMIP velocities
- 'CMIP6.PMIP.MIROC.MIROC-ES2L.lgm.r1i1p1f2.Omon.uo.gn.v20191002'
- 'CMIP6.PMIP.AWI.AWI-ESM-1-1-LR.lgm.r1i1p1f1.Odec.uo.gn.v20200212'
- 'CMIP6.PMIP.AWI.AWI-ESM-1-1-LR.lgm.r1i1p1f1.Omon.uo.gn.v20200212'
- 'CMIP6.PMIP.MIROC.MIROC-ES2L.lgm.r1i1p1f2.Omon.uo.gr1.v20200911'
- 'CMIP6.PMIP.MPI-M.MPI-ESM1-2-LR.lgm.r1i1p1f1.Omon.uo.gn.v20200909'
- 'CMIP6.PMIP.AWI.AWI-ESM-1-1-LR.lgm.r1i1p1f1.Omon.vo.gn.v20200212'
- 'CMIP6.PMIP.MIROC.MIROC-ES2L.lgm.r1i1p1f2.Omon.vo.gn.v20191002'
- 'CMIP6.PMIP.AWI.AWI-ESM-1-1-LR.lgm.r1i1p1f1.Odec.vo.gn.v20200212'
- 'CMIP6.PMIP.MIROC.MIROC-ES2L.lgm.r1i1p1f2.Omon.vo.gr1.v20200911'
- 'CMIP6.PMIP.MPI-M.MPI-ESM1-2-LR.lgm.r1i1p1f1.Omon.vo.gn.v20190710'
# from https://github.com/leap-stc/cmip6-leap-feedstock/issues/41
- 'CMIP6.*.*.*.historical.*.SImon.sifb.*.*'
- 'CMIP6.*.*.*.ssp126.*.SImon.sifb.*.*'
- 'CMIP6.*.*.*.ssp245.*.SImon.sifb.*.*'
- 'CMIP6.*.*.*.ssp585.*.SImon.sifb.*.*'
- 'CMIP6.*.*.*.historical.*.SImon.siitdthick.*.*'
- 'CMIP6.*.*.*.ssp126.*.SImon.siitdthick.*.*'
- 'CMIP6.*.*.*.ssp245.*.SImon.siitdthick.*.*'
- 'CMIP6.*.*.*.ssp585.*.SImon.siitdthick.*.*'
# for CMIP6 pco2 testbed
- "CMIP6.*.*.*.historical.*.Omon.spco2.*.*"
- "CMIP6.*.*.*.historical.*.Omon.tos.*.*"
- "CMIP6.*.*.*.historical.*.Omon.sos.*.*"
- "CMIP6.*.*.*.historical.*.Omon.chl.*.*"
- "CMIP6.*.*.*.historical.*.Omon.mlotst.*.*"
- "CMIP6.*.*.*.ssp245.*.Omon.spco2.*.*"
- "CMIP6.*.*.*.ssp245.*.Omon.tos.*.*"
- "CMIP6.*.*.*.ssp245.*.Omon.sos.*.*"
- "CMIP6.*.*.*.ssp245.*.Omon.chl.*.*"
- "CMIP6.*.*.*.ssp245.*.Omon.mlotst.*.*"
# - 'CMIP6.*.*.*.historical.*.day.sfcWind.*.*'
# - 'CMIP6.*.*.*.historical.*.day.pr.*.*'
# - 'CMIP6.*.*.*.ssp245.*.day.psl.*.*'
# - 'CMIP6.*.*.*.ssp245.*.day.sfcWind.*.*'
# - 'CMIP6.*.*.*.ssp245.*.day.pr.*.*'
# - 'CMIP6.*.*.*.ssp585.*.day.psl.*.*'
# - 'CMIP6.*.*.*.ssp585.*.day.sfcWind.*.*'
# - 'CMIP6.*.*.*.ssp585.*.day.pr.*.*'
# # from https://github.com/pangeo-forge/cmip6-feedstock/issues/22
# - 'CMIP6.*.*.*.historical.*.Omon.zmeso.*.*'
# - 'CMIP6.*.*.*.ssp126.*.Omon.zmeso.*.*'
# - 'CMIP6.*.*.*.ssp245.*.Omon.zmeso.*.*'
# - 'CMIP6.*.*.*.ssp585.*.Omon.zmeso.*.*'
# # PMIP velocities
# - 'CMIP6.PMIP.MIROC.MIROC-ES2L.lgm.r1i1p1f2.Omon.uo.gn.v20191002'
# - 'CMIP6.PMIP.AWI.AWI-ESM-1-1-LR.lgm.r1i1p1f1.Odec.uo.gn.v20200212'
# - 'CMIP6.PMIP.AWI.AWI-ESM-1-1-LR.lgm.r1i1p1f1.Omon.uo.gn.v20200212'
# - 'CMIP6.PMIP.MIROC.MIROC-ES2L.lgm.r1i1p1f2.Omon.uo.gr1.v20200911'
# - 'CMIP6.PMIP.MPI-M.MPI-ESM1-2-LR.lgm.r1i1p1f1.Omon.uo.gn.v20200909'
# - 'CMIP6.PMIP.AWI.AWI-ESM-1-1-LR.lgm.r1i1p1f1.Omon.vo.gn.v20200212'
# - 'CMIP6.PMIP.MIROC.MIROC-ES2L.lgm.r1i1p1f2.Omon.vo.gn.v20191002'
# - 'CMIP6.PMIP.AWI.AWI-ESM-1-1-LR.lgm.r1i1p1f1.Odec.vo.gn.v20200212'
# - 'CMIP6.PMIP.MIROC.MIROC-ES2L.lgm.r1i1p1f2.Omon.vo.gr1.v20200911'
# - 'CMIP6.PMIP.MPI-M.MPI-ESM1-2-LR.lgm.r1i1p1f1.Omon.vo.gn.v20190710'
# # from https://github.com/leap-stc/cmip6-leap-feedstock/issues/41
# - 'CMIP6.*.*.*.historical.*.SImon.sifb.*.*'
# - 'CMIP6.*.*.*.ssp126.*.SImon.sifb.*.*'
# - 'CMIP6.*.*.*.ssp245.*.SImon.sifb.*.*'
# - 'CMIP6.*.*.*.ssp585.*.SImon.sifb.*.*'
# - 'CMIP6.*.*.*.historical.*.SImon.siitdthick.*.*'
# - 'CMIP6.*.*.*.ssp126.*.SImon.siitdthick.*.*'
# - 'CMIP6.*.*.*.ssp245.*.SImon.siitdthick.*.*'
# - 'CMIP6.*.*.*.ssp585.*.SImon.siitdthick.*.*'
# # for CMIP6 pco2 testbed
# - "CMIP6.*.*.*.historical.*.Omon.spco2.*.*"
# - "CMIP6.*.*.*.historical.*.Omon.tos.*.*"
# - "CMIP6.*.*.*.historical.*.Omon.sos.*.*"
# - "CMIP6.*.*.*.historical.*.Omon.chl.*.*"
# - "CMIP6.*.*.*.historical.*.Omon.mlotst.*.*"
# - "CMIP6.*.*.*.ssp245.*.Omon.spco2.*.*"
# - "CMIP6.*.*.*.ssp245.*.Omon.tos.*.*"
# - "CMIP6.*.*.*.ssp245.*.Omon.sos.*.*"
# - "CMIP6.*.*.*.ssp245.*.Omon.chl.*.*"
# - "CMIP6.*.*.*.ssp245.*.Omon.mlotst.*.*"
# # from https://github.com/leap-stc/cmip6-leap-feedstock/issues/72
# - "CMIP6.HighResMIP.MOHC.HadGEM3-GC31-HH.highres-future.r1i1p1f1.Omon.so.gn.v20200514"
# - "CMIP6.HighResMIP.MOHC.HadGEM3-GC31-HH.highres-future.r1i1p1f1.Omon.thetao.gn.v20200514"
Expand Down
17 changes: 12 additions & 5 deletions feedstock/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,16 @@ class Copy(beam.PTransform):
target_prefix: str

def _copy(self,store: zarr.storage.FSStore) -> zarr.storage.FSStore:
gcs = gcsio.GcsIO()
# We do need the gs:// prefix?
# TODO: Determine this dynamically from zarr.storage.FSStore
source = f"gs://{os.path.normpath(store.path)}/" #FIXME more elegant. `.copytree` needs trailing slash
target = os.path.join(*[self.target_prefix]+source.split('/')[-3:])
gcs.copytree(source, target)
# gcs = gcsio.GcsIO()
# gcs.copytree(source, target)
print(f"HERE: Copying {source} to {target}")
import gcsfs
fs = gcsfs.GCSFileSystem()
fs.cp(source, target, recursive=True)
# return a new store with the new path that behaves exactly like the input
# to this stage (so we can slot this stage right before testing/logging stages)
return zarr.storage.FSStore(target)
Expand All @@ -146,7 +150,8 @@ def expand(self, pcoll: beam.PCollection) -> beam.PCollection:

if is_test:
setup_logging('DEBUG')
copy_target_bucket = "gs://leap-scratch"
# copy_target_bucket = "gs://leap-scratch/data-library/cmip6-pr-copied/
copy_target_bucket ="gs://cmip6/cmip6-pgf-ingestion-test/zarr_stores_pr/" #TODO: Change this back once we are ready to release this.
iid_file = "feedstock/iids_pr.yaml"
prune_iids = True
prune_submission = True # if set, only submits a subset of the iids in the final step
Expand All @@ -167,7 +172,7 @@ def expand(self, pcoll: beam.PCollection) -> beam.PCollection:

else:
setup_logging('INFO')
copy_target_bucket = "gs://leap-persistent-ro"
copy_target_bucket = "gs://cmip6/cmip6-pgf-ingestion-test/zarr_stores/"
iid_file = 'feedstock/iids.yaml'
prune_iids = False
prune_submission = False # if set, only submits a subset of the iids in the final step
Expand Down Expand Up @@ -332,6 +337,8 @@ def dynamic_chunking_func(ds: xr.Dataset) -> Dict[str, int]:
recipes = {}

for iid, urls in url_dict.items():
target_prefix = f'{copy_target_bucket}'
print(f"{target_prefix = }")
pattern = pattern_from_file_sequence(
urls,
concat_dim='time'
Expand All @@ -347,7 +354,7 @@ def dynamic_chunking_func(ds: xr.Dataset) -> Dict[str, int]:
combine_dims=pattern.combine_dim_keys,
dynamic_chunking_fn=dynamic_chunking_func,
)
| Copy(target_prefix=f'{copy_target_bucket}/data-library/cmip6-testing/copied_stores')
| Copy(target_prefix=target_prefix)
| "Logging to non-QC table" >> LogToBigQuery(iid=iid, table_id=table_id_nonqc)
| TestDataset(iid=iid)
| "Logging to QC table" >> LogToBigQuery(iid=iid, table_id=table_id)
Expand Down