https://prefect.io logo
Title
s

Santiago Toso

02/06/2023, 9:43 AM
hey there, we recently updated to
prefect 2.7.11
and I'm now getting an error when trying to deploy from the same
deployment.py
files I've been using all along. It seems to have a problem when executing the
apply
command in the file. Any ideas what could be going on? Thanks for your help! I leave the full message here:
Traceback (most recent call last):
  File "/home/jupyter-santiago/repos/via_ds_amm_gtfs_real_time_tools/valhalla_map_matching/deployments/python/tfl_deployment.py", line 26, in <module>
    deployment.apply()
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 230, in coroutine_wrapper
    return run_async_in_new_loop(async_fn, *args, **kwargs)
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 181, in run_async_in_new_loop
    return anyio.run(partial(__fn, *args, **kwargs))
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/anyio/_core/_eventloop.py", line 70, in run
    return asynclib.run(func, *args, **backend_options)
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 292, in run
    return native_run(wrapper(), debug=debug)
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 287, in wrapper
    return await func(*args)
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/prefect/deployments.py", line 651, in apply
    deployment_id = await client.create_deployment(
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/prefect/client/orion.py", line 1347, in create_deployment
    response = await <http://self._client.post|self._client.post>(
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/httpx/_client.py", line 1848, in post
    return await self.request(
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/httpx/_client.py", line 1533, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/prefect/client/base.py", line 253, in send
    response.raise_for_status()
  File "/home/jupyter-santiago/miniconda3/envs/prefect-gtfs/lib/python3.10/site-packages/httpx/_models.py", line 749, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '409 Conflict' for url '<http://10.90.64.221:4200/api/deployments/>'
2
the
tfl_deployment.py
file that it is referring to looks something like below. Just want to add that this deployment and all its infrastructure already exist and work fine. I get message when trying to re-deploy it with updated code.
# deployment.py
# This file hasn't been tested yet
from prefect_flow_code import \
     flow-name
from prefect.deployments import Deployment
from prefect.orion.schemas.schedules import CronSchedule
from prefect.filesystems import S3

s3_block = S3.load("s3-storage-name")

deployment = Deployment.build_from_flow(
    flow=flow-name,
    name="deployment-name",
    parameters={"event":{
        "timezone": "Europe/London",
        "agency_name": "agency"
        }},
    infra_overrides={},
    work_queue_name="queue-name",
    tags=['tag1', 'tag2'],
    schedule=(CronSchedule(cron="10 * * * *", timezone="Europe/London")),
    storage = s3_block
)

if __name__ == "__main__":
    deployment.apply()