Skip to content

Added process-executor which uses a process to execute tasks #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 21, 2017

Conversation

wachterjohannes
Copy link
Member

@wachterjohannes wachterjohannes commented Aug 9, 2017

Main PR php-task/php-task#38

In addition to the adaptations required by the php-task PR this one adds the ProcessExecutor which uses the symfony/process component to run the tasks in isolation.

composer.json Outdated
@@ -11,7 +11,7 @@
],
"require": {
"php": "~5.5 || ~7.0",
"php-task/php-task": "^1.1",
"php-task/php-task": "dev-feature/handler-executor",
"symfony/http-kernel": "^2.6 || ^3.0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing "symfony/process"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

} catch (\Exception $e) {
$errOutput->writeln($e->__toString());

return 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment

->arrayNode('executor')
->addDefaultsIfNotSet()
->children()
->enumNode('type')->values(['inline', 'process'])->defaultValue('inline')->end()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inside, separate

->addDefaultsIfNotSet()
->children()
->enumNode('type')->values(['inline', 'process'])->defaultValue('inline')->end()
->arrayNode('process')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

separate

/**
* Exception wrapper which transports the serialized exception from console to the runner.
*/
class ProcessException extends \Exception

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SeparateProcessException

/**
* Uses a process to start the executions via console-command.
*/
class ProcessExecutor implements ExecutorInterface

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SeparateProcessExecutor

public function execute(TaskExecutionInterface $execution)
{
$process = ProcessBuilder::create(
[$this->consoleFile, 'task:execute', $execution->getUuid(), '-e ' . $this->environment]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error handing if console path not exits

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be done in the TaskExtension

*/
public function __construct($consoleFile, $environment)
{
$this->consoleFile = $consoleFile;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to $consolePath

*
* @return string
*/
private function extractResult($output)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove method

@wachterjohannes wachterjohannes force-pushed the feature/process-executor branch from 3b9deda to a2a3c00 Compare August 14, 2017 05:53
@wachterjohannes
Copy link
Member Author

@chirimoya fixed

@chirimoya chirimoya merged commit cfc46bb into master Aug 21, 2017
@wachterjohannes wachterjohannes deleted the feature/process-executor branch August 21, 2017 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants