airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject [14/16] airavata git commit: credential store start up logs and adding xsede job reporting to JobSubmissionTask
Date Wed, 24 Feb 2016 20:08:20 GMT
credential store start up logs and adding xsede job reporting to JobSubmissionTask


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

Branch: refs/heads/master
Commit: 8e23fadcf0c8235b337b1d060a9cf319b6b47c40
Parents: b09ce0c
Author: Chathuri Wimalasena <chathuri@apache.org>
Authored: Wed Feb 24 14:39:38 2016 -0500
Committer: Chathuri Wimalasena <chathuri@apache.org>
Committed: Wed Feb 24 14:39:38 2016 -0500

----------------------------------------------------------------------
 .../store/server/CredentialStoreServer.java     |  3 +-
 .../impl/task/DefaultJobSubmissionTask.java     | 31 ++++++++++++++++----
 .../org/apache/airavata/server/ServerMain.java  |  4 +--
 3 files changed, 28 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/8e23fadc/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
index 2e3db05..5ccec02 100644
--- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
@@ -101,7 +101,6 @@ public class CredentialStoreServer  implements IServer {
             }.start();
         } catch (TTransportException e) {
             setStatus(ServerStatus.FAILED);
-//                logger.error("Error while starting the credential store service", e);
             throw new Exception("Error while starting the credential store service", e);
         }
     }
