<commit_before><?php

namespace Akeneo\Bundle\BatchBundle\Manager;

use Akeneo\Bundle\BatchBundle\Entity\JobExecution;
use Symfony\Component\Process\Process;
use Doctrine\ORM\EntityManager;
use Akeneo\Bundle\BatchBundle\Job\BatchStatus;
use Akeneo\Bundle\BatchBundle\Job\ExitStatus;

/**
 * Job execution manager
 *
 * @author    <NAME> <<EMAIL>>
 * @copyright 2014 Akeneo SAS (http://www.akeneo.com)
 * @license   http://opensource.org/licenses/MIT MIT
 */
class JobExecutionManager
{
    /**
     * @var EntityManager
     */
    protected $entityManager;

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

    /**
     * @param EntityManager $entityManager
     * @param string        $jobExecutionClass
     */
    public function __construct(EntityManager $entityManager, $jobExecutionClass)
    {
        $this->entityManager     = $entityManager;
        $this->jobExecutionClass = $jobExecutionClass;
    }

    /**
     * CHeck if the given JoExecution is still running using his PID
     * @param JobExecution $jobExecution
     *
     * @return bool
     */
    public function checkRunningStatus(JobExecution $jobExecution)
    {
        if (ExitStatus::UNKNOWN === $jobExecution->getExitStatus()->getValue()) {
            return $this->processIsRunning($jobExecution);
        } else {
            return true;
        }

    }

    /**
     * Test if the process is still running
     * @param JobExecution $jobExecution
     *
     * @return bool
     */
    protected function processIsRunning(JobExecution $jobExecution)
    {
        if (($pid = intval($jobExecution->getPid())) > 0) {
            exec(sprintf('ps -p %s', $pid), $output, $returnCode);
        } else {
            throw new \InvalidArgumentException('The job execution PID is not valid');
        }
<commit_msg>fix bug<commit_after><?php

namespace Akeneo\Bundle\BatchBundle\Manager;

use Akeneo\Bundle\BatchBundle\Entity\JobExecution;
use Symfony\Component\Process\Process;
use Doctrine\ORM\EntityManager;
use Akeneo\Bundle\BatchBundle\Job\BatchStatus;
use Akeneo\Bundle\BatchBundle\Job\ExitStatus;

/**
 * Job execution manager
 *
 * @author    <NAME> <<EMAIL>>
 * @copyright 2014 Akeneo SAS (http://www.akeneo.com)
 * @license   http://opensource.org/licenses/MIT MIT
 */
class JobExecutionManager
{
    /**
     * @var EntityManager
     */
    protected $entityManager;

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

    /**
     * @param EntityManager $entityManager
     * @param string        $jobExecutionClass
     */
    public function __construct(EntityManager $entityManager, $jobExecutionClass)
    {
        $this->entityManager     = $entityManager;
        $this->jobExecutionClass = $jobExecutionClass;
    }

    /**
     * CHeck if the given JoExecution is still running using his PID
     * @param JobExecution $jobExecution
     *
     * @return bool
     */
    public function checkRunningStatus(JobExecution $jobExecution)
    {
        if (ExitStatus::UNKNOWN === $jobExecution->getExitStatus()->getExitCode()) {
            return $this->processIsRunning($jobExecution);
        } else {
            return true;
        }
    }

    /**
     * Test if the process is still running
     * @param JobExecution $jobExecution
     *
     * @return bool
     */
    protected function processIsRunning(JobExecution $jobExecution)
    {
        if (($pid = intval($jobExecution->getPid())) > 0) {
            exec(sprintf('ps -p %s', $pid), $output, $returnCode);
        } else {
            throw new \InvalidArgumentException('The job execution PID is not valid');
        }

{'fraction_non_alphanumeric': 0.11674008810572688, 'fraction_numerical': 0.0027533039647577094, 'mean_word_length': 2.629370629370629, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '947415', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1025, 'n_words': 233}