taskError() public method

Print error.
public taskError ( boolean $nonFatal = true )
$nonFatal boolean
示例#1
0
 /**
  * {@inheritdoc}
  */
 public function run($tasks, $servers, $environments, $input, $output)
 {
     $output = new OutputWatcher($output);
     $informer = new Informer($output);
     foreach ($tasks as $task) {
         $success = true;
         $informer->startTask($task->getName());
         if ($task->isOnce()) {
             $task->run(new Context(null, null, $input, $output));
         } else {
             foreach ($servers as $serverName => $server) {
                 if ($task->runOnServer($serverName)) {
                     $env = isset($environments[$serverName]) ? $environments[$serverName] : ($environments[$serverName] = new Environment());
                     $informer->onServer($serverName);
                     try {
                         $task->run(new Context($server, $env, $input, $output));
                     } catch (NonFatalException $exception) {
                         $success = false;
                         $informer->taskException($serverName, 'Deployer\\Task\\NonFatalException', $exception->getMessage());
                     }
                     $informer->endOnServer($serverName);
                 }
             }
         }
         if ($success) {
             $informer->endTask();
         } else {
             $informer->taskError();
         }
     }
 }
示例#2
0
 public function testTaskErrorNonFatat()
 {
     $output = $this->getMockBuilder('Deployer\\Console\\Output\\OutputWatcher')->disableOriginalConstructor()->setMethods(['writeln', 'getVerbosity'])->getMock();
     $output->expects($this->once())->method('writeln')->with($this->equalTo('<fg=yellow>✘</fg=yellow> Some errors occurred!'));
     $informer = new Informer($output);
     $informer->taskError(true);
 }
示例#3
0
 /**
  * While idle master, print information about finished tasks.
  */
 public function idle()
 {
     if ($this->wait) {
         $taskToDoStorage = $this->pure->getStorage('tasks_to_do');
         foreach ($this->tasksToDo as $serverName => $taskName) {
             if (!$taskToDoStorage->has($serverName)) {
                 $this->informer->endOnServer($serverName);
                 unset($this->tasksToDo[$serverName]);
             }
         }
         if (count($taskToDoStorage) === 0) {
             if ($this->isSuccessfullyFinished) {
                 $this->informer->endTask();
             } else {
                 $this->informer->taskError($this->hasNonFatalException);
             }
             // We waited all workers to finish their tasks.
             // Wait no more!
             $this->wait = false;
             if ($this->isSuccessfullyFinished || $this->hasNonFatalException) {
                 // Reset to default for next tasks.
                 $this->isSuccessfullyFinished = true;
             }
         }
     }
 }