Skip to content

Commit

Permalink
image debug
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRunfola committed Dec 10, 2024
1 parent fd3ee11 commit 8c6e7fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 32 deletions.
28 changes: 8 additions & 20 deletions geoBoundaryBuilder/images/geoBoundariesBase.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN apk add --no-cache \
git \
git-lfs \
gdal \
gdal-dev \
geos-dev \
proj-dev \
jpeg-dev \
Expand All @@ -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
19 changes: 7 additions & 12 deletions geoBoundaryBuilder/test.py
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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)

0 comments on commit 8c6e7fd

Please sign in to comment.