Mitch
07/19/2023, 6:50 PMMarvin
07/19/2023, 6:50 PMModuleNotFoundErrorpip install prefectMitch
07/19/2023, 6:54 PMMarvin
07/19/2023, 6:55 PMyaml
# prefect.yaml
version: 1
name: MyFlow
context:
  secrets:
    - SECRET_ENV
  env:
    ENV_VALUE: "example_value"
storage:
  type: Docker
  registry_url: my.docker/registry
  dockerfile: path/to/Dockerfile
  prefect_version: "0.14.0"
run_config:
  type: ECSRun
  task_definition_path: "path/to/task_definition.json"
  run_task_kwargs:
    cluster: "my-cluster"
    launch_type: "FARGATE"
  labels: []
  env:
    ENV_VALUE: "example_value"
  aws_credentials_secret: "AWS_CREDENTIALS"
schedule:
  type: IntervalSchedule
  start_date: "2020-01-01T00:00:00Z"
  interval: "1 day"
flow_file_path: path/to/flow.py"path/to/...""example_value"Nate
07/19/2023, 9:02 PMMarvin
07/19/2023, 9:03 PMprefect.yamlyaml
version: 1
name: MyFlow
context:
  secrets:
    - AWS_CREDENTIALS
storage:
  type: Docker
  registry_url: my.docker/registry
  dockerfile: path/to/Dockerfile
  prefect_version: "0.14.0"
  python_dependencies:
    - awscli
  env_vars:
    - AWS_ACCESS_KEY_ID
    - AWS_SECRET_ACCESS_KEY
run_config:
  type: ECSRun
  image: my.docker/registry/my-flow:latest
  task_definition: 
    family: "my-task-definition"
    execution_role_arn: "arn:aws:iam::account-id:role/execution-role-name"
    network_mode: "awsvpc"
    cpu: "256"
    memory: "0.5GB"
    requires_compatibilities:
      - "FARGATE"
    container_definitions:
      - name: "my-flow-container"
        image: "my.docker/registry/my-flow:latest"
        cpu: 256
        memory: 512
        essential: true
        environment:
          - name: "PREFECT__CLOUD__AGENT__LABELS"
            value: "aws"
          - name: "PREFECT__LOGGING__LEVEL"
            value: "DEBUG"
          - name: "AWS_ACCESS_KEY_ID"
            value_from: "arn:aws:ssm:region:account-id:parameter/my-parameter/AWS_ACCESS_KEY_ID"
          - name: "AWS_SECRET_ACCESS_KEY"
            value_from: "arn:aws:ssm:region:account-id:parameter/my-parameter/AWS_SECRET_ACCESS_KEY"
    tags:
      - key: "Name"
        value: "my-task-definition"
  labels: ['aws']
  env:
    PREFECT__CLOUD__AGENT__LABELS: "aws"
    PREFECT__LOGGING__LEVEL: "DEBUG"
schedule:
  type: IntervalSchedule
  start_date: "2020-01-01T00:00:00Z"
  interval: "1 day"
flow_file_path: path/to/flow.pyNate
07/19/2023, 9:05 PMprefect.yaml# Generic metadata about this project
name: prefect-monorepo
prefect-version: 2.10.20
# 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: null
# pull section allows you to provide instructions for cloning this project in remote locations
pull:
- prefect.deployments.steps.git_clone:
    repository: <https://github.com/zzstoatzz/prefect-monorepo>
    branch: main
    access_token: null
# File for configuring project / deployment build, push and pull steps
definitions:
    work_pools:
        ecs_work_pool: &ecs_work_pool
            name: ecs
            work_queue_name: default
            job_variables:
                image: "{{ build_image.image }}"
    schedules:
        every_ten_minutes: &every_10_minutes
            interval: 600
        
    actions:
        docker_build: &docker_build
            - prefect_docker.deployments.steps.build_docker_image:
                id: build-image
                requires: prefect-docker>=0.2.0
                image_name: zzstoatzz/prefect-monorepo
                dockerfile: Dockerfile.demo
                push: true
deployments:
  - name: healthcheck-demo
    entrypoint: src/demo_project/healthcheck.py:healthcheck
    schedule: *every_ten_minutes
    parameters:
        message: Don't panic!
    work_pool: *ecs_work_pool
    build: *docker_buildMarvin
07/19/2023, 9:05 PMprefect.yaml