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

[Merged by Bors] - Hotfixes after #309 #351

Closed
wants to merge 13 commits into from

Conversation

torfjelde
Copy link
Member

#309 was merged a bit too soon, for example bors was never run on the final version due to some issues. Before we make a release, we should make sure that it all works properly.

src/submodel_macro.jl Outdated Show resolved Hide resolved
torfjelde and others added 3 commits December 14, 2021 15:52
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
src/submodel_macro.jl Outdated Show resolved Hide resolved
@torfjelde
Copy link
Member Author

bors try

bors bot added a commit that referenced this pull request Dec 14, 2021
@torfjelde
Copy link
Member Author

One thing is leaving me very confused. If I try to run the doctests locally, it'll complain because

ERROR: LoadError: cannot automatically prefix with no left-hand side
results in LoadError: LoadError: rather than just LoadError. Aaaand I have no idea why 🤷

@torfjelde
Copy link
Member Author

Is there something wrong with bors? It doesn't seem to want to comment despite all test-suites (except nightly) passing.

@torfjelde
Copy link
Member Author

@devmotion @phipsgabler @yebai Could one of you have a look here? I think it's pretty "simple" given what we have in master.

quote
$(esc(:__varinfo__)) = last(
$(DynamicPPL._evaluate!!)($(esc(expr)), $(esc(:__varinfo__)), $(ctx))
$retval, $(esc(:__varinfo__)) = $(DynamicPPL._evaluate!!)(
Copy link
Member

@yebai yebai Dec 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like returning both the retval and varinfo. I was talking with Philip that we should consider enforcing this more systematically. Roughly speaking, we can consider adopting the notation that retval refers to generated quantities and varinfo refers to model parameters. This would help clarify the submodel notation as well, i.e.

  1. x = SubModel will extract retval and assign it to LHS
  2. x ~ SubModel will extract varinfo and assign it to LHS

Following this view, we no longer need to concern ourselves what is the semantics if the returned value retval of SubModel is deterministic in case 2.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused. In both those cases we still have to concern ourselves with the return-value, no? Essentially the difference between = and ~ will be whether we have $retval or varinfo below, right?

Anyways, you're happy with this right? You're just talking about potentially also supporting ~ later?

Copy link
Member

@yebai yebai Dec 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, happy with this PR.

I think retval and varinfo provides a clear semantical distinction between = and ~. If we always return both, (e.g. we can return (, varinfo) in case retval is empty), we can extract either retval or varinfo for = or ~.

@torfjelde
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Dec 14, 2021
#309 was merged a bit too soon, for example `bors` was never run on the final version due to some issues. Before we make a release, we should make sure that it all works properly.
@devmotion
Copy link
Member

Is there something wrong with bors? It doesn't seem to want to comment despite all test-suites (except nightly) passing.

You broke it (or rather the last PR that was merged) 😛 It waits until all tests listed in bors.toml are finished (failed or succeeded) but since there are no tests of the form test (1.%...) it waits forever. You commented out the tests on Julia 1.3 (

# - '1.3' # minimum supported version
) which these patterns refer to.

@devmotion
Copy link
Member

results in LoadError: LoadError: rather than just LoadError. Aaaand I have no idea why shrug

Nested LoadErrors are a thing (e.g. JuliaLang/julia#38725) and I guess occur e.g. if modules are nested.

@torfjelde
Copy link
Member Author

torfjelde commented Dec 14, 2021

You broke it (or rather the last PR that was merged) stuck_out_tongue It waits until all tests listed in bors.toml are finished (failed or succeeded) but since there are no tests of the form test (1.%...) it waits forever.

As I said, I really didn't want the PR to get merged when it did 😅 But sorry! That was not the intended effect.

Nested LoadErrors are a thing (e.g. JuliaLang/julia#38725) and I guess occur e.g. if modules are nested.

I get that nested LoadError can occurr, but if I copy-paste the exact thing from the docstring into my REPL locally I get an additional LoadError: 🤷 It's the fact that it's different from my REPL and the docstring that confuses me.

@bors
Copy link
Contributor

bors bot commented Dec 14, 2021

Canceled.

@torfjelde
Copy link
Member Author

Any final things before we merge this @devmotion ?

@devmotion
Copy link
Member

It's the fact that it's different from my REPL and the docstring that confuses

I think Documenter creates some modules internally, I think this explains differences between running the examples in the REPL and running the doc tests.

@devmotion
Copy link
Member

Any final things before we merge this @devmotion ?

No, but it's also a bit difficult to see if e.g. anything else is missing 😄 I'm happy if bors is 🤖

@torfjelde
Copy link
Member Author

It's the fact that it's different from my REPL and the docstring that confuses

I think Documenter creates some modules internally, I think this explains differences between running the examples in the REPL and running the doc tests.

That was my immediate thought as well, but I can't properly understand exactly what goes wrong, only that I guess this could be the cause.

But I'll leave the version that works with Documenter.jl 👍

No, but it's also a bit difficult to see if e.g. anything else is missing smile I'm happy if bors is robot

Yeah I know, def non-ideal with such a big change 😕

But I'll bors it then 👍

@torfjelde
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Dec 14, 2021
#309 was merged a bit too soon, for example `bors` was never run on the final version due to some issues. Before we make a release, we should make sure that it all works properly.
@bors
Copy link
Contributor

bors bot commented Dec 14, 2021

Build failed:

@torfjelde
Copy link
Member Author

Sooo the behavior of LoadError seems to vary between Julia versions...

@devmotion
Copy link
Member

It seems we have to add a doctestfilter (

doctestfilters = [
and possibly in docs/make.jl) for LoadError: LoadError: with Julia 1.3?

docs/make.jl Outdated Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@torfjelde
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Dec 14, 2021
#309 was merged a bit too soon, for example `bors` was never run on the final version due to some issues. Before we make a release, we should make sure that it all works properly.
@bors
Copy link
Contributor

bors bot commented Dec 14, 2021

Build failed:

docs/make.jl Outdated
@@ -18,6 +18,9 @@ makedocs(;
r"(Array{.+,\s?1}|Vector{.+})",
# Older versions will show "Array{...,2}" instead of "Matrix{...}".
r"(Array{.+,\s?2}|Matrix{.+})",
# Errors from macros sometimes result in `LoadError: LoadError:`
# rather than `LoadError:`, depending on Julia version.
r"ERROR: LoadError: (LoadError:\s)?+",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just use

Suggested change
r"ERROR: LoadError: (LoadError:\s)?+",
r"ERROR: (LoadError:\s)+",

? And it seems you forgot to update test/runtests.jl?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just use

Is this correct though? Don't we want to match at least one LoadError?

And it seems you forgot to update test/runtests.jl?

Ah thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to match at least one LoadError?

+ matches one or more occurrences so it doesn't match only "ERROR: ":

julia> regex =  r"ERROR: (LoadError:\s)+";

julia> match(regex, "ERROR: ") === nothing
true

julia> match(regex, "ERROR: LoadError: ")
RegexMatch("ERROR: LoadError: ", 1="LoadError: ")

julia> match(regex, "ERROR: LoadError: LoadError: ")
RegexMatch("ERROR: LoadError: LoadError: ", 1="LoadError: ")

Copy link
Member Author

@torfjelde torfjelde Dec 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, yeah I knew that, hence why I used ? on the second one. Now you might ask "then why did you just say what you just did?", to which I don't have a good answer 🙃 Thanks man!

EDIT: Oh wait, now I remember why I did it! If you do (LoadError:\s)+ you'll end up comparing the output to Error: , no? While we want to compare it to Error: LoadError: , i.e. all the redundant LoadError: removed?|

EDIT 2: Nope:) I guess it removes it from both the expected output and the actual output then.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doctest filters will be applied to both the expected output and the actual output and then the matches will be removed. The remaining string is checked for equality. So the LoadError: will be removed from the expected output as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my original understanding when I wrote it, but I think I must have missed some whitespace so it didn't match but instead complained that "ERROR: ...ddin't matchERROR: LoadError: ...`, i.e. the display seemed to indicate it was only removed from the expected output which confused me.

What I've learned tonight: I should not let myself be so easily swayed by displayed information:)

@bors
Copy link
Contributor

bors bot commented Dec 14, 2021

try

Timed out.

@torfjelde
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Dec 14, 2021
#309 was merged a bit too soon, for example `bors` was never run on the final version due to some issues. Before we make a release, we should make sure that it all works properly.
@bors
Copy link
Contributor

bors bot commented Dec 14, 2021

Build failed:

@torfjelde
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request Dec 14, 2021
#309 was merged a bit too soon, for example `bors` was never run on the final version due to some issues. Before we make a release, we should make sure that it all works properly.
@bors bors bot changed the title Hotfixes after #309 [Merged by Bors] - Hotfixes after #309 Dec 14, 2021
@bors bors bot closed this Dec 14, 2021
@bors bors bot deleted the tor/submodels-hotfixes branch December 14, 2021 22:57
@yebai yebai mentioned this pull request Dec 16, 2021
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.

3 participants