public static ExecutionType getExecutionType(Experiment experiment){ try { ApplicationInterface applicationInterface = AppCatalogFactory.getAppCatalog().getApplicationInterface(); List<String> allApplicationInterfaceIds = applicationInterface.getAllApplicationInterfaceIds(); String applicationId = experiment.getApplicationId(); if (allApplicationInterfaceIds.contains(applicationId)){ return ExecutionType.SINGLE_APP; } else { List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows(); if (allWorkflows.contains(applicationId)){ return ExecutionType.WORKFLOW; } } } catch (AppCatalogException e) { e.printStackTrace(); } return ExecutionType.UNKNOWN; } }
@Override public void launchExperiment(String experimentId, String token) throws WorkflowEngineException { try { Registry registry = RegistryFactory.getDefaultRegistry(); Experiment experiment = (Experiment)registry.get(RegistryModelType.EXPERIMENT, experimentId); WorkflowCatalog workflowCatalog = WorkflowCatalogFactory.getWorkflowCatalog(); WorkflowInterpreterConfiguration config = new WorkflowInterpreterConfiguration(new Workflow(workflowCatalog.getWorkflow(experiment.getApplicationId()).getGraph())); final WorkflowInterpreter workflowInterpreter = new WorkflowInterpreter(experiment, token, config , getOrchestratorClient(), rabbitMQPublisher); new Thread(){ public void run() { try { workflowInterpreter.scheduleDynamically(); } catch (WorkflowException e) { e.printStackTrace(); } catch (RegistryException e) { e.printStackTrace(); } catch (AiravataException e) { e.printStackTrace(); } }; }.start(); } catch (Exception e) { logger.error("Error while retrieving the experiment", e); WorkflowEngineException exception = new WorkflowEngineException("Error while launching the workflow experiment. More info : " + e.getMessage()); throw exception; } }
existingExperiment.setCreationTime(AiravataUtils.getTime(experiment.getCreationTime())); existingExperiment.setDescription(experiment.getDescription()); existingExperiment.setApplicationId(experiment.getApplicationId()); existingExperiment.setApplicationVersion(experiment.getApplicationVersion()); existingExperiment.setWorkflowTemplateId(experiment.getWorkflowTemplateId());
experimentResource.setCreationTime(AiravataUtils.getTime(experiment.getCreationTime())); experimentResource.setDescription(experiment.getDescription()); experimentResource.setApplicationId(experiment.getApplicationId()); experimentResource.setApplicationVersion(experiment.getApplicationVersion()); experimentResource.setWorkflowTemplateId(experiment.getWorkflowTemplateId());