Skip to content

[Serve] Use safe_cursor for serve state #3299

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

Merged
merged 1 commit into from
Mar 12, 2024
Merged

Conversation

Michaelvll
Copy link
Collaborator

I encourtered issues with service db locked, like the following

E 03-12 05:28:23 subprocess_utils.py:84]   File "<string>", line 1, in <module>
E 03-12 05:28:23 subprocess_utils.py:84]   File "/opt/conda/lib/python3.10/site-packages/sky/serve/serve_utils.py", line 451, in wait_service_registration
E 03-12 05:28:23 subprocess_utils.py:84]     record = serve_state.get_service_from_name(service_name)
E 03-12 05:28:23 subprocess_utils.py:84]   File "/opt/conda/lib/python3.10/site-packages/sky/serve/serve_state.py", line 311, in get_service_from_name
E 03-12 05:28:23 subprocess_utils.py:84]     rows = _DB.cursor.execute('SELECT * FROM services WHERE name=(?)',
E 03-12 05:28:23 subprocess_utils.py:84] sqlite3.OperationalError: database is locked

This PR adopts the safe_cursor we used for spot jobs to avoid the issue with best effort.

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: bash tests/backward_comaptibility_tests.sh

@Michaelvll Michaelvll mentioned this pull request Mar 12, 2024
6 tasks
@Michaelvll Michaelvll merged commit c873c31 into master Mar 12, 2024
@Michaelvll Michaelvll deleted the use-safe-db-for-serve branch March 12, 2024 17:17
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.

2 participants