/**
  * Funkce pro definování úlohy na základě dat z EasyMineru
  * @return TaskState
  * @throws \Exception
  */
 public function startMining()
 {
     #region kontrola zadání úlohy v JSONu
     $taskSettingsJson = new TaskSettingsJson($this->task->taskSettingsJson);
     $this->checkRequiredIMs($taskSettingsJson);
     $this->task->setTaskSettings($taskSettingsJson->getJsonData());
     #endregion
     //serializace zadání v PMML
     $cloudDriverGuhaPmmlSerializer = $this->xmlSerializersFactory->createCloudDriverGuhaPmmlSerializer($this->task);
     $cloudDriverGuhaPmmlSerializer->appendTaskSettings();
     $pmml = $cloudDriverGuhaPmmlSerializer->getPmml();
     //import úlohy a spuštění dolování...
     $numRequests = 1;
     sendStartRequest:
     try {
         #region pracovní zjednodušený request
         $response = self::curlRequestResponse($this->getRemoteMinerUrl() . '/mine', $pmml->asXML(), $this->getApiKey(), $responseCode);
         $taskState = $this->parseResponse($response, $responseCode);
         #endregion
     } catch (\Exception $e) {
         if (++$numRequests < self::MAX_MINING_REQUESTS) {
             sleep(self::REQUEST_DELAY);
             goto sendStartRequest;
         }
     }
     if (!empty($taskState)) {
         return $taskState;
     } else {
         throw new \Exception('Task import failed!');
     }
 }