public class ParallelTask
extends java.lang.Object
ParallelTaskBuilder.execute(io.parallec.core.ParallecResponseHandler)
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.util.LinkedHashSet<java.lang.String>> |
aggregateResultMap
The aggregate result map.
|
private int |
concurrency
The concurrency.
|
private ParallelTaskConfig |
config
The config.
|
private double |
durationSec
The duration sec.
|
private long |
executeStartTime
The execute start time.
|
private long |
executionEndTime
The end time.
|
akka.actor.ActorRef |
executionManager
The command manager.
|
private ParallecResponseHandler |
handler
The handler.
|
private HttpMeta |
httpMeta
The http meta.
|
private static org.slf4j.Logger |
logger
The logger.
|
private java.util.Map<java.lang.String,NodeReqResponse> |
parallelTaskResult
The parallel task result:
a hashmap to store the request parameters, host name, ResponseOnSingleTask.
|
private PingMeta |
pingMeta
The ping meta.
|
private java.util.Map<java.lang.String,java.lang.String> |
replacementVarMap
The replacement var map.
|
private java.util.Map<java.lang.String,StrStrMap> |
replacementVarMapNodeSpecific
The replacement var map node specific.
|
private int |
requestNum
The request num.
|
private int |
requestNumActual
The request num actual.
|
private RequestProtocol |
requestProtocol
The request protocol.
|
private RequestReplacementType |
requestReplacementType
The request replacement type.
|
private java.util.Map<java.lang.String,java.lang.Object> |
responseContext
The response context.
|
private int |
responsedNum
The responsed num.
|
private SshMeta |
sshMeta
The ssh meta.
|
private ParallelTaskState |
state
The state.
|
private long |
submitTime
TODO: The start time.
|
private TargetHostMeta |
targetHostMeta
The target host meta.
|
private java.util.List<TaskErrorMeta> |
taskErrorMetas
The task error metas.
|
private java.lang.String |
taskId
The task id.
|
private TcpMeta |
tcpMeta
The TCP meta.
|
private UdpMeta |
udpMeta
The UDP meta.
|
Constructor and Description |
---|
ParallelTask()
Instantiates a new parallel task.
|
ParallelTask(RequestProtocol requestProtocol,
int concurrency,
HttpMeta httpMeta,
TargetHostMeta targetHostMeta,
SshMeta sshMeta,
TcpMeta tcpMeta,
UdpMeta udpMeta,
PingMeta pingMeta,
ParallecResponseHandler handler,
java.util.Map<java.lang.String,java.lang.Object> responseContext,
java.util.Map<java.lang.String,StrStrMap> replacementVarMapNodeSpecific,
java.util.Map<java.lang.String,java.lang.String> replacementVarMap,
RequestReplacementType requestReplacementType,
ParallelTaskConfig config)
Instantiates a new parallel task.
|
Modifier and Type | Method and Description |
---|---|
boolean |
cancel(boolean sync)
Cancel.
|
boolean |
cancelOnTargetHosts(java.util.List<java.lang.String> targetHosts)
Cancel on target hosts.
|
int |
capacityUsed()
Capacity used.
|
java.lang.String |
generateTaskId()
Gen job id.
|
java.lang.String |
getAggregatedResultHumanStr()
Gets the aggregated result human str.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getAggregateResultCountSummary()
Gets the aggregate result count summary.
|
java.util.Map<java.lang.String,SetAndCount> |
getAggregateResultFullSummary()
Aggregate results to see the status code distribution with target hosts.
|
java.util.Map<java.lang.String,java.util.LinkedHashSet<java.lang.String>> |
getAggregateResultMap()
Gets the aggregate result map.
|
com.ning.http.client.AsyncHttpClient |
getAsyncHttpClient()
Gets the async http client.
|
int |
getConcurrency()
Gets the concurrency.
|
ParallelTaskConfig |
getConfig()
Gets the config.
|
double |
getDurationSec()
Gets the duration sec.
|
long |
getExecuteStartTime()
Gets the execute start time.
|
long |
getExecutionEndTime()
Gets the execution end time.
|
ParallecResponseHandler |
getHandler()
Gets the handler.
|
HttpMeta |
getHttpMeta()
Gets the command meta.
|
java.util.Map<java.lang.String,NodeReqResponse> |
getParallelTaskResult()
Gets the parallel task result.
|
PingMeta |
getPingMeta()
Gets the ping meta.
|
java.lang.Double |
getProgress()
Gets the progress.
|
java.util.Map<java.lang.String,java.lang.String> |
getReplacementVarMap()
Gets the replacement var map.
|
java.util.Map<java.lang.String,StrStrMap> |
getReplacementVarMapNodeSpecific()
Gets the replacement var map node specific.
|
int |
getRequestNum()
Gets the request num.
|
int |
getRequestNumActual()
Gets the request num actual.
|
RequestProtocol |
getRequestProtocol()
Gets the request protocol.
|
RequestReplacementType |
getRequestReplacementType()
Gets the request replacement type.
|
java.util.Map<java.lang.String,java.lang.Object> |
getResponseContext()
Gets the response context.
|
int |
getResponsedNum()
Gets the responsed num.
|
SshMeta |
getSshMeta()
Gets the ssh meta.
|
ParallelTaskState |
getState()
Gets the state.
|
long |
getSubmitTime()
Gets the submit time.
|
TargetHostMeta |
getTargetHostMeta()
Gets the target host meta.
|
java.util.List<TaskErrorMeta> |
getTaskErrorMetas()
Gets the task error metas.
|
java.lang.String |
getTaskId()
Gets the task id.
|
TcpMeta |
getTcpMeta()
Gets the tcp meta.
|
UdpMeta |
getUdpMeta() |
boolean |
isCompleted()
state==ParallelTaskState.COMPLETED_WITHOUT_ERROR ||
state==ParallelTaskState.COMPLETED_WITH_ERROR;
|
java.lang.String |
prettyPrintInfo()
Pretty print info.
|
boolean |
saveLogToLocal()
Save log to local.
|
boolean |
saveLogToLocal(java.lang.String path)
Save log to local.
|
void |
setAsyncHttpClient(com.ning.http.client.AsyncHttpClient asyncHttpClient)
Sets the async http client.
|
void |
setConcurrency(int concurrency)
Sets the concurrency.
|
void |
setConfig(ParallelTaskConfig config)
Sets the config.
|
void |
setDurationSec(double durationSec)
Sets the duration sec.
|
void |
setExecuteStartTime(long executeStartTime)
Sets the execute start time.
|
void |
setExecutionEndTime(long executionEndTime)
Sets the execution end time.
|
void |
setHandler(ParallecResponseHandler handler)
Sets the handler.
|
void |
setHttpMeta(HttpMeta httpMeta)
Sets the command meta.
|
void |
setParallelTaskResult(java.util.Map<java.lang.String,NodeReqResponse> parallelTaskResult)
Sets the parallel task result.
|
void |
setPingMeta(PingMeta pingMeta)
Sets the ping meta.
|
void |
setRequestNum(int requestNum)
Sets the request num.
|
void |
setRequestNumActual(int requestNumActual)
Sets the request num actual.
|
void |
setRequestProtocol(RequestProtocol requestProtocol)
Sets the request protocol.
|
void |
setRequestReplacementType(RequestReplacementType requestReplacementType)
Sets the request replacement type.
|
void |
setResponseContext(java.util.Map<java.lang.String,java.lang.Object> responseContext)
Sets the response context.
|
void |
setResponsedNum(int responsedNum)
Sets the responsed num.
|
void |
setSshMeta(SshMeta sshMeta)
Sets the ssh meta.
|
void |
setState(ParallelTaskState state)
Sets the state.
|
void |
setSubmitTime(long submitTime)
Sets the submit time.
|
void |
setTargetHostMeta(TargetHostMeta targetHostMeta)
Sets the target host meta.
|
void |
setTaskId(java.lang.String taskId)
Sets the task id.
|
void |
setTcpMeta(TcpMeta tcpMeta)
Sets the tcp meta.
|
void |
setUdpMeta(UdpMeta udpMeta) |
java.lang.String |
toString() |
boolean |
validateWithFillDefault()
will do validation.
|
private static org.slf4j.Logger logger
private ParallelTaskConfig config
private long submitTime
private long executeStartTime
private long executionEndTime
private double durationSec
private int requestNum
private int requestNumActual
private volatile int responsedNum
private final java.util.List<TaskErrorMeta> taskErrorMetas
private java.util.Map<java.lang.String,java.lang.Object> responseContext
private ParallelTaskState state
private java.lang.String taskId
private ParallecResponseHandler handler
private final java.util.Map<java.lang.String,java.util.LinkedHashSet<java.lang.String>> aggregateResultMap
private java.util.Map<java.lang.String,NodeReqResponse> parallelTaskResult
ParallelTaskBuilder.setSaveResponseToTask(boolean)
private HttpMeta httpMeta
private TargetHostMeta targetHostMeta
private SshMeta sshMeta
private TcpMeta tcpMeta
private UdpMeta udpMeta
private PingMeta pingMeta
public akka.actor.ActorRef executionManager
private final java.util.Map<java.lang.String,StrStrMap> replacementVarMapNodeSpecific
private final java.util.Map<java.lang.String,java.lang.String> replacementVarMap
private RequestReplacementType requestReplacementType
private RequestProtocol requestProtocol
private int concurrency
public ParallelTask()
public ParallelTask(RequestProtocol requestProtocol, int concurrency, HttpMeta httpMeta, TargetHostMeta targetHostMeta, SshMeta sshMeta, TcpMeta tcpMeta, UdpMeta udpMeta, PingMeta pingMeta, ParallecResponseHandler handler, java.util.Map<java.lang.String,java.lang.Object> responseContext, java.util.Map<java.lang.String,StrStrMap> replacementVarMapNodeSpecific, java.util.Map<java.lang.String,java.lang.String> replacementVarMap, RequestReplacementType requestReplacementType, ParallelTaskConfig config)
requestProtocol
- the request protocolconcurrency
- the concurrencyhttpMeta
- the http metatargetHostMeta
- the target host metasshMeta
- the ssh metatcpMeta
- the tcp metaudpMeta
- the udp metapingMeta
- the ping metahandler
- the handlerresponseContext
- the response contextreplacementVarMapNodeSpecific
- the replacement var map node specificreplacementVarMap
- the replacement var maprequestReplacementType
- the request replacement typeconfig
- the configpublic boolean cancelOnTargetHosts(java.util.List<java.lang.String> targetHosts)
targetHosts
- the target hostspublic boolean cancel(boolean sync)
sync
- the syncpublic int capacityUsed()
public boolean validateWithFillDefault() throws ParallelTaskInvalidException
ParallelTaskInvalidException
- the parallel task invalid exceptionpublic java.lang.String generateTaskId()
public java.lang.Double getProgress()
public boolean isCompleted()
public com.ning.http.client.AsyncHttpClient getAsyncHttpClient()
public void setAsyncHttpClient(com.ning.http.client.AsyncHttpClient asyncHttpClient)
asyncHttpClient
- the new async http clientpublic java.util.Map<java.lang.String,NodeReqResponse> getParallelTaskResult()
public void setParallelTaskResult(java.util.Map<java.lang.String,NodeReqResponse> parallelTaskResult)
parallelTaskResult
- the parallel task resultpublic java.util.Map<java.lang.String,StrStrMap> getReplacementVarMapNodeSpecific()
public java.util.Map<java.lang.String,java.lang.String> getReplacementVarMap()
public RequestReplacementType getRequestReplacementType()
public void setRequestReplacementType(RequestReplacementType requestReplacementType)
requestReplacementType
- the new request replacement typepublic java.util.List<TaskErrorMeta> getTaskErrorMetas()
public java.lang.String toString()
toString
in class java.lang.Object
public SshMeta getSshMeta()
public void setSshMeta(SshMeta sshMeta)
sshMeta
- the new ssh metapublic java.util.Map<java.lang.String,java.lang.Object> getResponseContext()
public TargetHostMeta getTargetHostMeta()
public void setTargetHostMeta(TargetHostMeta targetHostMeta)
targetHostMeta
- the new target host metapublic HttpMeta getHttpMeta()
public void setHttpMeta(HttpMeta httpMeta)
httpMeta
- the new http metapublic java.lang.String getTaskId()
public void setTaskId(java.lang.String taskId)
taskId
- the new task idpublic void setResponseContext(java.util.Map<java.lang.String,java.lang.Object> responseContext)
responseContext
- the response contextpublic ParallelTaskConfig getConfig()
public void setConfig(ParallelTaskConfig config)
config
- the new configpublic java.lang.String prettyPrintInfo()
public boolean saveLogToLocal(java.lang.String path)
path
- the pathpublic boolean saveLogToLocal()
public long getExecutionEndTime()
public void setExecutionEndTime(long executionEndTime)
executionEndTime
- the new execution end timepublic java.util.Map<java.lang.String,SetAndCount> getAggregateResultFullSummary()
public java.lang.String getAggregatedResultHumanStr()
public java.util.Map<java.lang.String,java.lang.Integer> getAggregateResultCountSummary()
public java.util.Map<java.lang.String,java.util.LinkedHashSet<java.lang.String>> getAggregateResultMap()
public double getDurationSec()
public void setDurationSec(double durationSec)
durationSec
- the new duration secpublic TcpMeta getTcpMeta()
public void setTcpMeta(TcpMeta tcpMeta)
tcpMeta
- the new tcp metapublic RequestProtocol getRequestProtocol()
public void setRequestProtocol(RequestProtocol requestProtocol)
requestProtocol
- the new request protocolpublic int getConcurrency()
public void setConcurrency(int concurrency)
concurrency
- the new concurrencypublic long getSubmitTime()
public void setSubmitTime(long submitTime)
submitTime
- the new submit timepublic long getExecuteStartTime()
public void setExecuteStartTime(long executeStartTime)
executeStartTime
- the new execute start timepublic int getRequestNum()
public void setRequestNum(int requestNum)
requestNum
- the new request numpublic int getRequestNumActual()
public void setRequestNumActual(int requestNumActual)
requestNumActual
- the new request num actualpublic int getResponsedNum()
public void setResponsedNum(int responsedNum)
responsedNum
- the new responsed numpublic ParallelTaskState getState()
public void setState(ParallelTaskState state)
state
- the new statepublic ParallecResponseHandler getHandler()
public void setHandler(ParallecResponseHandler handler)
handler
- the new handlerpublic PingMeta getPingMeta()
public void setPingMeta(PingMeta pingMeta)
pingMeta
- the new ping metapublic UdpMeta getUdpMeta()
public void setUdpMeta(UdpMeta udpMeta)