projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2934: add "bar" repository to test fixture
[arvados.git]
/
services
/
api
/
app
/
models
/
job.rb
diff --git
a/services/api/app/models/job.rb
b/services/api/app/models/job.rb
index 21414e2f04d1a827851c2674f426f4bdd20893ef..51fb7c27832a21eec4193886e720d1c2c3363e23 100644
(file)
--- a/
services/api/app/models/job.rb
+++ b/
services/api/app/models/job.rb
@@
-1,5
+1,5
@@
class Job < ArvadosModel
class Job < ArvadosModel
- include
Assign
Uuid
+ include
Has
Uuid
include KindAndEtag
include CommonApiTemplate
serialize :script_parameters, Hash
include KindAndEtag
include CommonApiTemplate
serialize :script_parameters, Hash
@@
-27,6
+27,7
@@
class Job < ArvadosModel
t.add :started_at
t.add :finished_at
t.add :output
t.add :started_at
t.add :finished_at
t.add :output
+ t.add :output_is_persistent
t.add :success
t.add :running
t.add :is_locked_by_uuid
t.add :success
t.add :running
t.add :is_locked_by_uuid
@@
-34,9
+35,9
@@
class Job < ArvadosModel
t.add :runtime_constraints
t.add :tasks_summary
t.add :dependencies
t.add :runtime_constraints
t.add :tasks_summary
t.add :dependencies
- t.add :log_stream_href
- t.add :log_buffer
t.add :nondeterministic
t.add :nondeterministic
+ t.add :repository
+ t.add :supplied_script_version
end
def assert_finished
end
def assert_finished
@@
-45,12
+46,6
@@
class Job < ArvadosModel
running: false)
end
running: false)
end
- def log_stream_href
- unless self.finished_at
- "#{current_api_base}/#{self.class.to_s.pluralize.underscore}/#{self.uuid}/log_tail_follow"
- end
- end
-
def self.queue
self.where('started_at is ? and is_locked_by_uuid is ? and cancelled_at is ? and success is ?',
nil, nil, nil, nil).
def self.queue
self.where('started_at is ? and is_locked_by_uuid is ? and cancelled_at is ? and success is ?',
nil, nil, nil, nil).
@@
-68,6
+63,14
@@
class Job < ArvadosModel
super + %w(output log)
end
super + %w(output log)
end
+ def skip_uuid_read_permission_check
+ super + %w(cancelled_by_client_uuid)
+ end
+
+ def skip_uuid_existence_check
+ super + %w(output log)
+ end
+
def ensure_script_version_is_commit
if self.is_locked_by_uuid and self.started_at
# Apparently client has already decided to go for it. This is
def ensure_script_version_is_commit
if self.is_locked_by_uuid and self.started_at
# Apparently client has already decided to go for it. This is
@@
-76,8
+79,9
@@
class Job < ArvadosModel
return true
end
if new_record? or script_version_changed?
return true
end
if new_record? or script_version_changed?
- sha1 = Commit.find_commit_range(current_user,
nil, nil, self.script_version
)[0] rescue nil
+ sha1 = Commit.find_commit_range(current_user,
self.repository, nil, self.script_version, nil
)[0] rescue nil
if sha1
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")
self.script_version = sha1
else
raise ArgumentError.new("Specified script_version does not resolve to a commit")
@@
-177,15
+181,4
@@
class Job < ArvadosModel
end
end
end
end
end
end
-
- def log_buffer
- begin
- @@redis ||= Redis.new(:timeout => 0)
- if @@redis.exists uuid
- @@redis.getrange(uuid, 0 - 2**10, -1)
- end
- rescue Redis::CannotConnectError
- return '(not available)'
- end
- end
end
end