Skip to content
Browse files

added more custom actions for openmpi and mpich2 cluster config files

  • Loading branch information...
1 parent eb6299b commit 7e495fb19c56aa8658b775c2b11b493a64455547 Pete Skomoroch committed
View
45 app/controllers/jobs_controller.rb
@@ -170,6 +170,51 @@ def error
end
+ # custom actions for MPI cluster config files...
+ # TODO: move cpu logic out to new model for EC2 instance types.
+
+ # GET /jobs/1/hosts
+ def hosts
+ @job = Job.find(params[:id])
+ host_array = []
+ @job.nodes.each do |node|
+ host_array << "#{node.private_dns_name} #{node.private_dns_name.split('.')[0]}"
+ end
+ send_data host_array.join("\n"), :type => 'text/html; charset=utf-8'
+ end
+
+
+ # GET /jobs/1/openmpi_hostfile
+ def openmpi_hostfile
+ # hostfile for OpenMPI clusters
+ # node001 slots=2
+ # node002 slots=2
+ @job = Job.find(params[:id])
+ cpu_count = @job.processors_per_node
+ host_array = []
+ @job.nodes.each do |node|
+ host_array << "#{node.private_dns_name.split('.')[0]} slots=#{cpu_count}"
+ end
+ send_data host_array.join("\n"), :type => 'text/html; charset=utf-8'
+ end
+
+ # GET /jobs/1/mpich2_machinefile
+ def mpich2_machinefile
+ # machine file for MPICH2 clusters
+ # node001:2
+ # node002:2
+ @job = Job.find(params[:id])
+ cpu_count = @job.processors_per_node
+ host_array = []
+ @job.nodes.each do |node|
+ host_array << "#{node.private_dns_name.split('.')[0]}:#{cpu_count}"
+ end
+ send_data host_array.join("\n"), :type => 'text/html; charset=utf-8'
+ end
+
+
+ # Custom action for AJAX page refresh
+
# GET /jobs/refresh
def refresh
@jobs = Job.paginate :page => params[:page], :order => 'created_at DESC', :per_page =>10
View
7 app/models/job.rb
@@ -168,6 +168,13 @@ def is_cancellable?
return cancellable_states.include? self.state
end
+ def processors_per_node
+ # TODO: create a seperate model to hold this info
+ cpus = {"m1.small"=>1, "m1.large"=>2,
+ "m1.xlarge"=>4, "c1.medium"=>2, "c1.xlarge"=>8}
+ return cpus[self.instance_type]
+ end
+
def launch_cluster
puts 'background cluster launch initiated...'
View
3 app/views/layouts/green.html.erb
@@ -7,7 +7,8 @@
<%= javascript_include_tag :defaults %>
<%= yield(:head) %>
</head>
- <div class="logo"><a href="http://www.datawrangling.com" title="DataWrangling.com"><%= image_tag("datawrangling_logo_white.png") %></a></div>
+ <div class="logo"><a href="http://www.datawrangling.com" title="DataWrangling.com"><%= image_tag("datawrangling_logo_white.png") %></a>
+ </div>
<body>
<div id="container">
<%- flash.each do |name, msg| -%>
View
2 config/routes.rb
@@ -1,7 +1,7 @@
ActionController::Routing::Routes.draw do |map|
map.root :controller => "jobs"
- map.resources :jobs, :member => { :cancel => :put , :nextstep => :put, :updateprogress => :put, :error => :put} , :collection => { :refresh => :get }, :has_many => :nodes
+ map.resources :jobs, :member => { :cancel => :put , :nextstep => :put, :updateprogress => :put, :error => :put, :hosts => :get, :openmpi_hostfile => :get, :mpich2_machinefile => :get} , :collection => { :refresh => :get }, :has_many => :nodes
# The priority is based upon order of creation: first created -> highest priority.
View
BIN public/images/elasticwulf_logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2 script/delayed_job
@@ -4,7 +4,7 @@ require 'daemons'
dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
daemon_options = {
- :multiple => false,
+ :multiple => true,
:dir_mode => :normal,
:dir => File.join(dir, 'tmp', 'pids'),
:backtrace => true

0 comments on commit 7e495fb

Please sign in to comment.
Something went wrong with that request. Please try again.