Skip to content

Delay entering TrialRunner context until run_trial #970

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bpkroth
Copy link
Contributor

@bpkroth bpkroth commented Apr 28, 2025

Pull Request

Title

Delay entering TrialRunner context until run_trial.


Description

This is part of an attempt to try and see if can work around issues with multiprocessing.Pool needing to pickle certain objects when forking.

For instance, if the Environment is using an SshServer, we need to start an EventLoopContext in the background to handle the SSH connections and threads are not picklable.

Nor are file handles, DB connections, etc., so there may be other things we also need to adjust to make this work.

See Also #967


Type of Change

  • 🛠️ Bug fix
  • 🔄 Refactor

Testing

  • Light so far (still in draft mode)
  • Just basic existing CI tests (seems to not break anything)

Additional Notes (optional)

I think this is incomplete. To support forking inside the Scheduler and then entering the context of the given TrialRunner, we may also need to do something about the Scheduler's Storage object.

For now this is a draft PR to allow @jsfreischuetz and I to play with alternative organizations of #967.


This is part of an attempt to try and see if can work around issues with
`multiprocessing.Pool` needing to pickle certain objects when forking.

For instance, if the Environment is using an SshServer, we need to start an
EventLoopContext in the background to handle the SSH connections and threads are
not picklable.

Nor are file handles, DB connections, etc., so there may be other things we also
need to adjust to make this work.

See Also microsoft#967
@bpkroth bpkroth mentioned this pull request May 2, 2025
7 tasks
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.

1 participant