public class HDFSFunctions extends Object
Constructor | Description |
---|---|
HDFSFunctions(Map<String,org.apache.hyracks.api.client.NodeControllerInfo> nodeControllerInfos,
String hdfsConf) |
Create the configuration and add the paths for core-site and hdfs-site as resources.
|
Modifier and Type | Method | Description |
---|---|---|
void |
addScheduleToDistributedCache() |
Writes the schedule to a temporary file, then uploads the file to the HDFS.
|
Document |
convertStringToDocument(String xmlStr) |
|
org.apache.hadoop.fs.FileSystem |
getFileSystem() |
Get instance of the HDFSfile system if it is configured correctly.
|
org.apache.hadoop.mapreduce.InputFormat |
getinputFormat() |
|
org.apache.hadoop.mapreduce.Job |
getJob() |
|
HashMap<String,ArrayList<Integer>> |
getLocationsOfSplits() |
Create a HashMap that has as key the hostname and values the splits that belong to this hostname;
|
org.apache.hadoop.mapreduce.RecordReader |
getReader() |
|
HashMap<Integer,String> |
getSchedule() |
|
ArrayList<Integer> |
getScheduleForNode(String node) |
Return the splits belonging to this node for the existing schedule.
|
List<org.apache.hadoop.mapreduce.InputSplit> |
getSplits() |
|
boolean |
isLocatedInHDFS(String filename) |
Returns true if the file path exists or it is located somewhere in the home directory of the user that called the function.
|
boolean |
put(String filepath,
String dir) |
Upload a file/directory to HDFS.Filepath is the path in the local file system.dir is the destination path.
|
void |
readNodesFromXML() |
Read the hostname and the ip address of every node from the xml cluster configuration file.
|
void |
scheduleSplits() |
|
org.apache.hadoop.fs.Path |
searchInDirectory(org.apache.hadoop.fs.Path directory,
String filename) |
Searches the given directory for the file.
|
void |
setJob(String filepath,
String tag) |
Create the needed objects for reading the splits of the filepath given as argument.
|
protected static final Logger LOGGER
public HDFSFunctions(Map<String,org.apache.hyracks.api.client.NodeControllerInfo> nodeControllerInfos, String hdfsConf)
nodeControllerInfos
- hdfsConf
- public void setJob(String filepath, String tag)
filepath
- public boolean isLocatedInHDFS(String filename) throws IllegalArgumentException, IOException
filename
- IOException
IllegalArgumentException
public org.apache.hadoop.fs.Path searchInDirectory(org.apache.hadoop.fs.Path directory, String filename)
directory
- to searchfilename
- of file we wantpublic boolean put(String filepath, String dir)
filepath
- dir
- public org.apache.hadoop.fs.FileSystem getFileSystem()
public HashMap<String,ArrayList<Integer>> getLocationsOfSplits() throws IOException
IOException
public void scheduleSplits() throws IOException, ParserConfigurationException, SAXException
public void readNodesFromXML() throws ParserConfigurationException, SAXException, IOException
public void addScheduleToDistributedCache() throws FileNotFoundException, UnsupportedEncodingException
public org.apache.hadoop.mapreduce.RecordReader getReader()
public ArrayList<Integer> getScheduleForNode(String node)
node
- public List<org.apache.hadoop.mapreduce.InputSplit> getSplits()
public org.apache.hadoop.mapreduce.Job getJob()
public org.apache.hadoop.mapreduce.InputFormat getinputFormat()
Copyright © 2019 Apache Software Foundation. All rights reserved.