Search in sources :

Example 11 with AiravataClientException

use of org.apache.airavata.model.error.AiravataClientException in project airavata by apache.

the class LaunchApplicationWindow method initGUI.

private void initGUI() {
    this.parameterPanel = new GridPanel(true);
    this.instanceNameTextField = new XBayaTextField();
    XBayaLabel instanceNameLabel = new XBayaLabel("Experiment name", this.instanceNameTextField);
    GridPanel infoPanel = new GridPanel();
    infoPanel.add(instanceNameLabel);
    infoPanel.add(this.instanceNameTextField);
    infoPanel.layout(1, 2, GridPanel.WEIGHT_NONE, 1);
    GridPanel mainPanel = new GridPanel();
    mainPanel.getContentPanel().setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    mainPanel.add(infoPanel);
    mainPanel.add(this.parameterPanel);
    mainPanel.layout(2, 1, 0, 0);
    JButton okButton = new JButton("Run");
    okButton.addActionListener(new AbstractAction() {

        public void actionPerformed(ActionEvent event) {
            try {
                execute();
            } catch (AiravataClientConnectException e) {
                logger.error(e.getMessage(), e);
            } catch (InvalidRequestException e) {
                logger.error(e.getMessage(), e);
            } catch (AiravataClientException e) {
                logger.error(e.getMessage(), e);
            } catch (AiravataSystemException e) {
                logger.error(e.getMessage(), e);
            } catch (TException e) {
                logger.error(e.getMessage(), e);
            }
        }
    });
    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            hide();
        }
    });
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(okButton);
    buttonPanel.add(cancelButton);
    buttonPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    this.dialog = new XBayaDialog(this.engine.getGUI(), "Launch  workflow", mainPanel, buttonPanel);
    this.dialog.setDefaultButton(okButton);
}
Also used : TException(org.apache.thrift.TException) JPanel(javax.swing.JPanel) XBayaDialog(org.apache.airavata.xbaya.ui.dialogs.XBayaDialog) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) GridPanel(org.apache.airavata.xbaya.ui.widgets.GridPanel) AiravataClientConnectException(org.apache.airavata.model.error.AiravataClientConnectException) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) AbstractAction(javax.swing.AbstractAction) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 12 with AiravataClientException

use of org.apache.airavata.model.error.AiravataClientException in project airavata by apache.

the class LaunchApplicationWindow method show.

/**
 * Shows the dialog.
 */
public void show() {
    this.workflow = this.engine.getGUI().getWorkflow();
    // Create input fields
    // Collection<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
    // for (InputNode node : inputNodes) {
    // String id = node.getID();
    // QName parameterType = node.getParameterType();
    // JLabel nameLabel = new JLabel(id);
    // JLabel typeField = new JLabel(parameterType.getLocalPart());
    // XBayaTextField paramField = new XBayaTextField();
    // Object value = node.getDefaultValue();
    // 
    // String valueString;
    // if (value == null) {
    // valueString = "";
    // } else {
    // if (value instanceof XmlElement) {
    // XmlElement valueElement = (XmlElement) value;
    // valueString = XMLUtil.xmlElementToString(valueElement);
    // } else {
    // // Only string comes here for now.
    // valueString = value.toString();
    // }
    // }
    // paramField.setText(valueString);
    List<NodeImpl> nodes = workflow.getGraph().getNodes();
    NodeImpl node = null;
    for (int i = 0; i < nodes.size(); i++) {
        node = nodes.get(i);
        String html = node.getComponent().toHTML();
        String nodeType = html.substring(html.indexOf("<h1>") + 4, html.indexOf(":")).trim();
        if (nodeType.equals("Application")) {
            break;
        }
    }
    List<DataPort> inputPorts = node.getInputPorts();
    for (DataPort port : inputPorts) {
        String id = port.getName();
        DataType parameterType = port.getType();
        JLabel nameLabel = new JLabel(id);
        JLabel typeField = new JLabel(parameterType.toString());
        XBayaTextField paramField = new XBayaTextField();
        paramField.setText("");
        this.parameterPanel.add(nameLabel);
        this.parameterPanel.add(typeField);
        this.parameterPanel.add(paramField);
        this.parameterTextFields.add(paramField);
    }
    Map<String, String> hosts = null;
    try {
        hosts = airavataClient.getAllComputeResourceNames();
    } catch (InvalidRequestException e) {
        logger.error(e.getMessage(), e);
    } catch (AiravataClientException e) {
        logger.error(e.getMessage(), e);
    } catch (AiravataSystemException e) {
        logger.error(e.getMessage(), e);
    } catch (TException e) {
        logger.error(e.getMessage(), e);
    }
    hostNames = new HashMap<String, String>();
    Iterator it = hosts.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry) it.next();
        String key = (String) pairs.getKey();
        String value = (String) pairs.getValue();
        if (!hostNames.containsKey(value)) {
            hostNames.put(value, key);
        }
    }
    host = new JComboBox();
    it = hostNames.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry) it.next();
        String key = (String) pairs.getKey();
        host.addItem(key);
    }
    host.setSelectedIndex(1);
    XBayaLabel hostLabel = new XBayaLabel("Host", this.host);
    this.parameterPanel.add(hostLabel);
    this.parameterPanel.add(host);
    // this.parameterPanel.layout(inputNodes.size()+1, 2, GridPanel.WEIGHT_NONE, 2);
    this.dialog.show();
}
Also used : TException(org.apache.thrift.TException) NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) DataPort(org.apache.airavata.workflow.model.graph.DataPort) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) Iterator(java.util.Iterator) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) HashMap(java.util.HashMap) Map(java.util.Map) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 13 with AiravataClientException

