Skip to content

Commit

Permalink
feat(pipeline): copy layer icons within upload task
Browse files Browse the repository at this point in the history
  • Loading branch information
andreashelms committed Feb 5, 2024
1 parent 92512b4 commit 7a63857
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 2 deletions.
Binary file added pipeline/assets/layer-icons/biomass.agb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pipeline/assets/layer-icons/greenhouse.xch4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pipeline/assets/layer-icons/greenhouse.xco2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pipeline/assets/layer-icons/oc.chlor_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pipeline/assets/layer-icons/sea_ice.ice_conc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pipeline/assets/layer-icons/soil_moisture.sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions pipeline/dags/task_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,14 @@ def fn(**context):
upload_dir = f'{workdir}/upload'
clean_upload_dir = clean_dir(
task_id='clean_upload_dir', dir=upload_dir)
prepare_upload_task = prepare_upload(workdir, upload_dir, layer_type)
prepare_upload_task = prepare_upload(workdir, upload_dir, layer_type, layer_id, layer_variable)
upload_task = gcloud_upload_dir(
layer_id, layer_variable, directory=upload_dir)
clean_upload_dir >> prepare_upload_task() >> upload_task
return fn


def prepare_upload(workdir: str, upload_dir: str, layer_type: str):
def prepare_upload(workdir: str, upload_dir: str, layer_type: str, layer_id: str, layer_variable: str):
@task(task_id='prepare_upload')
def fn():
metadata_filepath = str(Path(workdir).joinpath('metadata.json'))
Expand Down Expand Up @@ -264,6 +264,8 @@ def fn():
shutil.copyfile(metadata_filepath, f'{upload_dir}/metadata.json')
# copy legend image
shutil.copyfile(f'{workdir}/legend.png', f'{upload_dir}/legend.png')
# copy layer icon
shutil.copyfile(f'/opt/airflow/assets/layer-icons/{layer_id}.{layer_variable}.png', f'{upload_dir}/{layer_id}.{layer_variable}.png')
# make zip archive for offline usage
zip_file = f'{workdir}/package'
shutil.make_archive(zip_file, 'zip', root_dir=upload_dir)
Expand Down

0 comments on commit 7a63857

Please sign in to comment.