Skip to content

Commit

Permalink
Merge pull request #74 from AgPipeline/develop
Browse files Browse the repository at this point in the history
Fixing up Actions for new ubuntu version
  • Loading branch information
Chris-Schnaufer authored Nov 28, 2022
2 parents 61b5174 + 6c75922 commit 7b4d9c2
Show file tree
Hide file tree
Showing 10 changed files with 364 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker_build_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
app_testing:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
name: Test simple apps (not workflow apps)
strategy:
fail-fast: false
Expand All @@ -26,13 +26,13 @@ jobs:
include:
- app: betydb2geojson
parameter_json: .github/workflows/app_testing.json
test_data_tar_gz: https://data.cyverse.org/dav-anon/iplant/projects/aes/cct/diag/ci/ci_docker_test_data_9.tar.gz
test_data_tar_gz: https://data.cyverse.org/dav-anon/iplant/projects/aes/cct/diag/ci/ci_docker_test_data_10.tar.gz
test_results: if [[ -f "outputs/plots.geojson" ]]; then echo "Test betydb2geojson success"; exit 0; else echo "App failed - betydb2geojson"; exit 1; fi;
test_results_quality: ./tests/compare_geojson.py './test_data/plots_betydb.geojson' './outputs/plots.geojson'
- app: shp2geojson
tar_gz_file: https://de.cyverse.org/dl/d/3C8A23C0-F77A-4598-ADC4-874EB265F9B0/scif_test_data.tar.gz
parameter_json: .github/workflows/app_testing.json
test_data_tar_gz: https://de.cyverse.org/dl/d/7AE4F4C8-5F40-4B56-91F3-127678EC58C0/ci_docker_test_data_4.tar.gz
test_data_tar_gz: https://data.cyverse.org/dav-anon/iplant/projects/aes/cct/diag/ci/ci_docker_test_data_10.tar.gz
test_results: if [[ -f "outputs/plots.geojson" ]]; then echo "Test shp2geojson success"; exit 0; else echo "App failed - shp2geojson"; exit 1; fi;
test_results_quality: ./tests/compare_geojson.py './test_data/plots_shapefile.geojson' './outputs/plots.geojson'
- app: soilmask
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
run: 'python3 -m pip install --upgrade --no-cache-dir numpy wheel requests'
- name: Install Python pygdal
shell: bash
run: 'python3 -m pip install --no-cache-dir pygdal==3.0.4.*'
run: 'python3 -m pip install --no-cache-dir pygdal==3.4.1.*'
- name: Install system requirements from source
shell: bash
run: 'if [ -s "packages.txt" ]; then (cat packages.txt | sudo xargs apt-get install -y --no-install-recommends) || (echo "Failed to install additional packages" && exit 1); fi'
Expand Down
49 changes: 26 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
FROM ubuntu:20.04 as base
FROM ubuntu:22.04 as base
ENV DOCKER_IMAGE agdrone/drone-workflow:1.1
ENV DEBIAN_FRONTEND noninteractive
WORKDIR /

# Install Python
RUN apt-get update -y \
&& apt-get install -y software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa -y \
&& apt-get update -y \
&& apt-get install --no-install-recommends -y \
git \
python3.8 \
python3.8-distutils \
python3-pip \
&& rm -f /usr/bin/python3 && ln -s /usr/bin/python3.8 /usr/bin/python3 \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& python3.8 -m pip install -U pip \
&& apt-get autoremove -y \
Expand Down Expand Up @@ -44,7 +49,6 @@ RUN apt-get update && \
libgdal-dev \
gcc \
g++ \
python-dev \
python3-dev \
python3.8-dev \
curl && \
Expand All @@ -53,7 +57,7 @@ RUN apt-get update && \
python3.8 -m pip install --upgrade --no-cache-dir \
influxdb matplotlib Pillow pip piexif python-dateutil pyyaml scipy utm numpy cryptography PDAL==2.3.6 && \
python3.8 -m pip install --upgrade --no-cache-dir \
pygdal==3.0.4.* && \
pygdal==3.4.1.* && \
python3 -m pip install --upgrade --no-cache-dir \
agpypeline && \
python3.8 -m pip install --upgrade --no-cache-dir \
Expand Down Expand Up @@ -85,12 +89,11 @@ RUN apt-get update -y && \
curl \
gnupg-agent \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
apt-key fingerprint 0EBFCD88 && \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable" && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker.gpg && \
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update && \
apt-get install -y --no-install-recommends \
docker-ce \
Expand All @@ -117,31 +120,31 @@ COPY ./scif_app_recipes/opendronemap_v2.2.scif /opt/
RUN scif install /opt/opendronemap_v2.2.scif

FROM odm_scif as combined_scif
COPY ./scif_app_recipes/ndcctools_v7.1.2_ubuntu20.04.scif /opt/
COPY ./scif_app_recipes/soilmask_v0.0.1_ubuntu20.04.scif /opt/
RUN scif install /opt/soilmask_v0.0.1_ubuntu20.04.scif
RUN scif install /opt/ndcctools_v7.1.2_ubuntu20.04.scif
COPY ./scif_app_recipes/ndcctools_v7.1.2_ubuntu22.04.scif /opt/
COPY ./scif_app_recipes/soilmask_v0.0.1_ubuntu22.04.scif /opt/
RUN scif install /opt/soilmask_v0.0.1_ubuntu22.04.scif
RUN scif install /opt/ndcctools_v7.1.2_ubuntu22.04.scif

COPY ./scif_app_recipes/soilmask_ratio_v0.0.1_ubuntu20.04.scif /opt/
RUN scif install /opt/soilmask_ratio_v0.0.1_ubuntu20.04.scif
COPY ./scif_app_recipes/soilmask_ratio_v0.0.1_ubuntu22.04.scif /opt/
RUN scif install /opt/soilmask_ratio_v0.0.1_ubuntu22.04.scif

COPY ./scif_app_recipes/plotclip_v0.0.1_ubuntu20.04.scif /opt/
RUN scif install /opt/plotclip_v0.0.1_ubuntu20.04.scif
COPY ./scif_app_recipes/plotclip_v0.0.1_ubuntu22.04.scif /opt/
RUN scif install /opt/plotclip_v0.0.1_ubuntu22.04.scif

COPY ./scif_app_recipes/canopycover_v0.0.1_ubuntu20.04.scif /opt/
RUN scif install /opt/canopycover_v0.0.1_ubuntu20.04.scif
COPY ./scif_app_recipes/canopycover_v0.0.1_ubuntu22.04.scif /opt/
RUN scif install /opt/canopycover_v0.0.1_ubuntu22.04.scif

COPY ./scif_app_recipes/greenness_v0.0.1_ubuntu20.04.scif /opt/
RUN scif install /opt/greenness_v0.0.1_ubuntu20.04.scif
COPY ./scif_app_recipes/greenness_v0.0.1_ubuntu22.04.scif /opt/
RUN scif install /opt/greenness_v0.0.1_ubuntu22.04.scif

