Class: BatchKit::Sequence::Run

Inherits:
Runnable
  • Object
show all
Defined in:
lib/batch-kit/framework/sequence_run.rb

Overview

Captures details of an execution of a task.

Instance Attribute Summary collapse

Attributes inherited from Runnable

#definition, #end_time, #exception, #exit_code, #instance, #lock_name, #lock_timeout, #lock_wait_timeout, #object, #start_time, #status

Instance Method Summary collapse

Methods inherited from Runnable

#abort, add_delegated_properties, #around_execute, #elapsed, #event_name, #failure, #label, #post_execute, #pre_execute, #success

Methods included from Lockable

#lock, #unlock, #with_lock

Constructor Details

#initialize(seq_def, job_object, *run_args) ⇒ Run

Create a new sequence run.

Parameters:

  • task_def (Sequence::Definition)

    The Sequence::Definition to which this run relates.

  • job_object (Object)

    The job object instance from which the sequence is being executed.

  • run_args (Array<Object>)

    An array of the argument values passed to the sequence method.

Raises:

  • (ArgumentError)


24
25
26
27
# File 'lib/batch-kit/framework/sequence_run.rb', line 24

def initialize(seq_def, job_object, *run_args)
    raise ArgumentError, "seq_def not a Sequence::Definition" unless seq_def.is_a?(Sequence::Definition)
    super(seq_def, job_object, run_args)
end

Instance Attribute Details

#sequence_run_idFixnum

Returns An integer identifier that uniquely identifies this task run.

Returns:

  • (Fixnum)

    An integer identifier that uniquely identifies this task run.



10
11
12
# File 'lib/batch-kit/framework/sequence_run.rb', line 10

def sequence_run_id
  @sequence_run_id
end

Instance Method Details

#persist?Boolean

Returns True if this sequence run should be persisted in any persistence layer.

Returns:

  • (Boolean)

    True if this sequence run should be persisted in any persistence layer.



32
33
34
# File 'lib/batch-kit/framework/sequence_run.rb', line 32

def persist?
    !definition.do_not_track
end

#to_sString

Returns A short representation of this Sequence::Run.

Returns:

  • (String)

    A short representation of this Sequence::Run.



38
39
40
# File 'lib/batch-kit/framework/sequence_run.rb', line 38

def to_s
    "<BatchKit::Sequence::Run label='#{label}'>"
end