1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class Job < ArvadosBase
6 def self.goes_in_projects?
14 def editable_attributes
20 x = "\"#{script}\" job"
25 x += " finished #{finished_at.strftime('%b %-d')}"
27 x += " started #{started_at.strftime('%b %-d')}"
29 x += " submitted #{created_at.strftime('%b %-d')}"
34 arvados_api_client.api "jobs/#{self.uuid}/", "cancel", {"cascade" => true}
38 arvados_api_client.api("jobs/", "queue_size", {"_method"=> "GET"})[:queue_size] rescue 0
42 arvados_api_client.unpack_api_response arvados_api_client.api("jobs/", "queue", {"_method"=> "GET"})
45 def textile_attributes
49 def stderr_log_query(limit=nil)
50 query = Log.where(object_uuid: self.uuid).order("created_at DESC").with_count('none')
51 query = query.limit(limit) if limit
55 def stderr_log_lines(limit=2000)
56 stderr_log_query(limit).results.reverse.
57 flat_map { |log| log.properties[:text].split("\n") rescue [] }
60 def work_unit(label=nil)
61 JobWorkUnit.new(self, label, self.uuid)