NAME

Schedule::LongSteps::Process - A base class for all LongSteps processes.

state

Returns the current state (a HashRef JSONable data structure) of this process.

new_step

Returns a new step from the given properties.

Usage examples:

  # In a process class.
  sub do_current_step{
     my ($self) = @_;
     return $this->new_step({ run_at => DateTime->... , what => 'do_nextstep' , state => { new => 'state' } });
  }

If you omit run_at, the process will not run again and stay in paused state until you go and set the run_at time manually.

If you omit 'what', the next step to run will be the same as the current step.

If you omit 'state', the state just doesnt change.

final_step

Returns a final step that will never run from the given properies.

Usage:

    # In a Process class.
    sub do_last_thing{
       my ($self) = @_;
       return $self->final_step({ state => { the => 'final' , state => 1 } });
    }

If you omit 'state', the current state of the process just doesnt change and the process terminates with the current state.

wait_processes

Wait for the given process IDs and returns whatever the given closure returns.

Usage:

   return $this->wait_process(
            [ $pid1 , $pid2 ],
            sub{
                ...
                return $this->new_step(...); # or whatever usual stuff
            }

If you skip the closure, this will just terminate $this process after the given subprocesses have finished.

revival_methods

Returns an array-ref of revive methods associated with the process.