job_info = JSON.parse params['job_info']
@object = Job.new
+
@object.script = job_info['script']
@object.repository = job_info['repository']
@object.nondeterministic = job_info['nondeterministic']
@object.script_parameters = job_info['script_parameters']
@object.runtime_constraints = job_info['runtime_constraints']
+ @object.supplied_script_version = job_info['supplied_script_version']
- if params['use_script'] == 'latest'
+ if 'use_latest' == params['script']
@object.script_version = job_info['supplied_script_version']
else
@object.script_version = job_info['script_version']
<p> The inputs and parameters will be the same as the current job.
Thus, the new job will not reflect any changes made to the pipeline that initiated this job. </p>
<div style="padding-left: 1em">
- <%= radio_button_tag(:use_script, "latest", true) %>
- <%= label_tag(:script_use_latest, "Use latest script version") %>
- <p style="padding-left: 1em"> Use the current commit indicated by '<%=job_info['supplied_script_version']%>' in the '<%=job_info['repository']%>' repository.</p>
- <%= radio_button_tag(:use_script, "same") %>
+ <%= radio_button_tag(:script, "use_same", true) %>
<%= label_tag(:script_use_same, "Use same script version as this run") %>
<p style="padding-left: 1em"> Use the same script version as the current job.</p>
+ <% if !job_info['supplied_script_version'].nil? and
+ !job_info['supplied_script_version'].empty? and
+ job_info['supplied_script_version'] != job_info['script_version'] %>
+ <%= radio_button_tag(:script, "use_latest") %>
+ <%= label_tag(:script_use_latest, "Use latest script version") %>
+ <p style="padding-left: 1em"> Use the current commit indicated by '<%=job_info['supplied_script_version']%>' in the '<%=job_info['repository']%>' repository.</p>
+ <% end %>
+
<input type="hidden" name="job_info" value="<%=job_info.to_json%>">
</div>
</div>
<% if @object.state != "Running" %>
- <%= form_tag '/jobs', style: "display:inline; padding-left: 1em" do |f| %>
- <% [:script, :script_version, :repository, :supplied_script_version, :nondeterministic].each do |d| %>
- <%= hidden_field :job, d, :value => @object[d] %>
- <% end %>
- <% [:script_parameters, :runtime_constraints].each do |d| %>
- <%= hidden_field :job, d, :value => JSON.dump(@object[d]) %>
- <% end %>
- <%= button_tag ({class: 'btn btn-sm btn-primary', id: "re-run-same-job-button",
- title: 'Re-run job using the same script version as this run'}) do %>
- <i class="fa fa-fw fa-gear"></i> Re-run same version
- <% end %>
- <% end %>
- <% if @object.respond_to? :supplied_script_version and !@object.supplied_script_version.nil? and !@object.supplied_script_version.empty? and @object.script_version != @object.supplied_script_version%>
- <%= link_to rerun_job_with_options_popup_path(script: @object[:script],
- script_version: @object[:script_version],
- repository: @object[:repository],
- supplied_script_version: @object[:supplied_script_version],
- nondeterministic: @object[:nondeterministic],
- script_parameters: @object[:script_parameters],
- runtime_constraints: @object[:runtime_constraints]),
- {class: 'btn btn-sm btn-primary', :remote => true, 'data-toggle' => "modal",
- 'data-target' => '#rerun-job-with-options', return_to: request.url} do %>
- <i class="fa fa-fw fa-gear"></i> Re-run with options...
- <% end %>
+<%
+ supplied_script_version = @object[:supplied_script_version] if @object.respond_to? :supplied_script_version
+%>
+ <%= link_to rerun_job_with_options_popup_path(script: @object[:script],
+ script_version: @object[:script_version],
+ repository: @object[:repository],
+ supplied_script_version: supplied_script_version,
+ nondeterministic: @object[:nondeterministic],
+ script_parameters: @object[:script_parameters],
+ runtime_constraints: @object[:runtime_constraints]),
+ {class: 'btn btn-sm btn-primary', :remote => true, 'data-toggle' => "modal",
+ 'data-target' => '#rerun-job-with-options', return_to: request.url} do %>
+ <i class="fa fa-fw fa-gear"></i> Re-run job...
<% end %>
<% end %>
end
[
- ['foobar', false, false, false],
- ['job_with_latest_version', true, false, false],
- ['job_with_latest_version', true, true, false],
- ['job_with_latest_version', true, true, true],
- ].each do |job_name, expect_options, use_options, click_option|
+ ['foobar', false, false],
+ ['job_with_latest_version', true, false],
+ ['job_with_latest_version', true, true],
+ ].each do |job_name, expect_options, use_latest|
test "Rerun #{job_name} job, expect options #{expect_options},
- use options #{use_options} and click option #{click_option}" do
+ and use latest version option #{use_latest}" do
need_javascript
job = api_fixture('jobs')[job_name]
visit page_with_token 'active', '/jobs/'+job['uuid']
- assert_selector 'a,button', text: 'Re-run same version'
if expect_options
assert_text 'supplied_script_version: master'
- assert_selector 'a,button', text: 'Re-run with options'
else
assert_text 'supplied_script_version: (none)'
- assert_no_selector 'a,button', text: 'Re-run with options'
end
- # Now re-run the job
- if use_options
- assert_triggers_dom_event 'shown.bs.modal' do
- find('a,button', text: 'Re-run with options...').click
- end
- within('.modal-dialog') do
- assert_selector 'a,button', text: 'Run now'
- assert_selector 'a,button', text: 'Cancel'
- page.choose('use_script_same') if click_option
- find('button', text: 'Run now').click
- end
- else
- find('a,button', text: 'Re-run same version').click
+ assert_triggers_dom_event 'shown.bs.modal' do
+ find('a,button', text: 'Re-run job...').click
+ end
+ within('.modal-dialog') do
+ assert_selector 'a,button', text: 'Run now'
+ assert_selector 'a,button', text: 'Cancel'
+ page.choose('script_use_latest') if use_latest
+ find('button', text: 'Run now').click
end
- # We see Fiddlesticks, but let's make sure the correct script version is sought.
- if use_options && !click_option
+ # Re-run job does not actually work and we see Fiddlesticks.
+ # So, let's make sure the correct script version is sought.
+ if expect_options && use_latest
assert_text "Script version #{job['supplied_script_version']} does not resolve to a commit"
else
assert_text "Script version #{job['script_version']} does not resolve to a commit"
visit(page_with_token("admin", "/jobs/#{p.uuid}"))
assert_no_text 'complete'
- assert_no_text 'Re-run same version'
+ assert_no_text 'Re-run job'
p.state = "Complete"
p.save!
assert_text 'complete'
- assert_text 'Re-run same version'
+ assert_text 'Re-run job'
Thread.current[:arvados_api_token] = nil
end
cancelled_at: ~
cancelled_by_user_uuid: ~
cancelled_by_client_uuid: ~
+ script: hash
+ repository: foo
script_version: 7def43a4d3f20789dda4700f703b5514cc3ed250
script_parameters:
input: 1f4b0bc7583c2a7f9102c395f4ffc5e3+45