Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get_result(wait=True) and support Python 3.12 #1949

Merged
merged 10 commits into from
Jan 17, 2025
Merged

Conversation

cjao
Copy link
Contributor

@cjao cjao commented May 21, 2024

get_result(wait=True) will still error out after some time. Thi PR proposes a fix using a combination of API and SDK improvements.

The previous GET /dispatches/{dispatch_id} endpoint was trying to do too much. Its responsibilities are now separated into two endpoints:

  • GET /dispatches: bulk query dispatch summaries (including status) with options to filter by dispatch_id, sort chronologically, and also limit the output to status only.

  • GET /dispatches/{dispatch_id}: download manifest

To achieve the desired behavior of get_result(id, wait=True), the client

  1. Polls the dispatch status by querying the first endpoint.

  2. Downloads the manifest after the dispatch has reached a final status.

The server no longer returns 503 errors when the dispatch is not yet "ready". A 503 status code is not appropriate here because it is intended to convey temporary service unavailablity resulting from server overload or rate limiting. However, the fact that the workflow is still running does not indicate any fault of the server.

These changes will allow get_result(dispatch_id, wait=True) to wait as long as required instead of erroring out after some time.

Fixes #1539
Fixes #1973
Fixes ENG-2039

  • I have added the tests to cover my changes.
  • I have updated the documentation and CHANGELOG accordingly.
  • I have read the CONTRIBUTING document.

@cjao cjao force-pushed the improve-result-api branch 2 times, most recently from 0a3b19c to 5f4adfb Compare May 21, 2024 21:48
@cjao cjao marked this pull request as ready for review May 21, 2024 21:52
@cjao cjao requested a review from a team as a code owner May 21, 2024 21:52
@cjao cjao changed the title API: redesign implementation of get_result(wait=True) Redesign implementation of get_result(wait=True) May 21, 2024
@cjao cjao force-pushed the improve-result-api branch 2 times, most recently from 40b509d to f98d1eb Compare May 29, 2024 18:42
@cjao cjao changed the title Redesign implementation of get_result(wait=True) Fix get_result(wait=True) May 29, 2024
@cjao cjao marked this pull request as draft May 29, 2024 18:49
@cjao cjao force-pushed the improve-result-api branch 2 times, most recently from 9138a30 to dd00785 Compare June 14, 2024 23:01
@santoshkumarradha
Copy link
Member

santoshkumarradha commented Jun 14, 2024

~~@cjao can you see if you make this true in a way for other waits as well like env and deployment ? ~~

Please ignore

@cjao cjao force-pushed the improve-result-api branch from dd00785 to 8c4dcb8 Compare June 14, 2024 23:19
@cjao cjao force-pushed the improve-result-api branch from 8c4dcb8 to 520df3b Compare September 11, 2024 18:33
@cjao cjao marked this pull request as ready for review September 12, 2024 18:03
@cjao cjao force-pushed the improve-result-api branch from 520df3b to 52db4a2 Compare January 16, 2025 21:04
@cjao cjao requested a review from a team as a code owner January 16, 2025 21:04
@cjao cjao force-pushed the improve-result-api branch from 52db4a2 to 131f6f8 Compare January 16, 2025 21:51
@cjao cjao changed the title Fix get_result(wait=True) Fix get_result(wait=True) and support Python 3.12 Jan 16, 2025
@cjao cjao requested a review from FyzHsn January 17, 2025 12:47
The previous `GET /dispatches/{dispatch_id}` endpoint was trying to do
too much. Its responsibilities are now separated into two endpoints:

* `GET /dispatches`: bulk query dispatch summaries (including status)
with options to filter by `dispatch_id`, sort chronologically, and
also limit the output to status only.

* `GET /dispatches/{dispatch_id}`: download manifest

To achieve the desired behavior of `get_result(id, wait=True)`, the
client

1. Polls the dispatch status by querying the first endpoint.

2. Downloads the manifest after the dispatch has reached a final
status.

The server no longer returns 503 errors when the dispatch is not yet
"ready". A 503 status code is not entirely accurate here because it is
intended to convey temporary service unavailablity resulting from
server overload or rate limiting. However, the fact that the workflow
is still running does not indicate any fault of the server.

These changes will allow `get_result(dispatch_id, wait=True)` to wait
as long as required instead of erroring out after some time.

Supporting improvements:

DAL: Add sorting and pagination to Controller

DAL: improve bulk get when retrieving only some columns

Directly select the specified columns instead of retrieving the whole
ORM entities and deferring column loading using load_only
@cjao cjao force-pushed the improve-result-api branch from 131f6f8 to 82e46de Compare January 17, 2025 14:45
covalent_dispatcher/_dal/result.py Outdated Show resolved Hide resolved
@FyzHsn FyzHsn self-requested a review January 17, 2025 15:59
@FyzHsn FyzHsn enabled auto-merge (squash) January 17, 2025 16:00
@cjao cjao disabled auto-merge January 17, 2025 16:31
@cjao cjao merged commit 74f2f22 into develop Jan 17, 2025
9 checks passed
@cjao cjao deleted the improve-result-api branch January 17, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot import covalent with Python >=3.12 Inevitable recursion error from inside get_result
4 participants