Skip to content

Commit

Permalink
Added update_resource_size link in dataset view
Browse files Browse the repository at this point in the history
  • Loading branch information
masaomi committed May 12, 2023
1 parent 830c842 commit c85f3a6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions master/app/controllers/data_set_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions master/app/models/data_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
3 changes: 3 additions & 0 deletions master/app/views/data_set/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down
1 change: 1 addition & 0 deletions master/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c85f3a6

Please sign in to comment.