Merge pull request #978 from flowbehappy/issue-977

fix issue #977
This commit is contained in:
Fangjin Yang 2014-12-29 15:24:39 -08:00
commit 1fda1c19a1
2 changed files with 5 additions and 4 deletions

View File

@ -56,7 +56,7 @@ public class HdfsTaskLogs implements TaskLogs
final Path path = getTaskLogFileFromId(taskId);
log.info("Writing task log to: %s", path);
Configuration conf = new Configuration();
final FileSystem fs = FileSystem.get(conf);
final FileSystem fs = path.getFileSystem(conf);
FileUtil.copy(logFile, fs, path, false, conf);
log.info("Wrote task log to: %s", path);
}
@ -65,7 +65,7 @@ public class HdfsTaskLogs implements TaskLogs
public Optional<ByteSource> streamTaskLog(final String taskId, final long offset) throws IOException
{
final Path path = getTaskLogFileFromId(taskId);
final FileSystem fs = FileSystem.get(new Configuration());
final FileSystem fs = path.getFileSystem(new Configuration());
if (fs.exists(path)) {
return Optional.<ByteSource>of(
new ByteSource()

View File

@ -18,6 +18,7 @@
*/
package io.druid.storage.hdfs.tasklog;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.validation.constraints.NotNull;
@ -27,12 +28,12 @@ import javax.validation.constraints.NotNull;
*/
public class HdfsTaskLogsConfig
{
@JsonProperty
@NotNull
private String directory;
public HdfsTaskLogsConfig(String directory)
@JsonCreator
public HdfsTaskLogsConfig(@JsonProperty("directory") String directory)
{
this.directory = directory;
}