airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1492288 - in /airavata/trunk/modules: airavata-client/src/main/java/org/apache/airavata/client/api/ airavata-client/src/main/java/org/apache/airavata/client/impl/ distribution/airavata-server/src/main/resources/conf/ registry/airavata-jpa-...
Date Wed, 12 Jun 2013 17:10:03 GMT
Author: samindaw
Date: Wed Jun 12 17:10:02 2013
New Revision: 1492288

URL: http://svn.apache.org/r1492288
Log:
API updates to saving the status history

Added:
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/ApplicationJobStatusData.java
  (with props)
Modified:
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ProvenanceManager.java
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ProvenanceManagerImpl.java
    airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
    airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/util/RegistrySettings.java
    airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ProvenanceManager.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ProvenanceManager.java?rev=1492288&r1=1492287&r2=1492288&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ProvenanceManager.java
(original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ProvenanceManager.java
Wed Jun 12 17:10:02 2013
@@ -27,6 +27,7 @@ import java.util.Map;
 
 import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.workflow.ApplicationJobStatusData;
 import org.apache.airavata.registry.api.workflow.ExperimentData;
 import org.apache.airavata.registry.api.workflow.ExperimentMetadata;
 import org.apache.airavata.registry.api.workflow.ExperimentName;
@@ -466,4 +467,12 @@ public interface ProvenanceManager {
       * @throws AiravataAPIInvocationException
       */
      public List<ApplicationJob> getApplicationJobs(String experimentId, String workflowExecutionId,
String nodeId) throws AiravataAPIInvocationException;
+     
+     /**
+      * Retrieve the list all the status updates for an application job.
+      * @param jobId - Application job id
+      * @return
+      * @throws AiravataAPIInvocationException
+      */
+     public List<ApplicationJobStatusData> getApplicationJobStatusHistory(String jobId)
throws AiravataAPIInvocationException;
 }

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ProvenanceManagerImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ProvenanceManagerImpl.java?rev=1492288&r1=1492287&r2=1492288&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ProvenanceManagerImpl.java
(original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ProvenanceManagerImpl.java
Wed Jun 12 17:10:02 2013
@@ -33,9 +33,22 @@ import org.apache.airavata.client.api.ex
 import org.apache.airavata.common.exception.AiravataConfigurationException;
 import org.apache.airavata.registry.api.AiravataExperiment;
 import org.apache.airavata.registry.api.exception.RegistryException;
-import org.apache.airavata.registry.api.workflow.*;
+import org.apache.airavata.registry.api.workflow.ApplicationJob;
 import org.apache.airavata.registry.api.workflow.ApplicationJob.ApplicationJobStatus;
+import org.apache.airavata.registry.api.workflow.ApplicationJobStatusData;
+import org.apache.airavata.registry.api.workflow.ExperimentData;
+import org.apache.airavata.registry.api.workflow.ExperimentMetadata;
+import org.apache.airavata.registry.api.workflow.ExperimentName;
+import org.apache.airavata.registry.api.workflow.ExperimentUser;
+import org.apache.airavata.registry.api.workflow.NodeExecutionStatus;
+import org.apache.airavata.registry.api.workflow.WorkflowExecution;
+import org.apache.airavata.registry.api.workflow.WorkflowExecutionData;
+import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus;
 import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus.State;
+import org.apache.airavata.registry.api.workflow.WorkflowInstanceNode;
+import org.apache.airavata.registry.api.workflow.WorkflowNodeGramData;
+import org.apache.airavata.registry.api.workflow.WorkflowNodeIOData;
+import org.apache.airavata.registry.api.workflow.WorkflowNodeType;
 
 public class ProvenanceManagerImpl implements ProvenanceManager {
 	private AiravataClient client;
@@ -609,4 +622,14 @@ public class ProvenanceManagerImpl imple
 		updateApplicationJobStatus(jobId, status, Calendar.getInstance().getTime());
 	}
 
+	@Override
+	public List<ApplicationJobStatusData> getApplicationJobStatusHistory(
+			String jobId) throws AiravataAPIInvocationException {
+		try {
+			return client.getRegistryClient().getApplicationJobStatusHistory(jobId);
+		} catch (Exception e) {
+			throw new AiravataAPIInvocationException(e);
+		}
+	}
+
 }

Modified: airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties?rev=1492288&r1=1492287&r2=1492288&view=diff
==============================================================================
--- airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
(original)
+++ airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
Wed Jun 12 17:10:02 2013
@@ -216,5 +216,7 @@ messagePerservationIntervalMinutes=0
 class.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
 #class.registry.accessor=org.apache.airavata.rest.client.RegistryClient
 
+###---------------------------Computational Middleware Configurations---------------------------###
 
+#enable.application.job.status.history=true
 

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1492288&r1=1492287&r2=1492288&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
Wed Jun 12 17:10:02 2013
@@ -39,6 +39,7 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
 import org.apache.airavata.persistance.registry.jpa.JPAResourceAccessor;
 import org.apache.airavata.persistance.registry.jpa.Resource;
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
 import org.apache.airavata.persistance.registry.jpa.resources.ApplicationDescriptorResource;
 import org.apache.airavata.persistance.registry.jpa.resources.ConfigurationResource;
@@ -48,6 +49,7 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.persistance.registry.jpa.resources.ExperimentMetadataResource;
 import org.apache.airavata.persistance.registry.jpa.resources.ExperimentResource;
 import org.apache.airavata.persistance.registry.jpa.resources.GFacJobDataResource;
+import org.apache.airavata.persistance.registry.jpa.resources.GFacJobStatusResource;
 import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
 import org.apache.airavata.persistance.registry.jpa.resources.HostDescriptorResource;
 import org.apache.airavata.persistance.registry.jpa.resources.NodeDataResource;
@@ -101,6 +103,8 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.registry.api.exception.worker.WorkspaceProjectDoesNotExistsException;
 import org.apache.airavata.registry.api.impl.WorkflowExecutionDataImpl;
 import org.apache.airavata.registry.api.util.RegistryConstants;
+import org.apache.airavata.registry.api.util.RegistrySettings;
+import org.apache.airavata.registry.api.workflow.ApplicationJobStatusData;
 import org.apache.airavata.registry.api.workflow.ExecutionError;
 import org.apache.airavata.registry.api.workflow.ExperimentData;
 import org.apache.airavata.registry.api.workflow.ExperimentExecutionError;
@@ -2264,6 +2268,7 @@ public class AiravataJPARegistry extends
 		gfacJob.setNodeID(job.getNodeId());
 		setupValues(job, gfacJob);
 		gfacJob.save();
+		addApplicationJobStatusData(job.getJobId(), job.getStatus(), job.getStatusUpdateTime(),gfacJob);
 	}
 
 	private void setupValues(ApplicationJob job, GFacJobDataResource gfacJob) {
@@ -2304,6 +2309,7 @@ public class AiravataJPARegistry extends
 		gFacJob.setStatus(status.toString());
 		gFacJob.setStatusUpdateTime(new Timestamp(statusUpdateTime.getTime()));
 		gFacJob.save();
+		addApplicationJobStatusData(gfacJobId, status, statusUpdateTime, null);
 	}
 
 	@Override
