<commit_before>import React, { PropTypes } from 'react';
import { connect } from 'react-redux';

import { Link } from 'react-router';
import { Button } from 'react-bootstrap';

import Section from '../common/Section';

import Utils from '../../utils';

import UITable from '../common/table/UITable';
import {
  Health,
  InstanceNumberWithHostname,
  Host,
  LastTaskState,
  DeployId,
  UpdatedAt,
  StartedAt,
  RunId,
  LogLinkAndActions
} from '../tasks/Columns';

import { FetchTaskHistoryForRequest } from '../../actions/api/history';

import TaskStateBreakdown from './TaskStateBreakdown';

const ActiveTasksTable = ({request, requestId, tasksAPI, healthyTaskIds, cleaningTaskIds,loadBalancedTaskIds, fetchTaskHistoryForRequest}) => {
  const tasks = tasksAPI ? tasksAPI.data : [];
  const emptyTableMessage = (Utils.api.isFirstLoad(tasksAPI)
    ? <p>Loading...</p>
    : <p>No active tasks</p>
  );

  let maybeAggregateTailButton;
  if (tasks.length > 1) {
    maybeAggregateTailButton = (
      <Link to={`request/${requestId}/tail/${config.runningTaskLogPath}`}>
        <Button className="pull-right">
          View Aggregate Logs
        </Button>
      </Link>
    );
  }

  const tasksWithHealth = _.map(tasks, (task) => {
    let health;
    if (request.loadBalanced) {
      if (_.contains(healthyTaskIds, task.taskId.id)) {
        if (_.contains(loadBalancedTaskIds, task.taskId.id)) {
          health = 'healthy, in load balancer';
        } else {
          health = 'healthy, awaiting load balancer';
        }
      } else if (_.contains(cleaningTaskIds, task.taskId.id)) {
        if (_.contains(loadBalancedTaskIds, task.taskId.id)) {
          health = 'cleaning, in load balancer';
        } else {
          health = 'cleaning, removed from load balancer';
        }
      } else {
        health = 'not yet healthy'
      }
    } else {
      if (_.contains(healthyTaskIds, task.taskId.id)) {
        health = 'healthy';
      } else if (_.contains(cleaningTaskIds, task.taskId.id)) {
        health = 'cleaning';
      } else {
        health = 'not yet healthy'
      }
    }<commit_msg>this is a request parent object, not request<commit_after>import React, { PropTypes } from 'react';
import { connect } from 'react-redux';

import { Link } from 'react-router';
import { Button } from 'react-bootstrap';

import Section from '../common/Section';

import Utils from '../../utils';

import UITable from '../common/table/UITable';
import {
  Health,
  InstanceNumberWithHostname,
  Host,
  LastTaskState,
  DeployId,
  UpdatedAt,
  StartedAt,
  RunId,
  LogLinkAndActions
} from '../tasks/Columns';

import { FetchTaskHistoryForRequest } from '../../actions/api/history';

import TaskStateBreakdown from './TaskStateBreakdown';

const ActiveTasksTable = ({request, requestId, tasksAPI, healthyTaskIds, cleaningTaskIds,loadBalancedTaskIds, fetchTaskHistoryForRequest}) => {
  const tasks = tasksAPI ? tasksAPI.data : [];
  const emptyTableMessage = (Utils.api.isFirstLoad(tasksAPI)
    ? <p>Loading...</p>
    : <p>No active tasks</p>
  );

  let maybeAggregateTailButton;
  if (tasks.length > 1) {
    maybeAggregateTailButton = (
      <Link to={`request/${requestId}/tail/${config.runningTaskLogPath}`}>
        <Button className="pull-right">
          View Aggregate Logs
        </Button>
      </Link>
    );
  }

  const tasksWithHealth = _.map(tasks, (task) => {
    let health;
    if (request.request.loadBalanced) {
      if (_.contains(healthyTaskIds, task.taskId.id)) {
        if (_.contains(loadBalancedTaskIds, task.taskId.id)) {
          health = 'healthy, in load balancer';
        } else {
          health = 'healthy, awaiting load balancer';
        }
      } else if (_.contains(cleaningTaskIds, task.taskId.id)) {
        if (_.contains(loadBalancedTaskIds, task.taskId.id)) {
          health = 'cleaning, in load balancer';
        } else {
          health = 'cleaning, removed from load balancer';
        }
      } else {
        health = 'not yet healthy'
      }
    } else {
      if (_.contains(healthyTaskIds, task.taskId.id)) {
        health = 'healthy';
      } else if (_.contains(cleaningTaskIds, task.taskId.id)) {
        health = 'cleaning';
      } else {
        health = 'not yet healthy'
      }
    }
{'fraction_non_alphanumeric': 0.13548236393366037, 'fraction_numerical': 0.000467180565288484, 'mean_word_length': 2.7994676131322094, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, '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': '3435055', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1315, 'n_words': 305}