Package org.apache.airavata.ws.monitor

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


        WorkflowCreator creator = new WorkflowCreator();
        Workflow workflow = creator.createComplexMathWorkflow();
        workflow.createScript();

        Monitor monitor;
        if (this.gui) {
            this.engine = new XBayaEngine(this.configuration);
            this.graphCanvas = this.engine.getGUI().getGraphCanvas();
            this.graphCanvas.setWorkflow(workflow);
            monitor = this.engine.getMonitor();
            this.engine.getGUI().eventReceived(new Event(Type.MONITOR_STARTED));
            repaintAndWait(2);
        } else {
            MonitorConfiguration monitorConfiguration = new MonitorConfiguration(this.configuration.getBrokerURL(),
                    this.configuration.getTopic(), this.configuration.isPullMode(),
                    this.configuration.getMessageBoxURL());
            monitor = new Monitor(monitorConfiguration);
        }

        EventDataRepository eventData = monitor.getEventDataRepository();
        MonitorCallback callback = new MonitorCallback(eventData);
        LoopbackPublisher publisher = new LoopbackPublisher(callback, this.configuration.getTopic());
        MonitorNotifier notifier = new MonitorNotifier(publisher);

        executeToMiddle(workflow, notifier);
View Full Code Here


//        log.debug("Workflow compose - " + buffer.toString());
//        return buffer.toString();
//    }

    public void monitor(final String experimentId) throws Exception {
        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

    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

        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

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.