@@ -2409,4 +2415,27 @@ public class AiravataJPARegistry extends
 		return jpa.getWorker().isGFacJobExists(gfacJobId);
 	}
 
+	@Override
+	public List<ApplicationJobStatusData> getApplicationJobStatusHistory(
+			String jobId) throws RegistryException {
+		List<ApplicationJobStatusData> statusData=new ArrayList<ApplicationJobStatusData>();
+		List<GFacJobStatusResource> statuses = jpa.getWorker().getGFacJobStatuses(jobId);
+		for (GFacJobStatusResource resource : statuses) {
+			statusData.add(new ApplicationJobStatusData(resource.getLocalJobID(),ApplicationJobStatus.valueOf(resource.getStatus()),resource.getStatusUpdateTime()));

+		}
+		return statusData;
+	}
+	
+	private void addApplicationJobStatusData(String jobId, ApplicationJobStatus status, Date
updatedTime, GFacJobDataResource dataResource) throws RegistryException {
+		if (RegistrySettings.isApplicationJobStatusHistoryEnabled()){
+			if (dataResource==null){
+				dataResource = jpa.getWorker().getGFacJob(jobId);
+			}
+			GFacJobStatusResource s = (GFacJobStatusResource)dataResource.create(ResourceType.GFAC_JOB_STATUS);
+			s.setStatus(status.toString());
+			s.setStatusUpdateTime(new Timestamp(updatedTime.getTime()));
+			s.save();
+		}
+	}
+
 }

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java?rev=1492288&r1=1492287&r2=1492288&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
Wed Jun 12 17:10:02 2013
@@ -31,6 +31,7 @@ import org.apache.airavata.persistance.r
 import org.apache.airavata.persistance.registry.jpa.ResourceType;
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
 import org.apache.airavata.persistance.registry.jpa.model.*;
+import org.apache.airavata.persistance.registry.jpa.resources.AbstractResource.GFacJobStatusConstants;
 import org.apache.airavata.persistance.registry.jpa.resources.AbstractResource.WorkflowDataConstants;
 import org.apache.airavata.persistance.registry.jpa.utils.QueryGenerator;
 import org.slf4j.Logger;
@@ -218,6 +219,24 @@ public class WorkerResource extends Abst
         em.close();
 		return result;
 	}