COPY *.jx *.py *.sh jx-args.json /scif/apps/src/
COPY plantit-workflow.sh /opt/dev/plantit-workflow.sh
RUN chmod a+x /scif/apps/src/*.sh && \
chmod a+x /scif/apps/src/*.py && \
chmod a+x /opt/dev/plantit-workflow.sh

COPY ./scif_app_recipes/git_v0.0.1_ubuntu20.04.scif /opt/
RUN scif install /opt/git_v0.0.1_ubuntu20.04.scif
COPY ./scif_app_recipes/git_v0.0.1_ubuntu22.04.scif /opt/
RUN scif install /opt/git_v0.0.1_ubuntu22.04.scif
# Silence a git warning
RUN git config --global advice.detachedHead false

Expand Down
36 changes: 36 additions & 0 deletions scif_app_recipes/canopycover_v0.0.1_ubuntu22.04.scif
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
%appinstall canopycover
# Download canopycover code. In the future use pip/conda install.
wget -O canopycover.tar.gz https://github.com/AgPipeline/transformer-canopycover/archive/v1.8.tar.gz
tar xvf canopycover.tar.gz
mv transformer-canopycover-1.8 src
echo "Removing unneeded files"
rm -rf --verbose src/test_data src/tests src/.github canopycover.tar.gz

# Install Makeflow and other dependencies
python3.8 -m venv --system-site-packages .venv
.venv/bin/python3 -m pip install --upgrade --no-cache-dir pip
.venv/bin/python3 -m pip install --upgrade --no-cache-dir -r "${PWD}/src/requirements.txt"

# Add example Docker command to SCIF app help section
if [ -n $DOCKER_IMAGE ]; then
echo "\n\nExample Docker command: docker run $DOCKER_IMAGE run canopycover\n" >> "${PWD}/scif/runscript.help"
fi

# Generate remainder of SCIF app help section by running main script
.venv/bin/python3 src/canopycover.py --help >> "${PWD}/scif/runscript.help"

%apprun canopycover
/cctools/bin/makeflow \
--jx \
--jx-args="/scif/apps/src/jx-args.json" \
--jx-args="/scif/apps/src/canopy_cover_files.json" \
--log-verbose \
--retry-count=1 \
--change-directory="${SCIF_APPDATA}" \
--makeflow-log="${SCIF_APPDATA}/workflow.jx.makeflowlog" \
--batch-log="${SCIF_APPDATA}/workflow.jx.batchlog" \
${1} \
"/scif/apps/src/canopycover_workflow.jx"

%apphelp canopycover
This app provides an entrypoint to the canopycover tool
29 changes: 29 additions & 0 deletions scif_app_recipes/git_v0.0.1_ubuntu22.04.scif
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
%appinstall git_rgb_plot
# Install Makeflow and other dependencies
python3.8 -m venv --system-site-packages .venv
.venv/bin/python3 -m pip install --upgrade --no-cache-dir pip
.venv/bin/python3 -m pip install --upgrade --no-cache-dir opencv-contrib-python-headless agpypeline

# Add example Docker command to SCIF app help section
if [ -n $DOCKER_IMAGE ]; then
echo "\n\nExample Docker command: docker run $DOCKER_IMAGE run git\n" >> "${PWD}/scif/runscript.help"
fi

# Generate remainder of SCIF app help section by running main script
.venv/bin/python3 /scif/apps/src/git_algo_rgb_plot.py --help >> "${PWD}/scif/runscript.help"

%apprun git_rgb_plot
/cctools/bin/makeflow \
--jx \
--jx-args="/scif/apps/src/jx-args.json" \
--jx-args="/scif/apps/src/git_rgb_plot_files.json" \
--log-verbose \
--retry-count=1 \
--change-directory="${SCIF_APPDATA}" \
--makeflow-log="${SCIF_APPDATA}/workflow.jx.makeflowlog" \
--batch-log="${SCIF_APPDATA}/workflow.jx.batchlog" \
${1} \
"/scif/apps/src/git_rgb_plot_workflow.jx"

%apphelp git_rgb_plot
This app provides an entrypoint to the git tool
43 changes: 43 additions & 0 deletions scif_app_recipes/greenness_v0.0.1_ubuntu22.04.scif
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
%appinstall greenness-indices
# Install Makeflow and other dependencies
python3.8 -m venv --system-site-packages .venv
.venv/bin/python3 -m pip install --upgrade --no-cache-dir pip

# Download plot-base-rgb code
wget -O plot_base_rgb.tar.gz https://github.com/AgPipeline/plot-base-rgb/archive/v1.10.tar.gz
tar xvf plot_base_rgb.tar.gz
mv plot-base-rgb-1.10 src
.venv/bin/python3 -m pip install --upgrade --no-cache-dir -r "${PWD}/src/requirements.txt"

# Download greenness-indices code. In the future use pip/conda install.
wget -O greenness_indices.tar.gz https://github.com/AgPipeline/transformer-rgb-indices/archive/v1.4.tar.gz
tar xvf greenness_indices.tar.gz
cp -r transformer-rgb-indices-1.4/* src/
rm -r transformer-rgb-indices-1.4
.venv/bin/python3 -m pip install --upgrade --no-cache-dir -r "${PWD}/src/requirements.txt"
echo "Removing unneeded files"
rm -rf --verbose src/test_data src/tests src/.github plot_base_rgb.tar.gz greenness_indices.tar.gz

# Add example Docker command to SCIF app help section
if [ -n $DOCKER_IMAGE ]; then
echo "\n\nExample Docker command: docker run $DOCKER_IMAGE run greenness-indices\n" >> "${PWD}/scif/runscript.help"
fi

# Generate remainder of SCIF app help section by running main script
.venv/bin/python3 src/transformer.py --help >> "${PWD}/scif/runscript.help"

%apprun greenness-indices
/cctools/bin/makeflow \
--jx \
--jx-args="/scif/apps/src/jx-args.json" \
--jx-args="/scif/apps/src/greenness-indices_files.json" \
--log-verbose \
--retry-count=1 \
--change-directory="${SCIF_APPDATA}" \
--makeflow-log="${SCIF_APPDATA}/workflow.jx.makeflowlog" \
--batch-log="${SCIF_APPDATA}/workflow.jx.batchlog" \
${1} \
"/scif/apps/src/greenness-indices_workflow.jx"

%apphelp greenness-indices
This app provides an entrypoint to the greenness-indices tool
116 changes: 116 additions & 0 deletions scif_app_recipes/ndcctools_v7.1.2_ubuntu22.04.scif
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@

%appinstall betydb2geojson
# Install dependencies
python3.8 -m venv --system-site-packages .venv
.venv/bin/python3 -m pip install --upgrade --no-cache-dir pip
.venv/bin/python3 -m pip install --upgrade --no-cache-dir requests pygdal==3.4.1.*

%apprun betydb2geojson
/cctools/bin/makeflow \
--jx \
--jx-args="/scif/apps/src/jx-args.json" \
--log-verbose \
--retry-count=1 \
--change-directory="${SCIF_APPDATA}" \
--makeflow-log="${SCIF_APPDATA}/workflow.jx.makeflowlog" \
--batch-log="${SCIF_APPDATA}/workflow.jx.batchlog" \
${1} \
"/scif/apps/src/betydb2geojson_workflow.jx"

%apphelp betydb2geojson
This app provides a conversion from BETYdb site data to GeoJSON plot geometries.

Expected keys in the "jx-args.json" file:
BETYDB_URL - the value is the URL of the BETYdb instance to get plot geometries from
PLOT_SHAPEFILE - the path to save the GeoJSON to

Sample command:
scif run betydb2geojson

See also:
https://github.com/AgPipeline/drone-makeflow/blob/master/README.md

%appinstall shp2geojson
# Install dependencies

%apprun shp2geojson
/cctools/bin/makeflow \
--jx \
--jx-args="/scif/apps/src/jx-args.json" \
--log-verbose \
--retry-count=1 \
--change-directory="${SCIF_APPDATA}" \
--makeflow-log="${SCIF_APPDATA}/workflow.jx.makeflowlog" \
--batch-log="${SCIF_APPDATA}/workflow.jx.batchlog" \
${1} \
"/scif/apps/src/shp2geojson_workflow.jx"

%apphelp shp2geojson
This app provides a conversion from a shapefile to GeoJSON plot geometries.

Expected keys in the "jx-args.json" file:
PLOT_GEOMETRY_FILE - the path to the shapefile to convert to GeoJSON
PLOT_SHAPEFILE - the path to save the GeoJSON to

Sample command:
scif run shp2geojson

See also:
https://github.com/AgPipeline/drone-makeflow/blob/master/README.md

%appinstall merge_csv
# Install dependencies

%apprun merge_csv
/cctools/bin/makeflow \
--jx \
--jx-args="/scif/apps/src/jx-args.json" \
--log-verbose \
--retry-count=1 \
--change-directory="${SCIF_APPDATA}" \
--makeflow-log="${SCIF_APPDATA}/workflow.jx.makeflowlog" \
--batch-log="${SCIF_APPDATA}/workflow.jx.batchlog" \
${1} \
"/scif/apps/src/merge_csv_workflow.jx"

%apphelp merge_csv
This app searches folders for CSV files and merges them by file name into the output folder

Expected keys in the "jx-args.json" file:
MERGECSV_SOURCE - the folder path to look for CSV file
MERGECSV_TARGET - the folder path to save the merged CSV files to
MERGECSV_OPTIONS - options for processing CSV files; set to "--help" to display all available options without processing files

Sample command:
scif run merge_csv

See also:
https://github.com/AgPipeline/drone-makeflow/blob/master/README.md

%appinstall find_files2json
# Install dependencies

%apprun find_files2json
/cctools/bin/makeflow \
--jx \
--jx-args="/scif/apps/src/jx-args.json" \
--log-verbose \
--retry-count=1 \
--change-directory="${SCIF_APPDATA}" \
--makeflow-log="${SCIF_APPDATA}/workflow.jx.makeflowlog" \
--batch-log="${SCIF_APPDATA}/workflow.jx.batchlog" \
${1} \
"/scif/apps/src/find_files2json_workflow.jx"

%apphelp find_files2json
This app searches folders for files and writes out a JSON file intended to be used as input to a workflow.
The search assumes the wanted files are located in subfolders off the FILES2JSON_SEARCH_FOLDER.
If no files matching the search name are found then no JSON file is saved.

Expected keys in the "jx-args.json" file:
FILES2JSON_SEARCH_NAME - the name of the files to locate
FILES2JSON_SEARCH_FOLDER - the path to the folder to search within
FILES2JSON_JSON_FILE - the path to the JSON file to write found files to

Sample command:
scif run find_files2json
Loading

0 comments on commit 7b4d9c2

Please sign in to comment.