public function run() {

        $options = $this->analyser->get_options();

        // Time limit control.
        $modeltimelimit = intval(get_config('analytics', 'modeltimelimit'));

        if ($this->includetarget) {
            $action = 'training';
        } else {
            $action = 'prediction';
        }
        $analysables = $this->analyser->get_analysables_iterator($action);

        $processedanalysables = $this->get_processed_analysables();

        $inittime = microtime(true);
        foreach ($analysables as $analysable) {
            $processed = false;

            if (!$analysable) {
                continue;
            }

            $analysableresults = $this->process_analysable($analysable);
            if ($analysableresults) {
                $processed = $this->result->add_analysable_results($analysableresults);
                if (!$processed) {
                    $errors = array();
                    foreach ($analysableresults as $timesplittingid => $result) {
                        $str = '';
                        if (count($analysableresults) > 1) {
                            $str .= $timesplittingid . ': ';
                        }
                        $str .= $result->message;
                        $errors[] = $str;
                    }

                    $a = new \stdClass();
                    $a->analysableid = $analysable->get_name();
                    $a->errors = implode(', ', $errors);
                    $this->analyser->add_log(get_string('analysablenotused', 'analytics', $a));
                }
            }

            if (!$options['evaluation']) {

                if (empty($processedanalysables[$analysable->get_id()]) ||
                        $this->analyser->get_target()->always_update_analysis_time() || $processed) {
                    // We store the list of processed analysables even if the target does not always_update_analysis_time(),
                    // what always_update_analysis_time controls is the update of the data.
                    $this->update_analysable_analysed_time($processedanalysables, $analysable->get_id());
                }

                // Apply time limit.
                $timespent = microtime(true) - $inittime;
                if ($modeltimelimit <= $timespent) {
                    break;
                }
            }
        }
    }