use of org.apache.airavata.model.error.AiravataClientException in project airavata by apache.

the class CreateLaunchExperimentUS3 method createUS3ExperimentForStampede.

public static String createUS3ExperimentForStampede(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("project1", "admin", "test project");
        String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "ultrascan", "US3ExperimentStampede", "US3AppStampede", "ultrascan_7ce6cd43-622c-44e0-87c5-fb7a6528c799", exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("stampede.tacc.xsede.org_e59e046f-e0e1-49c4-8475-2fab2e35d044", 32, 2, 0, "normal", 30, 0);
        scheduling.setResourceHostId("stampede.tacc.xsede.org_e59e046f-e0e1-49c4-8475-2fab2e35d044");
        UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
        userConfigurationData.setAiravataAutoSchedule(false);
        userConfigurationData.setOverrideManualScheduledParams(false);
        userConfigurationData.setComputationalResourceScheduling(scheduling);
        /*            AdvancedOutputDataHandling dataHandling = new AdvancedOutputDataHandling();
            dataHandling.setOutputDataDir("/home/sgg/chathuri/laptop_backup/airavata");
            userConfigurationData.setAdvanceOutputDataHandling(dataHandling);*/
        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);
    }
}
Also used : TException(org.apache.thrift.TException) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) Project(org.apache.airavata.model.workspace.Project) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Example 14 with AiravataClientException

use of org.apache.airavata.model.error.AiravataClientException in project airavata by apache.

the class CreateLaunchExperimentUS3 method createExperimentForTrestles.

// public static void addDescriptors() throws AiravataAPIInvocationException,ApplicationSettingsException  {
// try {
// UltrascanDocumentCreator documentCreator = new UltrascanDocumentCreator(getAiravataAPI());
// documentCreator.createMPIPBSDocsTrestles();
// documentCreator.createEchoPBSDocsforTestles();
// documentCreator.createEchoSlurmDocsofStampede();
// documentCreator.createMPISLURMDocsStampede();
// } catch (AiravataAPIInvocationException e) {
// logger.error("Unable to create airavata API", e.getMessage());
// throw new AiravataAPIInvocationException(e);
// } catch (ApplicationSettingsException e) {
// logger.error("Unable to create airavata API", e.getMessage());
// throw new ApplicationSettingsException(e.getMessage());
// }
// }
// private static AiravataAPI getAiravataAPI() throws AiravataAPIInvocationException, ApplicationSettingsException {
// AiravataAPI airavataAPI;
// try {
// String sysUser = ClientSettings.getSetting(DEFAULT_USER);
// String gateway = ClientSettings.getSetting(DEFAULT_GATEWAY);
// airavataAPI = AiravataAPIFactory.getAPI(gateway, sysUser);
// } catch (AiravataAPIInvocationException e) {
// logger.error("Unable to create airavata API", e.getMessage());
// throw new AiravataAPIInvocationException(e);
// } catch (ApplicationSettingsException e) {
// logger.error("Unable to create airavata API", e.getMessage());
// throw new ApplicationSettingsException(e.getMessage());
// }
// return airavataAPI;
// }
public static String createExperimentForTrestles(Airavata.Client client) throws TException {
    try {
        List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>();
        InputDataObjectType input = new InputDataObjectType();
        input.setName("echo_input");
        input.setType(DataType.STRING);
        input.setValue("echo_output=Hello World");
        exInputs.add(input);
        List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
        OutputDataObjectType output = new OutputDataObjectType();
        output.setName("echo_output");
        output.setType(DataType.STRING);
        output.setValue("");
        exOut.add(output);
        Project project = ProjectModelUtil.createProject("project1", "admin", "test project");
        String projectId = client.createProject(new AuthzToken(""), DEFAULT_GATEWAY, project);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, projectId, "admin", "US3EchoExperimentTrestles", "US3EchoTrestles", "US3EchoTrestles", exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "shared", 0, 0);
        scheduling.setResourceHostId("gsissh-trestles");
        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);
    }
}
Also used : TException(org.apache.thrift.TException) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) Project(org.apache.airavata.model.workspace.Project) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Example 15 with AiravataClientException

