use of com.qlangtech.tis.sql.parser.meta.DependencyNode in project plugins by qlangtech.
the class HiveTask method validateDependenciesNode.
protected void validateDependenciesNode(String taskname) {
Boolean dependencyWorkStatus = null;
final List<DependencyNodeStatus> lackDependencies = Lists.newArrayList();
for (DependencyNode depenency : this.nodeMeta.getDependencies()) {
dependencyWorkStatus = this.getTaskWorkStatus().get(depenency.getId());
if (dependencyWorkStatus == null || !dependencyWorkStatus) {
lackDependencies.add(new DependencyNodeStatus(depenency, dependencyWorkStatus));
}
}
if (!lackDependencies.isEmpty()) {
// 说明有依赖到的node没有被执行
throw new IllegalStateException("taskname:" + taskname + " lackDependencies:" + lackDependencies.stream().map((r) -> "(" + r.taskNode.getId() + "," + r.taskNode.parseEntityName() + ",status:" + (r.dependencyWorkStatus == null ? "notExecute" : r.dependencyWorkStatus) + ")").collect(Collectors.joining()) + "/n TaskWorkStatus:" + this.getTaskWorkStatus().entrySet().stream().map((e) -> "[" + e.getKey() + "->" + e.getValue() + "]").collect(Collectors.joining(",")));
}
}
use of com.qlangtech.tis.sql.parser.meta.DependencyNode in project tis by qlangtech.
the class ERRules method hasSetTimestampVerColumn.
public boolean hasSetTimestampVerColumn(EntityName tableName) {
DependencyNode dumpNode = getDumpNode(tableName);
TabExtraMeta extraMeta = dumpNode.getExtraMeta();
return extraMeta == null && StringUtils.isNotEmpty(extraMeta.getTimeVerColName());
}
use of com.qlangtech.tis.sql.parser.meta.DependencyNode in project tis by qlangtech.
the class ERRules method createDefaultErRule.
/**
* 使用默认DumpNode创建ERRule并且持久化
*
* @param topology
* @throws Exception
*/
public static void createDefaultErRule(SqlTaskNodeMeta.SqlDataFlowTopology topology) throws Exception {
// 还没有定义erRule
DependencyNode dumpNode = topology.getFirstDumpNode();
DataSourceFactoryPluginStore dsStore = TIS.getDataBasePluginStore(new PostedDSProp(dumpNode.getDbName()));
TISTable tab = dsStore.loadTableMeta(dumpNode.getName());
// String topologyName, DependencyNode node, TargetColumnMeta targetColMetas
Optional<ColumnMetaData> firstPK = tab.getReflectCols().stream().filter((col) -> col.isPk()).findFirst();
if (!firstPK.isPresent()) {
throw new IllegalStateException("table:" + dumpNode.parseEntityName() + " can not find relevant PK cols");
}
createErRule(topology.getName(), dumpNode, firstPK.get());
}
use of com.qlangtech.tis.sql.parser.meta.DependencyNode in project tis by qlangtech.
the class ERRules method getAllParent.
/**
* 取得表的所有主表信息
*
* @param
* @return
*/
public List<TableRelation> getAllParent(EntityName entityName) {
List<TableRelation> parentRefs = Lists.newArrayList();
DependencyNode child;
TableRelation resultRel = null;
for (TableRelation relation : this.getRelationList()) {
child = relation.getChild();
if (StringUtils.equals(child.getName(), entityName.getTabName())) {
resultRel = relation;
parentRefs.add(resultRel);
}
}
return parentRefs;
}
use of com.qlangtech.tis.sql.parser.meta.DependencyNode in project tis by qlangtech.
the class SingleTableAppSource method getProcessDataResults.
@Override
public ExecuteResult getProcessDataResults(IExecChainContext execChainContext, ISingleTableDumpFactory singleTableDumpFactory, IDataProcessFeedback dataProcessFeedback, ITaskPhaseInfo taskPhaseInfo) throws Exception {
// 复杂数据导出
DumpPhaseStatus dumpPhaseStatus = taskPhaseInfo.getPhaseStatus(execChainContext, FullbuildPhase.FullDump);
DataflowTask tabDump = null;
DependencyNode dump = new DependencyNode();
dump.setId(db.getName() + "." + tabName);
dump.setName(tabName);
dump.setDbName(db.getName());
dump.setTabid(String.valueOf(tabId));
dump.setDbid(String.valueOf(db.getId()));
// for (DependencyNode dump : topology.getDumpNodes()) {
tabDump = singleTableDumpFactory.createSingleTableDump(dump, false, /* isHasValidTableDump */
"tableDump.getPt()", execChainContext.getZkClient(), execChainContext, dumpPhaseStatus);
tabDump.run();
return ExecuteResult.SUCCESS;
}
Aggregations