Class GridJobProcessor
- java.lang.Object
-
- org.apache.ignite.internal.processors.GridProcessorAdapter
-
- org.apache.ignite.internal.processors.job.GridJobProcessor
-
- All Implemented Interfaces:
GridComponent,GridProcessor
public class GridJobProcessor extends GridProcessorAdapter
Responsible for all grid job execution and communication.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classGridJobProcessor.PartitionsReservation-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent
GridComponent.DiscoveryDataExchangeType
-
-
Field Summary
Fields Modifier and Type Field Description static StringACTIVEActive jobs metric name.static StringCANCELEDCanceled jobs metric name.static StringCOMPUTE_JOB_WORKER_INTERRUPT_TIMEOUTDistributed property that defines the timeout for interrupting theworkeraftercancellationin mills.static intDFLT_JOBS_HISTORY_SIZEstatic StringEXECUTION_TIMETotal jobs execution time metric name.static StringFINISHEDFinished jobs metric name.static StringJOBS_METRICSMetrics prefix.static StringJOBS_VIEWstatic StringJOBS_VIEW_DESCstatic StringREJECTEDRejected jobs metric name.static StringSTARTEDStarted jobs metric name.static StringWAITINGWaiting jobs metric name.static StringWAITING_TIMETotal jobs waiting time metric name.-
Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
ctx, diagnosticLog, log
-
-
Constructor Summary
Constructors Constructor Description GridJobProcessor(GridKernalContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable GridJobWorkeractiveJob(IgniteUuid jobId)Gets active job.voidcancelJob(@Nullable IgniteUuid sesId, @Nullable IgniteUuid jobId, boolean sys)longcomputeJobWorkerInterruptTimeout()GridDeploymentcurrentDeployment()Returns current deployment.StringcurrentTaskName()Gets name task executed by current thread.intcurrentTaskNameHash()Gets hash of task name executed by current thread.voidcurrentTaskSession(GridJobSessionImpl ses)Callback from job worker to set current task session for execution.voidhandleCollisions()Handles collisions.booleaninternal()Map<ComputeJobStatusEnum,Long>jobStatuses(IgniteUuid sesId)voidmasterLeaveLocal(IgniteUuid sesId)Notify processor that master leave aware handler must be invoked on all jobs with the given session ID.voidonChangeTaskAttributes(IgniteUuid sesId, IgniteUuid jobId, Map<?,?> attrs)Callback on changing task attributes.voidonKernalStop(boolean cancel)Callback to notify that kernal is about to stop.voidprintMemoryStats()Prints memory statistics (sizes of internal structures, etc.).voidprocessJobExecuteRequest(ClusterNode node, GridJobExecuteRequest req)Collection<ComputeJobSibling>requestJobSiblings(ComputeTaskSession ses)voidsetAttributes(GridJobSessionImpl ses, Map<?,?> attrs)voidstart()Starts grid component.voidstop(boolean cancel)Stops grid component.-
Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
assertParameter, collectGridNodeData, collectJoiningNodeData, discoveryDataType, onDisconnected, onGridDataReceived, onJoiningNodeDataReceived, onKernalStart, onReconnected, toString, validateNode, validateNode
-
-
-
-
Field Detail
-
JOBS_VIEW
public static final String JOBS_VIEW
- See Also:
- Constant Field Values
-
JOBS_VIEW_DESC
public static final String JOBS_VIEW_DESC
- See Also:
- Constant Field Values
-
DFLT_JOBS_HISTORY_SIZE
public static final int DFLT_JOBS_HISTORY_SIZE
-
JOBS_METRICS
public static final String JOBS_METRICS
Metrics prefix.
-
STARTED
public static final String STARTED
Started jobs metric name.- See Also:
- Constant Field Values
-
ACTIVE
public static final String ACTIVE
Active jobs metric name.- See Also:
- Constant Field Values
-
WAITING
public static final String WAITING
Waiting jobs metric name.- See Also:
- Constant Field Values
-
CANCELED
public static final String CANCELED
Canceled jobs metric name.- See Also:
- Constant Field Values
-
REJECTED
public static final String REJECTED
Rejected jobs metric name.- See Also:
- Constant Field Values
-
FINISHED
public static final String FINISHED
Finished jobs metric name.- See Also:
- Constant Field Values
-
EXECUTION_TIME
public static final String EXECUTION_TIME
Total jobs execution time metric name.- See Also:
- Constant Field Values
-
WAITING_TIME
public static final String WAITING_TIME
Total jobs waiting time metric name.- See Also:
- Constant Field Values
-
COMPUTE_JOB_WORKER_INTERRUPT_TIMEOUT
public static final String COMPUTE_JOB_WORKER_INTERRUPT_TIMEOUT
Distributed property that defines the timeout for interrupting theworkeraftercancellationin mills.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GridJobProcessor
public GridJobProcessor(GridKernalContext ctx)
- Parameters:
ctx- Kernal context.
-
-
Method Detail
-
start
public void start() throws IgniteCheckedExceptionStarts grid component.- Specified by:
startin interfaceGridComponent- Overrides:
startin classGridProcessorAdapter- Throws:
IgniteCheckedException- Throws in case of any errors.
-
stop
public void stop(boolean cancel)
Stops grid component.- Specified by:
stopin interfaceGridComponent- Overrides:
stopin classGridProcessorAdapter- Parameters:
cancel- Iftrue, then all ongoing tasks or jobs for relevant components need to be cancelled.
-
onKernalStop
public void onKernalStop(boolean cancel)
Callback to notify that kernal is about to stop.- Specified by:
onKernalStopin interfaceGridComponent- Overrides:
onKernalStopin classGridProcessorAdapter- Parameters:
cancel- Flag indicating whether jobs should be canceled.
-
activeJob
@Nullable public @Nullable GridJobWorker activeJob(IgniteUuid jobId)
Gets active job.- Parameters:
jobId- Job ID.- Returns:
- Active job.
-
internal
public boolean internal()
- Returns:
Trueif running internal task.
-
setAttributes
public void setAttributes(GridJobSessionImpl ses, Map<?,?> attrs) throws IgniteCheckedException
- Parameters:
ses- Session.attrs- Attributes.- Throws:
IgniteCheckedException- If failed.
-
requestJobSiblings
public Collection<ComputeJobSibling> requestJobSiblings(ComputeTaskSession ses) throws IgniteCheckedException
- Parameters:
ses- Session.- Returns:
- Siblings.
- Throws:
IgniteCheckedException- If failed.
-
masterLeaveLocal
public void masterLeaveLocal(IgniteUuid sesId)
Notify processor that master leave aware handler must be invoked on all jobs with the given session ID.- Parameters:
sesId- Session ID.
-
cancelJob
public void cancelJob(@Nullable @Nullable IgniteUuid sesId, @Nullable @Nullable IgniteUuid jobId, boolean sys)- Parameters:
sesId- Session ID.jobId- Job ID.sys- System flag.
-
handleCollisions
public void handleCollisions()
Handles collisions.In most cases this method should be called from main read lock to avoid jobs activation after node stop has started.
-
processJobExecuteRequest
public void processJobExecuteRequest(ClusterNode node, GridJobExecuteRequest req)
- Parameters:
node- Node.req- Request.
-
currentTaskSession
public void currentTaskSession(GridJobSessionImpl ses)
Callback from job worker to set current task session for execution.- Parameters:
ses- Session.
-
currentTaskNameHash
public int currentTaskNameHash()
Gets hash of task name executed by current thread.- Returns:
- Task name hash or
0if security is disabled.
-
currentTaskName
public String currentTaskName()
Gets name task executed by current thread.- Returns:
- Task name or
nullif security is disabled.
-
currentDeployment
public GridDeployment currentDeployment()
Returns current deployment.- Returns:
- Deployment.
-
printMemoryStats
public void printMemoryStats()
Prints memory statistics (sizes of internal structures, etc.). NOTE: this method is for testing and profiling purposes only.- Specified by:
printMemoryStatsin interfaceGridComponent- Overrides:
printMemoryStatsin classGridProcessorAdapter
-
onChangeTaskAttributes
public void onChangeTaskAttributes(IgniteUuid sesId, IgniteUuid jobId, Map<?,?> attrs)
Callback on changing task attributes.- Parameters:
sesId- Session ID.jobId- Job ID.attrs- Changed attributes.
-
jobStatuses
public Map<ComputeJobStatusEnum,Long> jobStatuses(IgniteUuid sesId)
- Parameters:
sesId- Task session ID.- Returns:
- Job statistics for the task. Mapping: Job status -> count of jobs.
-
-