-
Notifications
You must be signed in to change notification settings - Fork 35
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
ported Event example from old SimJulia doc #107
Conversation
…d SimJulia doc, tested, seems to be working as expected
Thank you! There is a small typo in a test we merged on master while working on something. I will fix that unrelated typo and merge your PR over the weekend. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #107 +/- ##
=======================================
Coverage 97.15% 97.15%
=======================================
Files 12 12
Lines 316 316
=======================================
Hits 307 307
Misses 9 9 ☔ View full report in Codecov by Sentry. |
Hi, Andrei! Concerning CI: The CI-nightly test is not related to your changes, do not worry about it. Could you briefly mention the documentation update in the CHANGELOG file? The performance tracking is not actually set up, so also do not worry about it. I pushed to your branch to retrigger the CI -- you might need to pull or force push to make sure future changes of yours are made accessible here. I also noticed you are working directly on your master branch -- this is perfectly workable, but it can cause you issues if you start working on multiple changes. I would generally suggest always creating separate branches with something like The docs you added are in the form of a literal code block, so they do not actually get tested for correctness. In order to ensure that the docs and the code do not diverge, we try to make sure all example code in the docs is always executed. That can be done in various ways. E.g. we use I think for your situation just a This can be a bit finicky to set up, so do not hesitate to message if something is unclear. Could you also remove the script from the Thanks for helping with all of this, it is really valuable! |
I added issue #111 to track the examples folder cleanup that I mentioned in the previous comment. |
…ample in events.md marked as jldoctest
Note that doctest is disabled in docs/make.jl. Also, it seems that Revise import is not necessary. I decided not to struggle with fixing of existing jldoctest errors at this point. I agree that it does make sense to work on separate branch in fork as additional measure to keep thing clear for everyone. |
I do not believe there are pre-existing doctest errors. The doctests are run when we run the tests (from the The example still needs some more work as it is not currently verifying the output (which is the reason for breakages in the CI). Could you flesh it out? Here are some guidelines on how to set it up https://documenter.juliadocs.org/stable/man/doctests/ For locally running the docs you can use:
It is the |
can you suggest how to properly run test/test_doctests.jl from shell?
I think it fails mostly because some output strings are not prepended with ConcurrentSim. Anyway, I put output into school example and commit/push. I think output should match and CI will run. I guess it requires your approval to go through. Do you know is it possible to see what exactly CI run is doing? I found yml files in .github but where detailed logs are stored? |
To find the logs from CI, go to the header of this PR and click on "checks" Then click on CI and find the failing CI run. Here is direct link to the latest run: https://github.com/JuliaDynamics/ConcurrentSim.jl/actions/runs/7834706506/job/21381106568 |
ah, you fixed it just as I was sending the comment :D |
for running the tests, it is easiest just to do it from the REPL with |
OK, i will follow this advice. |
I made a small edit to avoid giving SEO weight to the outdated documentation. There is one last piece that I noticed when I was reading through: the line that you commented out, what is it for, why is it commented out? |
docs/src/guides/events.md
Outdated
@yield timeout(env, 45.0) | ||
succeed(school.class_ends) | ||
#school.class_ends = Event(env) -- ?? orig SimJulia example somehow works |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, in old version this line was ok, but ConcurrentSim.jl was failing. When I moved this line right after yield statement (line 103 in events.md) everything works fine. So you can remove this commented line if there are no reason to investigate further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this actually introduced a bug: instead of all 3 pupils waiting on the same event, in the second round they all wait on different events, only one of which gets unlocked. I think I fixed that, although I would appreciate if you double check.
I also added a warning above the example to make sure that users know this is a low-level functionality they should not need. This is more easily done with Resource and Store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, i agree, my change was the bug. I forgot at that moment we have more pupil processes so resetting of event after yield does not look right. that also means i need to take a closer look on how succeed() implemented - it seems that you resetting event while it could still block some other yields. Or succeed() have something to guarantee that all pending yields will be processed before succeed() returns?
Looks like I also need to learn how to use Resource and Store.
General question: do you know any written text on web (or just the book/paper) where all this discrete simulation primitives and interactions are described in coherent fashion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ben wrote this library to mimic SimPy. That could be a useful reference.
Tests pass. If you confirm that my fixes did not introduce other bugs, I will merge. Thanks for taking care of this translation! |
Thank you for your contribution! It is very much appreciated! If you want to try your hand at anything else in the library, I would be happy to help. |
Fixes #106