You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by "sailingYang (JIRA)" <ji...@apache.org> on 2015/12/04 08:45:10 UTC

[jira] [Commented] (SAMZA-832) I hope Samza can upload job dist.tar to hdfs self

    [ https://issues.apache.org/jira/browse/SAMZA-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15041223#comment-15041223 ] 

sailingYang commented on SAMZA-832:
-----------------------------------

use this to copy it self!

private String upload(String appID, String localPath) throws IOException,
			URISyntaxException {
		FileSystem fs = FileSystem.get(this.conf);
		File f = new File(localPath);
		UserGroupInformation ugi = UserGroupInformation.getLoginUser();

		Path destDir = new Path(new Path(new Path("/user/"), new Path(
				ugi.getShortUserName())), new Path(new StringBuilder()
				.append("onlinestream/").append(appID).toString()));

		Path resultPath = null;
		Path srcPath = null;
		if ((!(f.exists())) || (!(f.isFile()))) {
			logger.info(new StringBuilder().append("Will find resource ")
					.append(localPath).append(" in jar package.").toString());
			resultPath = new Path(destDir, new Path(localPath));
			srcPath = new Path(OLSClient.class.getClassLoader()
					.getResource(localPath).toURI());
		} else {
			resultPath = new Path(destDir, new Path(f.getName()));
			srcPath = new Path(localPath);
		}

		fs.copyFromLocalFile(srcPath, resultPath);

		return resultPath.toUri().toString();
	}

> I hope Samza can upload job dist.tar to hdfs self
> -------------------------------------------------
>
>                 Key: SAMZA-832
>                 URL: https://issues.apache.org/jira/browse/SAMZA-832
>             Project: Samza
>          Issue Type: Wish
>    Affects Versions: 0.10.0
>            Reporter: sailingYang
>             Fix For: 0.10.0
>
>   Original Estimate: 504h
>  Remaining Estimate: 504h
>
> in every submit job  we must copy job jar to hdfs use below command ,I hope samza can do it self.
> $hadoop fs -put ./target/hello-samza-0.8.0-dist.tar.gz /path/for/tgz



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)