Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
public class McToOssCatalogJob extends CatalogJob {

private static final Logger LOG = LogManager.getLogger(McToOssCatalogJob.class);
private List<Job> subJobs;

public McToOssCatalogJob(
Job parentJob,
Expand All @@ -49,7 +50,10 @@ public McToOssCatalogJob(

@Override
public synchronized List<Task> getExecutableTasks() {
List<Job> subJobs = getSubJobs();
subJobs = getSubJobs();
if (subJobs.isEmpty()) {
setStatusInternal(JobStatus.SUCCEEDED);
}
List<Task> ret = new LinkedList<>();

// Firstly, execute table jobs
Expand Down Expand Up @@ -86,4 +90,15 @@ void getJobsByObjectType(List<Task> ret, List<Job> subJobs, ObjectType objectTyp
ret.addAll(job.getExecutableTasks());
}
}

@Override
public boolean clean() {
// all subjobs is clean => true
// else false
boolean clean = true;
for (Job job : subJobs) {
clean = job.clean() && clean;
}
return clean;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,11 @@ public boolean clean() {
cleaned = true;
return false;
}

@Override
public synchronized boolean reset(boolean force) throws Exception {
cleaned = false;
return super.reset(force);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,10 @@ public boolean clean() {
cleaned = true;
return false;
}

@Override
public synchronized boolean reset(boolean force) throws Exception {
cleaned = false;
return super.reset(force);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public List<Job> listJobs() {
public List<Job> listSubJobs(String parentJobId) {
try (SqlSession session = sqlSessionFactory.openSession(true)) {
JobDao dao = session.getMapper(JobDao.class);
dao.createSubJobTableIfNotExists(parentJobId);
return dao.selectSubJobs(parentJobId);
}
}
Expand All @@ -194,6 +195,7 @@ public List<Job> listJobsByStatus(JobStatus jobStatus) {
public List<Job> listSubJobsByStatus(String parentJobId, JobStatus jobStatus) {
try (SqlSession session = sqlSessionFactory.openSession(true)) {
JobDao dao = session.getMapper(JobDao.class);
dao.createSubJobTableIfNotExists(parentJobId);
return dao.selectSubJobsByJobStatus(parentJobId, jobStatus.name());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.aliyun.odps.mma.config.JobConfiguration;
import com.aliyun.odps.mma.server.action.ActionExecutionContext;
import com.aliyun.odps.mma.server.action.McToMcTableDataTransmissionAction;
import com.aliyun.odps.mma.server.action.McVerificationAction;
import com.aliyun.odps.mma.server.action.VerificationAction;
import com.aliyun.odps.mma.server.job.Job;
import com.aliyun.odps.mma.meta.MetaSource.TableMetaModel;

Expand Down Expand Up @@ -54,7 +56,42 @@ private void init() {
this,
context);
dag.addVertex(action);
// TODO: verification

McVerificationAction mcVerificationAction = new McVerificationAction(
id + ".McDataVerification",
config.get(JobConfiguration.DATA_SOURCE_MC_ACCESS_KEY_ID),
config.get(JobConfiguration.DATA_SOURCE_MC_ACCESS_KEY_SECRET),
executionProject,
config.get(JobConfiguration.DATA_SOURCE_MC_ENDPOINT),
source,
true,
this,
context);
dag.addVertex(mcVerificationAction);

McVerificationAction ossVerificationAction = new McVerificationAction(
id + ".OssDataVerification",
config.get(JobConfiguration.DATA_SOURCE_MC_ACCESS_KEY_ID),
config.get(JobConfiguration.DATA_SOURCE_MC_ACCESS_KEY_SECRET),
executionProject,
config.get(JobConfiguration.DATA_SOURCE_MC_ENDPOINT),
dest,
false,
this,
context);
dag.addVertex(ossVerificationAction);

VerificationAction verificationAction = new VerificationAction(
id + ".FinalVerification",
source,
this,
context);
dag.addVertex(verificationAction);

dag.addEdge(action, mcVerificationAction);
dag.addEdge(action, ossVerificationAction);
dag.addEdge(ossVerificationAction, verificationAction);
dag.addEdge(mcVerificationAction, verificationAction);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.aliyun.odps.mma.config.JobConfiguration;
import com.aliyun.odps.mma.server.action.ActionExecutionContext;
import com.aliyun.odps.mma.server.action.McToMcTableDataTransmissionAction;
import com.aliyun.odps.mma.server.action.McVerificationAction;
import com.aliyun.odps.mma.server.action.VerificationAction;
import com.aliyun.odps.mma.server.job.Job;
import com.aliyun.odps.mma.meta.MetaSource.TableMetaModel;

Expand Down Expand Up @@ -54,6 +56,42 @@ private void init() {
this,
context);
dag.addVertex(action);

McVerificationAction mcVerificationAction = new McVerificationAction(
id + ".McDataVerification",
config.get(JobConfiguration.DATA_DEST_MC_ACCESS_KEY_ID),
config.get(JobConfiguration.DATA_DEST_MC_ACCESS_KEY_SECRET),
executionProject,
config.get(JobConfiguration.DATA_DEST_MC_ENDPOINT),
source,
true,
this,
context);
dag.addVertex(mcVerificationAction);

McVerificationAction ossVerificationAction = new McVerificationAction(
id + ".OssDataVerification",
config.get(JobConfiguration.DATA_DEST_MC_ACCESS_KEY_ID),
config.get(JobConfiguration.DATA_DEST_MC_ACCESS_KEY_SECRET),
executionProject,
config.get(JobConfiguration.DATA_DEST_MC_ENDPOINT),
dest,
false,
this,
context);
dag.addVertex(ossVerificationAction);

VerificationAction verificationAction = new VerificationAction(
id + ".FinalVerification",
source,
this,
context);
dag.addVertex(verificationAction);

dag.addEdge(action, mcVerificationAction);
dag.addEdge(action, ossVerificationAction);
dag.addEdge(ossVerificationAction, verificationAction);
dag.addEdge(mcVerificationAction, verificationAction);
}

@Override
Expand Down