<commit_before><?php

namespace mbaynton\BatchFramework;


class TaskInstanceState implements TaskInstanceStateInterface {
  /**
   * @var int $task_id
   */
  protected $task_id;

  protected $runner_ids = NULL;

  /**
   * @var string $session_id
   */
  protected $session_id;

  /**
   * @var int $num_runnables
   */
  protected $num_runnables;

  /**
   * @var int $num_runnables_delta;
   */
  protected $num_runnables_delta;

  /**
   * @var bool $has_updates
   */
  protected $has_updates;

  /**
   * TaskState constructor.
   *
   * @param TaskInterface $task
   * @param int $task_id
   * @param int[] $runner_ids
   * @param string $session_id
   * @param int $num_runnables_estimate
   */
  public function __construct(TaskInterface $task, $task_id, $runner_ids, $session_id, $num_runnables_estimate) {
    $this->task_id = $task_id;
    if ($task->getMaxRunners($this) > 0) {
      $this->runner_ids = array_splice($runner_ids, 0, $task->getMaxRunners($this));
    } else {
      $this->runner_ids = $runner_ids;
    }
    $this->session_id = $session_id;
    $this->num_runnables = $num_runnables_estimate;
    $this->num_runnables_delta = 0;
    $this->has_updates = FALSE;
  }

  public function getNumRunners() {
    return count($this->runner_ids);
  }

  public function getRunnerIds() {
    return $this->runner_ids;<commit_msg>Beginning of adjustments to how number of runners and runner ids are set in task instance state. Removing them from the ctor, they need not be known by the code that sets up the task. This will temporarily break tests.<commit_after><?php

namespace mbaynton\BatchFramework;


class TaskInstanceState implements TaskInstanceStateInterface {
  /**
   * @var int $task_id
   */
  protected $task_id;

  protected $runner_ids = NULL;

  /**
   * @var string $session_id
   */
  protected $session_id;

  /**
   * @var int $num_runnables
   */
  protected $num_runnables;

  /**
   * @var int $num_runnables_delta;
   */
  protected $num_runnables_delta;

  /**
   * @var bool $has_updates
   */
  protected $has_updates;

  /**
   * TaskState constructor.
   *
   * @param int $task_id
   * @param string $session_id
   * @param int $num_runnables_estimate
   * @param int $max_runners
   */
  public function __construct($task_id, $session_id, $num_runnables_estimate) {
    $this->task_id = $task_id;

    $this->session_id = $session_id;
    $this->num_runnables = $num_runnables_estimate;
    $this->num_runnables_delta = 0;
    $this->has_updates = FALSE;
  }

  public function getNumRunners() {
    return count($this->runner_ids);
  }

  public function getRunnerIds() {
    return $this->runner_ids;
{'fraction_non_alphanumeric': 0.12052730696798493, 'fraction_numerical': 0.0015065913370998117, 'mean_word_length': 3.3900826446280994, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3483844', 'n_tokens_mistral': 936, 'n_tokens_neox': 907, 'n_words': 202}