public class Job extends Thread implements VariableSpace, NamedParams, HasLogChannelInterface, LoggingObjectInterface, ExecutorInterface, ExtensionDataInterface
The definition of a PDI job is represented by a JobMeta object. It is typically loaded from a .kjb file, a PDI repository, or it is generated dynamically. The declared parameters of the job definition are then queried using listParameters() and assigned values using calls to setParameterValue(..).
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
protected String[] |
arguments
The command line arguments for the job.
|
static String |
CONFIGURATION_IN_EXPORT_FILENAME |
protected Job |
parentJob
The job that's launching this (sub-) job.
|
protected Trans |
parentTrans
The parent transformation
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
Job() |
Job(Repository repository,
JobMeta jobMeta) |
Job(Repository repository,
JobMeta jobMeta,
LoggingObjectInterface parentLogging) |
Job(String name,
String file,
String[] args) |
Modifier and Type | Method and Description |
---|---|
void |
activateParameters() |
void |
addDelegationListener(DelegationListener delegationListener) |
void |
addErrors(int nrToAdd)
Add a number of errors to the total number of erros that occured during execution.
|
void |
addJobEntryListener(JobEntryListener jobEntryListener) |
void |
addJobListener(JobListener jobListener) |
void |
addParameterDefinition(String key,
String defValue,
String description) |
boolean |
beginProcessing()
Handle logging at start
|
void |
clearParameters() |
void |
copyParametersFrom(NamedParams params) |
void |
copyVariablesFrom(VariableSpace space) |
protected Database |
createDataBase(DatabaseMeta databaseMeta) |
static Job |
createJobWithNewClassLoader() |
String |
environmentSubstitute(String aString) |
String[] |
environmentSubstitute(String[] aString) |
void |
eraseParameters() |
Result |
execute(int nr,
Result result)
Execute a job with previous results passed in.
Execute called by JobEntryJob: don't clear the jobEntryResults. |
String |
fieldSubstitute(String aString,
RowMetaInterface rowMeta,
Object[] rowData) |
void |
fireJobFinishListeners()
Sets the finished flag. Then launch all the job listeners and call the jobFinished method for each.
|
void |
fireJobStartListeners()
Call all the jobStarted method for each listener.
|
Map<JobEntryCopy,JobEntryJob> |
getActiveJobEntryJobs()
Gets the activeJobEntryJobs.
|
Map<JobEntryCopy,JobEntryTrans> |
getActiveJobEntryTransformations()
Gets the activeJobEntryTransformations.
|
String[] |
getArguments() |
long |
getBatchId() |
boolean |
getBooleanValueOfVariable(String variableName,
boolean defaultValue) |
String |
getContainerObjectId()
Gets the carteObjectId.
|
Date |
getCurrentDate() |
List<DelegationListener> |
getDelegationListeners() |
Date |
getDepDate()
Gets the dep date.
|
Date |
getEndDate() |
int |
getErrors()
Get the number of errors that happened in the job.
|
String |
getExecutingServer()
Gets the executing server.
|
String |
getExecutingUser()
Gets the executing user.
|
Map<String,Object> |
getExtensionDataMap() |
String |
getFilename()
Gets the file name.
|
List<JobEntryListener> |
getJobEntryListeners() |
List<JobEntryResult> |
getJobEntryResults()
Gets a flat list of results in THIS job, in the order of execution of job entries.
|
List<JobListener> |
getJobListeners() |
JobMeta |
getJobMeta() |
String |
getJobname() |
JobTracker |
getJobTracker() |
LogChannelInterface |
getLogChannel()
Gets the log channel interface.
|
String |
getLogChannelId()
Gets the log channel id.
|
Date |
getLogDate() |
List<LoggingHierarchy> |
getLoggingHierarchy()
Gets the logging hierarchy.
|
LogLevel |
getLogLevel()
Gets the logLevel.
|
String |
getObjectCopy()
Always returns null for Job.
|
ObjectId |
getObjectId()
Gets the jobMeta's object id.
|
String |
getObjectName()
Gets the job name.
|
ObjectRevision |
getObjectRevision()
Gets the job meta's object revision.
|
LoggingObjectType |
getObjectType()
Gets LoggingObjectType.JOB, which is always the value for Job.
|
String |
getParameterDefault(String key) |
String |
getParameterDescription(String key) |
String |
getParameterValue(String key) |
LoggingObjectInterface |
getParent()
Gets parent logging object.
|
Job |
getParentJob()
Gets the parent job.
|
LoggingObjectInterface |
getParentLoggingObject()
Gets the parent logging object.
|
Trans |
getParentTrans() |
VariableSpace |
getParentVariableSpace() |
long |
getPassedBatchId() |
Date |
getRegistrationDate()
Gets the registration date.
|
Repository |
getRep() |
RepositoryDirectoryInterface |
getRepositoryDirectory()
Gets the job meta's repository directory interface.
|
Result |
getResult() |
SocketRepository |
getSocketRepository()
Gets the socket repository.
|
List<RowMetaAndData> |
getSourceRows()
Gets the source rows.
|
Date |
getStartDate() |
JobEntryCopy |
getStartJobEntryCopy()
Gets the start job entry copy.
|
Result |
getStartJobEntryResult() |
String |
getStatus() |
Thread |
getThread() |
String |
getTransactionId()
Gets the transaction id.
|
String |
getVariable(String variableName) |
String |
getVariable(String variableName,
String defaultValue) |
void |
init() |
void |
initializeVariablesFrom(VariableSpace parent) |
void |
injectVariables(Map<String,String> prop) |
boolean |
isActive() |
boolean |
isFinished() |
boolean |
isForcingSeparateLogging() |
boolean |
isGatheringMetrics() |
boolean |
isInitialized() |
boolean |
isInteractive()
Gets the boolean value of interactive.
|
boolean |
isStopped() |
String[] |
listParameters() |
String[] |
listVariables() |
void |
mergeParametersWith(NamedParams params,
boolean replace) |
void |
removeJobEntryListener(JobEntryListener jobEntryListener) |
void |
removeJobListener(JobListener jobListener) |
void |
resetErrors()
Set the number of occured errors to 0.
|
void |
run()
Threads main loop: called by Thread.start();
|
static String |
sendToSlaveServer(JobMeta jobMeta,
JobExecutionConfiguration executionConfiguration,
Repository repository,
org.pentaho.metastore.api.IMetaStore metaStore)
Send to slave server.
|
protected void |
setActive(boolean active) |
void |
setArguments(String[] arguments) |
void |
setBatchId(long batchId) |
void |
setContainerObjectId(String containerObjectId)
Sets the execution container object id (containerObjectId).
|
void |
setDelegationListeners(List<DelegationListener> delegationListeners) |
void |
setExecutingServer(String executingServer)
Sets the executing server.
|
void |
setExecutingUser(String executingUser)
Sets the executing user.
|
void |
setFinished(boolean finished) |
void |
setForcingSeparateLogging(boolean forcingSeparateLogging) |
void |
setGatheringMetrics(boolean gatheringMetrics) |
protected void |
setInitialized(boolean initialized) |
void |
setInteractive(boolean interactive)
Sets the value of interactive.
|
void |
setInternalKettleVariables(VariableSpace var)
Sets the internal kettle variables.
|
void |
setJobTracker(JobTracker jobTracker) |
void |
setLogLevel(LogLevel logLevel)
Sets the log level.
|
void |
setParameterValue(String key,
String value) |
void |
setParentJob(Job parentJob)
Sets the parent job.
|
void |
setParentTrans(Trans parentTrans) |
void |
setParentVariableSpace(VariableSpace parent) |
void |
setPassedBatchId(long jobBatchId) |
void |
setRepository(Repository rep) |
void |
setResult(Result result) |
void |
setSocketRepository(SocketRepository socketRepository)
Sets the socket repository.
|
void |
setSourceRows(List<RowMetaAndData> sourceRows) |
void |
setStartJobEntryCopy(JobEntryCopy startJobEntryCopy)
Sets the start job entry copy.
|
void |
setStartJobEntryResult(Result startJobEntryResult) |
void |
setStopped(boolean stopped)
Sets the stopped.
|
void |
setTransactionId(String transactionId)
Sets the transaction id.
|
void |
setVariable(String variableName,
String variableValue) |
void |
shareVariablesWith(VariableSpace space) |
protected void |
shutdownHeartbeat(ExecutorService heartbeat) |
protected ExecutorService |
startHeartbeat(long intervalInSeconds) |
void |
stopAll()
Stop all activity by setting the stopped property to true.
|
String |
toString()
Gets the name property of the JobMeta property.
|
void |
waitUntilFinished()
Wait until this job has finished.
|
void |
waitUntilFinished(long maxMiliseconds)
Wait until this job has finished.
|
protected void |
writeJobEntryLogInformation()
Write job entry log information.
|
protected void |
writeLogChannelInformation()
Write log channel information.
|
protected void |
writeLogTableInformation(JobLogTable jobLogTable,
LogStatus status)
Writes information to Job Log table.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
public static final String CONFIGURATION_IN_EXPORT_FILENAME
protected Job parentJob
protected Trans parentTrans
protected String[] arguments
public Job(Repository repository, JobMeta jobMeta)
public Job(Repository repository, JobMeta jobMeta, LoggingObjectInterface parentLogging)
public Job()
public void init()
public String toString()
public static final Job createJobWithNewClassLoader() throws KettleException
KettleException
public String getJobname()
public void setRepository(Repository rep)
public void run()
public Result execute(int nr, Result result) throws KettleException
nr
- The job entry numberresult
- the result of the previous executionKettleJobException
KettleException
public void fireJobFinishListeners() throws KettleException
KettleException
JobListener.jobFinished(Job)
public void fireJobStartListeners() throws KettleException
KettleException
JobListener.jobStarted(Job)
public void waitUntilFinished()
public void waitUntilFinished(long maxMiliseconds)
maxMiliseconds
- the maximum number of ms to waitpublic int getErrors()
public void resetErrors()
public void addErrors(int nrToAdd)
nrToAdd
- nr of errors to add.public boolean beginProcessing() throws KettleException
KettleException
protected void writeLogTableInformation(JobLogTable jobLogTable, LogStatus status) throws KettleJobException, KettleDatabaseException
protected void writeLogChannelInformation() throws KettleException
KettleException
- the kettle exceptionprotected void writeJobEntryLogInformation() throws KettleException
KettleException
- the kettle exceptionprotected Database createDataBase(DatabaseMeta databaseMeta)
public boolean isInitialized()
protected void setInitialized(boolean initialized)
public boolean isActive()
protected void setActive(boolean active)
public boolean isStopped()
public void stopAll()
public void setStopped(boolean stopped)
public boolean isFinished()
public void setFinished(boolean finished)
public Date getStartDate()
public Date getEndDate()
public Date getCurrentDate()
public Date getDepDate()
public Date getLogDate()
public JobMeta getJobMeta()
public Repository getRep()
public Thread getThread()
public JobTracker getJobTracker()
public void setJobTracker(JobTracker jobTracker)
public void setSourceRows(List<RowMetaAndData> sourceRows)
public List<RowMetaAndData> getSourceRows()
public Job getParentJob()
public void setParentJob(Job parentJob)
parentJob
- The parentJob to set.public Result getResult()
public void setResult(Result result)
public long getBatchId()
public void setBatchId(long batchId)
public long getPassedBatchId()
public void setPassedBatchId(long jobBatchId)
public void setInternalKettleVariables(VariableSpace var)
var
- the new internal kettle variables.public void copyVariablesFrom(VariableSpace space)
copyVariablesFrom
in interface VariableSpace
public String environmentSubstitute(String aString)
environmentSubstitute
in interface VariableSpace
public String[] environmentSubstitute(String[] aString)
environmentSubstitute
in interface VariableSpace
public String fieldSubstitute(String aString, RowMetaInterface rowMeta, Object[] rowData) throws KettleValueException
fieldSubstitute
in interface VariableSpace
KettleValueException
public VariableSpace getParentVariableSpace()
getParentVariableSpace
in interface VariableSpace
public void setParentVariableSpace(VariableSpace parent)
setParentVariableSpace
in interface VariableSpace
public String getVariable(String variableName, String defaultValue)
getVariable
in interface VariableSpace
public String getVariable(String variableName)
getVariable
in interface VariableSpace
public boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
getBooleanValueOfVariable
in interface VariableSpace
public void initializeVariablesFrom(VariableSpace parent)
initializeVariablesFrom
in interface VariableSpace
public String[] listVariables()
listVariables
in interface VariableSpace
public void setVariable(String variableName, String variableValue)
setVariable
in interface VariableSpace
public void shareVariablesWith(VariableSpace space)
shareVariablesWith
in interface VariableSpace
public void injectVariables(Map<String,String> prop)
injectVariables
in interface VariableSpace
public String getStatus()
public static String sendToSlaveServer(JobMeta jobMeta, JobExecutionConfiguration executionConfiguration, Repository repository, org.pentaho.metastore.api.IMetaStore metaStore) throws KettleException
jobMeta
- the job metaexecutionConfiguration
- the execution configurationrepository
- the repositorymetaStore
- the metaStoreKettleException
- the kettle exceptionpublic void addJobListener(JobListener jobListener)
public void addJobEntryListener(JobEntryListener jobEntryListener)
public void removeJobListener(JobListener jobListener)
public void removeJobEntryListener(JobEntryListener jobEntryListener)
public List<JobEntryListener> getJobEntryListeners()
public List<JobListener> getJobListeners()
public void addParameterDefinition(String key, String defValue, String description) throws DuplicateParamException
addParameterDefinition
in interface NamedParams
DuplicateParamException
public String getParameterDescription(String key) throws UnknownParamException
getParameterDescription
in interface NamedParams
UnknownParamException
public String getParameterDefault(String key) throws UnknownParamException
getParameterDefault
in interface NamedParams
UnknownParamException
public String getParameterValue(String key) throws UnknownParamException
getParameterValue
in interface NamedParams
UnknownParamException
public String[] listParameters()
listParameters
in interface NamedParams
public void setParameterValue(String key, String value) throws UnknownParamException
setParameterValue
in interface NamedParams
UnknownParamException
public void eraseParameters()
eraseParameters
in interface NamedParams
public void clearParameters()
clearParameters
in interface NamedParams
public void activateParameters()
activateParameters
in interface NamedParams
public void copyParametersFrom(NamedParams params)
copyParametersFrom
in interface NamedParams
public void mergeParametersWith(NamedParams params, boolean replace)
mergeParametersWith
in interface NamedParams
public void setSocketRepository(SocketRepository socketRepository)
socketRepository
- the new socket repositorypublic SocketRepository getSocketRepository()
public LogChannelInterface getLogChannel()
getLogChannel
in interface HasLogChannelInterface
public String getObjectName()
getObjectName
in interface LoggingObjectInterface
public String getObjectCopy()
getObjectCopy
in interface LoggingObjectInterface
public String getFilename()
getFilename
in interface LoggingObjectInterface
public String getLogChannelId()
getLogChannelId
in interface LoggingObjectInterface
public ObjectId getObjectId()
getObjectId
in interface LoggingObjectInterface
public ObjectRevision getObjectRevision()
getObjectRevision
in interface LoggingObjectInterface
public LoggingObjectType getObjectType()
getObjectType
in interface LoggingObjectInterface
public LoggingObjectInterface getParent()
getParent
in interface LoggingObjectInterface
public RepositoryDirectoryInterface getRepositoryDirectory()
getRepositoryDirectory
in interface LoggingObjectInterface
public LogLevel getLogLevel()
getLogLevel
in interface LoggingObjectInterface
public void setLogLevel(LogLevel logLevel)
logLevel
- the new log levelpublic List<LoggingHierarchy> getLoggingHierarchy()
public boolean isInteractive()
public void setInteractive(boolean interactive)
interactive
- the interactive to setpublic Map<JobEntryCopy,JobEntryTrans> getActiveJobEntryTransformations()
public Map<JobEntryCopy,JobEntryJob> getActiveJobEntryJobs()
public List<JobEntryResult> getJobEntryResults()
public String getContainerObjectId()
getContainerObjectId
in interface LoggingObjectInterface
public void setContainerObjectId(String containerObjectId)
containerObjectId
- the execution container object id to setpublic LoggingObjectInterface getParentLoggingObject()
public Date getRegistrationDate()
getRegistrationDate
in interface LoggingObjectInterface
public JobEntryCopy getStartJobEntryCopy()
public void setStartJobEntryCopy(JobEntryCopy startJobEntryCopy)
startJobEntryCopy
- the startJobEntryCopy to setpublic String getExecutingServer()
getExecutingServer
in interface ExecutorInterface
public void setExecutingServer(String executingServer)
setExecutingServer
in interface ExecutorInterface
executingServer
- the executingServer to setpublic String getExecutingUser()
getExecutingUser
in interface ExecutorInterface
public void setExecutingUser(String executingUser)
setExecutingUser
in interface ExecutorInterface
executingUser
- the executingUser to setpublic boolean isGatheringMetrics()
isGatheringMetrics
in interface LoggingObjectInterface
public void setGatheringMetrics(boolean gatheringMetrics)
setGatheringMetrics
in interface LoggingObjectInterface
public boolean isForcingSeparateLogging()
isForcingSeparateLogging
in interface LoggingObjectInterface
public void setForcingSeparateLogging(boolean forcingSeparateLogging)
setForcingSeparateLogging
in interface LoggingObjectInterface
public String getTransactionId()
public void setTransactionId(String transactionId)
transactionId
- the transactionId to setpublic List<DelegationListener> getDelegationListeners()
public void setDelegationListeners(List<DelegationListener> delegationListeners)
public void addDelegationListener(DelegationListener delegationListener)
public String[] getArguments()
public void setArguments(String[] arguments)
public Trans getParentTrans()
public void setParentTrans(Trans parentTrans)
public Map<String,Object> getExtensionDataMap()
getExtensionDataMap
in interface ExtensionDataInterface
public Result getStartJobEntryResult()
public void setStartJobEntryResult(Result startJobEntryResult)
protected ExecutorService startHeartbeat(long intervalInSeconds)
protected void shutdownHeartbeat(ExecutorService heartbeat)
Copyright © 2018 Hitachi Vantara. All rights reserved.