Skip to content

Accept trial_queue in SamplerContext constructor - #311

Merged
c-bata merged 1 commit into
mainfrom
c-bata/sampler-context-trial-queue
Nov 18, 2026
Merged

c-bata merged 1 commit into
mainfrom
c-bata/sampler-context-trial-queue

Conversation

@c-bata

@c-bata c-bata commented Nov 17, 2026

Copy link
Copy Markdown
Member

Motivation

#304 exposed the study's trial queue to samplers through ctx.trial_queue, but kept the Python SamplerContext constructor unchanged. A context built in Python therefore always got a new in-memory queue. Trials that a sampler enqueued through it never reached the study's queue, and nothing reported an error.

Changes

  • Add a required keyword argument trial_queue to rustuna.samplers.SamplerContext.
  • Move into_trial_queue_pyobj from study.rs to trial_queue/mod.rs. create_study(), load_study() and SamplerContext now resolve trial queues the same way. Built-in queues share their Rust queue, and other objects that implement TrialQueueProtocol are wrapped in ToRustTrialQueue.
  • Add a test checking that ctx.trial_queue shares its queue with the study, for both a built-in queue and a queue written in Python.

@c-bata c-bata self-assigned this Nov 17, 2026
@c-bata
c-bata merged commit f0f12af into main Nov 18, 2026
9 checks passed
@c-bata
c-bata deleted the c-bata/sampler-context-trial-queue branch November 18, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant