Summer.Batch.Core.Step.Tasklet.PowerShellTasklet Class Reference

An ITasklet that runs a powershell script. The script is executed asynchronously using injected ITaskExecutor - timeout value is required to be set, so that the batch job does not hang forever if the external process hangs. Tasklet periodically checks for termination status (i.e. Script finished its execution or timeout expired or job was interrupted). The check interval is given by TerminationCheckInterval. When job interrupt is detected tasklet's execution is terminated immediately by throwing JobInterruptedException. More...

Inheritance diagram for Summer.Batch.Core.Step.Tasklet.PowerShellTasklet:
Summer.Batch.Core.Listener.StepExecutionListenerSupport Summer.Batch.Core.Step.Tasklet.IStoppableTasklet Summer.Batch.Common.Factory.IInitializationPostOperations Summer.Batch.Core.IStepExecutionListener Summer.Batch.Core.Step.Tasklet.ITasklet Summer.Batch.Core.IStepListener

Public Types

enum  TimeoutBehaviorOption { TimeoutBehaviorOption.SetExitStatusToFailed, TimeoutBehaviorOption.ThrowException }
 Enumeration of the possible Timeout Bahavior Options... More...
 

Public Member Functions

void AfterPropertiesSet ()
 
void Stop ()
 IStoppableTasklet::Stop. More...
 
RepeatStatus Execute (StepContribution contribution, ChunkContext chunkContext)
 Wraps command execution into system process call. More...
 
override void BeforeStep (StepExecution stepExecution)
 
- Public Member Functions inherited from Summer.Batch.Core.Listener.StepExecutionListenerSupport
virtual ExitStatus AfterStep (StepExecution stepExecution)
 

Static Protected Attributes

static readonly Logger Logger = LogManager.GetCurrentClassLogger()
 Logger. More...
 

Properties

IResource ScriptResource [set]
 ScriptResource (i.e. Script File to be exeuted in PowerShell runspace) More...
 
IDictionary< string, object > Parameters [set]
 Parameters for powershell script file being executed...i.e. passed on the command line, accessed via Param() More...
 
IDictionary< string, object > Variables [set]
 Variables for powershell script file being executed...available in PowerShell Runspace to the script More...
 
IPowerShellExitCodeMapper PowerShellExitCodeMapper [set]
 System process exit code mapper property. More...
 
long Timeout [set]
 Timeout property. More...
 
TimeoutBehaviorOption TimeoutBehavior [get, set]
 FileType flag property. More...
 
long TerminationCheckInterval [set]
 Termination check interval property. More...
 
IJobExplorer JobExplorer [set]
 Job explorer property. More...
 

Detailed Description

An ITasklet that runs a powershell script. The script is executed asynchronously using injected ITaskExecutor - timeout value is required to be set, so that the batch job does not hang forever if the external process hangs. Tasklet periodically checks for termination status (i.e. Script finished its execution or timeout expired or job was interrupted). The check interval is given by TerminationCheckInterval. When job interrupt is detected tasklet's execution is terminated immediately by throwing JobInterruptedException.

NOTE : InterruptOnCancel is not being supported for now.

Since
1.1.0

Member Enumeration Documentation

Enumeration of the possible Timeout Bahavior Options...

Enumerator
SetExitStatusToFailed 

Will Set Step ExitStatus to ExitStatus.Failed if script execution times out...

ThrowException 

Will thow exception if script execution times out...

Member Function Documentation

void Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.AfterPropertiesSet ( )

See also
IInitializationPostOperations::AfterPropertiesSet.

Implements Summer.Batch.Common.Factory.IInitializationPostOperations.

override void Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.BeforeStep ( StepExecution  stepExecution)
virtual
RepeatStatus Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.Execute ( StepContribution  contribution,
ChunkContext  chunkContext 
)

Wraps command execution into system process call.

Returns
Exceptions
Exception

Implements Summer.Batch.Core.Step.Tasklet.ITasklet.

void Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.Stop ( )

Member Data Documentation

readonly Logger Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.Logger = LogManager.GetCurrentClassLogger()
staticprotected

Logger.

Property Documentation

IJobExplorer Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.JobExplorer
set

Job explorer property.

IDictionary<string, object> Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.Parameters
set

Parameters for powershell script file being executed...i.e. passed on the command line, accessed via Param()

IPowerShellExitCodeMapper Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.PowerShellExitCodeMapper
set

System process exit code mapper property.

IResource Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.ScriptResource
set

ScriptResource (i.e. Script File to be exeuted in PowerShell runspace)

long Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.TerminationCheckInterval
set

Termination check interval property.

long Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.Timeout
set

Timeout property.

TimeoutBehaviorOption Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.TimeoutBehavior
getset

FileType flag property.

IDictionary<string, object> Summer.Batch.Core.Step.Tasklet.PowerShellTasklet.Variables
set

Variables for powershell script file being executed...available in PowerShell Runspace to the script


The documentation for this class was generated from the following file:
  • Summer.Batch.Core/Core/Step/Tasklet/PowerShellTasklet.cs