Sha256: 59e64678c23c9b49be7304bee0905967a1f031566b31c7790a77296511055665

Contents?: true

Size: 1.75 KB

Versions: 46

Compression:

Stored size: 1.75 KB

Contents

require 'hybrid_platforms_conductor/report'

module MyHpcPlugins

  module HpcPlugins

    module Report

      # Publish reports to our web reporting tool
      class WebReport < HybridPlatformsConductor::Report

        # Give the list of supported locales by this report generator
        # [API] - This method is mandatory.
        #
        # Result::
        # * Array<Symbol>: List of supported locales
        def self.supported_locales
          # This method has to publish the list of translations it accepts.
          [:en]
        end

        # Create a report for a list of nodes, in a given locale
        # [API] - This method is mandatory.
        #
        # Parameters::
        # * *nodes* (Array<String>): List of nodes
        # * *locale_code* (Symbol): The locale code
        def report_for(nodes, locale_code)
          # This method simply provides a report for a given list of nodes in the desired locale.
          # The locale will be one of the supported ones.
          # Generate the report in a file to be uploaded on web10.
          File.write(
            '/tmp/web_report.txt',
            @platforms_handler.known_platforms.map do |platform|
              "= Inventory for platform #{platform.repository_path} of type #{platform.platform_type}:\n" +
                platform.known_nodes.map do |node|
                  "* Node #{node} (IP: #{@nodes_handler.get_host_ip_of(node)}, Hostname: #{@nodes_handler.get_hostname_of(node)})."
                end.join("\n")
            end.join("\n")
          )
          # Upload the file on our web10 instance
          system 'scp -o StrictHostKeyChecking=no /tmp/web_report.txt root@web10.hpc_tutorial.org:/root/hello_world.txt'
          out 'Upload successful'
        end

      end

    end

  end

end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.2.4 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.2.3 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.2.2 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.2.1 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.2.0 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.1.1 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.1.0 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.0.4 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.0.3 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.0.2 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.0.1 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-33.0.0 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-32.18.0 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-32.17.1 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-32.17.0 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-32.16.4 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-32.16.3 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-32.16.2 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-32.16.1 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb
hybrid_platforms_conductor-32.16.0 examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb