Class: OodCore::Job::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/ood_core/job/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, status:, wallclock_time: nil, **_) ⇒ Task

Returns a new instance of Task.



6
7
8
9
10
# File 'lib/ood_core/job/task.rb', line 6

def initialize(id:, status:, wallclock_time: nil, **_)
  @id = id.to_s
  @status = OodCore::Job::Status.new(state: status)
  @wallclock_time = wallclock_time && wallclock_time.to_i
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/ood_core/job/task.rb', line 4

def id
  @id
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/ood_core/job/task.rb', line 4

def status
  @status
end

#wallclock_timeObject (readonly)

Returns the value of attribute wallclock_time.



4
5
6
# File 'lib/ood_core/job/task.rb', line 4

def wallclock_time
  @wallclock_time
end

Instance Method Details

#==(other) ⇒ Object



20
21
22
# File 'lib/ood_core/job/task.rb', line 20

def ==(other)
  self.to_h == other.to_h
end

#to_hObject



12
13
14
15
16
17
18
# File 'lib/ood_core/job/task.rb', line 12

def to_h
  {
    :id => id,
    :status => status,
    :wallclock_time => wallclock_time
  }
end