Repository: airavata Updated Branches: refs/heads/master 05b9be77a -> 2e109fa19
fixing AIRAVATA-1434 Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2e109fa1 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2e109fa1 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2e109fa1 Branch: refs/heads/master Commit: 2e109fa194946d573ebb860103b94a597fe411cf Parents: 05b9be7 Author: Chathuri Wimalasena <[email protected]> Authored: Mon Sep 15 14:52:13 2014 -0400 Committer: Chathuri Wimalasena <[email protected]> Committed: Mon Sep 15 14:52:13 2014 -0400 ---------------------------------------------------------------------- .../client/samples/CreateLaunchExperiment.java | 588 ++++++++++--------- .../tools/RegisterSampleApplications.java | 109 +++- .../data/impl/ApplicationInterfaceImpl.java | 13 +- .../catalog/data/impl/ComputeResourceImpl.java | 4 +- .../data/impl/GwyResourceProfileImpl.java | 8 +- .../src/main/resources/registry-derby.sql | 2 +- 6 files changed, 433 insertions(+), 291 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/2e109fa1/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java index ec29dc1..827a187 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java @@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; +import java.util.Map; public class CreateLaunchExperiment { @@ -45,33 +46,28 @@ public class CreateLaunchExperiment { private static final String DEFAULT_USER = "default.registry.user"; private static final String DEFAULT_GATEWAY = "default.registry.gateway"; private static Airavata.Client airavataClient; - private static String localHostAppId = "localhost_3b5962d3-5e7e-4a97-9d1f-25c5ec436ba5,SimpleEcho0_44c34394-ca27-4fa9-bb2d-87f95a02352a"; - private static String sshHostAppId; - private static String pbsEchoAppId = "trestles.sdsc.edu_b67c9b6a-3940-4ba1-ac67-4f5c42e60fb8,SimpleEcho2_4c9e76f3-eab0-4ccb-8630-b53f22646ebd"; - private static String pbsWRFAppId = "trestles.sdsc.edu_c033c9b4-601e-4cd7-ac98-d7de33df0557,WRF_f1726a18-9aec-4077-91c2-93877df01972"; - private static String slurmAppId = "stampede.tacc.xsede.org_b2ef59cb-f626-4767-9ca0-601f94c42ba4,SimpleEcho3_b81c2559-a088-42a3-84ce-40119d874918"; - private static String sgeAppId; - private static String br2EchoAppId = "bigred2_9c1e6be8-f7d8-4494-98f2-bf508790e8c6,SimpleEchoBR_149fd613-98e2-46e7-ac7c-4d393349469e"; - private static String slurmWRFAppId = "stampede.tacc.xsede.org_2840c815-7e61-4579-8194-79fe15cea9a9,WRF_00817e82-7995-4986-8fe2-72da08b63ef0"; - private static String br2AmberAppId = "bigred2_5dc35993-31c4-499e-97c1-8d934007e135,AmberBR2_f63fd6f9-a93f-43a8-bd41-065740a32f1f"; - private static String slurmAmberAppId = "bigred2_5dc35993-31c4-499e-97c1-8d934007e135,AmberBR2_f63fd6f9-a93f-43a8-bd41-065740a32f1f"; - private static String trestlesAmberAppId = "trestles.sdsc.edu_8ca93e3d-135c-4e3a-bf58-bdcc2592625d,AmberTrestles_ea0e8e82-3b00-4ef7-9a78-867cfecebbf1"; - + private static String echoAppId = "Echo_bb2fe905-718b-4f4a-91ad-e1551feb06c3"; + private static String wrfAppId = "WRF_35684c10-7749-4691-939b-225903fd2f73"; + private static String amberAppId = "Amber_f4384478-a707-45f9-b2ed-477fe7fb486b"; + private static String localHost = "localhost"; + private static String trestlesHostName = "trestles.sdsc.xsede.org"; + private static String stampedeHostName = "stampede.tacc.xsede.org"; + private static String br2HostName = "bigred2.uits.iu.edu"; public static void main(String[] args) { try { airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT); System.out.println("API version is " + airavataClient.getAPIVersion()); -// getExperiment(client, "WRFExperiment_2a2de26c-7f74-47c9-8e14-40e50dedfe0f"); -// registerApplications(); +// registerApplications(); + + //// final String expId = createExperimentForSSHHost(airavata); -// final String expId = createExperimentForTrestles(airavataClient); -//// final String expId = createExperimentForStampede(airavataClient); -// final String expId = createExperimentForLocalHost(airavataClient); -// final String expId = createExperimentForLonestar(airavata); - final String expId = createExperimentWRFTrestles(airavataClient); +// final String expId = createEchoExperimentForTrestles(airavataClient); +// final String expId = createEchoExperimentForStampede(airavataClient); + final String expId = createExperimentEchoForLocalHost(airavataClient); +// final String expId = createExperimentWRFTrestles(airavataClient); // final String expId = createExperimentForBR2(airavataClient); // final String expId = createExperimentForBR2Amber(airavataClient); // final String expId = createExperimentWRFStampede(airavataClient); @@ -92,6 +88,9 @@ public class CreateLaunchExperiment { public static void registerApplications() { RegisterSampleApplications registerSampleApplications = new RegisterSampleApplications(airavataClient); + // register localhost compute host + registerSampleApplications.registerLocalHost(); + //Register all compute hosts registerSampleApplications.registerXSEDEHosts(); @@ -108,46 +107,13 @@ public class CreateLaunchExperiment { registerSampleApplications.registerAppInterfaces(); } -// public static void addDescriptors() throws AiravataAPIInvocationException, ApplicationSettingsException { -// try { -// DocumentCreatorNew documentCreator = new DocumentCreatorNew(client); -//// DocumentCreator documentCreator = new DocumentCreator(getAiravataAPI()); -// localHostAppId = documentCreator.createLocalHostDocs(); -// sshHostAppId = documentCreator.createSSHHostDocs(); -//// documentCreator.createGramDocs(); -// pbsEchoAppId =documentCreator.createPBSDocsForOGCE_Echo(); -// pbsWRFAppId =documentCreator.createPBSDocsForOGCE_WRF(); -// slurmAppId = documentCreator.createSlurmDocs(); -// sgeAppId = documentCreator.createSGEDocs(); -//// documentCreator.createEchoHostDocs(); -// br2EchoAppId = documentCreator.createBigRedDocs(); -// slurmWRFAppId = documentCreator.createSlumWRFDocs(); -// br2AmberAppId = documentCreator.createBigRedAmberDocs(); -// slurmAmberAppId = documentCreator.createStampedeAmberDocs(); -// trestlesAmberAppId = documentCreator.createTrestlesAmberDocs(); -// System.out.printf(localHostAppId); -// System.out.println(sshHostAppId); -// System.out.println(pbsEchoAppId); -// System.out.println(pbsWRFAppId); -// System.out.println(slurmAppId); -// System.out.println(sgeAppId); -// System.out.println(br2EchoAppId); -// System.out.println(slurmWRFAppId); -// System.out.println(br2AmberAppId); -// System.out.println(trestlesAmberAppId); -// } catch (Exception e) { -// logger.error("Unable to create documents", e.getMessage()); -// throw new ApplicationSettingsException(e.getMessage()); -// } -// } - - public static String createExperimentForTrestles(Airavata.Client client) throws TException { + public static String createEchoExperimentForTrestles(Airavata.Client client) throws TException { try { List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); DataObjectType input = new DataObjectType(); - input.setKey("echo_input"); + input.setKey("Input_to_Echo"); input.setType(DataType.STRING); - input.setValue("echo_output=Hello World"); + input.setValue("Echoed_Output=Hello World"); exInputs.add(input); List<DataObjectType> exOut = new ArrayList<DataObjectType>(); @@ -158,16 +124,24 @@ public class CreateLaunchExperiment { exOut.add(output); Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment("default", "admin", "echoExperiment", "SimpleEcho2", pbsEchoAppId.split(",")[1], exInputs); + ExperimentModelUtil.createSimpleExperiment("default", "admin", "echoExperiment", "SimpleEcho2", echoAppId, exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(pbsEchoAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, "sds128"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - userConfigurationData.setAiravataAutoSchedule(false); - userConfigurationData.setOverrideManualScheduledParams(false); - userConfigurationData.setComputationalResourceScheduling(scheduling); - simpleExperiment.setUserConfigurationData(userConfigurationData); - return client.createExperiment(simpleExperiment); + Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(echoAppId); + if (computeResources != null && computeResources.size() != 0){ + for (String id : computeResources.keySet()){ + String resourceName = computeResources.get(id); + if (resourceName.equals(trestlesHostName)){ + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 1, 0, 1, "sds128"); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + 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); @@ -181,18 +155,19 @@ public class CreateLaunchExperiment { logger.error("Error occured while creating the experiment...", e.getMessage()); throw new TException(e); } + return null; } public static String createExperimentWRFStampede(Airavata.Client client) throws TException { try { List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); DataObjectType input = new DataObjectType(); - input.setKey("WRF_Namelist"); + input.setKey("Config_Namelist_File"); input.setType(DataType.URI); input.setValue("/Users/lahirugunathilake/Downloads/wrf_sample_inputs/namelist.input"); DataObjectType input1 = new DataObjectType(); - input1.setKey("WRF_Input_File"); + input1.setKey("WRF_Initial_Conditions"); input1.setType(DataType.URI); input1.setValue("/Users/lahirugunathilake/Downloads/wrf_sample_inputs/wrfinput_d01"); @@ -223,16 +198,24 @@ public class CreateLaunchExperiment { Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment("default", "admin", "WRFExperiment", "Testing", slurmWRFAppId.split(",")[1], exInputs); + ExperimentModelUtil.createSimpleExperiment("default", "admin", "WRFExperiment", "Testing", wrfAppId, exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(slurmWRFAppId.split(",")[0], 2, 32, 1, "development", 90, 0, 1, "TG-STA110014S"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - userConfigurationData.setAiravataAutoSchedule(false); - userConfigurationData.setOverrideManualScheduledParams(false); - userConfigurationData.setComputationalResourceScheduling(scheduling); - simpleExperiment.setUserConfigurationData(userConfigurationData); - return client.createExperiment(simpleExperiment); + Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(wrfAppId); + if (computeResources != null && computeResources.size() != 0){ + for (String id : computeResources.keySet()){ + String resourceName = computeResources.get(id); + if (resourceName.equals(stampedeHostName)){ + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 2, 32, 1, "development", 90, 0, 1, "TG-STA110014S"); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + 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); @@ -246,6 +229,7 @@ public class CreateLaunchExperiment { logger.error("Error occured while creating the experiment...", e.getMessage()); throw new TException(e); } + return null; } public static String createExperimentWRFTrestles(Airavata.Client client) throws TException { @@ -288,16 +272,24 @@ public class CreateLaunchExperiment { Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment("default", "admin", "WRFExperiment", "Testing", pbsWRFAppId.split(",")[1], exInputs); + ExperimentModelUtil.createSimpleExperiment("default", "admin", "WRFExperiment", "Testing", wrfAppId, exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(pbsWRFAppId.split(",")[0], 32, 2, 1, "normal", 1, 0, 1, "sds128"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - userConfigurationData.setAiravataAutoSchedule(false); - userConfigurationData.setOverrideManualScheduledParams(false); - userConfigurationData.setComputationalResourceScheduling(scheduling); - simpleExperiment.setUserConfigurationData(userConfigurationData); - return client.createExperiment(simpleExperiment); + Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(wrfAppId); + if (computeResources != null && computeResources.size() != 0){ + for (String id : computeResources.keySet()){ + String resourceName = computeResources.get(id); + if (resourceName.equals(trestlesHostName)){ + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 1, 0, 1, "sds128"); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + 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); @@ -311,6 +303,7 @@ public class CreateLaunchExperiment { logger.error("Error occured while creating the experiment...", e.getMessage()); throw new TException(e); } + return null; } public static String cloneExperiment(Airavata.Client client, String expId) throws TException { @@ -335,18 +328,18 @@ public class CreateLaunchExperiment { } - public static String createExperimentForLocalHost(Airavata.Client client) throws TException { + public static String createExperimentEchoForLocalHost(Airavata.Client client) throws TException { try { List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); DataObjectType input = new DataObjectType(); - input.setKey("echo_input"); + input.setKey("Input_to_Echo"); input.setType(DataType.STRING); - input.setValue("echo_output=Hello World"); + input.setValue("Echoed_Output=Hello World"); exInputs.add(input); List<DataObjectType> exOut = new ArrayList<DataObjectType>(); DataObjectType output = new DataObjectType(); - output.setKey("echo_output"); + output.setKey("Echoed_Output"); output.setType(DataType.STRING); output.setValue(""); exOut.add(output); @@ -355,16 +348,24 @@ public class CreateLaunchExperiment { String projectId = client.createProject(project); Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", "Echo Test", localHostAppId.split(",")[1], exInputs); + ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", "Echo Test", echoAppId, exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(localHostAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, ""); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - userConfigurationData.setAiravataAutoSchedule(false); - userConfigurationData.setOverrideManualScheduledParams(false); - userConfigurationData.setComputationalResourceScheduling(scheduling); - simpleExperiment.setUserConfigurationData(userConfigurationData); - return client.createExperiment(simpleExperiment); + Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(echoAppId); + if (computeResources != null && computeResources.size() != 0){ + for (String id : computeResources.keySet()){ + String resourceName = computeResources.get(id); + if (resourceName.equals(localHost)){ + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 1, 0, 1, ""); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + 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); @@ -378,66 +379,67 @@ public class CreateLaunchExperiment { logger.error("Error occured while creating the experiment...", e.getMessage()); throw new TException(e); } + return null; } - public static String createExperimentForSSHHost(Airavata.Client client) throws TException { - try { - List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); - DataObjectType input = new DataObjectType(); - input.setKey("echo_input"); - input.setType(DataType.STRING); - input.setValue("echo_output=Hello World"); - exInputs.add(input); - - List<DataObjectType> exOut = new ArrayList<DataObjectType>(); - DataObjectType output = new DataObjectType(); - output.setKey("echo_output"); - output.setType(DataType.STRING); - output.setValue(""); - exOut.add(output); - - Project project = ProjectModelUtil.createProject("default", "admin", "test project"); - String projectId = client.createProject(project); - - Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SSHEcho1", sshHostAppId.split(",")[1], exInputs); - simpleExperiment.setExperimentOutputs(exOut); - - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(sshHostAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, "sds128"); - scheduling.setResourceHostId("gw111.iu.xsede.org"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - 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 createExperimentForSSHHost(Airavata.Client client) throws TException { +// try { +// List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); +// DataObjectType input = new DataObjectType(); +// input.setKey("echo_input"); +// input.setType(DataType.STRING); +// input.setValue("echo_output=Hello World"); +// exInputs.add(input); +// +// List<DataObjectType> exOut = new ArrayList<DataObjectType>(); +// DataObjectType output = new DataObjectType(); +// output.setKey("echo_output"); +// output.setType(DataType.STRING); +// output.setValue(""); +// exOut.add(output); +// +// Project project = ProjectModelUtil.createProject("default", "admin", "test project"); +// String projectId = client.createProject(project); +// +// Experiment simpleExperiment = +// ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SSHEcho1", sshHostAppId.split(",")[1], exInputs); +// simpleExperiment.setExperimentOutputs(exOut); +// +// ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(sshHostAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, "sds128"); +// scheduling.setResourceHostId("gw111.iu.xsede.org"); +// UserConfigurationData userConfigurationData = new UserConfigurationData(); +// 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 createExperimentForStampede(Airavata.Client client) throws TException { + public static String createEchoExperimentForStampede(Airavata.Client client) throws TException { try { List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); DataObjectType input = new DataObjectType(); - input.setKey("echo_input"); + input.setKey("Input_to_Echo"); input.setType(DataType.STRING); - input.setValue("echo_output=Hello World"); + input.setValue("Echoed_Output=Hello World"); exInputs.add(input); List<DataObjectType> exOut = new ArrayList<DataObjectType>(); DataObjectType output = new DataObjectType(); - output.setKey("echo_output"); + output.setKey("Echoed_Output"); output.setType(DataType.STRING); output.setValue(""); exOut.add(output); @@ -446,17 +448,24 @@ public class CreateLaunchExperiment { String projectId = client.createProject(project); Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", "SimpleEcho3", slurmAppId.split(",")[1], exInputs); + ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", "SimpleEcho3", echoAppId, exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = - ExperimentModelUtil.createComputationResourceScheduling(slurmAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, "TG-STA110014S"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - userConfigurationData.setAiravataAutoSchedule(false); - userConfigurationData.setOverrideManualScheduledParams(false); - userConfigurationData.setComputationalResourceScheduling(scheduling); - simpleExperiment.setUserConfigurationData(userConfigurationData); - return client.createExperiment(simpleExperiment); + Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(echoAppId); + if (computeResources != null && computeResources.size() != 0){ + for (String id : computeResources.keySet()){ + String resourceName = computeResources.get(id); + if (resourceName.equals(stampedeHostName)){ + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 1, 0, 1, "TG-STA110014S"); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + 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); @@ -470,75 +479,91 @@ public class CreateLaunchExperiment { logger.error("Error occured while creating the experiment...", e.getMessage()); throw new TException(e); } + return null; } - public static String createExperimentForLonestar(Airavata.Client client) throws TException { - try { - List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); - DataObjectType input = new DataObjectType(); - input.setKey("echo_input"); - input.setType(DataType.STRING); - input.setValue("echo_output=Hello World"); - exInputs.add(input); - - List<DataObjectType> exOut = new ArrayList<DataObjectType>(); - DataObjectType output = new DataObjectType(); - output.setKey("echo_output"); - output.setType(DataType.STRING); - output.setValue(""); - exOut.add(output); - - Project project = ProjectModelUtil.createProject("default", "admin", "test project"); - String projectId = client.createProject(project); - - Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", "SimpleEcho4", sgeAppId.split(",")[1], exInputs); - simpleExperiment.setExperimentOutputs(exOut); - - ComputationalResourceScheduling scheduling = - ExperimentModelUtil.createComputationResourceScheduling(sgeAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, "TG-STA110014S"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - 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 (LaunchValidationException e) { - logger.error("Validation failed" + e.getErrorMessage()); - org.apache.airavata.model.error.ValidationResults validationResult = e.getValidationResult(); - for (org.apache.airavata.model.error.ValidatorResult vResult : validationResult.getValidationResultList()) { - if (!vResult.isSetResult()) { - System.out.println("Error:" + vResult.getErrorDetails()); - } - } - throw e; - } catch (TException e) { - logger.error("Error occured while creating the experiment...", e.getMessage()); - throw new TException(e); - } - } +// public static String createEchoExperimentForLonestar(Airavata.Client client) throws TException { +// try { +// List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); +// DataObjectType input = new DataObjectType(); +// input.setKey("echo_input"); +// input.setType(DataType.STRING); +// input.setValue("echo_output=Hello World"); +// exInputs.add(input); +// +// List<DataObjectType> exOut = new ArrayList<DataObjectType>(); +// DataObjectType output = new DataObjectType(); +// output.setKey("echo_output"); +// output.setType(DataType.STRING); +// output.setValue(""); +// exOut.add(output); +// +// Project project = ProjectModelUtil.createProject("default", "admin", "test project"); +// String projectId = client.createProject(project); +// +// Experiment simpleExperiment = +// ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", "SimpleEcho4", echoAppId, exInputs); +// simpleExperiment.setExperimentOutputs(exOut); +// +// Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(echoAppId); +// if (computeResources != null && computeResources.size() != 0){ +// for (String id : computeResources.keySet()){ +// String resourceName = computeResources.get(id); +// if (resourceName.equals(stampedeHostName)){ +// ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 1, 0, 1, "TG-STA110014S"); +// UserConfigurationData userConfigurationData = new UserConfigurationData(); +// userConfigurationData.setAiravataAutoSchedule(false); +// userConfigurationData.setOverrideManualScheduledParams(false); +// userConfigurationData.setComputationalResourceScheduling(scheduling); +// simpleExperiment.setUserConfigurationData(userConfigurationData); +// return client.createExperiment(simpleExperiment); +// } +// } +// } +// ComputationalResourceScheduling scheduling = +// ExperimentModelUtil.createComputationResourceScheduling(sgeAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, "TG-STA110014S"); +// UserConfigurationData userConfigurationData = new UserConfigurationData(); +// 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 (LaunchValidationException e) { +// logger.error("Validation failed" + e.getErrorMessage()); +// org.apache.airavata.model.error.ValidationResults validationResult = e.getValidationResult(); +// for (org.apache.airavata.model.error.ValidatorResult vResult : validationResult.getValidationResultList()) { +// if (!vResult.isSetResult()) { +// System.out.println("Error:" + vResult.getErrorDetails()); +// } +// } +// throw e; +// } catch (TException e) { +// logger.error("Error occured while creating the experiment...", e.getMessage()); +// throw new TException(e); +// } +// } public static String createExperimentForBR2(Airavata.Client client) throws TException { try { List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); DataObjectType input = new DataObjectType(); - input.setKey("echo_input"); + input.setKey("Input_to_Echo"); input.setType(DataType.STRING); - input.setValue("echo_output=Hello World"); + input.setValue("Echoed_Output=Hello World"); exInputs.add(input); List<DataObjectType> exOut = new ArrayList<DataObjectType>(); DataObjectType output = new DataObjectType(); - output.setKey("echo_output"); + output.setKey("Echoed_Output"); output.setType(DataType.STRING); output.setValue(""); exOut.add(output); @@ -547,17 +572,24 @@ public class CreateLaunchExperiment { String projectId = client.createProject(project); Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SimpleEchoBR", br2EchoAppId.split(",")[1], exInputs); + ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SimpleEchoBR", echoAppId, exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(br2EchoAppId.split(",")[0], 1, 1, 1, "normal", 1, 0, 1, null); -// scheduling.setResourceHostId("bigred2.uits.iu.edu"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - userConfigurationData.setAiravataAutoSchedule(false); - userConfigurationData.setOverrideManualScheduledParams(false); - userConfigurationData.setComputationalResourceScheduling(scheduling); - simpleExperiment.setUserConfigurationData(userConfigurationData); - return client.createExperiment(simpleExperiment); + Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(echoAppId); + if (computeResources != null && computeResources.size() != 0){ + for (String id : computeResources.keySet()){ + String resourceName = computeResources.get(id); + if (resourceName.equals(br2HostName)){ + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 1, 1, 1, "normal", 1, 0, 1, null); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + 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); @@ -571,48 +603,49 @@ public class CreateLaunchExperiment { logger.error("Error occured while creating the experiment...", e.getMessage()); throw new TException(e); } + return null; } public static String createExperimentForBR2Amber(Airavata.Client client) throws TException { try { List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); DataObjectType input = new DataObjectType(); - input.setKey("AMBER_HEAT_RST"); + input.setKey("Heat_Restart_File"); input.setType(DataType.URI); input.setValue("/Users/lahirugunathilake/Downloads/02_Heat.rst"); exInputs.add(input); DataObjectType input1 = new DataObjectType(); - input1.setKey("AMBER_PROD_IN"); + input1.setKey("Production_Control_File"); input1.setType(DataType.URI); input1.setValue("/Users/lahirugunathilake/Downloads/03_Prod.in"); exInputs.add(input1); DataObjectType input2 = new DataObjectType(); - input2.setKey("AMBER_PRMTOP"); + input2.setKey("Parameter_Topology_File"); input2.setType(DataType.URI); input2.setValue("/Users/lahirugunathilake/Downloads/prmtop"); exInputs.add(input2); List<DataObjectType> exOut = new ArrayList<DataObjectType>(); DataObjectType output = new DataObjectType(); - output.setKey("AMBER_Prod.info"); + output.setKey("AMBER_Execution_Summary"); output.setType(DataType.URI); output.setValue(""); exOut.add(output); DataObjectType output1 = new DataObjectType(); - output1.setKey("AMBER_Prod.mdcrd"); + output1.setKey("AMBER_Execution_log"); output1.setType(DataType.URI); output1.setValue(""); exOut.add(output1); DataObjectType output2 = new DataObjectType(); - output2.setKey("AMBER_Prod.out"); + output2.setKey("AMBER_Trajectory_file"); output2.setType(DataType.URI); output2.setValue(""); exOut.add(output2); DataObjectType output3 = new DataObjectType(); - output3.setKey("AMBER_Prod.rst"); + output3.setKey("AMBER_Restart_file"); output3.setType(DataType.URI); output3.setValue(""); exOut.add(output3); @@ -621,17 +654,25 @@ public class CreateLaunchExperiment { String projectId = client.createProject(project); Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SimpleEchoBR", br2AmberAppId.split(",")[1], exInputs); + ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SimpleEchoBR", amberAppId, exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(br2AmberAppId.split(",")[0], 4, 1, 1, "cpu", 20, 0, 1, null); - scheduling.setResourceHostId("bigred2.uits.iu.edu"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - userConfigurationData.setAiravataAutoSchedule(false); - userConfigurationData.setOverrideManualScheduledParams(false); - userConfigurationData.setComputationalResourceScheduling(scheduling); - simpleExperiment.setUserConfigurationData(userConfigurationData); - return client.createExperiment(simpleExperiment); + + Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(amberAppId); + if (computeResources != null && computeResources.size() != 0){ + for (String id : computeResources.keySet()){ + String resourceName = computeResources.get(id); + if (resourceName.equals(br2HostName)){ + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "cpu", 20, 0, 1, null); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + 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); @@ -645,48 +686,49 @@ public class CreateLaunchExperiment { logger.error("Error occured while creating the experiment...", e.getMessage()); throw new TException(e); } + return null; } public static String createExperimentForStampedeAmber(Airavata.Client client) throws TException { try { List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); DataObjectType input = new DataObjectType(); - input.setKey("AMBER_HEAT_RST"); + input.setKey("Heat_Restart_File"); input.setType(DataType.URI); input.setValue("/Users/lahirugunathilake/Downloads/02_Heat.rst"); exInputs.add(input); DataObjectType input1 = new DataObjectType(); - input1.setKey("AMBER_PROD_IN"); + input1.setKey("Production_Control_File"); input1.setType(DataType.URI); input1.setValue("/Users/lahirugunathilake/Downloads/03_Prod.in"); exInputs.add(input1); DataObjectType input2 = new DataObjectType(); - input2.setKey("AMBER_PRMTOP"); + input2.setKey("Parameter_Topology_File"); input2.setType(DataType.URI); input2.setValue("/Users/lahirugunathilake/Downloads/prmtop"); exInputs.add(input2); List<DataObjectType> exOut = new ArrayList<DataObjectType>(); DataObjectType output = new DataObjectType(); - output.setKey("AMBER_Prod.info"); + output.setKey("AMBER_Execution_Summary"); output.setType(DataType.URI); output.setValue(""); exOut.add(output); DataObjectType output1 = new DataObjectType(); - output1.setKey("AMBER_Prod.mdcrd"); + output1.setKey("AMBER_Execution_Summary"); output1.setType(DataType.URI); output1.setValue(""); exOut.add(output1); DataObjectType output2 = new DataObjectType(); - output2.setKey("AMBER_Prod.out"); + output2.setKey("AMBER_Trajectory_file"); output2.setType(DataType.URI); output2.setValue(""); exOut.add(output2); DataObjectType output3 = new DataObjectType(); - output3.setKey("AMBER_Prod.rst"); + output3.setKey("AMBER_Restart_file"); output3.setType(DataType.URI); output3.setValue(""); exOut.add(output3); @@ -695,17 +737,24 @@ public class CreateLaunchExperiment { String projectId = client.createProject(project); Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SimpleEchoBR", slurmAmberAppId.split(",")[1], exInputs); + ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SimpleEchoBR", amberAppId, exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(slurmAmberAppId.split(",")[0], 4, 1, 1, "development", 20, 0, 1, null); - scheduling.setResourceHostId("bigred2.uits.iu.edu"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - userConfigurationData.setAiravataAutoSchedule(false); - userConfigurationData.setOverrideManualScheduledParams(false); - userConfigurationData.setComputationalResourceScheduling(scheduling); - simpleExperiment.setUserConfigurationData(userConfigurationData); - return client.createExperiment(simpleExperiment); + Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(amberAppId); + if (computeResources != null && computeResources.size() != 0){ + for (String id : computeResources.keySet()){ + String resourceName = computeResources.get(id); + if (resourceName.equals(stampedeHostName)){ + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "development", 20, 0, 1, null); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + 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); @@ -719,48 +768,49 @@ public class CreateLaunchExperiment { logger.error("Error occured while creating the experiment...", e.getMessage()); throw new TException(e); } + return null; } public static String createExperimentForTrestlesAmber(Airavata.Client client) throws TException { try { List<DataObjectType> exInputs = new ArrayList<DataObjectType>(); DataObjectType input = new DataObjectType(); - input.setKey("AMBER_HEAT_RST"); + input.setKey("Heat_Restart_File"); input.setType(DataType.URI); input.setValue("/Users/lahirugunathilake/Downloads/02_Heat.rst"); exInputs.add(input); DataObjectType input1 = new DataObjectType(); - input1.setKey("AMBER_PROD_IN"); + input1.setKey("Production_Control_File"); input1.setType(DataType.URI); input1.setValue("/Users/lahirugunathilake/Downloads/03_Prod.in"); exInputs.add(input1); DataObjectType input2 = new DataObjectType(); - input2.setKey("AMBER_PRMTOP"); + input2.setKey("Production_Control_File"); input2.setType(DataType.URI); input2.setValue("/Users/lahirugunathilake/Downloads/prmtop"); exInputs.add(input2); List<DataObjectType> exOut = new ArrayList<DataObjectType>(); DataObjectType output = new DataObjectType(); - output.setKey("AMBER_Prod.info"); + output.setKey("AMBER_Execution_Summary"); output.setType(DataType.URI); output.setValue(""); exOut.add(output); DataObjectType output1 = new DataObjectType(); - output1.setKey("AMBER_Prod.mdcrd"); + output1.setKey("AMBER_Execution_log"); output1.setType(DataType.URI); output1.setValue(""); exOut.add(output1); DataObjectType output2 = new DataObjectType(); - output2.setKey("AMBER_Prod.out"); + output2.setKey("AMBER_Trajectory_file"); output2.setType(DataType.URI); output2.setValue(""); exOut.add(output2); DataObjectType output3 = new DataObjectType(); - output3.setKey("AMBER_Prod.rst"); + output3.setKey("AMBER_Restart_file"); output3.setType(DataType.URI); output3.setValue(""); exOut.add(output3); @@ -769,17 +819,24 @@ public class CreateLaunchExperiment { String projectId = client.createProject(project); Experiment simpleExperiment = - ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SimpleEchoBR", trestlesAmberAppId.split(",")[1], exInputs); + ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "sshEchoExperiment", "SimpleEchoBR", amberAppId, exInputs); simpleExperiment.setExperimentOutputs(exOut); - ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(trestlesAmberAppId.split(",")[0], 4, 1, 1, "normal", 20, 0, 1, null); - scheduling.setResourceHostId("bigred2.uits.iu.edu"); - UserConfigurationData userConfigurationData = new UserConfigurationData(); - userConfigurationData.setAiravataAutoSchedule(false); - userConfigurationData.setOverrideManualScheduledParams(false); - userConfigurationData.setComputationalResourceScheduling(scheduling); - simpleExperiment.setUserConfigurationData(userConfigurationData); - return client.createExperiment(simpleExperiment); + Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(amberAppId); + if (computeResources != null && computeResources.size() != 0){ + for (String id : computeResources.keySet()){ + String resourceName = computeResources.get(id); + if (resourceName.equals(trestlesHostName)){ + ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling(id, 4, 1, 1, "normal", 20, 0, 1, null); + UserConfigurationData userConfigurationData = new UserConfigurationData(); + 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); @@ -793,6 +850,7 @@ public class CreateLaunchExperiment { logger.error("Error occured while creating the experiment...", e.getMessage()); throw new TException(e); } + return null; } public static void launchExperiment(Airavata.Client client, String expId) http://git-wip-us.apache.org/repos/asf/airavata/blob/2e109fa1/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java index 5a277d9..5e8bf60 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java @@ -36,13 +36,7 @@ import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelism import org.apache.airavata.model.appcatalog.appinterface.DataType; import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; -import org.apache.airavata.model.appcatalog.computeresource.JobManagerCommand; -import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager; -import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManagerType; -import org.apache.airavata.model.appcatalog.computeresource.SCPDataMovement; -import org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission; -import org.apache.airavata.model.appcatalog.computeresource.SecurityProtocol; +import org.apache.airavata.model.appcatalog.computeresource.*; import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference; import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile; import org.apache.airavata.model.error.AiravataClientException; @@ -57,10 +51,12 @@ public class RegisterSampleApplications { // public static final int THRIFT_SERVER_PORT = 9930; public static final int THRIFT_SERVER_PORT = 8930; private final static Logger logger = LoggerFactory.getLogger(RegisterSampleApplications.class); - private static final String DEFAULT_GATEWAY = "default"; +// private static final String DEFAULT_GATEWAY = "default"; + private static final String DEFAULT_GATEWAY = "php_reference_gateway"; private Airavata.Client airavataClient; //Host Id's + private static String localhostId = ""; private static String stampedeResourceId = "stampede.tacc.xsede.org_92ac5ed6-35a5-4910-82ef-48f128f9245a"; private static String trestlesResourceId = "trestles.sdsc.xsede.org_db29986e-5a27-4949-ae7f-04a6012d0d35"; private static String bigredResourceId = "bigred2.uits.iu.edu_3eae6e9d-a1a7-44ec-ac85-3796ef726ef1"; @@ -100,6 +96,7 @@ public class RegisterSampleApplications { //App Interface Id's private static String echoInterfaceId = ""; + private static String echoLocalInterfaceId = ""; private static String amberInterfaceId = ""; private static String autoDockInterfaceId = ""; private static String espressoInterfaceId = ""; @@ -112,6 +109,7 @@ public class RegisterSampleApplications { public RegisterSampleApplications(Airavata.Client airavataClient) { this.airavataClient = airavataClient; } + public static void main(String[] args) { try { Airavata.Client airavataClient = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST, THRIFT_SERVER_PORT); @@ -143,6 +141,27 @@ public class RegisterSampleApplications { } } + public void registerLocalHost() { + try { + System.out.println("\n #### Registering Localhost Computational Resource #### \n"); + + ComputeResourceDescription computeResourceDescription = RegisterSampleApplicationsUtils. + createComputeResourceDescription("localhost", "LocalHost", null, null); + localhostId = airavataClient.registerComputeResource(computeResourceDescription); + ResourceJobManager resourceJobManager = RegisterSampleApplicationsUtils. + createResourceJobManager(ResourceJobManagerType.FORK, null, null, null); + LOCALSubmission submission = new LOCALSubmission(); + submission.setResourceJobManager(resourceJobManager); + boolean localSubmission = airavataClient.addLocalSubmissionDetails(localhostId, 1, submission); + if (!localSubmission) throw new AiravataClientException(); + System.out.println("LocalHost Resource Id is " + localhostId); + + } catch (TException e) { + e.printStackTrace(); + } + + } + public void registerXSEDEHosts() { try { System.out.println("\n #### Registering XSEDE Computational Resources #### \n"); @@ -235,6 +254,8 @@ public class RegisterSampleApplications { public void registerAppDeployments() { System.out.println("\n #### Registering Application Deployments #### \n"); + //Registering localhost echo App + registerLocalApps(); //Registering Stampede Apps registerStampedeApps(); @@ -247,8 +268,11 @@ public class RegisterSampleApplications { public void registerAppInterfaces() { System.out.println("\n #### Registering Application Interfaces #### \n"); - registerGromaxWorkflowInterfaces(); - +// registerGromaxWorkflowInterfaces(); + + //Registering local Echo +// registerLocalEchoInterface(); + //Registering Echo registerEchoInterface(); @@ -280,10 +304,10 @@ public class RegisterSampleApplications { public void registerGromaxWorkflowInterfaces() { try { - System.out.println("#### Registering Echo Interface #### \n"); + System.out.println("#### Registering Gromax Interface #### \n"); List<String> appModules = new ArrayList<String>(); - appModules.add(echoModuleId); + appModules.add(gromacsModuleId); List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>(); @@ -297,7 +321,7 @@ public class RegisterSampleApplications { applicationOutputs.add(RegisterSampleApplicationsUtils.createAppOutput("topology", "", DataType.URI)); - echoInterfaceId = airavataClient.registerApplicationInterface( + gromacsInterfaceId = airavataClient.registerApplicationInterface( RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("pb2gmx", "pb2gmx", appModules, applicationInputs, applicationOutputs)); @@ -317,7 +341,7 @@ public class RegisterSampleApplications { applicationOutputs.add(RegisterSampleApplicationsUtils.createAppOutput("energy_min_struct", "", DataType.URI)); - echoInterfaceId = airavataClient.registerApplicationInterface( + gromacsInterfaceId = airavataClient.registerApplicationInterface( RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("simulation1", "simulation1", appModules, applicationInputs, applicationOutputs)); @@ -331,7 +355,7 @@ public class RegisterSampleApplications { applicationOutputs.add(RegisterSampleApplicationsUtils.createAppOutput("struct_with_pbc", "", DataType.URI)); - echoInterfaceId = airavataClient.registerApplicationInterface( + gromacsInterfaceId = airavataClient.registerApplicationInterface( RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("editconf", "Edit configuration", appModules, applicationInputs, applicationOutputs)); @@ -352,7 +376,7 @@ public class RegisterSampleApplications { "", DataType.URI)); - echoInterfaceId = airavataClient.registerApplicationInterface( + gromacsInterfaceId = airavataClient.registerApplicationInterface( RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("genbox", "genbox", appModules, applicationInputs, applicationOutputs)); @@ -370,7 +394,7 @@ public class RegisterSampleApplications { applicationOutputs.add(RegisterSampleApplicationsUtils.createAppOutput("struct_topoogy", "", DataType.URI)); - echoInterfaceId = airavataClient.registerApplicationInterface( + gromacsInterfaceId = airavataClient.registerApplicationInterface( RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("grompp", "grompp", appModules, applicationInputs, applicationOutputs)); @@ -389,7 +413,7 @@ public class RegisterSampleApplications { applicationOutputs.add(RegisterSampleApplicationsUtils.createAppOutput("sys_config", "", DataType.URI)); - echoInterfaceId = airavataClient.registerApplicationInterface( + gromacsInterfaceId = airavataClient.registerApplicationInterface( RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("genion", "grompp", appModules, applicationInputs, applicationOutputs)); @@ -407,18 +431,46 @@ public class RegisterSampleApplications { applicationOutputs.add(RegisterSampleApplicationsUtils.createAppOutput("energymin_sys", "", DataType.URI)); - echoInterfaceId = airavataClient.registerApplicationInterface( + gromacsInterfaceId = airavataClient.registerApplicationInterface( RegisterSampleApplicationsUtils.createApplicationInterfaceDescription("simulation2", "simulation2", appModules, applicationInputs, applicationOutputs)); - System.out.println("Echo Application Interface Id " + echoInterfaceId); + System.out.println("Gromax Application Interface Id " + echoInterfaceId); + + } catch (TException e) { + e.printStackTrace(); + } + } + + public void registerLocalEchoInterface() { + try { + System.out.println("#### Registering Echo Interface #### \n"); + + List<String> appModules = new ArrayList<String>(); + appModules.add(echoModuleId); + + InputDataObjectType input1 = RegisterSampleApplicationsUtils.createAppInput("echo_input", "echo_output=Hello World", + DataType.STRING, null, false, "A test string to Echo", null); + + List<InputDataObjectType> applicationInputs = new ArrayList<InputDataObjectType>(); + applicationInputs.add(input1); + + OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("echo_output", + "", DataType.STRING); + + List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>(); + applicationOutputs.add(output1); + + echoLocalInterfaceId = airavataClient.registerApplicationInterface( + RegisterSampleApplicationsUtils.createApplicationInterfaceDescription(echoName, echoDescription, + appModules, applicationInputs, applicationOutputs)); + System.out.println("Local Echo Application Interface Id " + echoLocalInterfaceId); } catch (TException e) { e.printStackTrace(); } } - public void registerEchoInterface() { try { System.out.println("#### Registering Echo Interface #### \n"); @@ -730,6 +782,21 @@ public class RegisterSampleApplications { } } + public void registerLocalApps (){ + try { + System.out.println("#### Registering Application Deployments on Localhost #### \n"); + //Register Echo + String echoAppDeployId = airavataClient.registerApplicationDeployment( + RegisterSampleApplicationsUtils.createApplicationDeployment(echoModuleId, localhostId, + "/bin/echo", ApplicationParallelismType.SERIAL, echoDescription)); + + + System.out.println("Echo on localhost Id " + echoAppDeployId); + }catch (TException e) { + e.printStackTrace(); + } + } + public void registerStampedeApps() { try { System.out.println("#### Registering Application Deployments on Stampede #### \n"); http://git-wip-us.apache.org/repos/asf/airavata/blob/2e109fa1/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java index c4040c4..87be3b6 100644 --- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java +++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java @@ -30,6 +30,7 @@ import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule; import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription; import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; +import org.apache.airavata.model.appcatalog.appinterface.applicationInterfaceModelConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,7 +47,11 @@ public class ApplicationInterfaceImpl implements ApplicationInterface { try { AppModuleResource moduleResource = new AppModuleResource(); moduleResource.setModuleName(applicationModule.getAppModuleName()); - moduleResource.setModuleId(AppCatalogUtils.getID(applicationModule.getAppModuleName())); + if (!applicationModule.getAppModuleId().equals("") && !applicationModule.getAppModuleId().equals(applicationInterfaceModelConstants.DEFAULT_ID)){ + moduleResource.setModuleId(applicationModule.getAppModuleId()); + }else { + moduleResource.setModuleId(AppCatalogUtils.getID(applicationModule.getAppModuleName())); + } moduleResource.setModuleDesc(applicationModule.getAppModuleDescription()); moduleResource.setModuleVersion(applicationModule.getAppModuleVersion()); moduleResource.save(); @@ -63,7 +68,11 @@ public class ApplicationInterfaceImpl implements ApplicationInterface { try { AppInterfaceResource resource = new AppInterfaceResource(); resource.setAppName(applicationInterfaceDescription.getApplicationName()); - resource.setInterfaceId(AppCatalogUtils.getID(applicationInterfaceDescription.getApplicationName())); + if (!applicationInterfaceDescription.getApplicationInterfaceId().equals("") && !applicationInterfaceDescription.getApplicationInterfaceId().equals(applicationInterfaceModelConstants.DEFAULT_ID)){ + resource.setInterfaceId(applicationInterfaceDescription.getApplicationInterfaceId()); + }else { + resource.setInterfaceId(AppCatalogUtils.getID(applicationInterfaceDescription.getApplicationName())); + } resource.setAppDescription(applicationInterfaceDescription.getApplicationDesription()); resource.save(); applicationInterfaceDescription.setApplicationInterfaceId(resource.getInterfaceId()); http://git-wip-us.apache.org/repos/asf/airavata/blob/2e109fa1/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java index 03f8625..2b13cee 100644 --- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java +++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java @@ -38,7 +38,9 @@ public class ComputeResourceImpl implements ComputeResource { @Override public String addComputeResource(ComputeResourceDescription description) throws AppCatalogException { try { - description.setComputeResourceId(AppCatalogUtils.getID(description.getHostName())); + if (description.getComputeResourceId().equals("") || !description.getComputeResourceId().equals(computeResourceModelConstants.DEFAULT_ID)){ + description.setComputeResourceId(AppCatalogUtils.getID(description.getHostName())); + } return saveComputeResourceDescriptorData(description); } catch (Exception e) { logger.error("Error while saving compute resource...", e); http://git-wip-us.apache.org/repos/asf/airavata/blob/2e109fa1/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java index 279ff0e..ed66bff 100644 --- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java +++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java @@ -26,6 +26,7 @@ import java.util.List; import org.airavata.appcatalog.cpi.AppCatalogException; import org.airavata.appcatalog.cpi.GwyResourceProfile; +import org.apache.aiaravata.application.catalog.data.model.GatewayProfile; import org.apache.aiaravata.application.catalog.data.resources.AbstractResource; import org.apache.aiaravata.application.catalog.data.resources.ComputeHostPreferenceResource; import org.apache.aiaravata.application.catalog.data.resources.ComputeResourceResource; @@ -35,6 +36,7 @@ import org.apache.aiaravata.application.catalog.data.util.AppCatalogThriftConver import org.apache.aiaravata.application.catalog.data.util.AppCatalogUtils; import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference; import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile; +import org.apache.airavata.model.appcatalog.gatewayprofile.gatewayResourceProfileModelConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,7 +48,11 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { try { GatewayProfileResource profileResource = new GatewayProfileResource(); profileResource.setGatewayName(gatewayProfile.getGatewayName()); - profileResource.setGatewayID(AppCatalogUtils.getID(gatewayProfile.getGatewayName())); + if (!gatewayProfile.getGatewayID().equals("") && !gatewayProfile.getGatewayID().equals(gatewayResourceProfileModelConstants.DEFAULT_ID)){ + profileResource.setGatewayID(gatewayProfile.getGatewayID()); + }else { + profileResource.setGatewayID(AppCatalogUtils.getID(gatewayProfile.getGatewayName())); + } profileResource.setGatewayDesc(gatewayProfile.getGatewayDescription()); profileResource.save(); gatewayProfile.setGatewayID(profileResource.getGatewayID()); http://git-wip-us.apache.org/repos/asf/airavata/blob/2e109fa1/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql b/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql index 8e27188..9ed5ca9 100644 --- a/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql +++ b/modules/registry/airavata-jpa-registry/src/main/resources/registry-derby.sql @@ -21,7 +21,7 @@ CREATE TABLE GATEWAY ( GATEWAY_NAME VARCHAR(255), - OWNER VARCHAR(255), + OWNER VARCHAR(255), PRIMARY KEY (GATEWAY_NAME) );
