简体   繁体   English

从Pentaho Kettle Job从Java API获取结果

[英]Fetching Result From Java API from Pentaho Kettle Job

I have a Job in Pentaho. 我在Pentaho有工作。 The job has many sub-jobs and many transformation. 该工作有许多子工作和许多转变。 Most of the transformation writes to a table. 大多数转换都写入表。 I would like to get some stat information like below. 我想获得一些如下的统计信息。

  1. Table1 Finished processing (I=0, O=0, R=86400, W=86400, U=0, E=0) 表1完成的处理(I = 0,O = 0,R = 86400,W = 86400,U = 0,E = 0)
  2. Table2 Finished processing (I=0, O=0, R=86400, W=86400, U=0, E=0) 表2完成的处理(I = 0,O = 0,R = 86400,W = 86400,U = 0,E = 0)
  3. Table3 Finished processing (I=0, O=0, R=86400, W=86400, U=0, E=0) 表3完成的处理(I = 0,O = 0,R = 86400,W = 86400,U = 0,E = 0)

My code is: With this code, I'm just getting the result of the last transformation. 我的代码是:使用此代码,我只是得到上一次转换的结果。 For Example, If i run 40 transformation, my result is just the 40th transformation result. 例如,如果我运行40转换,我的结果就是40转换结果。 But I would like to see all the 40 transformation result. 但我希望看到所有40个转换结果。

KettleEnvironment.init();
JobMeta jobMeta = new JobMeta("Job.kjb", null);
Job job = new Job(null, jobMeta);          
job.start();
job.waitUntilFinished() 
Result result = job.getResult();   
System.out.println("dfffdgfdg: "+result.getLogText());

Use the logging system . 使用日志记录系统 On each transformation of interest, right-click anywhere, select setting, then logging and setup the data you want to collect stat on (for example in front of the Output button select the step that writes the data on the table you want to monitor). 在每个感兴趣的转换上,右键单击任意位置,选择设置,然后记录并设置要收集统计数据的数据(例如,在“输出”按钮前面,选择将数据写入要监视的表的步骤) 。 I suggest you use the default to start with. 我建议您使用默认的开始。

After that, press the SQL button, and Pentaho Data Integrator will create a table in a database, with the relevant columns. 之后,按下SQL按钮,Pentaho Data Integrator将在数据库中创建一个带有相关列的表。 And each time you run the transformation (or anyone using the same repository) will put a row in the table. 每次运行转换(或任何使用相同存储库的人)时,都会在表中放置一行。 After that, just SELECT * FROM TRANSFORMATION_LOG. 之后,只需SELECT * FROM TRANSFORMATION_LOG。

In the last Pentaho Meetup , I explained why you should do that at transformation level, and at at job level (although you can automate this if you know how to navigate in a repository). 在上一次的Pentaho Meetup中 ,我解释了为什么应该在转换级别和作业级别执行此操作(尽管如果您知道如何在存储库中导航,则可以自动执行此操作)。 You'll also have a pointer to a github with a JSP you an copy/paste in your Pentaho BA server's WEB_INF so that you get exactly what you are after in web server. 您还将拥有一个指向带有JSP的github的指针,您可以在Pentaho BA服务器的WEB_INF中进行复制/粘贴,以便获得与Web服务器完全相同的内容。

Do not hesitate to ask for more info or provide feedback. 请随时询问更多信息或提供反馈。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM