diff --git a/master/app/controllers/data_set_controller.rb b/master/app/controllers/data_set_controller.rb index f2018ba5a..dc679f339 100644 --- a/master/app/controllers/data_set_controller.rb +++ b/master/app/controllers/data_set_controller.rb @@ -982,6 +982,16 @@ def register_bfabric Process.waitpid pid redirect_to :controller => "data_set", :action => "show" end + def update_resource_size + data_set = DataSet.find_by_id(params[:id]) + pid = Process.fork do + Process.fork do + data_set.update_resource_size + end # grand-child process + end # child process + Process.waitpid pid + redirect_to :controller => "data_set", :action => "show" + end def announce_template_set @data_set_id = params[:id] @announce_templates = Dir["announce_templates/*.txt"].to_a.sort diff --git a/master/app/models/data_set.rb b/master/app/models/data_set.rb index f8e822c95..06768766b 100644 --- a/master/app/models/data_set.rb +++ b/master/app/models/data_set.rb @@ -149,6 +149,12 @@ def register_bfabric(op = 'new', bfabric_application_number: nil) end end end + def update_resource_size + #command = "update_resource_size -w #{self.workunit_id} --test" + command = "update_resource_size -w #{self.workunit_id}" + #p command + `#{command}` + end def paths dirs = [] samples.each do |sample| diff --git a/master/app/views/data_set/show.html.erb b/master/app/views/data_set/show.html.erb index 42069647c..edf39aa5e 100644 --- a/master/app/views/data_set/show.html.erb +++ b/master/app/views/data_set/show.html.erb @@ -175,6 +175,9 @@ $(document).ready(function(){ <% if @can_register_bfabric %> - <%= link_to "register in B-Fabric", {:action=>"register_bfabric", :id=>@data_set.id}, :data=>{:confirm=>"Are you sure you want to register this dataset? DataSet ID:#{@data_set.id}? It will take some seconds."}, :method=>:post %> <% end %> +<% if session[:employee] and @data_set.workunit_id %> +- <%= link_to "update resource size", {:action=>"update_resource_size", :id=>@data_set.id}, :data=>{:confirm=>"Note: It will stop if workunit size != 0 and resouce is missing in gstore."}, :method=>:post %> +<% end %> <% if session[:employee] %> - <%= link_to "Set B-Fabric ID", '', :id=>"mod_bfab_data_set_id" %> <% if !@data_set.data_set %> diff --git a/master/config/routes.rb b/master/config/routes.rb index e3f44c6ce..2bd507d54 100644 --- a/master/config/routes.rb +++ b/master/config/routes.rb @@ -29,6 +29,7 @@ post :confirm_delete_only_data_files post :run_delete_only_data_files post :register_bfabric + post :update_resource_size get :update_completed_samples end collection do