/** * @param string $content Text content or path to file in local file system * @param string $filePath * @return mixed * @throws \Exception */ public function writeToFile($content, $filePath) { if (is_file($content)) { return $this->exec('put', array($content, $filePath)); } if (!is_string($content) && method_exists($content, '__toString')) { $content = $content->__toString(); } if (is_string($content)) { return $this->shell->exec('printf "' . str_replace('"', '\\"', str_replace('\\', '\\\\', $content)) . '" | %hadoop% dfs -put', array('-', $filePath)); } throw new \Exception(sprintf('Invalid content type "%s"', is_object($content) ? get_class($content) : gettype($content))); }
/** * @return string */ private function getHadoopStreamingJarPath() { $streamingDirPath = "{$this->shell->getHadoopPath()}/contrib/streaming"; return $streamingDirPath . '/' . system("ls {$streamingDirPath} | grep \"hadoop-streaming.*\\.jar\""); }