Oliver Tedder
12/09/2024, 7:46 PMdeploy.py
script which i run to make the deployment
from prefect.client.schemas.schedules import IntervalSchedule
from prefect import deploy, flow
import datetime
if __name__ == "__main__":
@flow
def dummy_flow():
pass
dummy_flow.deploy(
name="gmk-ollie",
image="registry.gitlab.com/mycompany/lab/project/project:dev",
work_pool_name="ollie-pool",
job_variables={"env": {}},
parameters={"prefect_secret_to_env_var": {}},
schedules=[
IntervalSchedule(
interval=datetime.timedelta(minutes=10),
)
],
build=False,
push=False
)
which does trigger the worker to pull the docker container, but then i get an error on the worker
19:41:53.184 | INFO | prefect.workers.docker.ollie - Docker container 'steady-shrimp' has status 'running'
19:41:58.844 | INFO | prefect.flow_runs.runner - Opening process...
19:42:03.176 | INFO | Flow run 'steady-shrimp' - Downloading flow code from storage at '.'
19:42:03.200 | ERROR | prefect.engine - Engine execution of flow run 'c526cdfc-ff92-4909-9cfe-cee07ac09ecc' exited with unexpected exception
Traceback (most recent call last):
File "<frozen importlib._bootstrap_external>", line 936, in exec_module
File "<frozen importlib._bootstrap_external>", line 1073, in get_code
File "<frozen importlib._bootstrap_external>", line 1130, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/app/deploy.py
so the worker is trying to run the deploy.py
which is definitely not correct.
(In addition there is that dummy_flow()
which seems to be suggested whenever i try and search for this).
Much appreciated for any advice on how to proceed? Thanks!Oliver Tedder
12/09/2024, 7:49 PMFROM python:3.11-slim
WORKDIR /app
COPY ./gold_mine_keysight /app/gold_mine_keysight
COPY ./pyproject.toml /app/
RUN pip install --upgrade pip
RUN pip install .
# run the file to run the flow function
# run.py contains
#
# @flow
# def run():
# ..
#
# if __name__ == "__main__":
# run()
CMD ["python", "-m", "project.run"]