```name: arable-water-data-pipeline prefect-versio...
# ask-community
a
Copy code
name: arable-water-data-pipeline
prefect-version: 3.2.0

build:
  - prefect_docker.deployments.steps.build_docker_image:
      id: build_image
      requires: prefect-docker>=0.3.1
      image_name: ""
      tag: "latest"

push:
  - prefect_docker.deployments.steps.push_docker_image:
      requires: prefect-docker>=0.3.1
      image_name: "{{ build_image.image_name }}"
      tag: "{{ build_image.tag }}"

pull:
  - prefect_docker.deployments.steps.pull_docker_image:
      requires: prefect-docker>=0.3.1
      image_name: "{{ build_image.image_name }}"
      tag: "{{ build_image.tag }}"


deployments:
  - name: arable-water-data-pipeline
    version: 1.0.0
    description: Deployment for the Per Farm and Field Parallel Pipeline Flow
    entrypoint: main.py:per_farm_pipeline_flow
    schedule:
      interval: 900  # 15 minutes in seconds
    work_pool:
      name: docker-pool
      job_variables:
        image: "{{ build_image.image }}"
What is wrong here, i want to pull the image and run
b
Hi Ashik! I'm going to move the error stack trace you shared here just to keep things tidy in the main channel.
Copy code
Unexpected exception encountered when trying to load flow
Traceback (most recent call last):
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/deployments/steps/core.py", line 163, in run_steps
    step_output = await run_step(step, upstream_outputs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/deployments/steps/core.py", line 133, in run_step
    step_func = _get_function_for_step(fqn, requires=keywords.get("requires"))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/deployments/steps/core.py", line 76, in _get_function_for_step
    step_func = import_object(fully_qualified_name)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/utilities/importtools.py", line 169, in import_object
    return getattr(module, object_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'prefect_docker.deployments.steps' has no attribute 'pull_docker_image'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/engine.py", line 51, in <module>
    flow: "Flow[..., Any]" = load_flow(flow_run)
                             ^^^^^^^^^^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/flow_engine.py", line 130, in load_flow
    flow = run_coro_as_sync(
           ^^^^^^^^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/utilities/asyncutils.py", line 207, in run_coro_as_sync
    return call.result()
           ^^^^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 329, in result
    return self.future.result(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 192, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 402, in _run_async
    result = await coro
             ^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/utilities/asyncutils.py", line 188, in coroutine_wrapper
    return await task
           ^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/client/utilities.py", line 69, in wrapper
    return await func(client, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/flows.py", line 2332, in load_flow_from_flow_run
    output = await run_steps(deployment.pull_steps)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/prefect/data_pipeline/prefect-env/lib/python3.11/site-packages/prefect/deployments/steps/core.py", line 191, in run_steps
    raise StepExecutionError(f"Encountered error while running {fqn}") from exc
prefect.deployments.steps.core.StepExecutionError: Encountered error while running prefect_docker.deployments.steps.pull_docker_image
Here's an example
prefect.yaml
file that should help if you'd like to push an image to docker.io
Copy code
# Welcome to your prefect.yaml file! You can use this file for storing and managing
# configuration for deploying your flows. We recommend committing this file to source
# control along with your flow code.

# Generic metadata about this project
name: yule
prefect-version: 3.1.9

# build section allows you to manage and build docker images
build:
- prefect_docker.deployments.steps.build_docker_image:
    requires: prefect-docker>=0.3.1
    id: build-image
    dockerfile: auto
    image_name: <http://docker.io/biancaines/neighborhood-image|docker.io/biancaines/neighborhood-image>
    tag: v1.0

# 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 }}'

# pull section allows you to provide instructions for cloning this project in remote locations
pull:
- prefect.deployments.steps.set_working_directory:
    directory: /opt/prefect/yule

# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: christmas-neighborhood-delivery
  version:
  tags: []
  concurrency_limit:
  description:
  entrypoint: neighborhood_route.py:start_neighborhood_route
  parameters: {}
  work_pool:
    name: docker-pool
    work_queue_name:
    job_variables:
      image: '{{ build-image.image }}'
  enforce_parameter_schema: true
  schedules: []
The pull step is used to set the working directory (in my case it's called
yule
). I think the pull step you've configured is where things are breaking:
Copy code
AttributeError: module 'prefect_docker.deployments.steps' has no attribute 'pull_docker_image'
For reference, here is my directory structure. I've kept things simple and have the
prefect.yaml
in the same folder as all of my python scripts.
a
ok thanks ,