incomplete_job = nil
@objects.each do |j|
if j.nondeterministic != true and
- ((j.success == true and j.output != nil) or j.running == true) and
+ ["Queued", "Running", "Complete"].include?(j.state) and
j.script_parameters == resource_attrs[:script_parameters]
- if j.running && j.owner_uuid == current_user.uuid
+ if j.state != "Complete" && j.owner_uuid == current_user.uuid
# We'll use this if we don't find a job that has completed
incomplete_job ||= j
else
def cancel
reload_object_before_update
- @object.update_attributes! cancelled_at: Time.now
+ @object.update_attributes! state: Job::Cancelled
+ show
+ end
+
+ def lock
+ @object.lock current_user.uuid
show
end