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 490E818019 for ; Wed, 10 Jun 2015 16:54:37 +0000 (UTC) Received: (qmail 19790 invoked by uid 500); 10 Jun 2015 16:54:37 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 19649 invoked by uid 500); 10 Jun 2015 16:54:37 -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 19587 invoked by uid 99); 10 Jun 2015 16:54:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2015 16:54:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 882DBE04BB; Wed, 10 Jun 2015 16:54:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: scnakandala@apache.org To: commits@airavata.apache.org Date: Wed, 10 Jun 2015 16:54:39 -0000 Message-Id: In-Reply-To: <71f2fcb1c37241e2af4edba6e45a768b@git.apache.org> References: <71f2fcb1c37241e2af4edba6e45a768b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/4] airavata git commit: Adding getExperimentStatistics API method Adding getExperimentStatistics API method Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2c6620f0 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2c6620f0 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2c6620f0 Branch: refs/heads/master Commit: 2c6620f03f5d5ba9d7255f65156adffbe687ff18 Parents: 3224e72 Author: Supun Nakandala Authored: Wed Jun 10 22:23:17 2015 +0530 Committer: Supun Nakandala Committed: Wed Jun 10 22:23:17 2015 +0530 ---------------------------------------------------------------------- .../server/handler/AiravataServerHandler.java | 36 + .../java/org/apache/airavata/api/Airavata.java | 16246 +++++++++-------- .../experiment/ExperimentStatistics.java | 1280 ++ .../airavata-api/airavataAPI.thrift | 15 + .../airavata-api/experimentModel.thrift | 11 + .../catalog/impl/ExperimentCatalogImpl.java | 3 + .../catalog/impl/ExperimentRegistry.java | 51 + .../resources/ExperimentStatisticsResource.java | 133 + .../catalog/resources/WorkerResource.java | 287 +- .../cpi/ExperimentCatalogModelType.java | 1 + 10 files changed, 10515 insertions(+), 7548 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/2c6620f0/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 3f0fc0d..915973a 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 @@ -1003,6 +1003,42 @@ public class AiravataServerHandler implements Airavata.Iface { } /** + * Get Experiment execution statisitics by sending the gateway id and the time period interested in. + * This method will retrun an ExperimentStatistics object which contains the number of successfully + * completed experiments, failed experiments etc. + * @param gatewayId + * @param fromTime + * @param toTime + * @return + * @throws InvalidRequestException + * @throws AiravataClientException + * @throws AiravataSystemException + * @throws TException + */ + @Override + public ExperimentStatistics getExperimentStatistics(String gatewayId, long fromTime, long toTime) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException { + if (!isGatewayExist(gatewayId)){ + logger.error("Gateway does not exist.Please provide a valid gateway id..."); + throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR); + } + try { + Map filters = new HashMap(); + filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId); + filters.put(Constants.FieldConstants.ExperimentConstants.FROM_DATE, fromTime+""); + filters.put(Constants.FieldConstants.ExperimentConstants.TO_DATE, toTime+""); + + List results = experimentCatalog.search(ExperimentCatalogModelType.EXPERIMENT_STATISTICS, filters); + return (ExperimentStatistics) results.get(0); + }catch (Exception e) { + logger.error("Error while retrieving experiments", e); + AiravataSystemException exception = new AiravataSystemException(); + exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); + exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage()); + throw exception; + } + } + + /** * Get all Experiments within a Project * * @param projectId