use of org.apache.airavata.model.error.AiravataClientException in project airavata by apache.

the class CreateLaunchExperimentUS3 method createUS3ExperimentForLonestar.

public static String createUS3ExperimentForLonestar(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/airavata/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("project1", "admin", "test project");
        // String projectId = client.createProject(project);
        ExperimentModel simpleExperiment = ExperimentModelUtil.createSimpleExperiment(DEFAULT_GATEWAY, "ultrascan_41574ef5-b054-4d03-ab20-2cfe768d5096", "ultrascan", "US3ExperimentLonestar", "US3AppLonestar", "ultrascan_e76ab5cf-79f6-44df-a244-10a734183fec", exInputs);
        simpleExperiment.setExperimentOutputs(exOut);
        ComputationalResourceSchedulingModel scheduling = ExperimentModelUtil.createComputationResourceScheduling("lonestar.tacc.teragrid.org_2e0273bc-324b-419b-9786-38a360d44772", 12, 2, 0, "normal", 30, 0);
        scheduling.setResourceHostId("lonestar.tacc.teragrid.org_2e0273bc-324b-419b-9786-38a360d44772");
        UserConfigurationDataModel userConfigurationData = new UserConfigurationDataModel();
        userConfigurationData.setAiravataAutoSchedule(false);
        userConfigurationData.setOverrideManualScheduledParams(false);
        userConfigurationData.setComputationalResourceScheduling(scheduling);
        /*            AdvancedOutputDataHandling dataHandling = new AdvancedOutputDataHandling();
            dataHandling.setOutputDataDir("/home/airavata/output/");
            userConfigurationData.setAdvanceOutputDataHandling(dataHandling);*/
        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);
    }
}
Also used : TException(org.apache.thrift.TException) InputDataObjectType(org.apache.airavata.model.application.io.InputDataObjectType) ArrayList(java.util.ArrayList) ExperimentModel(org.apache.airavata.model.experiment.ExperimentModel) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) OutputDataObjectType(org.apache.airavata.model.application.io.OutputDataObjectType) UserConfigurationDataModel(org.apache.airavata.model.experiment.UserConfigurationDataModel) AuthzToken(org.apache.airavata.model.security.AuthzToken) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) ComputationalResourceSchedulingModel(org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)

Aggregations

AiravataClientException (org.apache.airavata.model.error.AiravataClientException)26 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)15 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)15 TException (org.apache.thrift.TException)15 AuthzToken (org.apache.airavata.model.security.AuthzToken)12 HashMap (java.util.HashMap)7 ArrayList (java.util.ArrayList)6 InputDataObjectType (org.apache.airavata.model.application.io.InputDataObjectType)6 OutputDataObjectType (org.apache.airavata.model.application.io.OutputDataObjectType)6 ExperimentModel (org.apache.airavata.model.experiment.ExperimentModel)6 UserConfigurationDataModel (org.apache.airavata.model.experiment.UserConfigurationDataModel)6 ComputationalResourceSchedulingModel (org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel)6 SCPDataMovement (org.apache.airavata.model.data.movement.SCPDataMovement)5 Project (org.apache.airavata.model.workspace.Project)5 XBayaLabel (org.apache.airavata.xbaya.ui.widgets.XBayaLabel)4 XBayaTextField (org.apache.airavata.xbaya.ui.widgets.XBayaTextField)4 JLabel (javax.swing.JLabel)3 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)3 TProtocol (org.apache.thrift.protocol.TProtocol)3 TSocket (org.apache.thrift.transport.TSocket)3