如何在Oracle Data Integrator中获取执行详细信息

时间:2013-06-15 02:48:23

标签: oracle email oracle-data-integrator

我已经使用程序编写了一个代码来在Jython中发送电子邮件。现在我把我的程序放在一个包中,然后运行包。

但是,我需要得到的是包名,包的执行开始时间和包执行的结束时间,并通过电子邮件发送。

我尝试使用getPrevStepLog,但这不起作用

我现在的程序代码:

import smtplib
import string
BODY = string.join((
"From: %s" % 'test@gmail.com',
"To: %s" % 'admin@odi.com',
"Subject: %s" % 'Mail From ODI',
"",
'This is a mail from ODI Studio. Thank You.Previous step 
'<%=odiRef.getPrevStepLog("STEP_NAME")%>' executed in    
'<%=odiRef.getPrevStepLog("DURATION")%>' seconds'
 ), "\r\n")
 sender = smtplib.SMTP('smtp.gmail.com',587)
 sender.set_debuglevel(1)
 sender.ehlo()
 sender.starttls()
 sender.ehlo()
 sender.login('test', 'test123')
 sender.sendmail('test@gmail.com',['admin@odi.com'],BODY)
 sender.close()

1 个答案:

答案 0 :(得分:1)

您是否尝试使用函数getSession?

public java.lang.String getSession(java.lang.String pPropertyName)

pPropertyName

SESS_NO = internal session ID
SESS_NAME = session name
SCEN_VERSION = version of current scenario
CONTEXT_NAME = name of the execution context
CONTEXT_CODE = code of the execution context
AGENT_NAME = name of the physical agent
SESS_BEG = date and hour of the begining of the session
USER_NAME = Oracle Data Integrator user executing the session

例子:获取当前会话名称

<%=odiRef.getSession("SESS_NAME")%>