Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add compatibility for Ruby 1.8 #1

Merged
merged 2 commits into from

2 participants

@jumanjiman

Resolves backtrace:

$ iblinkinfo.pl | /tmp/topology.rb -f svg -o top1
/tmp/topology.rb:230: wrong argument type Symbol (expected Proc) (TypeError)
  from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:152:in `instance_eval'
  from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:152:in `initialize'
  from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:567:in `new'
  from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:567:in `digraph'
  from /tmp/topology.rb:210

Tested-by: Paul Morgan jumanjiman@gmail.com

Tested on these Ruby versions:

  • RHEL 5: ruby 1.8.5 (2006-08-25) [x86_64-linux]
  • RHEL 6: ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  • Fedora 17: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

Test procedure:
I saved the output from iblinkinfo in a test environment, then
provided that as input for this patch using each version of Ruby listed above.

@jumanjiman jumanjiman Add compatibility for Ruby 1.8
Resolves backtrace:

$ iblinkinfo.pl | /tmp/topology.rb -f svg -o top1
/tmp/topology.rb:230: wrong argument type Symbol (expected Proc) (TypeError)
  from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:152:in `instance_eval'
  from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:152:in `initialize'
  from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:567:in `new'
  from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:567:in `digraph'
  from /tmp/topology.rb:210

Tested-by: Paul Morgan <jumanjiman@gmail.com>

Tested on these Ruby versions:
* RHEL 5:    ruby 1.8.5 (2006-08-25) [x86_64-linux]
* RHEL 6:    ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
* Fedora 17: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

Test procedure:
I saved the output from iblinkinfo in a test environment, then
provided that as input for this patch using each version of Ruby listed above.
dfcff4e
@jumanjiman

fyi: the file I used as input for testing (along with the resulting topology.dot) are posted at https://gist.github.com/3752177

@jumanjiman jumanjiman Add recommendation to README
In a medium-to-large IB infrastructure, generating SVG output is orders of
magnitude faster and results in much smaller output files. For example,
in one of our environments, the SVG is a few MB while the PNG is 12 GB!
8fde3cf
@glaville glaville merged commit bb9f81a into from
@glaville
Owner

Thanks, merged. I only use ruby 1.9 on our clusters (and can confirm the svg output recommandation: with > 90 nodes, the file becomes cumbersome fast with rasterized formats)

@glaville
Owner

Btw, I used your topology example input to improve output names generation (your clients should no longer be named switch_1, ... when they are not switch at all).

I added dynamic port number detection as well: Since on my clusters all Infiniband switches have 36 ports, it was the total hardcoded in the source code.

@jumanjiman jumanjiman deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 19, 2012
  1. @jumanjiman

    Add compatibility for Ruby 1.8

    jumanjiman authored
    Resolves backtrace:
    
    $ iblinkinfo.pl | /tmp/topology.rb -f svg -o top1
    /tmp/topology.rb:230: wrong argument type Symbol (expected Proc) (TypeError)
      from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:152:in `instance_eval'
      from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:152:in `initialize'
      from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:567:in `new'
      from /usr/lib/ruby/gems/1.8/gems/graph-2.5.1/lib/graph.rb:567:in `digraph'
      from /tmp/topology.rb:210
    
    Tested-by: Paul Morgan <jumanjiman@gmail.com>
    
    Tested on these Ruby versions:
    * RHEL 5:    ruby 1.8.5 (2006-08-25) [x86_64-linux]
    * RHEL 6:    ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
    * Fedora 17: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
    
    Test procedure:
    I saved the output from iblinkinfo in a test environment, then
    provided that as input for this patch using each version of Ruby listed above.
  2. @jumanjiman

    Add recommendation to README

    jumanjiman authored
    In a medium-to-large IB infrastructure, generating SVG output is orders of
    magnitude faster and results in much smaller output files. For example,
    in one of our environments, the SVG is a few MB while the PNG is 12 GB!
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 1 deletion.
  1. +3 −0  README.rdoc
  2. +3 −1 topology.rb
View
3  README.rdoc
@@ -17,6 +17,9 @@ to non-dot file formats such as png, svg, pdf...
$ iblinkinfo.pl | topology.rb -f png
# Or topology.rb <iblinkinfo.pl output file>
+Saving to svg format is recommended instead of png if your fabric
+contains hundreds of switches.
+
== Copyright
Copyright (c) 2012 Guillaume Laville. See LICENSE for details.
View
4 topology.rb
@@ -225,8 +225,10 @@ def port_label(i, ports, color)
else
proc { |e| true }
end
+
+ id_mapper = proc { |e| e.sw_id }
- sw_list = links.select(&lid_filter).map(&:sw_id).uniq
+ sw_list = links.select(&lid_filter).map(&id_mapper).uniq
sw_list.each do |id|
ports = (1..36).to_a.map { |e| "<p%d> %d" % [e, e] }.join("|")
Something went wrong with that request. Please try again.