@NotThreadSafe public class LoadJob extends AbstractJob<LoadJob.LoadTask>
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, mStartTime, mState, mUser
Constructor and Description |
---|
LoadJob(String path,
Optional<String> user,
String jobId,
OptionalLong bandwidth,
boolean usePartialListing,
boolean verificationEnabled,
FileIterable 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.
|
Optional<LoadJob.LoadTask> |
getNextTask(WorkerInfo worker)
get next load task.
|
String |
getPath()
Get load file path.
|
String |
getProgress(JobProgressReportFormat format,
boolean verbose)
Get job progress.
|
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.
|
boolean |
processResponse(LoadJob.LoadTask loadTask)
process task result.
|
void |
setVerificationEnabled(boolean enableVerification)
Enable verification.
|
Journal.JournalEntry |
toJournalEntry() |
String |
toString() |
void |
updateBandwidth(OptionalLong bandwidth)
Update bandwidth.
|
void |
updateJob(Job<?> job)
update job configs.
|
getEndTime, getJobId, getJobState, isDone, isRunning, setEndTime, setJobState
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, FileIterable 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 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 Optional<LoadJob.LoadTask> getNextTask(WorkerInfo worker)
worker
- blocker to workerpublic 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 void updateJob(Job<?> job)
Job
job
- the job to update from. Must be the same job typepublic boolean needVerification()
Copyright © 2023. All Rights Reserved.