X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1d135e43d06148b100fbc8534144b405e4824af9..34a7e1ea48470ba540bc7d18de4836b0bb9197f8:/apps/workbench/app/models/job.rb diff --git a/apps/workbench/app/models/job.rb b/apps/workbench/app/models/job.rb index f933c07701..c59bb89fe8 100644 --- a/apps/workbench/app/models/job.rb +++ b/apps/workbench/app/models/job.rb @@ -7,12 +7,8 @@ class Job < ArvadosBase "#{script} job" end - def attribute_editable? attr, *args - if attr.to_sym == :description - super && attr.to_sym == :description - else - false - end + def editable_attributes + %w(description) end def self.creatable? @@ -42,33 +38,10 @@ class Job < ArvadosBase arvados_api_client.api("jobs/", "queue_size", {"_method"=> "GET"})[:queue_size] rescue 0 end - def self.queue + def self.queue arvados_api_client.unpack_api_response arvados_api_client.api("jobs/", "queue", {"_method"=> "GET"}) end - # The 'job' parameter can be either a Job model object, or a hash containing - # the same fields as a Job object (such as the :job entry of a pipeline - # component). - def self.state job - # This has a valid state method on it so call that - if job.respond_to? :state and job.state - return job.state - end - - # Figure out the state based on the other fields. - if job[:cancelled_at] - "Cancelled" - elsif job[:success] == false - "Failed" - elsif job[:success] == true - "Complete" - elsif job[:running] == true - "Running" - else - "Queued" - end - end - def textile_attributes [ 'description' ] end