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

progress(simulation) is not always called during run! #723

Closed
glwagner opened this issue Mar 28, 2020 · 2 comments
Closed

progress(simulation) is not always called during run! #723

glwagner opened this issue Mar 28, 2020 · 2 comments
Labels
duplicate 🧬 The search bar is your friend

Comments

@glwagner
Copy link
Member

glwagner commented Mar 28, 2020

This line:

https://github.com/climate-machine/Oceananigans.jl/blob/6502f078c8f7698a2fb6cd398d9e96cfacccc787/src/Simulations.jl#L166

prevents the method progress(simulation) from being called if progress is not a subtype of the abstract type Function.

This makes using callable objects for progress more complicated (at least, these callable objects would have to subtype Function, which seems like an arbitrary requirement for such objects).

What is the reasoning behind requiring progress to subtype Function (and furthermore enforcing this with an if-statement)? If progress does not subtype function, the keyword argument is unused (despite the desperate efforts of flailing users, such as myself).

Callable objects are nice for progress. For example, a callable object is a good way to keep track of wall time, make plots, automatically format strings containing diagnostics information, or otherwise reference objects outside simulation for the purposes of logging.

@glwagner glwagner changed the title progress is not always called progress(simulation) is not always called during run! Mar 28, 2020
@ali-ramadhan ali-ramadhan added the duplicate 🧬 The search bar is your friend label Mar 30, 2020
@ali-ramadhan
Copy link
Member

Isn't this a duplicate of #642?

I agree that callable objects should work. I think the solution we discussed in #642 should work:

iscallable(sim.progress) && sim.progress(sim) 

@glwagner
Copy link
Member Author

Yep, dup of #642 (more or less)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate 🧬 The search bar is your friend
Projects
None yet
Development

No branches or pull requests

2 participants