You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hama.apache.org by Filipe David Manana <fd...@apache.org> on 2010/11/11 02:57:14 UTC

small cleanup patch

Hi
Do you agree? The odd part is the line:

report.setGroomServer(status.getGroomName());

All tests pass without it.


diff --git a/src/java/org/apache/hama/bsp/BSPMaster.java
b/src/java/org/apache/hama/bsp/BSPMaster.java
index 1e0aef8..aca690e 100644
--- a/src/java/org/apache/hama/bsp/BSPMaster.java
+++ b/src/java/org/apache/hama/bsp/BSPMaster.java
@@ -233,8 +233,7 @@ public class BSPMaster implements
JobSubmissionProtocol, InterTrackerProtocol,
   public static BSPMaster startTracker(HamaConfiguration conf, String
identifier)
       throws IOException, InterruptedException {

-    BSPMaster result = null;
-    result = new BSPMaster(conf, identifier);
+    BSPMaster result = new BSPMaster(conf, identifier);
     result.taskScheduler.setGroomServerManager(result);

     return result;
@@ -247,16 +246,12 @@ public class BSPMaster implements
JobSubmissionProtocol, InterTrackerProtocol,
     return NetUtils.createSocketAddr(hamaMasterStr, defaultPort);
   }

-  private static SimpleDateFormat getDateFormat() {
-    return new SimpleDateFormat("yyyyMMddHHmm");
-  }
-
   /**
    *
    * @return
    */
   private static String generateNewIdentifier() {
-    return getDateFormat().format(new Date());
+    return new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
   }

   public void offerService() throws InterruptedException, IOException {
@@ -404,7 +399,6 @@ public class BSPMaster implements
JobSubmissionProtocol, InterTrackerProtocol,
   void updateTaskStatuses(GroomServerStatus status) {
     for (Iterator<TaskStatus> it = status.taskReports(); it.hasNext();) {
       TaskStatus report = it.next();
-      report.setGroomServer(status.getGroomName());
       String taskId = report.getTaskId();
       TaskInProgress tip = (TaskInProgress) taskidToTIPMap.get(taskId);





-- 
Filipe David Manana,
fdmanana@gmail.com, fdmanana@apache.org

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

Re: small cleanup patch

Posted by "Edward J. Yoon" <ed...@apache.org>.
P.S. they = tasks

On Thu, Nov 11, 2010 at 6:14 PM, Edward J. Yoon <ed...@apache.org> wrote:
> Regarding that "report.setGroomServer(status.getGroomName());", I'm
> not sure, but it should not be removed. When some node failure occurs,
> they can be re-assigned to other GroomServers.
>
> I moved updateTaskStatuses(status); line to the bottom of action
> adding part. and committed rest lines. :)
>
> On Thu, Nov 11, 2010 at 10:57 AM, Filipe David Manana
> <fd...@apache.org> wrote:
>> Hi
>> Do you agree? The odd part is the line:
>>
>> report.setGroomServer(status.getGroomName());
>>
>> All tests pass without it.
>>
>>
>> diff --git a/src/java/org/apache/hama/bsp/BSPMaster.java
>> b/src/java/org/apache/hama/bsp/BSPMaster.java
>> index 1e0aef8..aca690e 100644
>> --- a/src/java/org/apache/hama/bsp/BSPMaster.java
>> +++ b/src/java/org/apache/hama/bsp/BSPMaster.java
>> @@ -233,8 +233,7 @@ public class BSPMaster implements
>> JobSubmissionProtocol, InterTrackerProtocol,
>>   public static BSPMaster startTracker(HamaConfiguration conf, String
>> identifier)
>>       throws IOException, InterruptedException {
>>
>> -    BSPMaster result = null;
>> -    result = new BSPMaster(conf, identifier);
>> +    BSPMaster result = new BSPMaster(conf, identifier);
>>     result.taskScheduler.setGroomServerManager(result);
>>
>>     return result;
>> @@ -247,16 +246,12 @@ public class BSPMaster implements
>> JobSubmissionProtocol, InterTrackerProtocol,
>>     return NetUtils.createSocketAddr(hamaMasterStr, defaultPort);
>>   }
>>
>> -  private static SimpleDateFormat getDateFormat() {
>> -    return new SimpleDateFormat("yyyyMMddHHmm");
>> -  }
>> -
>>   /**
>>    *
>>    * @return
>>    */
>>   private static String generateNewIdentifier() {
>> -    return getDateFormat().format(new Date());
>> +    return new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
>>   }
>>
>>   public void offerService() throws InterruptedException, IOException {
>> @@ -404,7 +399,6 @@ public class BSPMaster implements
>> JobSubmissionProtocol, InterTrackerProtocol,
>>   void updateTaskStatuses(GroomServerStatus status) {
>>     for (Iterator<TaskStatus> it = status.taskReports(); it.hasNext();) {
>>       TaskStatus report = it.next();
>> -      report.setGroomServer(status.getGroomName());
>>       String taskId = report.getTaskId();
>>       TaskInProgress tip = (TaskInProgress) taskidToTIPMap.get(taskId);
>>
>>
>>
>>
>>
>> --
>> Filipe David Manana,
>> fdmanana@gmail.com, fdmanana@apache.org
>>
>> "Reasonable men adapt themselves to the world.
>>  Unreasonable men adapt the world to themselves.
>>  That's why all progress depends on unreasonable men."
>>
>
>
>
> --
> Best Regards, Edward J. Yoon
> edwardyoon@apache.org
> http://blog.udanax.org
>



-- 
Best Regards, Edward J. Yoon
edwardyoon@apache.org
http://blog.udanax.org

Re: small cleanup patch

Posted by "Edward J. Yoon" <ed...@apache.org>.
Regarding that "report.setGroomServer(status.getGroomName());", I'm
not sure, but it should not be removed. When some node failure occurs,
they can be re-assigned to other GroomServers.

I moved updateTaskStatuses(status); line to the bottom of action
adding part. and committed rest lines. :)

On Thu, Nov 11, 2010 at 10:57 AM, Filipe David Manana
<fd...@apache.org> wrote:
> Hi
> Do you agree? The odd part is the line:
>
> report.setGroomServer(status.getGroomName());
>
> All tests pass without it.
>
>
> diff --git a/src/java/org/apache/hama/bsp/BSPMaster.java
> b/src/java/org/apache/hama/bsp/BSPMaster.java
> index 1e0aef8..aca690e 100644
> --- a/src/java/org/apache/hama/bsp/BSPMaster.java
> +++ b/src/java/org/apache/hama/bsp/BSPMaster.java
> @@ -233,8 +233,7 @@ public class BSPMaster implements
> JobSubmissionProtocol, InterTrackerProtocol,
>   public static BSPMaster startTracker(HamaConfiguration conf, String
> identifier)
>       throws IOException, InterruptedException {
>
> -    BSPMaster result = null;
> -    result = new BSPMaster(conf, identifier);
> +    BSPMaster result = new BSPMaster(conf, identifier);
>     result.taskScheduler.setGroomServerManager(result);
>
>     return result;
> @@ -247,16 +246,12 @@ public class BSPMaster implements
> JobSubmissionProtocol, InterTrackerProtocol,
>     return NetUtils.createSocketAddr(hamaMasterStr, defaultPort);
>   }
>
> -  private static SimpleDateFormat getDateFormat() {
> -    return new SimpleDateFormat("yyyyMMddHHmm");
> -  }
> -
>   /**
>    *
>    * @return
>    */
>   private static String generateNewIdentifier() {
> -    return getDateFormat().format(new Date());
> +    return new SimpleDateFormat("yyyyMMddHHmm").format(new Date());
>   }
>
>   public void offerService() throws InterruptedException, IOException {
> @@ -404,7 +399,6 @@ public class BSPMaster implements
> JobSubmissionProtocol, InterTrackerProtocol,
>   void updateTaskStatuses(GroomServerStatus status) {
>     for (Iterator<TaskStatus> it = status.taskReports(); it.hasNext();) {
>       TaskStatus report = it.next();
> -      report.setGroomServer(status.getGroomName());
>       String taskId = report.getTaskId();
>       TaskInProgress tip = (TaskInProgress) taskidToTIPMap.get(taskId);
>
>
>
>
>
> --
> Filipe David Manana,
> fdmanana@gmail.com, fdmanana@apache.org
>
> "Reasonable men adapt themselves to the world.
>  Unreasonable men adapt the world to themselves.
>  That's why all progress depends on unreasonable men."
>



-- 
Best Regards, Edward J. Yoon
edwardyoon@apache.org
http://blog.udanax.org