From 8c6e7fd125a87e88858c839523ef8673dbb3eec5 Mon Sep 17 00:00:00 2001 From: DanRunfola Date: Tue, 10 Dec 2024 09:43:46 -0500 Subject: [PATCH] image debug --- .../images/geoBoundariesBase.Dockerfile | 28 ++++++------------- geoBoundaryBuilder/test.py | 19 +++++-------- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/geoBoundaryBuilder/images/geoBoundariesBase.Dockerfile b/geoBoundaryBuilder/images/geoBoundariesBase.Dockerfile index 4234b2e..b5d4873 100644 --- a/geoBoundaryBuilder/images/geoBoundariesBase.Dockerfile +++ b/geoBoundaryBuilder/images/geoBoundariesBase.Dockerfile @@ -17,6 +17,7 @@ RUN apk add --no-cache \ git \ git-lfs \ gdal \ + gdal-dev \ geos-dev \ proj-dev \ jpeg-dev \ @@ -25,29 +26,16 @@ RUN apk add --no-cache \ py3-cffi \ py3-psycopg2 +# Install Python packages in steps for debugging +RUN pip install --upgrade pip && \ + pip install prefect==2.2.0 kubernetes==25.3.0 -# Install Python packages -RUN pip install --upgrade pip \ - && pip install \ - prefect==2.2.0 \ - kubernetes==25.3.0 \ - geopandas==0.13.2 \ - shapely==2.0.1 \ - matplotlib==3.7.2 \ - pandas==2.1.1 \ - hashlib==20081119 \ - jsonschema==4.19.0 \ - zipfile36==0.1.3 +RUN pip install geopandas==0.13.2 shapely==2.0.1 matplotlib==3.7.2 pandas==2.1.1 + +RUN pip install jsonschema==4.19.0 zipfile36==0.1.3 # Install Prefect Kubernetes components RUN pip install prefect-kubernetes # Set up git-lfs -RUN git lfs install - -# Expose necessary ports -EXPOSE 4200 -EXPOSE 8080 - -ENTRYPOINT ["prefect"] -CMD ["worker", "start", "--pool", "kubernetes"] +RUN git lfs install \ No newline at end of file diff --git a/geoBoundaryBuilder/test.py b/geoBoundaryBuilder/test.py index b8e197c..b8aaf55 100644 --- a/geoBoundaryBuilder/test.py +++ b/geoBoundaryBuilder/test.py @@ -1,9 +1,7 @@ -import os -from prefect import flow, task -from prefect.deployments import Deployment import subprocess +from prefect import flow, task -# Step 1: Set Prefect API URL +# Step 1: Set Prefect API URL dynamically PREFECT_API_URL = "http://prefect-server-service.geoboundaries.svc.cluster.local:4200/api" subprocess.run(["prefect", "config", "set", f"PREFECT_API_URL={PREFECT_API_URL}"], check=True) @@ -21,19 +19,16 @@ def process_numbers_flow(numbers): results.append(result) return [r.result() for r in results] # Gather the results -# Step 4: Main script to run locally or deploy +# Step 4: Main script to deploy and run the flow if __name__ == "__main__": # Define the list of numbers numbers = list(range(1, 11)) - # Create a deployment for the flow - deployment = Deployment.build_from_flow( - flow=process_numbers_flow, - name="process-numbers-deployment", - ) - deployment.apply() + # Deploy the flow (if needed) + print("Deploying the flow...") + process_numbers_flow.deploy(name="process-numbers-deployment", work_pool_name="k8s-gB") - # Run the flow directly + # Run the flow locally print("Running the flow locally...") results = process_numbers_flow(numbers) print("Results:", results)