Package org.apache.airavata.ws.monitor

Examples of org.apache.airavata.ws.monitor.Monitor


    }

    public void monitor(final String experimentId) throws Exception {
        AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(new URI(getRegistryURL()), getGatewayName(), getUserName(),
                new PasswordCallbackImpl());
        final Monitor experimentMonitor = airavataAPI.getExecutionManager().getExperimentMonitor(experimentId,
                new EventDataListenerAdapter() {

                    @Override
                    public void notify(EventDataRepository eventDataRepo, EventData eventData) {
                        Assert.assertNotNull(eventDataRepo);
                        Assert.assertNotNull(eventData);
                        if (MonitorUtil.EventType.WORKFLOW_TERMINATED.equals(eventData.getType())) {
                            try {
                                BaseCaseIT.this.verifyOutput(experimentId, "echo_output=Airavata_Test");
                            } catch (Exception e) {
                                log.error("Error verifying output", e);
                                Assert.fail("Error occurred while verifying output.");
                            } finally {
                                getMonitor().stopMonitoring();
                            }
                        }
                        log.info("No of events: " + eventDataRepo.getEvents().size());
                    }
                });
        experimentMonitor.startMonitoring();
        experimentMonitor.waitForCompletion();
    }
View Full Code Here


        // Creates some essential objects.

        MonitorConfiguration monitorConfiguration = new MonitorConfiguration(configuration.getBrokerURL(),
                configuration.getTopic(), configuration.isPullMode(), configuration.getMessageBoxURL());
        this.monitor = new Monitor(monitorConfiguration);

        // MyProxy
        // this.myProxyClient = new MyProxyClient(this.configuration.getMyProxyServer(),
        // this.configuration.getMyProxyPort(), this.configuration.getMyProxyUsername(),
        // this.configuration.getMyProxyPassphrase(), this.configuration.getMyProxyLifetime());
View Full Code Here

        PasswordCallback passwordCallback = new PasswordCallbackImpl(RunWorkflow.getUserName(),
                RunWorkflow.getPassword());
        AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(new URI(RunWorkflow.getRegistryURL()),
                RunWorkflow.getGatewayName(), RunWorkflow.getUserName(), passwordCallback);
        MonitorListener monitorListener = new MonitorListener();
        Monitor experimentMonitor = airavataAPI.getExecutionManager().getExperimentMonitor(experimentId,
                monitorListener);
        log.info("Started the Workflow monitor");
        experimentMonitor.startMonitoring();
    }
View Full Code Here

     */
    public RunMenuItem(XBayaEngine engine, XBayaToolBar toolBar) {
        this.engine = engine;
        setToolBar(toolBar);
        createWorkflowMenu();
        Monitor monitor = this.engine.getMonitor();
        monitor.addEventListener(this);
        monitor.getConfiguration().addEventListener(this);
        engine.getConfiguration().registerExecutionModeChangeListener(this);
        XBayaToolBar.setGroupOrder(EXECUTE_ACTIONS, 5);
        XBayaToolBar.setGroupOrder(EXECUTE_MONITOR_ACTIONS, 6);
    }
View Full Code Here

        // Creates some essential objects.

        MonitorConfiguration monitorConfiguration = new MonitorConfiguration(configuration.getBrokerURL(),
                configuration.getTopic(), configuration.isPullMode(), configuration.getMessageBoxURL());
        this.monitor = new Monitor(monitorConfiguration);

        // MyProxy
        // this.myProxyClient = new MyProxyClient(this.configuration.getMyProxyServer(),
        // this.configuration.getMyProxyPort(), this.configuration.getMyProxyUsername(),
        // this.configuration.getMyProxyPassphrase(), this.configuration.getMyProxyLifetime());
View Full Code Here

    }

    public void monitor(final String experimentId) throws Exception {
        AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(new URI(getRegistryURL()), getGatewayName(), getUserName(),
                new PasswordCallbackImpl());
        final Monitor experimentMonitor = airavataAPI.getExecutionManager().getExperimentMonitor(experimentId,
                new EventDataListenerAdapter() {

                    @Override
                    public void notify(EventDataRepository eventDataRepo, EventData eventData) {
                        Assert.assertNotNull(eventDataRepo);
                        Assert.assertNotNull(eventData);
                        if (MonitorUtil.EventType.WORKFLOW_TERMINATED.equals(eventData.getType())) {
                            try {
                                BaseCaseIT.this.verifyOutput(experimentId, "echo_output=Airavata_Test");
                            } catch (Exception e) {
                                log.error("Error verifying output", e);
                                Assert.fail("Error occurred while verifying output.");
                            } finally {
                                getMonitor().stopMonitoring();
                            }
                        }
                        log.info("No of events: " + eventDataRepo.getEvents().size());
                    }
                });
        experimentMonitor.startMonitoring();
        experimentMonitor.waitForCompletion();
    }
