[kepler-dev] Different runModelInThread() Result Between Windows and Linux

Daniel Crawl danielcrawl at gmail.com
Sat Dec 6 10:48:08 PST 2014


Hi Jie,

The runModelInThread() method adds a Manager to the workflow and
calls Manager.startRun() to execute the workflow in a new thread.
Since startRun() uses a new thread, you don't have to call
runModelInThread() in separate threads.

I noticed you are calling ExecutionEngine.runModel(), not
runModelInThread(). This method does not execute workflows in
a separate thread.

Both runModelInThread() and runModel() should behave the same regardless
of OS. Perhaps the workflows you are executing behave different on
Windows and Linux? It would help if you could share these workflows
in order to reproduce the problem.

   --dan


On 12/4/14 4:46 PM, ZhangJie wrote:
> Hi All,
>
> I use the code of org/kepler/ExecutionEngine.java to run my Xml Kepler
> Workflows. I executed lots of Workflows use the function of
> runModelInThread() . I can get correct result in every thread of executions
> when I run on windows machine. However I only get single correct result to
> do this on Linux machine. In fact it couldn't run other workflow Threads. I
> add sleep() between these parallel threads, I can get all the correct
> executions again! Why? How can I run lots workflows without any wait? Is
> there any advise from any one. More details about the runtime codes and
> result are as follows:
>
> Any help will be grately appriciated.
>
> with regards,
>
> Jie Zhang
>
>
>
> import org.kepler.ExecutionEngine;
>
> import ptolemy.actor.CompositeActor;
>
> import Workflow.Kepler.KeplerL2OrderWorkFlowGenerator;
>
>
>
> public class test extends Thread {
>
>           public String Id ;
>
>           private ExecutionEngine engine;
>
>
>
>           public test(String Id)  {
>
>                     this.Id=Id;
>
>           }
>
>
>
>           public void run() {
>
>                     // 1.Generate Moml Kepler Workflow by my class
>
>                     KeplerL2OrderWorkFlowGenerator kL2WFG = new
> KeplerL2OrderWorkFlowGenerator(
>
>                                       this.Id);
>
>                     String Moml=kL2WFG.KeplerWorkflow();
>
>
>
>                     //2.Run Moml by Kepler ExecutionEngine
>
>                     System.out.println("Begin to execute!")
>
>                     engine = ExecutionEngine.getInstance();
>
>                     try {
>
>                              engine.runModel((CompositeActor)
> ExecutionEngine.parseMoML(Moml));
>
>
>
>                     } catch (Exception e) {
>
>                              System.out.println("Error running model or
> finding output file: "
>
>                                                 + e.getMessage());
>
>                     }
>
>           }
>
>
>
>           public static void main(String[] args) {
>
>                     // TODO Auto-generated method stub
>
>                     for (int i = 0; i < 50; i++) {
>
>                              test tempTest=new test("WorkFlow"+i);
>
>                              tempTest.start();
>
>
>
>                              //In Linux Mmachine,I have to add sleep()
>
>                              //Thread.sleep(15000);
>
>                     }
>
>           }
>
> }
>
>
>
> Result in Windows
>
> Begin to execute!
>
> Running model in new thread: L2CP201412040015KeplerWF
>
> Running model in new thread: L2CP201412040004KeplerWF
>
> Running model in new thread: L2CP201412040013KeplerWF
>
> Running model in new thread: L2CP201412040012KeplerWF
>
> Running model in new thread: L2CP201412040008KeplerWF
>
> Running model in new thread: L2CP201412040001KeplerWF
>
> Running model in new thread: L2CP201412040017KeplerWF
>
> Running model in new thread: L2CP201412040007KeplerWF
>
> Running model in new thread: L2CP201412040011KeplerWF
>
> Running model in new thread: L2CP201412040003KeplerWF
>
> Running model in new thread: L2CP201412040005KeplerWF
>
> Running model in new thread: L2CP201412040002KeplerWF
>
> Running model in new thread: L2CP201412040018KeplerWF
>
> . . . .
>
> Running model in new thread: L2CP201412040014KeplerWF
>
> 21737 ms. Memory: 418304K Free: 295512K (71%)
>
> Execution finished successfully.
>
> . . . .
>
> 23436 ms. Memory: 418304K Free: 294916K (71%)
>
> Execution finished successfully.
>
>
>
>
>
> Result in Linux without wait, only have one result
>
> Begin to execute!
>
> Running model in new thread: L2CP201412040014KeplerWF
>
> 21737 ms. Memory: 418304K Free: 295512K (71%)
>
> Execution finished successfully.
>
>
>
>
>
>
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at kepler-project.org
> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>



More information about the Kepler-dev mailing list