+	
+	public List<GFacJobStatusResource> getGFacJobStatuses(String jobId){
+		List<GFacJobStatusResource> resourceList = new ArrayList<GFacJobStatusResource>();
+        EntityManager em = ResourceUtils.getEntityManager();
+        em.getTransaction().begin();
+        QueryGenerator generator;
+        Query q;
+        generator = new QueryGenerator(GFAC_JOB_STATUS);
+        generator.setParameter(GFacJobStatusConstants.LOCAL_JOB_ID, jobId);
+        q = generator.selectQuery(em);
+        for (Object result : q.getResultList()) {
+            GFac_Job_Status gFacJobStatus = (GFac_Job_Status) result;
+            GFacJobStatusResource gFacJobStatusResource =
+                    (GFacJobStatusResource)Utils.getResource(ResourceType.GFAC_JOB_STATUS,
gFacJobStatus);
+            resourceList.add(gFacJobStatusResource);
+        }
+        return resourceList;
+	}
 
     /**
      *

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java?rev=1492288&r1=1492287&r2=1492288&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
(original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/ProvenanceRegistry.java
Wed Jun 12 17:10:02 2013
@@ -514,4 +514,12 @@ public interface ProvenanceRegistry exte
      * @throws RegistryException
      */
     public List<ApplicationJob> getApplicationJobs(String experimentId, String workflowExecutionId,
String nodeId) throws RegistryException;
+    
+    /**
+     * Retrieve the list all the status updates for an application job.
+     * @param jobId - Application job id
+     * @return
+     * @throws RegistryException
+     */
+    public List<ApplicationJobStatusData> getApplicationJobStatusHistory(String jobId)
throws RegistryException;
 }
\ No newline at end of file

Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/util/RegistrySettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/util/RegistrySettings.java?rev=1492288&r1=1492287&r2=1492288&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/util/RegistrySettings.java
(original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/util/RegistrySettings.java
Wed Jun 12 17:10:02 2013
@@ -34,6 +34,7 @@ public class RegistrySettings {
     private static Properties properties = new Properties();
     private static Exception propertyLoadException;
     private static final String REGISTRY_ACCESSOR_CLASS = "class.registry.accessor";
+    private static final String SAVE_APPLICATION_JOB_STATUS_HISTORY="enable.application.job.status.history";
     
     static{
     	URL url = RegistrySettings.class.getClassLoader()
@@ -88,4 +89,8 @@ public class RegistrySettings {
     public static String getRegistryAccessorClass() throws RegistrySettingsException{
     	return getSetting(REGISTRY_ACCESSOR_CLASS);
     }
+    
+    public static boolean isApplicationJobStatusHistoryEnabled(){
+    	return "true".equalsIgnoreCase(getSetting(SAVE_APPLICATION_JOB_STATUS_HISTORY, "false"));
+    }
 }

Added: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/ApplicationJobStatusData.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/ApplicationJobStatusData.java?rev=1492288&view=auto
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/ApplicationJobStatusData.java
(added)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/ApplicationJobStatusData.java
Wed Jun 12 17:10:02 2013
@@ -0,0 +1,57 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.registry.api.workflow;
+
+import java.util.Date;
+
+import org.apache.airavata.registry.api.workflow.ApplicationJob.ApplicationJobStatus;
+
+public class ApplicationJobStatusData {
+	private String jobId;
+	private ApplicationJobStatus status;
+	private Date time;
+	
+	public ApplicationJobStatusData(String jobId, ApplicationJobStatus status, Date time) {
+		setJobId(jobId);
+		setStatus(status);
+		setTime(time);
+	}
+	
+	public String getJobId() {
+		return jobId;
+	}
+	private void setJobId(String jobId) {
+		this.jobId = jobId;
+	}
+	public ApplicationJobStatus getStatus() {
+		return status;
+	}
+	private void setStatus(ApplicationJobStatus status) {
+		this.status = status;
+	}
+	public Date getTime() {
+		return time;
+	}
+	private void setTime(Date time) {
+		this.time = time;
+	}
+}

Propchange: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/ApplicationJobStatusData.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java?rev=1492288&r1=1492287&r2=1492288&view=diff
==============================================================================
--- airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java
(original)
+++ airavata/trunk/modules/rest/client/src/main/java/org/apache/airavata/rest/client/RegistryClient.java
Wed Jun 12 17:10:02 2013
@@ -970,4 +970,11 @@ public class RegistryClient extends Aira
 	public boolean isApplicationJobExists(String gfacJobId) throws RegistryException {
 		return getProvenanceResourceClient().isApplicationJobExists(gfacJobId);
 	}
+
+	@Override
+	public List<ApplicationJobStatusData> getApplicationJobStatusHistory(
+			String jobId) throws RegistryException {
+		// TODO Auto-generated method stub
+		return null;
+	}
 }



Mime
View raw message