Rafał Bielicki
09/28/2024, 4:52 PM.serve()
method of the Flow, while on deploy()
I am required to pass the image which is not supported by process type queues…
Am I missing something here? How can I automatically register Deployment from flow that would go to specific work pool similar to.
await Deployment.build_from_flow(
flow=flow_setting.flow,
name=flow_setting.name,
work_queue_name=queue_setting.name,
work_pool_name=pool_setting.name,
skip_upload=True,
apply=True,
version=flow_setting.version,
schedules=[CronSchedule(cron=flow_setting.cron)] if flow_setting.cron else None,
)
Nate
09/28/2024, 5:01 PMfrom pathlib import Path
from prefect import flow
@flow
def hello_world():
print("Hello, World!")
if __name__ == "__main__":
flow.from_source(
source=str(Path(__file__).parent.resolve()),
entrypoint="deploy_process.py:hello_world",
).deploy(
name="hello-world", work_pool_name="local", build=False, ignore_warnings=True
)
Nate
09/28/2024, 5:01 PMfrom_source
to define where to get my code at runtime (this file in this case)
• pass build=False
Nate
09/28/2024, 5:02 PMRafał Bielicki
09/28/2024, 5:06 PMRafał Bielicki
09/29/2024, 12:05 PMUntil now we did this by running run_deployment but now I keep getting an error File /usr/local/lib/python3.11/site-packages/httpx/_client.py:1585, in AsyncClient.request(self, method, url, content, data, files, json, params, headers, cookies, auth, follow_redirects, timeout, extensions)
1570 warnings.warn(message, DeprecationWarning)
1572 request = self.build_request(
1573 method=method,
1574 url=url,
(...)
1583 extensions=extensions,
1584 )
-> 1585 return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File /usr/local/lib/python3.11/site-packages/prefect/client/base.py:361, in PrefectHttpxAsyncClient.send(self, request, *args, **kwargs)
358 response = PrefectResponse.from_httpx_response(response)
360 if self.raise_on_all_errors:
--> 361 response.raise_for_status()
363 return response
File /usr/local/lib/python3.11/site-packages/prefect/client/base.py:174, in PrefectResponse.raise_for_status(self)
172 return super().raise_for_status()
173 except HTTPStatusError as exc:
--> 174 raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.__cause__
PrefectHTTPStatusError: Client error '409 Conflict' for url '<http://prefect_server:4200/api/deployments/effbc2e1-997e-4414-bcfa-1d0a4d120aac/create_flow_run>'
Response: {'detail': "Error creating flow run: Validation failed. Failure reason: 'period_seconds' is a required property"}
For more information check: <https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409>
Seems like run_deployment
function wasn’t updated to new server contract.Rafał Bielicki
09/29/2024, 12:10 PMRafał Bielicki
09/29/2024, 12:10 PMRafał Bielicki
09/29/2024, 6:26 PM