Aurko Routh
08/08/2023, 4:06 PMAurko Routh
08/08/2023, 4:07 PMNimesh
09/26/2023, 6:23 AMpull:
- prefect_docker.images.pull_docker_image:
requires: prefect-docker>=0.3.1
repository: '{{ build_image.image_name }}'
tag: '{{ build_image.tag }}'
docker_registry_credentials: '{{ prefect.blocks.gcp-credentials.gcp-data-credentials }}'
Nimesh
09/26/2023, 6:24 AMRuntimeError: Tasks cannot be run outside of a flow. To call the underlying task function outside of a flow use `task.fn()`.
Jake Kaplan
09/26/2023, 11:46 AM...
deployments:
- name: my-deployment
work_pool:
name: "my-work-pool"
job_variables:
image: <<GCR IMAGE URL GOES HERE>>
Nimesh
09/26/2023, 4:18 PMNimesh
09/26/2023, 5:43 PM# Generic metadata about this project
name: data-scripts
prefect-version: 2.13.1
# build section allows you to manage and build docker images
build:
- prefect_docker.deployments.steps.build_docker_image:
id: build_image
requires: prefect-docker>=0.3.1
image_name: '{{ prefect.variables.prefect_image_name }}'
tag: latest
dockerfile: Dockerfile
# push section allows you to manage if and how this project is uploaded to remote locations
push:
- prefect_docker.deployments.steps.push_docker_image:
requires: prefect-docker>=0.3.1
image_name: '{{ build_image.image_name }}'
tag: '{{ build_image.tag }}'
credentials: '{{ prefect.blocks.gcp-credentials.gcp-data-credentials }}'
# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: lrp-deployment
version:
tags:
- lrp
description:
schedule:
cron: 00 20 * * 1-5
timezone: America/Chicago
day_or: true
entrypoint: src/flow.py:run_lrp
parameters: {}
work_pool:
name: data-scripts-workpool
work_queue_name:
job_variables: {}
work_queue_name: default
job_variables:
image: '{{ build_image.image }}'
Jake Kaplan
09/26/2023, 5:44 PMJake Kaplan
09/26/2023, 5:44 PMNimesh
09/26/2023, 7:40 PMNimesh
09/26/2023, 7:41 PMFileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/src/flow.py'
Nimesh
09/26/2023, 7:41 PMCOPY . /opt/prefect
Nimesh
09/26/2023, 7:48 PMFROM python:3.9-slim AS base
#updating pip
RUN pip install --upgrade pip
#installing all dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt
FROM base AS build
COPY . /opt/prefect
CMD ["python", "src/flow.py"]