public class HadoopPlugin extends Object implements ApplicationSetup.TerrierApplicationPlugin
HadoopPlugin.JobFactory jf = HadoopPlugin.getJobFactory("HOD-TerrierIndexing"); if (jf == null) throw new Exception("Could not get JobFactory from HadoopPlugin"); JobConf conf = jf.newJob(); .... jf.close(); //closing the JobFactory will ensure that the HOD session endsWhen using your own code in Terrier MapReduce jobs, ensure that you configure the Terrier application before anything else:
public void configure(JobConf jc) { try{ HadoopUtility.loadTerrierJob(jc); } catch (Exception e) { throw new Error("Cannot load ApplicationSetup", e); } }
Modifier and Type | Class and Description |
---|---|
static class |
HadoopPlugin.JobFactory
a Job Factory is responsible for creating Terrier MapReduce jobs.
|
Modifier and Type | Field and Description |
---|---|
protected org.apache.hadoop.conf.Configuration |
config
configuration used by this plugin
|
protected org.apache.hadoop.fs.FileSystem |
hadoopFS
distributed file system used by this plugin
|
protected static org.apache.log4j.Logger |
logger
The logger used
|
protected static org.apache.hadoop.conf.Configuration |
singletonConfiguration
main configuration object to use for Hadoop access
|
protected static HadoopPlugin |
singletonHadoopPlugin
instance of this class - it is a singleton
|
Constructor and Description |
---|
HadoopPlugin()
Constructs a new plugin
|
Modifier and Type | Method and Description |
---|---|
org.apache.hadoop.conf.Configuration |
getConfiguration()
Returns the Hadoop configuration underlying this plugin instance
|
static org.apache.hadoop.fs.FileSystem |
getDefaultFileSystem()
What is the default file system according to Hadoop
|
static String |
getDefaultFileSystemPrefix()
What is the String prefix of the default file system according to Hadoop
|
static URI |
getDefaultFileSystemURI()
What is the URI of the default file system according to Hadoop
|
static org.apache.hadoop.conf.Configuration |
getGlobalConfiguration()
Obtain the global Hadoop configuration in use by the plugin
|
static HadoopPlugin.JobFactory |
getJobFactory(String sessionName)
Get a JobFactory with the specified session name.
|
protected static HadoopPlugin.JobFactory |
getJobFactory(String sessionName,
boolean persistent)
implements the obtaining of job factories
|
void |
initialise()
Initialises the Plugin, by connecting to the distributed file system
|
static void |
setGlobalConfiguration(org.apache.hadoop.conf.Configuration _config)
Update the global Hadoop configuration in use by the plugin
|
protected static HadoopPlugin singletonHadoopPlugin
protected static org.apache.hadoop.conf.Configuration singletonConfiguration
protected static final org.apache.log4j.Logger logger
protected org.apache.hadoop.conf.Configuration config
protected org.apache.hadoop.fs.FileSystem hadoopFS
public static HadoopPlugin.JobFactory getJobFactory(String sessionName)
protected static HadoopPlugin.JobFactory getJobFactory(String sessionName, boolean persistent)
public static void setGlobalConfiguration(org.apache.hadoop.conf.Configuration _config)
public static org.apache.hadoop.conf.Configuration getGlobalConfiguration()
public static String getDefaultFileSystemPrefix()
public static URI getDefaultFileSystemURI()
public static org.apache.hadoop.fs.FileSystem getDefaultFileSystem() throws IOException
IOException
public void initialise() throws Exception
initialise
in interface ApplicationSetup.TerrierApplicationPlugin
Exception
public org.apache.hadoop.conf.Configuration getConfiguration()
Terrier 4.0. Copyright © 2004-2014 University of Glasgow