@@ -135,7 +134,7 @@ public class CredentialStoreServer  implements IServer {
 
     @Override
     public ServerStatus getStatus() throws Exception {
-        return null;
+        return status;
     }
 
     private void setStatus(IServer.ServerStatus stat){

http://git-wip-us.apache.org/repos/asf/airavata/blob/8e23fadc/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
index 81b5f91..fd2af7f 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
@@ -24,19 +24,25 @@ package org.apache.airavata.gfac.impl.task;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.gfac.core.*;
+import org.apache.airavata.gfac.core.cluster.CommandInfo;
 import org.apache.airavata.gfac.core.cluster.JobSubmissionOutput;
+import org.apache.airavata.gfac.core.cluster.RawCommandInfo;
 import org.apache.airavata.gfac.core.cluster.RemoteCluster;
 import org.apache.airavata.gfac.core.context.ProcessContext;
 import org.apache.airavata.gfac.core.context.TaskContext;
 import org.apache.airavata.gfac.core.task.JobSubmissionTask;
 import org.apache.airavata.gfac.core.task.TaskException;
 import org.apache.airavata.gfac.impl.Factory;
+import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription;
 import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager;
 import org.apache.airavata.model.commons.ErrorModel;
+import org.apache.airavata.model.experiment.ExperimentModel;
 import org.apache.airavata.model.job.JobModel;
 import org.apache.airavata.model.status.*;
 import org.apache.airavata.model.task.TaskTypes;
 import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
+import org.apache.airavata.registry.cpi.RegistryException;
 import org.apache.commons.io.FileUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -82,13 +88,14 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 				jobModel.setStdErr(jobSubmissionOutput.getStdErr());
 				jobModel.setStdOut(jobSubmissionOutput.getStdOut());
 				String jobId = jobSubmissionOutput.getJobId();
-				if (exitCode != 0 || jobSubmissionOutput.isJobSubmissionFailed()) {
+                String experimentId = taskContext.getExperimentId();
+                if (exitCode != 0 || jobSubmissionOutput.isJobSubmissionFailed()) {
 					jobModel.setJobId(DEFAULT_JOB_ID);
 					if (jobSubmissionOutput.isJobSubmissionFailed()) {
 						jobModel.setJobStatus(new JobStatus(JobState.FAILED));
 						jobModel.getJobStatus().setReason(jobSubmissionOutput.getFailureReason());
 						log.error("expId: {}, processid: {}, taskId: {} :- Job submission failed for job name
{}",
-								taskContext.getExperimentId(), taskContext.getProcessId(), taskContext.getTaskId(),
jobModel.getJobName());
+                                experimentId, taskContext.getProcessId(), taskContext.getTaskId(),
jobModel.getJobName());
 						ErrorModel errorModel = new ErrorModel();
 						errorModel.setUserFriendlyMessage(jobSubmissionOutput.getFailureReason());
 						errorModel.setActualErrorMessage(jobSubmissionOutput.getFailureReason());
@@ -135,8 +142,9 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 				    jobModel.setJobId(jobId);
 				    GFacUtils.saveJobModel(processContext, jobModel);
 				    jobStatus.setJobState(JobState.SUBMITTED);
-				    jobStatus.setReason("Successfully Submitted to " + taskContext.getParentProcessContext()
-						    .getComputeResourceDescription().getHostName());
+                    ComputeResourceDescription computeResourceDescription = taskContext.getParentProcessContext()
+                            .getComputeResourceDescription();
+                    jobStatus.setReason("Successfully Submitted to " + computeResourceDescription.getHostName());
                     jobStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
 				    jobModel.setJobStatus(jobStatus);
 				    GFacUtils.saveJobStatus(taskContext.getParentProcessContext(), jobModel);
@@ -147,6 +155,15 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 					    jobModel.setJobStatus(jobStatus);
 					    GFacUtils.saveJobStatus(taskContext.getParentProcessContext(), jobModel);
 				    }
+                    // doing gateway reporting
+                    if (computeResourceDescription.isGatewayUsageReporting()){
+                        String loadCommand = computeResourceDescription.getGatewayUsageModuleLoadCommand();
+                        String usageExecutable = computeResourceDescription.getGatewayUsageExecutable();
+                        ExperimentModel experiment = (ExperimentModel)taskContext.getParentProcessContext().getExperimentCatalog().get(ExperimentCatalogModelType.EXPERIMENT,
experimentId);
+                        RawCommandInfo rawCommandInfo = new RawCommandInfo(loadCommand +
" && " + usageExecutable + " -gateway_user " +  experiment.getUserName()  +
+                                                                           " -submit_time
\"`date '+%F %T %:z'`\"  -jobid " + jobId );
+                        remoteCluster.execute(rawCommandInfo);
+                    }
 				    taskStatus = new TaskStatus(TaskState.COMPLETED);
 				    taskStatus.setReason("Submitted job to compute resource");
                     taskStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
@@ -252,9 +269,11 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 		    errorModel.setActualErrorMessage(e.getMessage());
 		    errorModel.setUserFriendlyMessage(msg);
 		    taskContext.getTaskModel().setTaskError(errorModel);
-	    }
+	    } catch (RegistryException e) {
+            e.printStackTrace();
+        }
 
-	    taskContext.setTaskStatus(taskStatus);
+        taskContext.setTaskStatus(taskStatus);
 	    try {
 		    GFacUtils.saveAndPublishTaskStatus(taskContext);
 	    } catch (GFacException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/8e23fadc/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
----------------------------------------------------------------------
diff --git a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
index 0117f7a..8055dda 100644
--- a/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
+++ b/modules/server/src/main/java/org/apache/airavata/server/ServerMain.java
@@ -296,7 +296,7 @@ public class ServerMain {
 			}
 		}
 	}
-	private static final int SERVER_STATUS_CHANGE_WAIT_INTERVAL=100;
+	private static final int SERVER_STATUS_CHANGE_WAIT_INTERVAL=500;
 
 	private static void waitForServerToStart(IServer server,Integer maxWait) throws Exception
{
 		int count=0;
@@ -307,7 +307,7 @@ public class ServerMain {
 			Thread.sleep(SERVER_STATUS_CHANGE_WAIT_INTERVAL);
 			count+=SERVER_STATUS_CHANGE_WAIT_INTERVAL;
 		}
-		if (server.getStatus()!=ServerStatus.STARTED){
+		if (server.getStatus()!= ServerStatus.STARTED){
 			logger.error("The "+server.getName()+" did not start!!!");
 		}
 	}


Mime
View raw message