@NotThreadSafe public class LoadJob extends AbstractJob<LoadJob.LoadTask>
DoraLoadJob
Modifier and Type | Class and Description |
---|---|
class |
LoadJob.LoadTask
Loads blocks in a UFS through an Alluxio worker.
|
Modifier and Type | Field and Description |
---|---|
static com.codahale.metrics.Counter |
JOB_LOAD_BLOCK_COUNT |
static com.codahale.metrics.Counter |
JOB_LOAD_BLOCK_FAIL |
static com.codahale.metrics.Counter |
JOB_LOAD_BLOCK_SIZE |
static com.codahale.metrics.Counter |
JOB_LOAD_FAIL |
static com.codahale.metrics.Meter |
JOB_LOAD_RATE |
static com.codahale.metrics.Counter |
JOB_LOAD_SUCCESS |
static java.util.function.Predicate<FileInfo> |
QUALIFIED_FILE_FILTER |
static String |
TYPE |
mEndTime, mJobId, mRetryTaskList, mStartTime, mState, mTaskIdGenerator, mUser, mWorkerAssignPolicy
Constructor and Description |
---|
LoadJob(String path,
Optional<String> user,
String jobId,
OptionalLong bandwidth,
boolean usePartialListing,
boolean verificationEnabled,
Iterable<FileInfo> fileIterable)
Constructor.
|
LoadJob(String path,
String user,
OptionalLong bandwidth,
FileIterable fileIterator)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addBlockFailure(Block block,
String message,
int code)
Add a block to failure summary.
|
boolean |
addBlockToRetry(Block block)
Add a block to retry later.
|
void |
addLoadedBytes(long bytes)
Add bytes to total loaded bytes.
|
boolean |
equals(Object o) |
void |
failJob(AlluxioRuntimeException reason)
Set load state to FAILED with given reason.
|
OptionalLong |
getBandwidth()
Get bandwidth.
|
long |
getCurrentBlockCount()
Get the processed block count in the current loading pass.
|
JobDescription |
getDescription() |
long |
getDurationInSec()
Get duration in seconds.
|
List<Block> |
getNextBatchBlocks(int count)
Get next batch of blocks.
|
List<LoadJob.LoadTask> |
getNextTasks(Collection<WorkerInfo> workers)
get next load task.
|
String |
getPath()
Get load file path.
|
String |
getProgress(JobProgressReportFormat format,
boolean verbose)
Get job progress.
|
boolean |
hasFailure() |
int |
hashCode() |
void |
initiateVerification()
Initiate a verification pass.
|
boolean |
isCurrentPassDone()
Check whether the current pass is finished.
|
boolean |
isHealthy()
Check whether the job is healthy.
|
boolean |
isVerificationEnabled()
Is verification enabled.
|
boolean |
needVerification()
Is verification enabled.
|
void |
onTaskSubmitFailure(Task<?> task)
Define how to process task that gets rejected when scheduler tried to kick off.
|
boolean |
processResponse(LoadJob.LoadTask loadTask)
process task result.
|
void |
setJobSuccess()
set job as success.
|
void |
setVerificationEnabled(boolean enableVerification)
Enable verification.
|
Journal.JournalEntry |
toJournalEntry() |
String |
toString() |
void |
updateBandwidth(OptionalLong bandwidth)
Update bandwidth.
|
getEndTime, getJobId, getJobState, getWorkerAssignPolicy, initializeJob, isDone, isRunning, setEndTime, setJobState, setStartTime, setWorkerAssignPolicy
public static final String TYPE
public static final java.util.function.Predicate<FileInfo> QUALIFIED_FILE_FILTER
public static final com.codahale.metrics.Counter JOB_LOAD_SUCCESS
public static final com.codahale.metrics.Counter JOB_LOAD_FAIL
public static final com.codahale.metrics.Counter JOB_LOAD_BLOCK_COUNT
public static final com.codahale.metrics.Counter JOB_LOAD_BLOCK_FAIL
public static final com.codahale.metrics.Counter JOB_LOAD_BLOCK_SIZE
public static final com.codahale.metrics.Meter JOB_LOAD_RATE
public LoadJob(String path, String user, OptionalLong bandwidth, FileIterable fileIterator)
path
- file pathuser
- user for authenticationbandwidth
- bandwidthfileIterator
- file iteratorpublic LoadJob(String path, Optional<String> user, String jobId, OptionalLong bandwidth, boolean usePartialListing, boolean verificationEnabled, Iterable<FileInfo> fileIterable)
path
- file pathuser
- user for authenticationjobId
- job identifierbandwidth
- bandwidthusePartialListing
- whether to use partial listingverificationEnabled
- whether to verify the job after loadedfileIterable
- file iterablepublic String getPath()
public JobDescription getDescription()
public OptionalLong getBandwidth()
public void updateBandwidth(OptionalLong bandwidth)
bandwidth
- new bandwidthpublic boolean isVerificationEnabled()
public void setVerificationEnabled(boolean enableVerification)
enableVerification
- whether to enable verificationpublic void failJob(AlluxioRuntimeException reason)
reason
- failure exceptionpublic void setJobSuccess()
Job
public void addLoadedBytes(long bytes)
bytes
- bytes to be added to totalpublic String getProgress(JobProgressReportFormat format, boolean verbose)
Job
format
- progress report formatverbose
- whether to include detailed informationpublic long getCurrentBlockCount()
public boolean isHealthy()
Job
public boolean isCurrentPassDone()
Job
public void initiateVerification()
Job
public List<LoadJob.LoadTask> getNextTasks(Collection<WorkerInfo> workers)
workers
- list of available workers to schedule task onpublic void onTaskSubmitFailure(Task<?> task)
Job
onTaskSubmitFailure
in interface Job<LoadJob.LoadTask>
onTaskSubmitFailure
in class AbstractJob<LoadJob.LoadTask>
public List<Block> getNextBatchBlocks(int count)
count
- number of blockspublic boolean addBlockToRetry(Block block)
block
- the block that failed to load thus needing retrypublic void addBlockFailure(Block block, String message, int code)
block
- the block that failed to load and cannot be retriedmessage
- failure messagecode
- status code for exceptionpublic Journal.JournalEntry toJournalEntry()
public long getDurationInSec()
public boolean processResponse(LoadJob.LoadTask loadTask)
Job
loadTask
- task containing result futurepublic boolean hasFailure()
public boolean needVerification()
Copyright © 2023. All Rights Reserved.