View Full Code Here

  }

  @Override
  public void waitForExperimentTermination(String experimentId)
      throws AiravataAPIInvocationException {
    Monitor experimentMonitor = getExperimentMonitor(experimentId, new EventDataListenerAdapter() {
      @Override
      public void notify(EventDataRepository eventDataRepo,
          EventData eventData) {
        if (eventData.getType()==EventType.WORKFLOW_TERMINATED){
          getMonitor().stopMonitoring();
        }
      }
    });
    experimentMonitor.startMonitoring();
    try {
      WorkflowExecutionStatus workflowInstanceStatus = getClient().getProvenanceManager().getWorkflowInstanceStatus(experimentId, experimentId);
      if (workflowInstanceStatus.getExecutionStatus()==State.FINISHED || workflowInstanceStatus.getExecutionStatus()==State.FAILED){
        experimentMonitor.stopMonitoring();
        return;
      }
    } catch (AiravataAPIInvocationException e) {
      //Workflow may not have started yet. Best to use the monitor to follow the progress
    }
    experimentMonitor.waitForCompletion();
  }
View Full Code Here

    MonitorConfiguration monitorConfiguration;
    try {
      monitorConfiguration = new MonitorConfiguration(
          getClient().getClientConfiguration().getMessagebrokerURL().toURI(), experimentId,
          true, getClient().getClientConfiguration().getMessageboxURL().toURI());
      final Monitor monitor = new Monitor(monitorConfiguration);
      monitor.printRawMessage(false);
      if (listener!=null) {
        monitor.getEventDataRepository().registerEventListener(listener);
        listener.setExperimentMonitor(monitor);
      }
      if (!monitor.getExperimentId().equals(">")){
        monitor.getEventDataRepository().registerEventListener(new EventDataListenerAdapter() {
          @Override
          public void notify(EventDataRepository eventDataRepo, EventData eventData) {
            if (eventData.getType()==EventType.WORKFLOW_TERMINATED || eventData.getType()==EventType.SENDING_FAULT){
              monitor.stopMonitoring();
            }
          }
        });
      }
      return monitor;
View Full Code Here

    }

    public void monitor(final String experimentId) throws Exception {
        AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(new URI(getRegistryURL()), getGatewayName(), getUserName(),
                new PasswordCallbackImpl());
        final Monitor experimentMonitor = airavataAPI.getExecutionManager().getExperimentMonitor(experimentId,
                new EventDataListenerAdapter() {

                    public void notify(EventDataRepository eventDataRepo, EventData eventData) {
                        Assert.assertNotNull(eventDataRepo);
                        Assert.assertNotNull(eventData);
                        if (MonitorUtil.EventType.WORKFLOW_TERMINATED.equals(eventData.getType())) {
                            try {
                                BaseCaseIT.this.verifyOutput(experimentId, "echo_output=Airavata_Test");
                            } catch (Exception e) {
                                log.error("Error verifying output", e);
                                Assert.fail("Error occurred while verifying output.");
                            } finally {
                                getMonitor().stopMonitoring();
                            }
                        }
                        log.info("No of events: " + eventDataRepo.getEvents().size());
                    }
                });
        experimentMonitor.startMonitoring();
        experimentMonitor.waitForCompletion();
    }
View Full Code Here

  }

  @Override
  public void waitForExperimentTermination(String experimentId)
      throws AiravataAPIInvocationException {
    Monitor experimentMonitor = getExperimentMonitor(experimentId, new EventDataListenerAdapter() {
      @Override
      public void notify(EventDataRepository eventDataRepo,
          EventData eventData) {
        if (eventData.getType()==EventType.WORKFLOW_TERMINATED){
          getMonitor().stopMonitoring();
        }
      }
    });
    experimentMonitor.startMonitoring();
    try {
      WorkflowExecutionStatus workflowInstanceStatus = getClient().getProvenanceManager().getWorkflowInstanceStatus(experimentId, experimentId);
      if (workflowInstanceStatus.getExecutionStatus()==State.FINISHED || workflowInstanceStatus.getExecutionStatus()==State.FAILED){
        experimentMonitor.stopMonitoring();
        return;
      }
    } catch (AiravataAPIInvocationException e) {
      //Workflow may not have started yet. Best to use the monitor to follow the progress
    }
    experimentMonitor.waitForCompletion();
  }
View Full Code Here

TOP

Related Classes of org.apache.airavata.ws.monitor.Monitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.