public interface GuaguaService
GuaguaService is a common service interface of both master and worker service implementations.
GuaguaService defines the process to launch a master or worker service in container. GuaguaService
should be called like code in below:
try {
guaguaService.init(props);
guaguaService.start();
guaguaService.run(null);
} finally {
guaguaService.stop();
}
init(Properties) is used to transfer all properties needed in one guagua application. For Hadoop MapReduce
or YARN job, it includes all the properties copied from Hadoop Configuration instance. And these properties will be
set to MasterContext and WorkerContext for user to use them.
| Modifier and Type | Method and Description |
|---|---|
void |
init(Properties props)
Service initialization.
|
void |
run(Progressable progress)
Real logic implementation, for example, master and worker iteration logic.
|
void |
setAppId(String appId)
App id for whole application.
|
void |
setContainerId(String containerId)
Set the unique container id for master or worker.
|
void |
setSplits(List<GuaguaFileSplit> splits)
Assign splits to each worker to make them load that data.
|
void |
start()
Start point for the service.
|
void |
stop()
Stop service, resources cleaning should be added in this function.
|
void init(Properties props)
The caller should make sure init(Properties) is called before start(),
run(Progressable), stop() functions.
props - which contains different properties for master and workers to use.void start()
void run(Progressable progress)
If progress is not null, it will be invoked by once per iteration.
void stop()
void setSplits(List<GuaguaFileSplit> splits)
void setAppId(String appId)
void setContainerId(String containerId)
Copyright © 2015. All Rights Reserved.