-
Notifications
You must be signed in to change notification settings - Fork 22
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
Version the graph examples #84
Conversation
* Run the Ruby examples on GraalVM distributions that support it. * Added GraalVM 22.3.1 to the list of GraalVM distributions used for graph generation. * Restructure the way we run commands to enable code reuse.
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.
Seems good to me.
A few minor nits but fine as is.
01243ba
to
ff10661
Compare
…rmat. GraalVM used to ship as a JVM into which one could install multiple languages with a tool named `gu`. The `gu` utility was removed and languages are now avaliable as Maven artifacts. While that's considerably more convenient for applications embedding Truffle languages, it complicates using each language's launcher. Consequently, we now need to install separate distributions for each language in order to run the examples for that language.
5d082a8
to
94e5dda
Compare
tools/generate-examples.rb
Outdated
FileUtils.cp("fib-java.bgv.gz", "#{__dir__}/../examples/#{graalvm.name}") | ||
|
||
if reference_graalvm?(graalvm) | ||
FileUtils.ln_sf("#{__dir__}/../examples/#{graalvm.name}/fib-java.bgv.gz", "#{__dir__}/../examples") |
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 is creating symlinks with absolute paths
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.
Does this work?
FileUtils.ln_sf("#{__dir__}/../examples/#{graalvm.name}/fib-java.bgv.gz", "#{__dir__}/../examples") | |
FileUtils.ln_sf("#{graalvm.name}/fib-java.bgv.gz", "#{__dir__}/../examples") |
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.
Argh. I thought I fixed all of those. I'll take another look. Thanks!
tools/generate-examples.rb
Outdated
FileUtils.ln_sf("#{__dir__}/../examples/#{graalvm.name}/fib-js.bgv.gz", "#{__dir__}/../examples/") | ||
FileUtils.ln_sf( |
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.
also these
tools/generate-examples.rb
Outdated
FileUtils.ln_sf("#{__dir__}/../examples/#{graalvm.name}/fib-ruby.bgv.gz", "#{__dir__}/../examples") | ||
FileUtils.ln_sf( |
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.
and these
raise unless bgv.size == 1 | ||
raise if bgv_ast.size > 1 |
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.
Is there a good error message we could include here? Like a pointer as to what file to go look at if these sizes aren't right? Or would it be more likely to be a failure in a command?
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 really don't know. It's a sanity check so the code that follows makes sense. I can't think of a reason why there would ever be more than one AST file unless Graal changes something unexpectedly. If that's the case, all we can really do is look at the error and reevaluate what assumption no longer holds.
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.
As long as we fix the symlinks the rest of the comments aren't blockers, feel free to take them or leave them.
raise unless bgv.size == 1 | ||
raise if bgv_ast.size > 1 |
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.
same, is there any hint worth providing about what to look into if this was an issue?
94e5dda
to
741310d
Compare
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.
The tests pass for me locally.
I tried the tool and it updates all the examples, but then I get a single test failure:
rspec spec
........................................................F........................................................................................
Failures:
1) Seafoam::Commands#props prints properties for a file
Failure/Error: expect(@out.string.gsub("\n\n", "\n")).to(eq("{\n \"vm.uuid\": \"21734\"\n}\n"))
expected: "{\n \"vm.uuid\": \"21734\"\n}\n"
got: "{\n \"vm.uuid\": \"64368\"\n}\n"
(compared using ==)
Diff:
@@ -1,4 +1,4 @@
{
- "vm.uuid": "21734"
+ "vm.uuid": "64368"
}
# ./spec/seafoam/command_spec.rb:253:in `block (3 levels) in <top (required)>'
Finished in 1.1 seconds (files took 0.10114 seconds to load)
145 examples, 1 failure
Failed examples:
rspec ./spec/seafoam/command_spec.rb:251 # Seafoam::Commands#props prints properties for a file
rake aborted!
Command failed with status (1): [rspec spec...]
/Users/rwstauner/src/github.com/Shopify/seafoam/Rakefile:8:in `block in <top (required)>'
/Users/rwstauner/ruby/rbenv/versions/3.3.0/bin/bundle:25:in `load'
/Users/rwstauner/ruby/rbenv/versions/3.3.0/bin/bundle:25:in `<main>'
Tasks: TOP => specs
(See full trace by running task with --trace)
Any idea why that is or what it means? Is it worth fixing
seafoam/spec/seafoam/command_spec.rb
Line 253 in 741310d
expect(@out.string.gsub("\n\n", "\n")).to(eq("{\n \"vm.uuid\": \"21734\"\n}\n")) |
somehow? Do we care what the value is, or could we change it to just match digits?
expect(@out.string.gsub("\n\n", "\n")).to(match(/{\n "vm\.uuid": "\d+"\n}/))
The UUID is unique for each graph. If you regenerate the examples, you'll get a new graph. While it's inconvenient that the one spec would fail, the expectation is that you'll go verify the UUID is correct by other means and ensure the test is checking for the correct value. If we made it a regex pattern it could result in the parser breaking without anyone noticing. |
I did notice that in 2 different runs I got different values, but I thought if it was always different I would have seen you update it... which I didn't. I do see it has changed a few times in the history. What does the value mean? Or what is it tied to? Now I realize that when I run the script I have updates to |
…he reference examples to use GraalVM 23.1.2.
I didn't include them because there was no real need to regenerate them. Moreover, we can't fully regenerate them without patching Graal since GraalVM 21.1.0 did not support the I suppose I could just not regenerate the graphs if the directory exists, but if we add new examples or change any of the engine options, we could then miss updates. In either case the person running the tool needs to be aware of what they're pushing. Given the node IDs change, this operation will never be idempotent, so it's incumbent on the person running the script to only commit meaningful changes. |
Thanks, that makes sense to me 👍 |
* Added optional logging of commands being run. * Fixed deprecated usage of Graal options. * Cleaned up the reference to the examples directory.
741310d
to
14794a9
Compare
This PR restores the script for generating examples and modernizes it.
We were unable to run the Ruby examples with GraalVM 21.2.0 because Graal was missing a necessary option. When those results were generated manually they were done with a patched version of Graal. Subsequent versions of Graal have the option enabled so this script can now process the Ruby examples.
To help keep storage size down, I've switched all the top-level examples to symlinks to a GraalVM-versioned set of files. Now that the Ruby example graphs are generated automatically, I've compressed them just like the Java example graphs.
I think is in keeping with what @chrisseaton had in mind in #37. I haven't yet added the ability to directly compare graphs from different GraalVM versions, although that can be done approximately with the
seafoam describe
command.