airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramin...@apache.org
Subject [3/4] git commit: Fixed AIRAVATA-1043.
Date Mon, 03 Mar 2014 20:42:50 GMT
Fixed AIRAVATA-1043.

Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2736d75c
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2736d75c
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2736d75c

Branch: refs/heads/master
Commit: 2736d75c7cc04b1486190f86117cf1e545afc07b
Parents: 5fb684b
Author: raminder <raminder@apache.org>
Authored: Mon Mar 3 15:28:01 2014 -0500
Committer: raminder <raminder@apache.org>
Committed: Mon Mar 3 15:28:01 2014 -0500

----------------------------------------------------------------------
 .../job/monitor/AiravataJobStatusUpdator.java    | 19 +++++++++++++++++++
 .../airavata/gfac/handler/SCPOutputHandler.java  |  1 -
 .../apache/airavata/gfac/utils/GFacUtils.java    |  3 ++-
 3 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/2736d75c/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/AiravataJobStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/AiravataJobStatusUpdator.java
b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/AiravataJobStatusUpdator.java
index 0a0fde5..a6d6c31 100644
--- a/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/AiravataJobStatusUpdator.java
+++ b/modules/airavata-job-monitor/src/main/java/org/apache/airavata/job/monitor/AiravataJobStatusUpdator.java
@@ -21,12 +21,16 @@
 package org.apache.airavata.job.monitor;
 
 import com.google.common.eventbus.Subscribe;
+
 import org.apache.airavata.job.monitor.state.JobStatus;
+import org.apache.airavata.model.workspace.experiment.JobDetails;
 import org.apache.airavata.model.workspace.experiment.JobState;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
 import org.apache.airavata.registry.cpi.Registry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Calendar;
 import java.util.concurrent.BlockingQueue;
 
 public class AiravataJobStatusUpdator{
@@ -64,6 +68,11 @@ public class AiravataJobStatusUpdator{
                 the registry accordingly, for now we are just printing to standard Out
                  */
         JobState state = jobStatus.getState();
+        try {
+			updateJobStatus(jobStatus.getMonitorID().getJobID(),state);
+		} catch (Exception e) {
+			logger.error("Error persisting data" + e.getLocalizedMessage(),e);
+		}
         switch (state) {
             case COMPLETE:
                 logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is DONE");
@@ -97,4 +106,14 @@ public class AiravataJobStatusUpdator{
                 break;
         }
     }
+    public static void updateJobStatus(String jobID, JobState state) throws Exception {
+  			Registry registry = RegistryFactory.getDefaultRegistry();
+  			JobDetails details = new JobDetails();
+  			org.apache.airavata.model.workspace.experiment.JobStatus status = new org.apache.airavata.model.workspace.experiment.JobStatus();
+  			status.setJobState(state);
+  			status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+          	details.setJobStatus(status);
+          	details.setJobID(jobID);
+  			registry.update(org.apache.airavata.registry.cpi.DataType.JOB_DETAIL, details, jobID);
+  	}
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/2736d75c/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
index eca0daf..555a889 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
@@ -104,7 +104,6 @@ public class SCPOutputHandler extends AbstractHandler{
             }
             status.setTransferState(TransferState.DOWNLOAD);
             detail.setTransferStatus(status);
-            detail.setTransferDescription("Output: " + stringMap.get(output.keySet()).toString());
             registry.add(ChildDataType.DATA_TRANSFER_DETAIL,detail, jobExecutionContext.getTaskData().getTaskID());
         
         } catch (XmlException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/2736d75c/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
index e6b70e7..ad741b6 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
@@ -46,6 +46,7 @@ import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
 import org.apache.airavata.registry.api.workflow.ApplicationJob;
 import org.apache.airavata.registry.api.workflow.ApplicationJob.ApplicationJobStatus;
 import org.apache.airavata.registry.cpi.ChildDataType;
+import org.apache.airavata.registry.cpi.CompositeIdentifier;
 import org.apache.airavata.registry.cpi.Registry;
 import org.apache.airavata.schemas.gfac.*;
 import org.apache.axiom.om.OMElement;
@@ -707,7 +708,7 @@ public class GFacUtils {
 			JobStatus status = new JobStatus();
 			status.setJobState(state);
         	details.setJobStatus(status);
-			registry.add(ChildDataType.JOB_DETAIL,details, taskID);
+			registry.add(ChildDataType.JOB_DETAIL,details, new CompositeIdentifier(taskID, details.getJobID()));
 		} catch (Exception e) {
 			throw new GFacException("Error persisting job status" + e.getLocalizedMessage(),e);
 		}


Mime
View raw message