61 $replace_thunk_values =
false;
62 foreach ($values as $value) {
63 if (is_a($value, ThunkValue::class)) {
64 $value = $this->
executeTask($value->getParentTask(), $observer);
65 $replace_thunk_values =
true;
67 $final_values[] = $value;
70 if ($replace_thunk_values) {
74 if (is_a($task, Task\Job::class)) {
78 $value = $job->run($final_values, $observer);
79 if (!$value->getType()->isExtensionOf($job->getOutputType())) {
80 throw new Exception(
"The job " . $job->getType()
81 .
" did state to output a value of type "
82 . $job->getOutputType() .
" but outputted a value of type "
90 if (is_a($task, Task\UserInteraction::class)) {
92 $userInteraction = $task;
95 throw new UserInteractionRequiredException(
"User interaction required.");
98 throw new Exception(
"You need to execute a Job or a UserInteraction.");
122 $this->persistence->saveBucketAndItsTasks($bucket);
142 $this->persistence->deleteBucket($bucket);
152 $this->persistence->deleteBucket($bucket);
An exception for terminatinating execution or to throw for unit testing.
quitBucket(Bucket $bucket)
Quits and deletes a Bucket with all it's Jobs.
continueTask(Bucket $bucket, Option $option)
Continue a task with a given option.
run(Bucket $bucket)
This will add an Observer of the Task and start running the task.
__construct(Persistence $persistence)
Class NonPersistingObserver.
userInteraction(Option $option)
Let the user interact with the bucket task queue.
notifyPercentage(Task $task, $percentage)
You can change the progress of a currently running task.
notifyCurrentTask(Task $task)
If the current task changes notify the observer.
notifyState($state)
If the bucket goes into another state notify the observer.
executeTask(Task $task, Observer $observer)
Actually executes a task.