Search in sources :

Example 1 with ExperimentStatistics

use of org.apache.airavata.model.experiment.ExperimentStatistics in project airavata by apache.

the class ExperimentRegistry method getExperimentStatistics.

public ExperimentStatistics getExperimentStatistics(Map<String, String> filters) throws RegistryException {
    try {
        ExperimentStatistics experimentStatistics = new ExperimentStatistics();
        ExperimentStatisticsResource experimentStatisticsResource = workerResource.getExperimentStatistics(filters.get(Constants.FieldConstants.ExperimentConstants.GATEWAY_ID), new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.FROM_DATE))), new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.TO_DATE))), filters.get(Constants.FieldConstants.ExperimentConstants.USER_NAME), filters.get(Constants.FieldConstants.ExperimentConstants.EXECUTION_ID), filters.get(Constants.FieldConstants.ExperimentConstants.RESOURCE_HOST_ID));
        experimentStatistics.setAllExperimentCount(experimentStatisticsResource.getAllExperimentCount());
        experimentStatistics.setCreatedExperimentCount(experimentStatisticsResource.getCreatedExperimentCount());
        experimentStatistics.setRunningExperimentCount(experimentStatisticsResource.getRunningExperimentCount());
        experimentStatistics.setCompletedExperimentCount(experimentStatisticsResource.getCompletedExperimentCount());
        experimentStatistics.setFailedExperimentCount(experimentStatisticsResource.getFailedExperimentCount());
        experimentStatistics.setCancelledExperimentCount(experimentStatisticsResource.getCancelledExperimentCount());
        ArrayList<ExperimentSummaryModel> experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getAllExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setAllExperiments(experimentSummaries);
        experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getCreatedExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setCreatedExperiments(experimentSummaries);
        experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getRunningExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setRunningExperiments(experimentSummaries);
        experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getCompletedExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setCompletedExperiments(experimentSummaries);
        experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getFailedExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setFailedExperiments(experimentSummaries);
        experimentSummaries = new ArrayList();
        for (ExperimentSummaryResource ex : experimentStatisticsResource.getCancelledExperiments()) {
            experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
        }
        experimentStatistics.setCancelledExperiments(experimentSummaries);
        return experimentStatistics;
    } catch (RegistryException e) {
        logger.error("Error while retrieving experiment statistics from registry", e);
        throw new RegistryException(e);
    }
}
Also used : ExperimentSummaryModel(org.apache.airavata.model.experiment.ExperimentSummaryModel) ExperimentStatistics(org.apache.airavata.model.experiment.ExperimentStatistics) Timestamp(java.sql.Timestamp) RegistryException(org.apache.airavata.registry.cpi.RegistryException)

Aggregations

Timestamp (java.sql.Timestamp)1 ExperimentStatistics (org.apache.airavata.model.experiment.ExperimentStatistics)1 ExperimentSummaryModel (org.apache.airavata.model.experiment.ExperimentSummaryModel)1 RegistryException (org.apache.airavata.registry.cpi.RegistryException)1