Search in sources :

Example 6 with AiravataClientException

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

the class RegisterOGCEUS3Application method registerComputeHost.

public static String registerComputeHost(String hostName, String hostDesc, ResourceJobManagerType resourceJobManagerType, String monitoringEndPoint, String jobMangerBinPath, SecurityProtocol securityProtocol, int portNumber, String jobManagerCommand) throws TException {
    ComputeResourceDescription computeResourceDescription = RegisterSampleApplicationsUtils.createComputeResourceDescription(hostName, hostDesc, null, null);
    String computeResourceId = airavataClient.registerComputeResource(new AuthzToken(""), computeResourceDescription);
    if (computeResourceId.isEmpty())
        throw new AiravataClientException();
    ResourceJobManager resourceJobManager = RegisterSampleApplicationsUtils.createResourceJobManager(resourceJobManagerType, monitoringEndPoint, jobMangerBinPath, null);
    if (jobManagerCommand != null) {
        Map<JobManagerCommand, String> jobManagerCommandStringMap = new HashMap<JobManagerCommand, String>();
        jobManagerCommandStringMap.put(JobManagerCommand.SUBMISSION, jobManagerCommand);
        resourceJobManager.setJobManagerCommands(jobManagerCommandStringMap);
    }
    SSHJobSubmission sshJobSubmission = new SSHJobSubmission();
    sshJobSubmission.setResourceJobManager(resourceJobManager);
    sshJobSubmission.setSecurityProtocol(securityProtocol);
    sshJobSubmission.setSshPort(portNumber);
    airavataClient.addSSHJobSubmissionDetails(new AuthzToken(""), computeResourceId, 1, sshJobSubmission);
    SCPDataMovement scpDataMovement = new SCPDataMovement();
    scpDataMovement.setSecurityProtocol(securityProtocol);
    scpDataMovement.setSshPort(portNumber);
    airavataClient.addSCPDataMovementDetails(new AuthzToken(""), computeResourceId, DMType.COMPUTE_RESOURCE, 1, scpDataMovement);
    return computeResourceId;
}
Also used : SCPDataMovement(org.apache.airavata.model.data.movement.SCPDataMovement) HashMap(java.util.HashMap) AuthzToken(org.apache.airavata.model.security.AuthzToken) AiravataClientException(org.apache.airavata.model.error.AiravataClientException)

Example 7 with AiravataClientException

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

the class WorkflowInterpreterLaunchWindow method initGUI.

private void initGUI() {
    this.parameterPanel = new GridPanel(true);
    GridPanel infoPanel = new GridPanel();
    this.instanceNameTextField = new XBayaTextField();
    XBayaLabel instanceNameLabel = new XBayaLabel("Experiment name", this.instanceNameTextField);
    infoPanel.add(instanceNameLabel);
    infoPanel.add(this.instanceNameTextField);
    token = new XBayaTextField("");
    JLabel tokenLabel = new JLabel("Token Id: ");
    infoPanel.add(tokenLabel);
    infoPanel.add(token);
    infoPanel.layout(2, 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 e) {
            try {
                execute();
            } catch (AiravataClientConnectException e1) {
                e1.printStackTrace();
            } catch (InvalidRequestException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            } catch (AiravataClientException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            } catch (AiravataSystemException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            } catch (TException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
    });
    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) JLabel(javax.swing.JLabel) 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 8 with AiravataClientException

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

the class WorkflowInterpreterLaunchWindow 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();
        DataType parameterType = node.getParameterType();
        JLabel nameLabel = new JLabel(id);
        JLabel typeField = new JLabel(parameterType.toString());
        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);
        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();
        if (hosts.isEmpty()) {
            JOptionPane.showMessageDialog(engine.getGUI().getFrame(), "No Compute Resources found", "Compute Resources", JOptionPane.ERROR_MESSAGE);
            return;
        }
    } catch (InvalidRequestException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
    } catch (AiravataClientException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
    } catch (AiravataSystemException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
    } catch (TException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
    }
    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(0);
    XBayaLabel hostLabel = new XBayaLabel("Host", host);
    this.parameterPanel.add(hostLabel);
    this.parameterPanel.add(host);
    this.parameterPanel.layout(inputNodes.size(), 3, GridPanel.WEIGHT_NONE, 2);
    this.dialog.show();
}
Also used : TException(org.apache.thrift.TException) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) Iterator(java.util.Iterator) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) XmlElement(org.xmlpull.infoset.XmlElement) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) Map(java.util.Map) HashMap(java.util.HashMap) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 9 with AiravataClientException

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

the class OrchestratorClientFactory method createOrchestratorClient.

public static OrchestratorService.Client createOrchestratorClient(String serverHost, int serverPort) throws AiravataClientException {
    try {
        TTransport transport = new TSocket(serverHost, serverPort);
        transport.open();
        TProtocol protocol = new TBinaryProtocol(transport);
        return new OrchestratorService.Client(protocol);
    } catch (TTransportException e) {
        throw new AiravataClientException();
    }
}
Also used : TBinaryProtocol(org.apache.thrift.protocol.TBinaryProtocol) TProtocol(org.apache.thrift.protocol.TProtocol) TTransportException(org.apache.thrift.transport.TTransportException) TTransport(org.apache.thrift.transport.TTransport) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) TSocket(org.apache.thrift.transport.TSocket)

Example 10 with AiravataClientException

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

the class WorkflowImportWindow method show.

/**
 * Shows the window.
 */
public void show() {
    /*
         * this.list.getList().setListData( new String[]{ "Loading the workflow list from the Registry.",
         * "Please wait for a moment."});
         */
    this.list.setEnabled(false);
    this.okButton.setEnabled(false);
    this.deleteButton.setEnabled(false);
    new Thread() {

        @Override
        public void run() {
            try {
                SwingUtilities.invokeLater(new Runnable() {

                    public void run() {
                        try {
                            // FIXME: Update the gateway id fetched from UI
                            List<String> resultList = getClient().getAllWorkflows(engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE).getGatewayId());
                            if (resultList == null || resultList.size() == 0) {
                            /*
								     * OGCEXRegistryLoaderWindow.this.list.getList(). setListData( new
								     * String[]{"No workflow"});
								     */
                            } else {
                                Vector<RegistrySearchResult> results = new Vector<RegistrySearchResult>();
                                String val = null;
                                for (String key : resultList) {
                                    results.add(new RegistrySearchResult(new QName(key), key, key));
                                }
                                WorkflowImportWindow.this.list.setListData(results);
                                WorkflowImportWindow.this.list.setEnabled(true);
                            }
                        } catch (InvalidRequestException e) {
                            log.error(e.getMessage(), e);
                        } catch (AiravataClientException e) {
                            log.error(e.getMessage(), e);
                        } catch (AiravataSystemException e) {
                            log.error(e.getMessage(), e);
                        } catch (TException e) {
                            log.error(e.getMessage(), e);
                        }
                    }
                });
            } catch (RuntimeException e) {
                WorkflowImportWindow.this.engine.getGUI().getErrorWindow().error(ErrorMessages.REGISTRY_WORKFLOW_LIST_LOAD_ERROR, e);
                hide();
            } catch (Error e) {
                WorkflowImportWindow.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
                hide();
            }
        }
    }.start();
    // This has to be the last because it blocks when the dialog is modal.
    this.dialog.show();
}
Also used : TException(org.apache.thrift.TException) RegistrySearchResult(org.apache.airavata.xbaya.ui.experiment.RegistrySearchResult) QName(javax.xml.namespace.QName) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) Vector(java.util.Vector)

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