https://prefect.io logo
g

Geese Howard

09/15/2023, 8:11 AM
Hi prefect cloud! I was wondering if there is any way to modify prefect.yaml file deployment session to assign custom kubernetes cloud resources, including cpu, gpu and memory. Previously, I was using prefect.yaml file of the following format, which did not work (the flow runs well, but it ignores using the resource specifications):
Copy code
# Generic metadata about this project
name: flows
prefect-version: 2.12.1

# build section allows you to manage and build docker images
build: null

# push section allows you to manage if and how this project is uploaded to remote locations
push:
- prefect_gcp.deployments.steps.push_to_gcs:
    id: push_code
    requires: prefect-gcp>=0.4.3
    bucket: prefect-flows
    folder: prefect_practice
    credentials: "{{ prefect.blocks.gcp-credentials.credential }}"

# prefect.yaml
pull:
- prefect_gcp.deployments.steps.pull_from_gcs:
    id: pull_code
    requires: prefect-gcp>=0.4.3
    bucket: '{{ push_code.bucket }}'
    folder: prefect_practice
    credentials: "{{ prefect.blocks.gcp-credentials.credential }}"

# the definitions section allows you to define reusable components for your deployments
definitions:
  tags: &common_tags
    - "dev"
  work_pool: &gke
    name: "gke"
    work_queue_name: "dev"

# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: "dev: resource allocation with GPU"
  tags: *common_tags
  schedule: null
  entrypoint: "test.py:get_data"
  work_pool: 
    <<: *gke_workpool
    job_variables:
        job_configuration:
          job_manifest:
            spec:
              template:
                spec:
                  containers:
                  - resources:
                      limits: 
                        cpu: "5000m"
                        memory: "4Gi"
                        <http://nvidia.com/gpu|nvidia.com/gpu>: "1"
                      requests: 
                        cpu: "5000m"
                        memory: "4Gi"
                        <http://nvidia.com/gpu|nvidia.com/gpu>: "1"
                  nodeSelector:
                    <http://cloud.google.com/gke-accelerator|cloud.google.com/gke-accelerator>: "nvidia-tesla-t4"
                    <http://iam.gke.io/gke-metadata-server-enabled|iam.gke.io/gke-metadata-server-enabled>: "true"