我有一个使用勺子创建的作业并导入到DI存储库。 如果不使用PDI作业调度程序进行调度,如何使用REST Web服务在Data Integration Server上运行PDI作业?所以我可以随时调用它。
答案 0 :(得分:1)
在开始这些步骤之前,请确保您的Carte服务器(或嵌入在DI服务器中的Carte服务器)配置为连接到存储库以进行REST调用。可以在wiki page上找到流程和说明。请注意,需要在DI服务器的appropriate location中定义repositories.xml。
方法1:(运行作业并继续,无状态检查):
启动PDI作业(/ home / admin / Job 1):
curl -L "http://admin:password@localhost:9080/pentaho-di/kettle/runJob?job=/home/admin/Job%201" 2> /dev/null | xmllint --format -
方法2:(定期运行作业和轮询作业状态):
生成登录cookie:
curl -d "j_username=admin&j_password=password&locale=en_US" -c cookies.txt http://localhost:9080/pentaho-di/j_spring_security_check
检查DI服务器状态:
curl -L -b cookies.txt http://localhost:9080/pentaho-di/kettle/status?xml=Y | xmllint --format -
结果:
<?xml version="1.0" encoding="UTF-8"?>
<serverstatus>
<statusdesc>Online</statusdesc>
<memory_free>850268568</memory_free>
<memory_total>1310720000</memory_total>
<cpu_cores>4</cpu_cores>
<cpu_process_time>22822946300</cpu_process_time>
<uptime>100204</uptime>
<thread_count>59</thread_count>
<load_avg>-1.0</load_avg>
<os_name>Windows 7</os_name>
<os_version>6.1</os_version>
<os_arch>amd64</os_arch>
<transstatuslist>
<transstatus>
<transname>Row generator test</transname>
<id>de44a94e-3bf7-4369-9db1-1630640e97e2</id>
<status_desc>Waiting</status_desc>
<error_desc/>
<paused>N</paused>
<stepstatuslist>
</stepstatuslist>
<first_log_line_nr>0</first_log_line_nr>
<last_log_line_nr>0</last_log_line_nr>
<logging_string><![CDATA[]]></logging_string>
</transstatus>
</transstatuslist>
<jobstatuslist>
</jobstatuslist>
</serverstatus>
启动PDI作业(/ home / admin / Job 1):
curl -L -b cookies.txt "http://localhost:9080/pentaho-di/kettle/runJob?job=/home/admin/Job%201" | xmllint --format -
结果:
<webresult>
<result>OK</result>
<message>Job started</message>
<id>dd419628-3547-423f-9468-2cb5ffd826b2</id>
</webresult>
检查作业的状态:
curl -L -b cookies.txt "http://localhost:9080/pentaho-di/kettle/jobStatus?name=/home/admin/Job%201&id=dd419628-3547-423f-9468-2cb5ffd826b2&xml=Y" | xmllint --format -
结果:
<?xml version="1.0" encoding="UTF-8"?>
<jobstatus>
<jobname>Job 1</jobname>
<id>dd419628-3547-423f-9468-2cb5ffd826b2</id>
<status_desc>Finished</status_desc>
<error_desc/>
<logging_string><![CDATA[H4sIAAAAAAAAADMyMDTRNzDUNzJSMDSxMjawMrZQ0FXwyk9SMATSwSWJRSUK+WkKWUCB1IrU5NKSzPw8LiPCmjLz0hVS80qKKhWiXUJ9fSNjSdQUXJqcnFpcTEibW2ZeZnFGagrEgahaFTSKUotLc0pso0uKSlNjNckwCuJ0Eg3yQg4rhTSosVwABykpF2oBAAA=]]></logging_string>
<first_log_line_nr>0</first_log_line_nr>
<last_log_line_nr>13</last_log_line_nr>
<result>
<lines_input>0</lines_input>
<lines_output>0</lines_output>
<lines_read>0</lines_read>
<lines_written>0</lines_written>
<lines_updated>0</lines_updated>
<lines_rejected>0</lines_rejected>
<lines_deleted>0</lines_deleted>
<nr_errors>0</nr_errors>
<nr_files_retrieved>0</nr_files_retrieved>
<entry_nr>0</entry_nr>
<result>Y</result>
<exit_status>0</exit_status>
<is_stopped>N</is_stopped>
<log_channel_id/>
<log_text>null</log_text>
<result-file/>
<result-rows/>
</result>
</jobstatus>
curl -L -b cookies.txt "http://localhost:9080/pentaho-di/kettle/jobStatus?name=/home/admin/Job%201&id=dd419628-3547-423f-9468-2cb5ffd826b2&xml=Y" 2> /dev/null | xmllint --xpath "string(/jobstatus/status_desc)"
-
结果:
Finished
PS: curl
&amp; libxml2-utils
通过apt-get
安装。
libxml2-utils
包是可选的,仅用于格式化DI服务器的XML输出。这显示了如何使用Bash shell启动PDI作业
在5.3及更高版本中支持。