When creating a deployment by building a Docker im...
# ask-community
d
When creating a deployment by building a Docker image, where/how should you specify the entrypoint? The deployment isn't able to find the flow for some reason:
entrypoint_type="/opt/prefect/arte_tasks/flows/export/set_export_freq.py:set_export_freq"
Copy code
FileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/arte_tasks/None'
any ideas? (more details in thread)
from the flow.py:
Copy code
if __name__ == "__main__":
    import sys
    import os

    A_TOKEN = os.getenv("A_TOKEN")

    set_export_freq.deploy(
        name="set_export_freq",
        work_pool_name="arte-k8s",
        image=DockerImage(
                name="<http://docker-arte-release.dr-uw2.adobeitc.com/arte-flows-dflake|docker-arte-release.dr-uw2.adobeitc.com/arte-flows-dflake>",
                tag="0.2",
                dockerfile="containers/arte-flows/Dockerfile",
                buildargs={"username": "arte", "pypitoken": A_TOKEN},
        ),
        #entrypoint_type="set_export_freq.py:set_export_freq",
        #entrypoint_type="/usr/local/lib/python3.11/site-packages/arte_tasks/flows/export/set_export_freq.py:set_export_freq",
        #entrypoint_type="arte_tasks/flows/export/set_export_freq.py:set_export_freq",
        entrypoint_type="/opt/prefect/arte_tasks/flows/export/set_export_freq.py:set_export_freq",
        parameters={"started_by": "dflake", "dry_run": True, "dpc_type": "prod", "verbose": True},
        #cron="0 9 * * *",
        description="Find rsids with > 1M daily hits. Set the export interval to 30 min if interval > 30 min.",
        tags=["automation", "export"]
        #push=False,
        #build=False
    )
traceback from a flow run:
Copy code
| Traceback (most recent call last):
    |   File "/usr/local/lib/python3.11/site-packages/prefect/runner/runner.py", line 1102, in _submit_run_and_capture_errors
    |     await self._run_on_crashed_hooks(flow_run=flow_run, state=terminal_state)
    |   File "/usr/local/lib/python3.11/site-packages/prefect/runner/runner.py", line 1251, in _run_on_crashed_hooks
    |     flow = await load_flow_from_flow_run(
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/prefect/client/utilities.py", line 75, in wrapper
    |     return await func(client, *args, **kwargs)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/prefect/flows.py", line 1932, in load_flow_from_flow_run
    |     await storage_block.get_directory(from_path=from_path, local_path=".")
    |   File "/usr/local/lib/python3.11/site-packages/prefect/utilities/asyncutils.py", line 389, in ctx_call
    |     result = await async_fn(*args, **kwargs)
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/prefect/filesystems.py", line 158, in get_directory
    |     copytree(from_path, local_path, dirs_exist_ok=True, ignore=ignore_func)
    |   File "/usr/local/lib/python3.11/shutil.py", line 571, in copytree
    |     with os.scandir(src) as itr:
    |          ^^^^^^^^^^^^^^^
    | FileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/arte_tasks/None'
also - in case it helps, here's a bit from the Dockerfile where I'm trying to laydown the code for our flows:
Copy code
RUN pip3 install arte_tools} arte_tasks --extra-index-url \
    https://$username:$pypitoken@${artifactory_url}/artifactory/api/pypi/${pypi_repo}/simple

# Copy the arte-tasks python package to where Prefect can find the flows
COPY arte_tasks /opt/prefect/arte_tasks
WORKDIR /opt/prefect/arte_tasks/