Customer Portal

Executing Graph multiple times

Comments 4

  • Avatar
    avackova
    0
    Comment actions Permalink
    Hello,
    you have to call graph.reset() method between particular graph execution:
    			
    graph = TransformationGraphXMLReaderWriter.loadGraph(new FileInputStream(file), runtimeContext.getAdditionalProperties());
    EngineInitializer.initGraph(graph, runtimeContext);
    IThreadManager threadManager = new SimpleThreadManager();
    WatchDog watchDog = new WatchDog(graph, runtimeContext);
    futureResult = threadManager.executeWatchDog(watchDog);
    Result result = futureResult.get();
    graph.reset();
    futureResult = threadManager.executeWatchDog(watchDog);
    result = futureResult.get();
    graph.free();
  • Avatar
    gribr
    0
    Comment actions Permalink
    Yes I tried that but it still goes into a loop when the 2nd threadManager.executeWatchDog(watchDog); is called. This also happens when I tried your example.
    The only way I could get it to work was to add a sufficient sleep time between executeGraph() calls.


    Future<Result> result = runGraph.executeGraph(graph, runtimeContext);
    sleep(5000);
    graph.reset();
    result = runGraph.executeGraph(graph, runtimeContext);


    Adding the sleep() using the threadManager method did not work, it still looped.
  • Avatar
    mzatopek
    0
    Comment actions Permalink
    I have updated the related wiki page

    http://wiki.cloveretl.com/doku.php?id=embedding_clover#embedding_clover

    Please follow the example, I hope it helps.

    In short:
    1) you don't need to 'reset' the graph anymore
    2) you need to create a watchdog instance for each separete graph run

    Let me know if the example on wiki page is not comprehensive. More detailed piece of code is also available at our junit test org.jetel.graph.ResetTest.
  • Avatar
    mzatopek
    0
    Comment actions Permalink
    All mentioned above is totally right from release 3.0 which is not still public :) But you can download it from our svn trunk, it should be already pretty stable. We are going to release it in few days.

    For older clover release I still recommend to be inspired by org.jetel.graph.ResetTest junit test (should be part of each source distribution).

    Let me know if you don't have it. Martin

Please sign in to leave a comment.