Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A843E10903 for ; Tue, 4 Mar 2014 22:01:19 +0000 (UTC) Received: (qmail 13898 invoked by uid 500); 4 Mar 2014 22:01:17 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 13811 invoked by uid 500); 4 Mar 2014 22:01:17 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 13794 invoked by uid 99); 4 Mar 2014 22:01:16 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Mar 2014 22:01:16 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9C588936056; Tue, 4 Mar 2014 22:01:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lahiru@apache.org To: commits@airavata.apache.org Date: Tue, 04 Mar 2014 22:01:16 -0000 Message-Id: <43f086d28a7a47b1b8fc0b3897480cb7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: Fixing issue with multiple calls in airavata-server Repository: airavata Updated Branches: refs/heads/master 592f10276 -> 4d6dbbeec Fixing issue with multiple calls in airavata-server Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e0eb89a0 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e0eb89a0 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e0eb89a0 Branch: refs/heads/master Commit: e0eb89a074ecca6e7e4ff641509875877a926343 Parents: 5b62ef6 Author: lahiru Authored: Tue Mar 4 17:00:50 2014 -0500 Committer: lahiru Committed: Tue Mar 4 17:00:50 2014 -0500 ---------------------------------------------------------------------- .../server/handler/AiravataServerHandler.java | 50 ++++++++----- .../client/samples/CreateLaunchExperiment.java | 5 ++ .../job/monitor/AiravataJobStatusUpdator.java | 74 ++++++++++---------- 3 files changed, 76 insertions(+), 53 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/e0eb89a0/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java index 72446e3..03a47a4 100644 --- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java +++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java @@ -50,6 +50,7 @@ public class AiravataServerHandler implements Airavata.Iface { private static final Logger logger = LoggerFactory.getLogger(AiravataServerHandler.class); public static final String ORCHESTRATOR_SERVER_HOST = "localhost"; public static final int ORCHESTRATOR_SERVER_PORT = 8940; + private OrchestratorService.Client orchestratorClient; /** * Query Airavata to fetch the API version */ @@ -269,26 +270,41 @@ public class AiravataServerHandler implements Airavata.Iface { * if more security credentials are enables, then the structure ExecutionSecurityParameters should be used. * Note: This parameter is not persisted within Airavata Registry for security reasons. * @return This method call does not have a return value. - * @throws org.apache.airavata.api.error.InvalidRequestException For any incorrect forming of the request itself. - * @throws org.apache.airavata.api.error.ExperimentNotFoundException If the specified experiment is not previously created, then an Experiment Not Found Exception is thrown. - * @throws org.apache.airavata.api.error.AiravataClientException The following list of exceptions are thrown which Airavata Client can take corrective actions to resolve: - *

- * UNKNOWN_GATEWAY_ID - If a Gateway is not registered with Airavata as a one time administrative - * step, then Airavata Registry will not have a provenance area setup. The client has to follow - * gateway registration steps and retry this request. - *

- * AUTHENTICATION_FAILURE - How Authentication will be implemented is yet to be determined. - * For now this is a place holder. - *

- * INVALID_AUTHORIZATION - This will throw an authorization exception. When a more robust security hand-shake - * is implemented, the authorization will be more substantial. - * @throws org.apache.airavata.api.error.AiravataSystemException This exception will be thrown for any Airavata Server side issues and if the problem cannot be corrected by the client - * rather an Airavata Administrator will be notified to take corrective action. + * @throws org.apache.airavata.api.error.InvalidRequestException + * For any incorrect forming of the request itself. + * @throws org.apache.airavata.api.error.ExperimentNotFoundException + * If the specified experiment is not previously created, then an Experiment Not Found Exception is thrown. + * @throws org.apache.airavata.api.error.AiravataClientException + * The following list of exceptions are thrown which Airavata Client can take corrective actions to resolve: + *

+ * UNKNOWN_GATEWAY_ID - If a Gateway is not registered with Airavata as a one time administrative + * step, then Airavata Registry will not have a provenance area setup. The client has to follow + * gateway registration steps and retry this request. + *

+ * AUTHENTICATION_FAILURE - How Authentication will be implemented is yet to be determined. + * For now this is a place holder. + *

+ * INVALID_AUTHORIZATION - This will throw an authorization exception. When a more robust security hand-shake + * is implemented, the authorization will be more substantial. + * @throws org.apache.airavata.api.error.AiravataSystemException + * This exception will be thrown for any Airavata Server side issues and if the problem cannot be corrected by the client + * rather an Airavata Administrator will be notified to take corrective action. */ @Override public void launchExperiment(String airavataExperimentId, String airavataCredStoreToken) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException { - OrchestratorService.Client orchestratorClient = OrchestratorClientFactory.createOrchestratorClient(ORCHESTRATOR_SERVER_HOST, ORCHESTRATOR_SERVER_PORT); - orchestratorClient.launchExperiment(airavataExperimentId); + if(orchestratorClient == null){ + orchestratorClient = OrchestratorClientFactory.createOrchestratorClient(ORCHESTRATOR_SERVER_HOST, ORCHESTRATOR_SERVER_PORT); + } + final String expID = airavataExperimentId; + (new Thread(){ + public void run(){ + try { + orchestratorClient.launchExperiment(expID); + } catch (TException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + } + }).start(); } /** http://git-wip-us.apache.org/repos/asf/airavata/blob/e0eb89a0/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java index 6bf809f..0c5e351 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java @@ -65,6 +65,11 @@ public class CreateLaunchExperiment { System.out.println("Experiment ID : " + expId); launchExperiment(airavata, expId); System.out.println("Launched successfully"); + try { + Thread.sleep(20000); + } catch (InterruptedException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } Thread monitor = (new Thread(){ public void run() { Map jobStatuses = null; http://git-wip-us.apache.org/repos/asf/airavata/blob/e0eb89a0/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 a6d6c31..78f0621 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 @@ -68,42 +68,44 @@ 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"); - jobsToMonitor.remove(jobStatus.getMonitorID()); - break; - case UNKNOWN: - logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is UNKNOWN"); - logger.info("Unknown job status came, if the old job status is RUNNING or something active, we have to make it complete"); - //todo implement this logic - break; - case QUEUED: - logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is QUEUED"); - break; - case SUBMITTED: - logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is SUBMITTED"); - break; - case ACTIVE: - logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is ACTIVE"); - break; - case CANCELED: - logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is CANCELED"); - break; - case FAILED: - logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is FAILED"); - break; - case HELD: - logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is HELD"); - break; - case SUSPENDED: - logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is SUSPENDED"); - break; + if (state != null) { + 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"); + jobsToMonitor.remove(jobStatus.getMonitorID()); + break; + case UNKNOWN: + logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is UNKNOWN"); + logger.info("Unknown job status came, if the old job status is RUNNING or something active, we have to make it complete"); + //todo implement this logic + break; + case QUEUED: + logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is QUEUED"); + break; + case SUBMITTED: + logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is SUBMITTED"); + break; + case ACTIVE: + logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is ACTIVE"); + break; + case CANCELED: + logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is CANCELED"); + break; + case FAILED: + logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is FAILED"); + break; + case HELD: + logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is HELD"); + break; + case SUSPENDED: + logger.info("Job ID:" + jobStatus.getMonitorID().getJobID() + " is SUSPENDED"); + break; + } } } public static void updateJobStatus(String jobID, JobState state) throws Exception {