-
Notifications
You must be signed in to change notification settings - Fork 95
Allow arbitrary functions to extract name from configuration in produce_or_load
#366
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
Conversation
Ah no my dreams are ruined. Seems like this isn't reliable. Here: julia> objectid(rand(Random.MersenneTwister(4321), 1000))
0xc8f87467e4da680a
julia> objectid(rand(Random.MersenneTwister(4321), 1000))
0x0205f59056f4c6e6
julia> objectid(rand(Random.MersenneTwister(4321), 1000))
0xd49ed4947c3f3987 @sebastianpech this won't work unfortunately. Is my dream of using |
MY DREAM IS SAVED I JUST NEEDED HASH: julia> hash(rand(Random.MersenneTwister(4321), 1000))
0xc3437f37a6e8d226
julia> hash(rand(Random.MersenneTwister(4321), 1000))
0xc3437f37a6e8d226
julia> hash(rand(Random.MersenneTwister(4321), 1000))
0xc3437f37a6e8d226 |
Codecov Report
@@ Coverage Diff @@
## main #366 +/- ##
==========================================
+ Coverage 91.12% 91.18% +0.06%
==========================================
Files 8 8
Lines 732 749 +17
==========================================
+ Hits 667 683 +16
- Misses 65 66 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This is good to go. |
Hm, no, this isn't good to go :( From the example here: https://juliadynamics.github.io/DrWatson.jl/previews/PR366/real_world/#produce_or_load-with-hash-codes-1 we see that once I run the code with exactly the same configuration as it has been run before, e.g., |
Alright, update: I've fixed everything here. First of all, you can use |
This looks good to me! |
Alright, so this PR kinda solves my problems I had with really wanting to use
produce_or_load
, but also having too many, or too complicated, simulation parameters. I guess it is a simple inbetween step until DrWatson has some proper way to manage metadata/configuration "files". The discussion here #316 and the PR #333 are relevant.My intermediate solution is to allow arbitrary functions in
produce_or_load
that take as an input theconfig
container, and return a hopefully unique string for it. In my personal workflow I am usingobjectid
, but I haven't tested it extensively to see really how unique or safe its output is. When DrWatsonSim functionality is in, the change in this PR would still allow us to effortlessly integrate DrWatsonSim withproduce_or_load
.See the new example added in the Real World Usage for an overview of why this functionality is useful: https://juliadynamics.github.io/DrWatson.jl/previews/PR366/real_world/#produce_or_load-with-hash-codes-1