-
-
Notifications
You must be signed in to change notification settings - Fork 996
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
enqueue, storage & parallelization #4002
Comments
Thank you for your bug report. We think this bug occurs when SQLite is used for parallel optimization. optuna/optuna/storages/_rdb/models.py Lines 241 to 244 in a61e53d
If you need a database for parallel optimization, please try other RDB storage. (Or, please wait for the v3.1.0 release, which includes new style storage #3854) |
Thank you for reporting the problem. I'll update the documentation to let Optuna users know this feature does not work with SQLite3. @wattlebirdaz I tried using https://gist.github.com/c-bata/e68678f8ee248f82d378b0cd3bee8d83#file-example-journal-py
|
Lines 948 to 959 in 31da4d0
In the mean time, a quick way to fix this for both sqlite3 and JournalStorage should be the following: Define def _pop_waiting_trial_id(self) -> Optional[int]:
with self._enqueue_trial_lock:
for trial in self._storage.get_all_trials(
self._study_id, deepcopy=False, states=(TrialState.WAITING,)
):
if not self._storage.set_trial_state_values(trial._trial_id, state=TrialState.RUNNING):
continue
print("Thread:{} Successed in popping: {}".format(threading.get_ident(), trial._trial_id))
_logger.debug("Trial {} popped from the trial queue.".format(trial.number))
return trial._trial_id
return None |
@wattlebirdaz Thank you for your investigation. |
Expected behavior
run the attached code, you will see the problem. this issue does not always happen, but often.
Environment
Error messages, stack traces, or logs
Steps to reproduce
Additional context (optional)
No response
The text was updated successfully, but these errors were encountered: