47 return $this->user_id ?? 0;
57 $this->percentages[spl_object_hash($task)] =
$percentage;
58 $this->calculateOverallPercentage();
68 $this->current_task = $task;
74 $this->total_number_of_tasks = count($this->tasks);
75 $this->root_task = $task;
76 foreach ($this->tasks as $subTask) {
77 $this->percentages[spl_object_hash($subTask)] = 0;
84 public function calculateOverallPercentage():
void 90 foreach ($this->tasks as $task) {
91 if ($task instanceof
Task\
Job) {
96 $this->percentage = array_sum($this->percentages) / $countable_tasks;
116 return isset($this->current_task);
132 foreach ($this->
getTask()->unfoldTask() as $task) {
134 throw new Exception(
"Your task contains user interactions and thus needs a user that observes the task.");
150 throw new Exception(
"Cannot continue a task that is not in the state 'user interaction'");
154 throw new Exception(
"Observer is in an invalid state! state: userInteraction but current task is not a user interaction!");
158 $inputs = $currentTask->getInput();
159 $resulting_value = $currentTask->interaction(
$inputs, $option, $this);
161 if ($currentTask === $this->root_task) {
176 $tasks = $this->
getTask()->unfoldTask();
178 foreach ($tasks as $task) {
180 foreach ($task->getInput() as $input) {
182 $newInputs[] = $resulting_value;
184 $newInputs[] = $input;
187 $task->setInput($newInputs);
217 $this->last_heartbeat = $now->getTimestamp();
setCurrentTask(Task $task)
getLastHeartbeat()
When was the last time that something happened on this bucket?
setDescription(string $description)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOverallPercentage(int $percentage)
setPercentage(Task $task, int $percentage)
Used by a job to notify his percentage.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
int $total_number_of_tasks
setLastHeartbeat(int $timestamp)
userInteraction(Option $option)