@NotThreadSafe public class CopyJob extends AbstractJob<CopyJob.CopyTask>
Modifier and Type | Class and Description |
---|---|
class |
CopyJob.CopyTask
Loads blocks in a UFS through an Alluxio worker.
|
Modifier and Type | Field and Description |
---|---|
static com.codahale.metrics.Counter |
COPY_FAIL_FILE_COUNT |
static com.codahale.metrics.Counter |
COPY_FILE_COUNT |
static com.codahale.metrics.Meter |
COPY_RATE |
static com.codahale.metrics.Counter |
COPY_SIZE |
static com.codahale.metrics.Counter |
COPY_SKIP_FILE_COUNT |
static com.codahale.metrics.Counter |
JOB_COPY_FAIL |
static com.codahale.metrics.Counter |
JOB_COPY_SUCCESS |
static java.util.function.Predicate<FileInfo> |
QUALIFIED_FILE_FILTER |
static String |
TYPE |
mEndTime, mJobId, mRetryTaskList, mStartTime, mState, mTaskIdGenerator, mUser, mWorkerAssignPolicy
Constructor and Description |
---|
CopyJob(String src,
String dst,
boolean overwrite,
Optional<String> user,
String jobId,
OptionalLong bandwidth,
boolean usePartialListing,
boolean verificationEnabled,
boolean checkContent,
Iterable<FileInfo> fileIterable,
Optional<Job.FileFilter> filter)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addCopiedBytes(long bytes)
Add bytes to total loaded bytes.
|
void |
addFailure(String src,
String message,
int code)
Add a block to failure summary.
|
void |
addSkip()
Add a skip to metrics.
|
boolean |
addToRetry(Route route)
Add a route to retry later.
|
boolean |
equals(Object o) |
void |
failJob(AlluxioRuntimeException reason)
Set load state to FAILED with given reason.
|
OptionalLong |
getBandwidth()
Get bandwidth.
|
JobDescription |
getDescription() |
long |
getDurationInSec()
Get duration in seconds.
|
List<Route> |
getNextRoutes(int count)
Get next batch of blocks.
|
List<CopyJob.CopyTask> |
getNextTasks(Collection<WorkerInfo> workers)
get next load task.
|
String |
getProgress(JobProgressReportFormat format,
boolean verbose)
Get job progress.
|
String |
getSrc() |
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.
|
boolean |
processResponse(CopyJob.CopyTask task)
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, onTaskSubmitFailure, 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_COPY_SUCCESS
public static final com.codahale.metrics.Counter JOB_COPY_FAIL
public static final com.codahale.metrics.Counter COPY_FILE_COUNT
public static final com.codahale.metrics.Counter COPY_FAIL_FILE_COUNT
public static final com.codahale.metrics.Counter COPY_SKIP_FILE_COUNT
public static final com.codahale.metrics.Counter COPY_SIZE
public static final com.codahale.metrics.Meter COPY_RATE
public CopyJob(String src, String dst, boolean overwrite, Optional<String> user, String jobId, OptionalLong bandwidth, boolean usePartialListing, boolean verificationEnabled, boolean checkContent, Iterable<FileInfo> fileIterable, Optional<Job.FileFilter> filter)
src
- file sourcedst
- file destinationoverwrite
- whether to overwrite the fileuser
- user for authenticationjobId
- job identifierbandwidth
- bandwidthusePartialListing
- whether to use partial listingverificationEnabled
- whether to verify the job after loadedcheckContent
- whether to check contentfileIterable
- file iterablefilter
- file filterpublic String getSrc()
public JobDescription getDescription()
public OptionalLong getBandwidth()
public void updateBandwidth(OptionalLong bandwidth)
bandwidth
- new bandwidthpublic boolean isVerificationEnabled()
public boolean needVerification()
public void setVerificationEnabled(boolean enableVerification)
enableVerification
- whether to enable verificationpublic void failJob(AlluxioRuntimeException reason)
reason
- failure exceptionpublic void setJobSuccess()
Job
public void addCopiedBytes(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 boolean isHealthy()
Job
public boolean isCurrentPassDone()
Job
public void initiateVerification()
Job
public List<CopyJob.CopyTask> getNextTasks(Collection<WorkerInfo> workers)
workers
- workerInfospublic List<Route> getNextRoutes(int count)
count
- number of blockspublic boolean addToRetry(Route route)
route
- the route to retrypublic void addFailure(String src, String message, int code)
src
- the source path of the file that failedmessage
- failure messagecode
- status code for exceptionpublic void addSkip()
public Journal.JournalEntry toJournalEntry()
public long getDurationInSec()
public boolean processResponse(CopyJob.CopyTask task)
Job
task
- task containing result futurepublic boolean hasFailure()
Copyright © 2023. All Rights Reserved.