Package org.apache.airavata.model.workspace.experiment

Examples of org.apache.airavata.model.workspace.experiment.Experiment


     * @param experimentId
     * @return
     * @throws OrchestratorException
     */
    public List<TaskDetails> createTasks(String experimentId) throws OrchestratorException {
        Experiment experiment = null;
        List<TaskDetails> tasks = new ArrayList<TaskDetails>();
        try {
            Registry newRegistry = orchestratorContext.getNewRegistry();
            experiment = (Experiment) newRegistry.get(RegistryModelType.EXPERIMENT, experimentId);

View Full Code Here


        outMessage.addParameter("echo_output", echo_out);

        jobExecutionContext.setOutMessageContext(outMessage);

        jobExecutionContext.setExperimentID("test123");
        jobExecutionContext.setExperiment(new Experiment("test123","project1","admin","testExp"));
        jobExecutionContext.setTaskData(new TaskDetails(jobExecutionContext.getExperimentID()));
        jobExecutionContext.setRegistry(new LoggingRegistryImpl());
        jobExecutionContext.setWorkflowNodeDetails(new WorkflowNodeDetails(jobExecutionContext.getExperimentID(),"none", ExecutionUnit.APPLICATION));

View Full Code Here

        exOut.add(output);

        Project project = ProjectModelUtil.createProject("project1", "admin", "test project");
        String projectId = getClient().createProject(project);

        Experiment simpleExperiment =
                ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", appId, appId, exInputs);
        simpleExperiment.setExperimentOutputs(exOut);

        ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(hostId, 1, 1, 1, "normal", 1, 0, 1, "sds128");
        scheduling.setResourceHostId(hostId);
        UserConfigurationData userConfigurationData = new UserConfigurationData();
        userConfigurationData.setAiravataAutoSchedule(false);
        userConfigurationData.setOverrideManualScheduledParams(false);
        userConfigurationData.setComputationalResourceScheduling(scheduling);
        simpleExperiment.setUserConfigurationData(userConfigurationData);

        log.info("Creating experiment...");

        final String expId = createExperiment(simpleExperiment);
        log.info("Experiment Id returned : " + expId);
View Full Code Here

   * *
   *
   * @param experimentId
   */
  public boolean launchExperiment(String experimentId) throws TException {
    Experiment experiment = null;
    try {
      List<String> ids = registry.getIds(
          RegistryModelType.WORKFLOW_NODE_DETAIL,
          WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
      for (String workflowNodeId : ids) {
        WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry
            .get(RegistryModelType.WORKFLOW_NODE_DETAIL,
                workflowNodeId);
        List<Object> taskDetailList = registry.get(
            RegistryModelType.TASK_DETAIL,
            TaskDetailConstants.NODE_ID, workflowNodeId);
        for (Object o : taskDetailList) {
          TaskDetails taskID = (TaskDetails) o;
          // iterate through all the generated tasks and performs the
          // job submisssion+monitoring
          experiment = (Experiment) registry.get(
              RegistryModelType.EXPERIMENT, experimentId);
          if (experiment == null) {
            log.error("Error retrieving the Experiment by the given experimentID: "
                + experimentId);
            return false;
          }
          ExperimentStatus status = new ExperimentStatus();
          status.setExperimentState(ExperimentState.LAUNCHED);
          status.setTimeOfStateChange(Calendar.getInstance()
              .getTimeInMillis());
          experiment.setExperimentStatus(status);
          registry.update(RegistryModelType.EXPERIMENT, experiment,
              experimentId);
          // launching the experiment
          orchestrator.launchExperiment(experiment,
              workflowNodeDetail, taskID,null);
        }
      }

    } catch (Exception e) {
      // Here we really do not have to do much because only potential
      // failure can happen
      // is in gfac, if there are errors in gfac, it will handle the
      // experiment/task/job statuses
      // We might get failures in registry access before submitting the
      // jobs to gfac, in that case we
      // leave the status of these as created.
      ExperimentStatus status = new ExperimentStatus();
      status.setExperimentState(ExperimentState.FAILED);
      status.setTimeOfStateChange(Calendar.getInstance()
          .getTimeInMillis());
      experiment.setExperimentStatus(status);
      try {
        registry.update(RegistryModelType.EXPERIMENT, experiment,
            experimentId);
      } catch (RegistryException e1) {
        throw new TException(e);
View Full Code Here

            TaskDetailConstants.NODE_ID, workflowNodeId);
        for (Object o : taskDetailList) {
          TaskDetails taskID = (TaskDetails) o;
          // iterate through all the generated tasks and performs the
          // job submisssion+monitoring
          Experiment experiment = (Experiment) registry.get(
              RegistryModelType.EXPERIMENT, experimentId);
          if (experiment == null) {
            log.error("Error retrieving the Experiment by the given experimentID: "
                + experimentId);
            return false;
View Full Code Here

        }
    }

    public  void updateExperimentStatus(String experimentId, ExperimentState state) throws Exception {
        logger.info("Updating the experiment status of experiment: " + experimentId + " to " + state.toString());
      Experiment details = (Experiment)airavataRegistry.get(RegistryModelType.EXPERIMENT, experimentId);
        if(details == null) {
            details = new Experiment();
            details.setExperimentID(experimentId);
        }
        org.apache.airavata.model.workspace.experiment.ExperimentStatus status = new org.apache.airavata.model.workspace.experiment.ExperimentStatus();
        status.setExperimentState(state);
        status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
        details.setExperimentStatus(status);
        airavataRegistry.update(RegistryModelType.EXPERIMENT_STATUS, status, experimentId);

    }
View Full Code Here

            }
        }
    }

    private boolean launchSingleAppExperiment(String experimentId, String airavataCredStoreToken, OrchestratorService.Client orchestratorClient) throws TException {
        Experiment experiment = null;
        try {
            List<String> ids = registry.getIds(RegistryModelType.WORKFLOW_NODE_DETAIL, WorkflowNodeConstants.EXPERIMENT_ID, experimentId);
            for (String workflowNodeId : ids) {
//                WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails) registry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeId);
                List<Object> taskDetailList = registry.get(RegistryModelType.TASK_DETAIL, TaskDetailConstants.NODE_ID, workflowNodeId);
                for (Object o : taskDetailList) {
                    TaskDetails taskData = (TaskDetails) o;
                    //iterate through all the generated tasks and performs the job submisssion+monitoring
                    experiment = (Experiment) registry.get(RegistryModelType.EXPERIMENT, experimentId);
                    if (experiment == null) {
                        logger.error("Error retrieving the Experiment by the given experimentID: " + experimentId);
                        return false;
                    }
                    ExperimentStatus status = new ExperimentStatus();
                    status.setExperimentState(ExperimentState.LAUNCHED);
                    status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
                    experiment.setExperimentStatus(status);
                    registry.update(RegistryModelType.EXPERIMENT_STATUS, status, experimentId);
                    registry.update(RegistryModelType.TASK_DETAIL, taskData, taskData.getTaskID());
                    //launching the experiment
                    orchestratorClient.launchTask(taskData.getTaskID(),airavataCredStoreToken);
                }
            }

        } catch (Exception e) {
            // Here we really do not have to do much because only potential failure can happen
            // is in gfac, if there are errors in gfac, it will handle the experiment/task/job statuses
            // We might get failures in registry access before submitting the jobs to gfac, in that case we
            // leave the status of these as created.
            ExperimentStatus status = new ExperimentStatus();
            status.setExperimentState(ExperimentState.FAILED);
            status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
            experiment.setExperimentStatus(status);
            try {
                registry.update(RegistryModelType.EXPERIMENT_STATUS, status, experimentId);
            } catch (RegistryException e1) {
                throw new TException(e);
            }
View Full Code Here

        try {
            registry = RegistryFactory.getDefaultRegistry();
            if (!registry.isExist(RegistryModelType.EXPERIMENT, existingExperimentID)){
                throw new ExperimentNotFoundException("Requested experiment id " + existingExperimentID + " does not exist in the system..");
            }
            Experiment existingExperiment = (Experiment)registry.get(RegistryModelType.EXPERIMENT, existingExperimentID);
            existingExperiment.setCreationTime(AiravataUtils.getCurrentTimestamp().getTime());
            if (validateString(newExperiementName)){
                existingExperiment.setName(newExperiementName);
            }
            if (existingExperiment.getWorkflowNodeDetailsList() != null){
                existingExperiment.getWorkflowNodeDetailsList().clear();
            }
            if (existingExperiment.getErrors() != null ){
                existingExperiment.getErrors().clear();
            }
            return (String)registry.add(ParentDataType.EXPERIMENT, existingExperiment);
        } catch (Exception e) {
            logger.error("Error while cloning the experiment with existing configuration...", e);
            AiravataSystemException exception = new AiravataSystemException();
View Full Code Here

    }


    public static Experiment getExperiment(ExperimentResource experimentResource) throws RegistryException {
        if (experimentResource != null){
            Experiment experiment = new Experiment();
            if (experimentResource.getProject()!= null){
                experiment.setProjectID(experimentResource.getProject().getId());
            }
            experiment.setExperimentID(experimentResource.getExpID());
            experiment.setCreationTime(experimentResource.getCreationTime().getTime());
            experiment.setUserName(experimentResource.getExecutionUser());
            experiment.setName(experimentResource.getExpName());
            experiment.setDescription(experimentResource.getDescription());
            experiment.setApplicationId(experimentResource.getApplicationId());
            experiment.setApplicationVersion(experimentResource.getApplicationVersion());
            experiment.setWorkflowTemplateId(experimentResource.getWorkflowTemplateId());
            experiment.setWorkflowTemplateVersion(experimentResource.getWorkflowTemplateVersion());
            experiment.setWorkflowExecutionInstanceId(experimentResource.getWorkflowExecutionId());
            List<ExperimentInputResource> experimentInputs = experimentResource.getExperimentInputs();
            experiment.setExperimentInputs(getExpInputs(experimentInputs));
            List<ExperimentOutputResource> experimentOutputs = experimentResource.getExperimentOutputs();
            experiment.setExperimentOutputs(getExpOutputs(experimentOutputs));
            StatusResource experimentStatus = experimentResource.getExperimentStatus();
            if (experimentStatus != null){
                experiment.setExperimentStatus(getExperimentStatus(experimentStatus));
            }
            List<StatusResource> changeList = experimentResource.getWorkflowNodeStatuses();
            if (changeList != null && !changeList.isEmpty()){
                experiment.setStateChangeList(getWorkflowNodeStatusList(changeList));
            }

            List<WorkflowNodeDetailResource> workflowNodeDetails = experimentResource.getWorkflowNodeDetails();
            if (workflowNodeDetails != null && !workflowNodeDetails.isEmpty()){
                experiment.setWorkflowNodeDetailsList(getWfNodeList(workflowNodeDetails));
            }
            List<ErrorDetailResource> errorDetails = experimentResource.getErrorDetails();
            if (errorDetails!= null && !errorDetails.isEmpty()){
                experiment.setErrors(getErrorDetailList(errorDetails));
            }
            String expID = experimentResource.getExpID();
            if (experimentResource.isExists(ResourceType.CONFIG_DATA, expID)){
                ConfigDataResource userConfigData = experimentResource.getUserConfigData(expID);
                experiment.setUserConfigurationData(getUserConfigData(userConfigData));
            }
            return experiment;
        }
        return null;
    }
View Full Code Here

        output.setKey("echo_output");
        output.setType(DataType.STDOUT);
        output.setValue("");
        exOut.add(output);

        Experiment simpleExperiment =
                ExperimentModelUtil.createSimpleExperiment(projectId, user, "echoExperiment", "SimpleEcho0", "SimpleEcho0", exInputs);
        simpleExperiment.setExperimentOutputs(exOut);

        ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("localhost", 1, 1, 1, "normal", 0, 0, 1, "sds128");
        scheduling.setResourceHostId("localhost");
        UserConfigurationData userConfigurationData = new UserConfigurationData();
        userConfigurationData.setAiravataAutoSchedule(false);
        userConfigurationData.setOverrideManualScheduledParams(false);
        userConfigurationData.setComputationalResourceScheduling(scheduling);
        simpleExperiment.setUserConfigurationData(userConfigurationData);



    final String expId = client.createExperiment(simpleExperiment);
        System.out.println("Experiment Id returned : " + expId);
View Full Code Here

TOP

Related Classes of org.apache.airavata.model.workspace.experiment.Experiment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.