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

Periodically call arbitrary callback #206

Open
jbweston opened this issue Mar 5, 2024 · 4 comments · May be fixed by #209
Open

Periodically call arbitrary callback #206

jbweston opened this issue Mar 5, 2024 · 4 comments · May be fixed by #209

Comments

@jbweston
Copy link
Collaborator

jbweston commented Mar 5, 2024

Currently adaptive-scheduler is capable of periodically saving the learner data, and calling 'learner.to_dataframe' and saving the resultant dataframe.

I would like to request the option to be able to additionally call an arbitrary callback.
My use-case is that I would like to save the learner data in a more efficient format.

Failing this I could potentially override the 'save' method for my learners; does adaptive-scheduler assume anything about the filenames/data format produced by 'save'?

@basnijholt
Copy link
Owner

basnijholt commented Mar 6, 2024

[This should be pretty easy to implement, because adaptive already accepts callbacks. We just need to pass the method and call it somewhere around here

runner.start_periodic_saving({"fname": fname}, interval=args.save_interval)

Currently AFK, but will look tomorrow.

@jbweston
Copy link
Collaborator Author

jbweston commented Mar 6, 2024

Yes; I think the issue is piping 'save_method' all the way from the top of the API. We would also need to store 'save_method' somewhere so that the clients can pick it up.

Contrast this to 'save_dataframe', where we hardcode the method invocation and instead pass through simple data (boolean flag and a format specifier string).

@basnijholt
Copy link
Owner

basnijholt commented Mar 6, 2024

We can probably pass it in the same way as the runner_kwargs:

parser.add_argument("--serialized-runner-kwargs", action="store", type=str)

base64_runner_kwargs = _serialize_to_b64(runner_kwargs)

@basnijholt basnijholt linked a pull request Mar 11, 2024 that will close this issue
@basnijholt
Copy link
Owner

@jbweston, I opened #209.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants