[ARVADOS] created: c67402c3d993007f7d925d605eb486d21df4e278

git at public.curoverse.com git at public.curoverse.com
Fri May 30 19:51:39 EDT 2014


        at  c67402c3d993007f7d925d605eb486d21df4e278 (commit)


commit c67402c3d993007f7d925d605eb486d21df4e278
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri May 30 16:45:00 2014 -0400

    2939: Added a status page for jobs that is similar to the pipeline instance
    status page.  Adds two "Re-run job" buttons that allow you to re-run either the
    exact version or the version that was originally supplied (usually a branch
    name).  Adds a "supplied_script_version" column to jobs to remember the
    original script_version contents.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index 59ca350..cf46868 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -147,7 +147,7 @@ class ApplicationController < ActionController::Base
     @new_resource_attrs.reject! { |k,v| k.to_s == 'uuid' }
     @object ||= model_class.new @new_resource_attrs
     @object.save!
-    show
+    redirect_to @object
   end
 
   def destroy
diff --git a/apps/workbench/app/controllers/jobs_controller.rb b/apps/workbench/app/controllers/jobs_controller.rb
index 4746635..f693fa6 100644
--- a/apps/workbench/app/controllers/jobs_controller.rb
+++ b/apps/workbench/app/controllers/jobs_controller.rb
@@ -16,7 +16,7 @@ class JobsController < ApplicationController
 
     @svg = ProvenanceHelper::create_provenance_graph nodes, "provenance_svg", {
       :request => request,
-      :all_script_parameters => true, 
+      :all_script_parameters => true,
       :script_version_nodes => true}
   end
 
@@ -44,6 +44,6 @@ class JobsController < ApplicationController
   end
 
   def show_pane_list
-    %w(Attributes Provenance Metadata JSON API)
+    %w(Status Attributes Provenance Metadata JSON API)
   end
 end
diff --git a/apps/workbench/app/views/jobs/_show_status.html.erb b/apps/workbench/app/views/jobs/_show_status.html.erb
new file mode 100644
index 0000000..f3fab17
--- /dev/null
+++ b/apps/workbench/app/views/jobs/_show_status.html.erb
@@ -0,0 +1,86 @@
+
+<div class="pull-right">
+Re-run job using version:
+<%= form_tag '/jobs', style: "display:inline; padding-left: 1em" do |f| %>
+<% [:script, :script_version, :repository, :output_is_persistent, :supplied_script_version].each do |d| %>
+  <%= hidden_field :job, d, :value => @object[d] %>
+<% end %>
+<% [:script_parameters, :runtime_constraints].each do |d| %>
+  <%= hidden_field :job, d, :value => Oj.dump(@object[d]) %>
+<% end %>
+<%= button_tag "Same (#{@object.script_version.slice 0,8}...)", {class: 'btn btn-primary', id: "run-pipeline-button"} %>
+<% end %>
+
+<%= form_tag '/jobs', style: "display:inline" do |f| %>
+<% [:script, :repository, :output_is_persistent, :supplied_script_version].each do |d| %>
+  <%= hidden_field :job, d, :value => @object[d] %>
+<% end %>
+<%= hidden_field :job, :script_version, :value => @object[:supplied_script_version] %>
+<% [:script_parameters, :runtime_constraints].each do |d| %>
+  <%= hidden_field :job, d, :value => Oj.dump(@object[d]) %>
+<% end %>
+<%= button_tag "Latest (#{@object.supplied_script_version})", {class: 'btn btn-primary', id: "run-pipeline-button"} %>
+<% end %>
+</div>
+
+<table class="table pipeline-components-table">
+  <colgroup>
+    <col style="width: 20%" />
+    <col style="width: 24%" />
+    <col style="width: 12%" />
+    <col style="width: 45%" />
+  </colgroup>
+  <thead>
+    <tr><th>
+        script, version
+      </th><th>
+        progress
+        <%# format:'js' here helps browsers avoid using the cached js
+            content in html context (e.g., duplicate tab -> see
+                                     javascript) %>
+        <%= link_to '(refresh)', {format: :js}, {class: 'refresh hide', remote: true, method: 'get'} %>
+      </th>
+      <th></th>
+      <th>
+        output
+      </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>
+        <%= @object[:script] %><br>
+        <span class="deemphasize"><%= @object[:script_version] %></span>
+      </td>
+      <td>
+        <%= render partial: 'job_progress', locals: {:j => @object} %>
+        <% if @object.running == false %>
+          <% if @object[:job].andand[:uuid] %>
+            <span class="deemphasize">
+              <%= link_to("..."+ at object[:job][:uuid].last(15), job_url(id: @object[:job][:uuid])) %>
+            </span>
+
+            <% current_job = @object %>
+            <% if current_job.andand[:log] %>
+              <% fixup = /([a-f0-9]{32}\+\d+)(\+?.*)/.match(current_job[:log])%>
+              <% Collection.limit(1).where(uuid: fixup[1]).each do |c| %>
+                <% c.files.each do |file| %>
+                  <br/><span class="deemphasize">
+                    <a href="<%= collection_path(current_job[:log]) %>/<%= file[1] %>?disposition=inline&size=<%= file[2] %>">log</a>
+                  </span>
+                <% end %>
+              <% end %>
+            <% end %>
+          <% end %>
+        <% end %>
+      </td><td>
+        <%= render(partial: 'job_status_label',
+                   locals: { :j => @object }) %>
+      </td><td>
+        <%= link_to_if_arvados_object @object[:output], {:thumbnail => true} %>
+      </td>
+    </tr>
+    <tfoot>
+      <tr><td colspan="5"></td></tr>
+    </tfoot>
+</table>
diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index fbc5640..dc35398 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -39,6 +39,7 @@ class Job < ArvadosModel
     t.add :log_buffer
     t.add :nondeterministic
     t.add :repository
+    t.add :supplied_script_version
   end
 
   def assert_finished
@@ -88,6 +89,7 @@ class Job < ArvadosModel
     if new_record? or script_version_changed?
       sha1 = Commit.find_commit_range(current_user, self.repository, nil, self.script_version, nil)[0] rescue nil
       if sha1
+        self.supplied_script_version = self.script_version if self.supplied_script_version.nil? or self.supplied_script_version.empty?
         self.script_version = sha1
       else
         raise ArgumentError.new("Specified script_version does not resolve to a commit")
diff --git a/services/api/db/migrate/20140530200539_add_supplied_script_version.rb b/services/api/db/migrate/20140530200539_add_supplied_script_version.rb
new file mode 100644
index 0000000..c054235
--- /dev/null
+++ b/services/api/db/migrate/20140530200539_add_supplied_script_version.rb
@@ -0,0 +1,9 @@
+class AddSuppliedScriptVersion < ActiveRecord::Migration
+  def up
+    add_column :jobs, :supplied_script_version, :string
+  end
+
+  def down
+    remove_column :jobs, :supplied_script_version, :string
+  end
+end
diff --git a/services/api/db/schema.rb b/services/api/db/schema.rb
index 26f1bdc..d6be906 100644
--- a/services/api/db/schema.rb
+++ b/services/api/db/schema.rb
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20140527152921) do
+ActiveRecord::Schema.define(:version => 20140530200539) do
 
 
 
@@ -196,6 +196,7 @@ ActiveRecord::Schema.define(:version => 20140527152921) do
     t.boolean  "nondeterministic"
     t.string   "repository"
     t.boolean  "output_is_persistent",     :default => false, :null => false
+    t.string   "supplied_script_version"
   end
 
   add_index "jobs", ["created_at"], :name => "index_jobs_on_created_at"

commit 8ca3553c699e5fb2e026aa1ab0c0f20b6c43881f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri May 30 14:40:06 2014 -0400

    Pass PATH, PYTHONPATH and PERLLIB environment from crunch-dispatcher to
    crunch-job, this makes setting up a working crunch-dispatch much easier.

diff --git a/services/api/script/crunch-dispatch.rb b/services/api/script/crunch-dispatch.rb
index a9b7598..be0669b 100755
--- a/services/api/script/crunch-dispatch.rb
+++ b/services/api/script/crunch-dispatch.rb
@@ -136,7 +136,9 @@ class Dispatcher
       if Server::Application.config.crunch_job_user
         cmd_args.unshift("sudo", "-E", "-u",
                          Server::Application.config.crunch_job_user,
-                         "PERLLIB=#{ENV['PERLLIB']}")
+                         "PATH=#{ENV['PATH']}",
+                         "PERLLIB=#{ENV['PERLLIB']}",
+                         "PYTHONPATH=#{ENV['PYTHONPATH']}")
       end
 
       job_auth = ApiClientAuthorization.

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list