https://prefect.io logo
Title
j

Josh Paulin

04/13/2023, 3:56 PM
Hello. I have some unit tests to exercise some code I’ve got around
Deployment.build_from_flow
. Things have been working fine until I tried adding in
work_pool
configuration. Not the tests fail with
except HTTPStatusError as exc:
>           raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.__cause__
E           prefect.exceptions.PrefectHTTPStatusError: Client error '404 Not Found' for url '<http://ephemeral-prefect/api/deployments/>'
E           Response: {'detail': 'Work pool "<work-pool-name>" not found.'}
E           For more information check: <https://httpstatuses.com/404>
This works fine if I’m using
work_queue
, or leave them both out altogether. Any suggestions?
c

Chris White

04/13/2023, 6:21 PM
Hi Josh - work pools need to be created before they are referenced by a deployment, so if you want to use work pools in your tests then you just need to create it first (maybe as a fixture)
j

Josh Paulin

04/13/2023, 6:23 PM
I tried creating them by calling
client.create_work_pool
in a fixture, but that gave back a 500 from the ephemeral cluster
c

Chris White

04/13/2023, 6:24 PM
500 usually means the API wasn't available or accessible
j

Josh Paulin

04/13/2023, 6:25 PM
This was in the same fixture as the test_harness being instantiated
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: work_pool
[SQL: INSERT INTO work_pool (id, created, updated, name, description, type, base_job_template, is_paused, default_queue_id, concurrency_limit) VALUES (:id, :created, :updated, :name, :description, :type, :base_job_template, :is_paused, :default_queue_id, :concurrency_limit)]
[parameters: {'id': 'cf6eba98-8b63-4ee0-bc92-0fa9f3c2c02b', 'created': '2023-04-13 18:27:47.288283', 'updated': '2023-04-13 18:27:47.288310', 'name': 'dummy-work-pool', 'description': None, 'type': 'prefect-agent', 'base_job_template': '{}', 'is_paused': 0, 'default_queue_id': None, 'concurrency_limit': None}]
(Background on this error at: <https://sqlalche.me/e/14/e3q8>)
API is up; threw in a
client.api_healthcheck()
for good measure
c

Chris White

04/13/2023, 6:30 PM
oh it looks like you haven't upgraded your DB
j

Josh Paulin

04/13/2023, 6:31 PM
This is using the test harness; I’ve not touched the db at all (ever)