You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hama.apache.org by "Edward J. Yoon (Resolved) (JIRA)" <ji...@apache.org> on 2011/12/21 07:05:30 UTC

[jira] [Resolved] (HAMA-473) Local files should be deleted when task is completed or killed

     [ https://issues.apache.org/jira/browse/HAMA-473?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edward J. Yoon resolved HAMA-473.
---------------------------------

    Resolution: Fixed

I'm committing below small patch and close this.

{code}
Index: core/src/main/java/org/apache/hama/bsp/GroomServer.java
===================================================================
--- core/src/main/java/org/apache/hama/bsp/GroomServer.java     (revision 1221542)
+++ core/src/main/java/org/apache/hama/bsp/GroomServer.java     (working copy)
@@ -521,6 +521,17 @@

     synchronized (rjob) {
       if (!rjob.localized) {
+
+        FileSystem localFs = FileSystem.getLocal(conf);
+        Path jobDir = localJobFile.getParent();
+        if (localFs.exists(jobDir)){
+          localFs.delete(jobDir, true);
+          boolean b = localFs.mkdirs(jobDir);
+          if (!b)
+            throw new IOException("Not able to create job directory "
+                                  + jobDir.toString());
+        }
+
         Path localJarFile = defaultJobConf.getLocalPath(SUBDIR + "/"
             + task.getTaskID() + "/" + "job.jar");
         systemFS.copyToLocalFile(new Path(task.getJobFile()), localJobFile);
{code}
                
> Local files should be deleted when task is completed or killed
> --------------------------------------------------------------
>
>                 Key: HAMA-473
>                 URL: https://issues.apache.org/jira/browse/HAMA-473
>             Project: Hama
>          Issue Type: Bug
>          Components: bsp
>    Affects Versions: 0.3.0
>            Reporter: Edward J. Yoon
>            Assignee: Edward J. Yoon
>             Fix For: 0.4.0
>
>
> I think, below codes should be just moved into Child.done() method.
> {code}
>           if (taskStatus.getRunState() == TaskStatus.State.RUNNING) {
>             if (!tip.runner.isAlive()) {
>               if (taskStatus.getRunState() != TaskStatus.State.FAILED) {
>                 taskStatus.setRunState(TaskStatus.State.SUCCEEDED);
>                 LOG.info("Task '" + taskStatus.getTaskId().toString()
>                     + "' has completed.");
>               }
>               taskStatus.setPhase(TaskStatus.Phase.CLEANUP);
>             }
>           }
> {code}
> and, local files should be deleted when task is completed, or killed.
> {code}
>             // TODO Use the cleanup thread
>             // tasksToCleanup.put(action);
>             KillTaskAction killAction = (KillTaskAction) action;
>             if (tasks.containsKey(killAction.getTaskID())) {
>               TaskInProgress tip = tasks.get(killAction.getTaskID());
>               tip.taskStatus.setRunState(TaskStatus.State.FAILED);
>               try {
>                 tip.killAndCleanup(true);
>               } catch (IOException ioe) {
>                 throw new DirectiveException("Error when killing a "
>                     + "TaskInProgress.", ioe);
>               }
>             }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira