use of org.apache.airavata.model.application.io.InputDataObjectType in project airavata by apache.
the class WorkflowCatalogImpl method updateWorkflow.
@Override
public void updateWorkflow(String workflowTemplateId, WorkflowModel workflow) throws WorkflowCatalogException {
try {
WorkflowResource resource = new WorkflowResource();
WorkflowResource existingWF = (WorkflowResource) resource.get(workflowTemplateId);
existingWF.setWfName(workflow.getName());
existingWF.setGraph(workflow.getGraph());
if (workflow.getImage() != null) {
existingWF.setImage(new String(workflow.getImage()));
}
existingWF.save();
List<InputDataObjectType> existingwFInputs = workflow.getWorkflowInputs();
if (existingwFInputs != null && existingwFInputs.size() != 0) {
for (InputDataObjectType input : existingwFInputs) {
WorkflowInputResource wfInputResource = new WorkflowInputResource();
Map<String, String> ids = new HashMap<String, String>();
ids.put(WorkflowCatAbstractResource.WorkflowInputConstants.WF_TEMPLATE_ID, existingWF.getWfTemplateId());
ids.put(WorkflowCatAbstractResource.WorkflowInputConstants.INPUT_KEY, input.getName());
WorkflowInputResource existingInput = (WorkflowInputResource) wfInputResource.get(ids);
existingInput.setWorkflowResource(existingWF);
existingInput.setInputKey(input.getName());
existingInput.setInputVal(input.getValue());
existingInput.setWfTemplateId(existingWF.getWfTemplateId());
existingInput.setDataType(input.getType().toString());
existingInput.setAppArgument(input.getApplicationArgument());
existingInput.setStandardInput(input.isStandardInput());
existingInput.setUserFriendlyDesc(input.getUserFriendlyDescription());
existingInput.setMetadata(input.getMetaData());
existingInput.save();
}
}
List<OutputDataObjectType> workflowOutputs = workflow.getWorkflowOutputs();
if (workflowOutputs != null && workflowOutputs.size() != 0) {
for (OutputDataObjectType output : workflowOutputs) {
WorkflowOutputResource outputResource = new WorkflowOutputResource();
Map<String, String> ids = new HashMap<String, String>();
ids.put(WorkflowCatAbstractResource.WorkflowOutputConstants.WF_TEMPLATE_ID, existingWF.getWfTemplateId());
ids.put(WorkflowCatAbstractResource.WorkflowOutputConstants.OUTPUT_KEY, output.getName());
WorkflowOutputResource existingOutput = (WorkflowOutputResource) outputResource.get(ids);
existingOutput.setWorkflowResource(existingWF);
existingOutput.setOutputKey(output.getName());
existingOutput.setOutputVal(output.getValue());
existingOutput.setWfTemplateId(existingWF.getWfTemplateId());
existingOutput.setDataType(output.getType().toString());
existingOutput.setDataType(output.getType().toString());
existingOutput.setAppArgument(output.getApplicationArgument());
existingOutput.setDataNameLocation(output.getLocation());
existingOutput.setRequired(output.isIsRequired());
existingOutput.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
existingOutput.setOutputStreaming(output.isOutputStreaming());
existingOutput.setDataMovement(output.isDataMovement());
existingOutput.save();
}
}
} catch (Exception e) {
logger.error("Error while updating the workflow...", e);
throw new WorkflowCatalogException(e);
}
}
use of org.apache.airavata.model.application.io.InputDataObjectType in project airavata by apache.
the class WorkflowCatalogImpl method registerWorkflow.
@Override
public String registerWorkflow(WorkflowModel workflow, String gatewayId) throws WorkflowCatalogException {
try {
WorkflowResource resource = new WorkflowResource();
resource.setWfTemplateId(WorkflowCatalogUtils.getID(workflow.getName()));
resource.setWfName(workflow.getName());
resource.setGraph(workflow.getGraph());
resource.setGatewayId(gatewayId);
if (workflow.getImage() != null) {
resource.setImage(new String(workflow.getImage()));
}
resource.save();
workflow.setTemplateId(resource.getWfTemplateId());
List<InputDataObjectType> workflowInputs = workflow.getWorkflowInputs();
if (workflowInputs != null && workflowInputs.size() != 0) {
for (InputDataObjectType input : workflowInputs) {
WorkflowInputResource wfInputResource = new WorkflowInputResource();
wfInputResource.setWorkflowResource(resource);
wfInputResource.setInputKey(input.getName());
wfInputResource.setInputVal(input.getValue());
wfInputResource.setWfTemplateId(resource.getWfTemplateId());
wfInputResource.setDataType(input.getType().toString());
wfInputResource.setAppArgument(input.getApplicationArgument());
wfInputResource.setStandardInput(input.isStandardInput());
wfInputResource.setUserFriendlyDesc(input.getUserFriendlyDescription());
wfInputResource.setMetadata(input.getMetaData());
wfInputResource.save();
}
}
List<OutputDataObjectType> workflowOutputs = workflow.getWorkflowOutputs();
if (workflowOutputs != null && workflowOutputs.size() != 0) {
for (OutputDataObjectType output : workflowOutputs) {
WorkflowOutputResource outputResource = new WorkflowOutputResource();
outputResource.setWorkflowResource(resource);
outputResource.setOutputKey(output.getName());
outputResource.setOutputVal(output.getValue());
outputResource.setWfTemplateId(resource.getWfTemplateId());
outputResource.setDataType(output.getType().toString());
outputResource.setAppArgument(output.getApplicationArgument());
outputResource.setDataNameLocation(output.getLocation());
outputResource.setRequired(output.isIsRequired());
outputResource.setRequiredToCMD(output.isRequiredToAddedToCommandLine());
outputResource.setOutputStreaming(output.isOutputStreaming());
outputResource.setDataMovement(output.isDataMovement());
outputResource.save();
}
}
return resource.getWfTemplateId();
} catch (Exception e) {
logger.error("Error while saving the workflow...", e);
throw new WorkflowCatalogException(e);
}
}
use of org.apache.airavata.model.application.io.InputDataObjectType in project airavata by apache.
the class CreateLaunchExperiment method createEchoExperimentForStampede.
// public static String createExperimentForSSHHost(Airavata.Client client) throws TException {
// try {
// List<OutputDataObjectType> exInputs = new ArrayList<OutputDataObjectType>();
// OutputDataObjectType input = new OutputDataObjectType();
// input.setName("echo_input");
// input.setType(DataType.STRING);
// input.setValue("Echoed_Output=Hello World");
// exInputs.add(input);
//
// List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
// OutputDataObjectType output = new OutputDataObjectType();
// output.setName("Echoed_Output");
// output.setType(DataType.STRING);
// output.setValue("");
// exOut.add(output);
//
// Project project = ProjectModelUtil.createProject("default", "admin", "test project");
// String projectId = client.createProject(project);
//
// ExperimentModel simpleExperiment =
// ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SSHEcho1", sshHostAppId.split(",")[1], exInputs);
// simpleExperiment.setExperimentOutputs(exOut);
//
// ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(sshHostAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, "sds128");
// scheduling.setResourceHostId("gw111.iu.xsede.org");
// UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
// userConfigurationData.setAiravataAutoSchedule(false);
// userConfigurationData.setOverrideManualScheduledParams(false);
// userConfigurationData.setComputationalResourceScheduling(scheduling);
// simpleExperiment.setUserConfigurationData(userConfigurationData);
// return client.createExperiment(simpleExperiment);
// } catch (AiravataSystemException e) {
// logger.error("Error occured while creating the experiment...", e.getMessage());
// throw new AiravataSystemException(e);
// } catch (InvalidRequestException e) {
// logger.error("Error occured while creating the experiment...", e.getMessage());
// throw new InvalidRequestException(e);
// } catch (AiravataClientException e) {
// logger.error("Error occured while creating the experiment...", e.getMessage());
// throw new AiravataClientException(e);
// } catch (TException e) {
// logger.error("Error occured while creating the experiment...", e.getMessage());
// throw new TException(e);
// }
// }
public static String createEchoExperimentForStampede(Airavata.Client client) throws TException {
try {
List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), echoAppId);
// for (InputDataObjectType inputDataObjectType : exInputs) {
// if (inputDataObjectType.getName().equalsIgnoreCase("Input_to_Echo")) {
// inputDataObjectType.setValue("Hello World");
// }
// }
// List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), echoAppId);
Project project = ProjectModelUtil.createProject("default", "admin", "test project");
String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "admin", "echoExperiment", "SimpleEcho3", echoAppId, exInputs);
// simpleExperiment.setExperimentOutputs(exOut);
Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), echoAppId);
if (computeResources != null && computeResources.size() != 0) {
for (String id : computeResources.keySet()) {
String resourceName = computeResources.get(id);
if (resourceName.equals(stampedeHostName)) {
ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 30, 1);
UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
userConfigurationData.setComputationalResourceScheduling(scheduling);
simpleExperiment.setUserConfigurationData(userConfigurationData);
return client.createExperiment(new AuthzToken(""), DEFAULT_GATEWAY, simpleExperiment);
}
}
}
} catch (AiravataSystemException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataSystemException(e);
} catch (InvalidRequestException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new InvalidRequestException(e);
} catch (AiravataClientException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataClientException(e);
} catch (TException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new TException(e);
}
return null;
}
use of org.apache.airavata.model.application.io.InputDataObjectType in project airavata by apache.
the class CreateLaunchExperiment method createExperimentESPRESSOStampede.
public static String createExperimentESPRESSOStampede(Airavata.Client client) throws TException {
try {
List<InputDataObjectType> exInputs = client.getApplicationInputs(new AuthzToken(""), espressoAppId);
setESPRESSOInputs(exInputs);
List<OutputDataObjectType> exOut = client.getApplicationOutputs(new AuthzToken(""), espressoAppId);
ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "default", "admin", "EspressoExperiment", "Testing", espressoAppId, exInputs);
simpleExperiment.setExperimentOutputs(exOut);
Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(new AuthzToken(""), espressoAppId);
if (computeResources != null && computeResources.size() != 0) {
for (String id : computeResources.keySet()) {
String resourceName = computeResources.get(id);
if (resourceName.equals(stampedeHostName)) {
ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 16, 1, "development", 30, 1);
UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
userConfigurationData.setComputationalResourceScheduling(scheduling);
simpleExperiment.setUserConfigurationData(userConfigurationData);
return client.createExperiment(new AuthzToken(""), DEFAULT_GATEWAY, simpleExperiment);
}
}
}
} catch (AiravataSystemException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataSystemException(e);
} catch (InvalidRequestException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new InvalidRequestException(e);
} catch (AiravataClientException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataClientException(e);
} catch (TException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new TException(e);
}
return null;
}
use of org.apache.airavata.model.application.io.InputDataObjectType in project airavata by apache.
the class CreateLaunchExperimentUS3 method createUS3ExperimentForTrestles.
public static String createUS3ExperimentForTrestles(Airavata.Client client) throws AiravataSystemException, InvalidRequestException, AiravataClientException, TException {
try {
List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>();
InputDataObjectType input = new InputDataObjectType();
input.setName("input");
input.setType(DataType.URI);
input.setValue("file:///home/sgg/chathuri/laptop_backup/airavata/ultrascan_input/hpcinput.tar");
InputDataObjectType input1 = new InputDataObjectType();
input1.setName("walltime");
input1.setType(DataType.STRING);
input1.setValue("-walltime=60");
InputDataObjectType input2 = new InputDataObjectType();
input2.setName("mgroupcount");
input2.setType(DataType.STRING);
input2.setValue("-mgroupcount=1");
exInputs.add(input);
exInputs.add(input1);
exInputs.add(input2);
List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
OutputDataObjectType output = new OutputDataObjectType();
output.setName("output");
output.setType(DataType.URI);
output.setValue("");
// OutputDataObjectType output1 = new OutputDataObjectType();
// output1.setName("stdout");
// output1.setType(DataType.STDOUT);
// output1.setValue("");
// OutputDataObjectType output2 = new OutputDataObjectType();
// output2.setName("stderr");
// output2.setType(DataType.STDERR);
// output2.setValue("");
exOut.add(output);
// exOut.add(output1);
// exOut.add(output2);
Project project = ProjectModelUtil.createProject("ultrascan", "ultrascan", "test project");
String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "ultrascan", "US3ExperimentTrestles", "US3AppTrestles", "ultrascan_7ce6cd43-622c-44e0-87c5-fb7a6528c799", exInputs);
simpleExperiment.setExperimentOutputs(exOut);
ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.xsede.org_72b9181b-7156-4975-a386-ed98b4949496", 32, 1, 0, "shared", 30, 0);
UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
scheduling.setResourceHostId("trestles.sdsc.xsede.org_72b9181b-7156-4975-a386-ed98b4949496");
userConfigurationData.setAiravataAutoSchedule(false);
userConfigurationData.setOverrideManualScheduledParams(false);
/* AdvancedOutputDataHandling dataHandling = new AdvancedOutputDataHandling();
dataHandling.setOutputDataDir("/home/sgg/chathuri/laptop_backup/airavata");
userConfigurationData.setAdvanceOutputDataHandling(dataHandling);*/
userConfigurationData.setComputationalResourceScheduling(scheduling);
simpleExperiment.setUserConfigurationData(userConfigurationData);
return client.createExperiment(new AuthzToken(""), DEFAULT_GATEWAY, simpleExperiment);
} catch (AiravataSystemException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataSystemException(e);
} catch (InvalidRequestException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new InvalidRequestException(e);
} catch (AiravataClientException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new AiravataClientException(e);
} catch (TException e) {
logger.error("Error occured while creating the experiment...", e.getMessage());
throw new TException(e);
}
}
Aggregations