Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature](Load)(step2)support nereids load job schedule #26356

Merged
merged 12 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into load_step2
  • Loading branch information
wsjz committed Dec 12, 2023
commit 7671d9e964fd757169412d691d6e7545456cf4f4
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public abstract class AbstractJob<T extends AbstractTask, C> implements Job<T, C
@SerializedName(value = "ctms")
private Long createTimeMs;

@SerializedName(value = "ftm")
private long finishTimeMs;

@SerializedName(value = "sql")
String executeSql;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public class InsertJob extends AbstractJob<InsertTask, Map> {
private List<TabletCommitInfo> commitInfos = new ArrayList<>();

// max save task num, do we need to config it?
private static final int MAX_SAVE_TASK_NUM = 50;
private static final int MAX_SAVE_TASK_NUM = 100;

/**
* load job type
Expand Down Expand Up @@ -204,7 +204,7 @@ public InsertJob(ConnectContext ctx,
}

@Override
public List<InsertTask> createTasks(TaskType taskType) {
public List<InsertTask> createTasks(TaskType taskType, Map taskContext) {
if (plans.isEmpty()) {
InsertTask task = new InsertTask(labelName, getCurrentDbName(), getExecuteSql(), getCreateUser());
task.setJobId(getJobId());
Expand Down Expand Up @@ -233,7 +233,6 @@ private List<InsertTask> createBatchTasks(TaskType taskType) {
}

public void addNewTask(long id) {

if (CollectionUtils.isEmpty(taskIdList)) {
taskIdList = new ConcurrentLinkedQueue<>();
Env.getCurrentEnv().getEditLog().logUpdateJob(this);
Expand Down Expand Up @@ -266,6 +265,12 @@ public void cancelJob(FailMsg failMsg) throws DdlException {
}
}

@Override
public boolean isReadyForScheduling(Map taskContext) {
return CollectionUtils.isEmpty(getRunningTasks());
}


@Override
public void cancelAllTasks() throws JobException {
super.cancelAllTasks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ protected TUniqueId generateQueryId(String taskIdString) {
@Override
public void run() throws JobException {
try {
if (isCanceled.get()) {
log.info("task has been canceled, task id is {}", getTaskId());
return;
}
command.statefulRun(ctx, stmtExecutor);
} catch (Exception e) {
log.warn("execute insert task error, job id is {}, task id is {},sql is {}", getJobId(),
Expand Down Expand Up @@ -216,49 +220,6 @@ public void cancel() throws JobException {
super.cancel();
}

@Override
public List<String> getShowInfo() {
if (null == loadJob) {
return new ArrayList<>();
}
List<String> jobInfo = Lists.newArrayList();
// jobId
jobInfo.add(String.valueOf(loadJob.getId()));
// label
jobInfo.add(loadJob.getLabel());
// state
jobInfo.add(loadJob.getState().name());

// etl info
if (loadJob.getLoadingStatus().getCounters().isEmpty()) {
jobInfo.add(FeConstants.null_string);
} else {
jobInfo.add(Joiner.on("; ").withKeyValueSeparator("=").join(loadJob.getLoadingStatus().getCounters()));
}

// task info
jobInfo.add("cluster:" + loadJob.getResourceName() + "; timeout(s):" + loadJob.getTimeout()
+ "; max_filter_ratio:" + loadJob.getMaxFilterRatio() + "; priority:" + loadJob.getPriority());
// error msg
if (loadJob.getFailMsg() == null) {
jobInfo.add(FeConstants.null_string);
} else {
jobInfo.add("type:" + loadJob.getFailMsg().getCancelType() + "; msg:" + loadJob.getFailMsg().getMsg());
}

// create time
jobInfo.add(TimeUtils.longToTimeString(loadJob.getCreateTimestamp()));

// load end time
jobInfo.add(TimeUtils.longToTimeString(loadJob.getFinishTimestamp()));
// tracking url
jobInfo.add(loadJob.getLoadingStatus().getTrackingUrl());
// jobInfo.add(coordinator.getLoadStatistic().toJson());
// user
jobInfo.add(loadJob.getUserInfo().getQualifiedUser());
return jobInfo;
}

@Override
public TRow getTvfInfo() {
TRow trow = new TRow();
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.