77 $this->userId = $user_id;
91 $this->percentages[spl_object_hash($task)] =
$percentage;
92 $this->calculateOverallPercentage();
109 $this->currentTask = $task;
121 $this->totalNumberOfTasks = count($this->tasks);
122 $this->rootTask = $task;
123 foreach ($this->tasks as $subTask) {
124 $this->percentages[spl_object_hash($subTask)] = 0;
134 public function calculateOverallPercentage()
136 $countable_tasks = 0;
140 foreach ($this->tasks as $task) {
142 case ($task instanceof
Task\
Job):
148 $this->percentage = array_sum($this->percentages) / $countable_tasks;
202 foreach ($this->
getTask()->unfoldTask() as $task) {
204 throw new Exception(
"Your task contains user interactions and thus needs a user that observes the task.");
226 throw new Exception(
"Cannot continue a task that is not in the state 'user interaction'");
230 throw new Exception(
"Observer is in an invalid state! state: userInteraction but current task is not a user interaction!");
235 $resulting_value =
$currentTask->interaction($inputs, $option, $this);
258 foreach (
$tasks as $task) {
260 foreach ($task->getInput() as $input) {
262 $newInputs[] = $resulting_value;
264 $newInputs[] = $input;
267 $task->setInput($newInputs);
315 $timezone_identifier = ini_get(
'date.timezone');
316 date_default_timezone_set($timezone_identifier ? $timezone_identifier :
'UTC');
317 $now = new \DateTime();
318 $this->lastHeartbeat = $now->getTimestamp();
setPercentage(Task $task, $percentage)
Used by a job to notify his percentage.
getLastHeartbeat()
When was the last time that something happened on this bucket?
setDescription($description)
setOverallPercentage($percentage)
foreach($mandatory_scripts as $file) $timestamp
heartbeat()
There was something going on in the bucket, it's still working.
replaceThunkValue(Task $currentTask, Value $resulting_value)
In the structure of the task of this bucket the result of $currentTask is replaced with the $resultin...
setLastHeartbeat($timestamp)
userInteraction(Option $option)
Continue a task with a given option.