<commit_before><?php

namespace Inowas\ModflowBundle\Command;

use Inowas\ModflowBundle\Exception\InvalidArgumentException;
use Inowas\ModflowBundle\Model\Calculation;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\ProcessBuilder;

class ModflowModelCalculateCommand extends ContainerAwareCommand
{

    protected function configure()
    {
        // Name and description for app/console command
        $this
            ->setName('inowas:model:calculate')
            ->setDescription('Calculate ModflowModel by Calculation Id')
            ->addArgument(
                'id',
                InputArgument::REQUIRED,
                'The Calculation-Id'
            )
            ->addOption(
                'async',
                'a',
                InputOption::VALUE_OPTIONAL,
                'Start a asynchronous Job.',
                false
            )
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $id = $input->getArgument('id');
        $cm = $this->getContainer()->get('inowas.modflow.calculationmanager');
        $calculation = $cm->findById($id);

        if (! $calculation instanceof Calculation) {
            throw new InvalidArgumentException(sprintf('There is no calculation with ID=%s', $id));
        }

        $flopy = $this->getContainer()->get('inowas.flopy');

        $output->writeln(sprintf("Calculating model id: %s", $calculation->getModelId()));<commit_msg>Update ModflowModelCalculateCommand<commit_after><?php

namespace Inowas\ModflowBundle\Command;

use Inowas\ModflowBundle\Exception\InvalidArgumentException;
use Inowas\ModflowBundle\Model\Calculation;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\ProcessBuilder;

class ModflowModelCalculateCommand extends ContainerAwareCommand
{

    protected function configure()
    {
        // Name and description for app/console command
        $this
            ->setName('inowas:model:calculate')
            ->setDescription('Calculate ModflowModel by CalculationId or ModelId')
            ->addArgument(
                'id',
                InputArgument::REQUIRED,
                'The CalculationId or ModelId'
            )
            ->addOption(
                'async',
                'a',
                InputOption::VALUE_OPTIONAL,
                'Start a asynchronous Job.',
                false
            )
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $id = $input->getArgument('id');
        $cm = $this->getContainer()->get('inowas.modflow.calculationmanager');
        $calculation = $cm->findById($id);

        if (! $calculation instanceof Calculation) {
            $calculation = $cm->findByModelId($id);
        }

        if (! $calculation instanceof Calculation) {
            throw new InvalidArgumentException(sprintf('There is no calculation with ID=%s', $id));
        }

        $flopy = $this->getContainer()->get('inowas.flopy');

        $output->writeln(sprintf("Calculating model id: %s", $calculation->getModelId()));
{'fraction_non_alphanumeric': 0.10956618464961068, 'fraction_numerical': 0.0, 'mean_word_length': 2.6554878048780486, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '1792282', 'n_tokens_mistral': 977, 'n_tokens_neox': 925, 'n_words': 179}