-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing "symfony/process"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/Command/ExecuteCommand.php
Outdated
} catch (\Exception $e) { | ||
$errOutput->writeln($e->__toString()); | ||
|
||
return 1; |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separate
src/Executor/ProcessException.php
Outdated
/** | ||
* Exception wrapper which transports the serialized exception from console to the runner. | ||
*/ | ||
class ProcessException extends \Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SeparateProcessException
src/Executor/ProcessExecutor.php
Outdated
/** | ||
* Uses a process to start the executions via console-command. | ||
*/ | ||
class ProcessExecutor implements ExecutorInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SeparateProcessExecutor
src/Executor/ProcessExecutor.php
Outdated
public function execute(TaskExecutionInterface $execution) | ||
{ | ||
$process = ProcessBuilder::create( | ||
[$this->consoleFile, 'task:execute', $execution->getUuid(), '-e ' . $this->environment] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
src/Executor/ProcessExecutor.php
Outdated
*/ | ||
public function __construct($consoleFile, $environment) | ||
{ | ||
$this->consoleFile = $consoleFile; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to $consolePath
src/Executor/ProcessExecutor.php
Outdated
* | ||
* @return string | ||
*/ | ||
private function extractResult($output) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove method
3b9deda
to
a2a3c00
Compare
@chirimoya fixed |
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 thesymfony/process
component to run the tasks in isolation.