status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
unknown | language
stringclasses 5
values | commit_datetime
unknown | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | */
priva void xcuComplmnProcss() hrows Excpion {
Map<Sring, Sring> cmdParam = JSONUils.oMap(procssInsanc.gCommandParam());
Da sarDa = DaUils.gSchdulDa(cmdParam.g(CMDPARAM_COMPLEMENT_DATA_START_DATE));
Da ndDa = DaUils.gSchdulDa(cmdParam.g(CMDPARAM_COMPLEMENT_DATA_END_DATE));
procssSrvic.savProcssInsanc(procssInsanc);
in procssDfiniionId = procssInsanc.gProcssDfiniionId();
Lis<Schdul> schduls = procssSrvic.quryRlasSchdulrLisByProcssDfiniionId(procssDfiniionId);
Lis<Da> lisDa = Liss.nwLinkdLis();
!CollcionUils.isEmpy(schduls)){
for (Schdul schdul : schduls) {
lisDa.addAll(CronUils.gSlfFirDaLis(sarDa, ndDa, schdul.gCronab()));
}
}
Iraor<Da> iraor = null;
Da schdulDa = null;
!CollcionUils.isEmpy(lisDa)) {
iraor = lisDa.iraor();
schdulDa = iraor.nx();
procssInsanc.sSchdulTim(schdulDa);
procssSrvic.updaProcssInsanc(procssInsanc);
}ls{
schdulDa = procssInsanc.gSchdulTim();
schdulDa == null){
schdulDa = sarDa;
}
}
whil(Soppr.isRunning()){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | loggr.info("procss {} sar o complmn {} daa",
procssInsanc.gId(), DaUils.daToSring(schdulDa));
prparProcss();
dag == null){
loggr.rror("procss {} dag is null, plas chck ou paramrs",
procssInsanc.gId());
procssInsanc.sSa(ExcuionSaus.SUCCESS);
procssSrvic.updaProcssInsanc(procssInsanc);
rurn;
}
runProcss();
ndProcss();
!procssInsanc.gSa().ypIsSuccss()){
loggr.info("procss {} sa {}, complmn no complly!",
procssInsanc.gId(), procssInsanc.gSa());
brak;
}
//
null == iraor){
//
schdulDa = DaUils.gSomDay(schdulDa, 1);
schdulDa.afr(ndDa)){
//
loggr.info("procss {} complmn complly!", procssInsanc.gId());
brak;
}
}ls{ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | //
!iraor.hasNx()){
//
loggr.info("procss {} complmn complly!", procssInsanc.gId());
brak;
}
schdulDa = iraor.nx();
}
// flow nd
//
procssInsanc.sSchdulTim(schdulDa);
cmdParam.conainsKy(Consans.CMDPARAM_RECOVERY_START_NODE_STRING)){
cmdParam.rmov(Consans.CMDPARAM_RECOVERY_START_NODE_STRING);
procssInsanc.sCommandParam(JSONUils.oJson(cmdParam));
}
procssInsanc.sSa(ExcuionSaus.RUNNING_EXEUTION);
procssInsanc.sGlobalParams(ParamrUils.curingGlobalParams(
procssInsanc.gProcssDfiniion().gGlobalParamMap(),
procssInsanc.gProcssDfiniion().gGlobalParamLis(),
CommandTyp.COMPLEMENT_DATA, procssInsanc.gSchdulTim()));
procssInsanc.sId(0);
procssInsanc.sSarTim(nw Da());
procssInsanc.sEndTim(null);
procssSrvic.savProcssInsanc(procssInsanc);
}
}
/**
* prpar procss paramr
* @hrows Excpion xcpion
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | priva void prparProcss() hrows Excpion {
//
iniTaskQuu();
//
buildFlowDag();
loggr.info("prpar procss :{} nd", procssInsanc.gId());
}
/**
* procss nd handl
*/
priva void ndProcss() {
procssInsanc.sEndTim(nw Da());
procssSrvic.updaProcssInsanc(procssInsanc);
procssInsanc.gSa().ypIsWaiingThrad()){
procssSrvic.craRcovryWaiingThradCommand(null, procssInsanc);
}
Lis<TaskInsanc> askInsancs = procssSrvic.findValidTaskLisByProcssId(procssInsanc.gId());
alrManagr.sndAlrProcssInsanc(procssInsanc, askInsancs);
}
/**
*
* @hrows Excpion xcpion
*/
priva void buildFlowDag() hrows Excpion {
rcovrNodIdLis = gSarTaskInsancLis(procssInsanc.gCommandParam());
forbiddnTaskLis = DagHlpr.gForbiddnTaskNodMaps(procssInsanc.gProcssInsancJson());
//
Lis<Sring> rcovryNamLis = gRcovryNodNamLis();
Lis<Sring> sarNodNamLis = parsSarNodNam(procssInsanc.gCommandParam());
ProcssDag procssDag = gnraFlowDag(procssInsanc.gProcssInsancJson(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | sarNodNamLis, rcovryNamLis, procssInsanc.gTaskDpndTyp());
procssDag == null){
loggr.rror("procssDag is null");
rurn;
}
//
dag = DagHlpr.buildDagGraph(procssDag);
}
/**
*
*/
priva void iniTaskQuu(){
askFaildSubmi = fals;
acivTaskNod.clar();
dpndFaildTask.clar();
complTaskLis.clar();
rrorTaskLis.clar();
Lis<TaskInsanc> askInsancLis = procssSrvic.findValidTaskLisByProcssId(procssInsanc.gId());
for(TaskInsanc ask : askInsancLis){
ask.isTaskCompl()){
complTaskLis.pu(ask.gNam(), ask);
}
ask.gSa().ypIsFailur() && !ask.askCanRry()){
rrorTaskLis.pu(ask.gNam(), ask);
}
}
}
/**
* procss pos handl
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | priva void posHandl() {
loggr.info("dvlop mod is: {}", CommonUils.isDvlopMod());
if (!CommonUils.isDvlopMod()) {
//
Sring xcLocalPah = org.apach.dolphinschdulr.common.uils.FilUils
.gProcssExcDir(procssInsanc.gProcssDfiniion().gProjcId(),
procssInsanc.gProcssDfiniionId(),
procssInsanc.gId());
ry {
FilUils.dlDircory(nw Fil(xcLocalPah));
} cach (IOExcpion ) {
loggr.rror("dl xc dir faild ", );
}
}
}
/**
* submi ask o xcu
* @param askInsanc ask insanc
* @rurn TaskInsanc
*/
priva TaskInsanc submiTaskExc(TaskInsanc askInsanc) {
MasrBasTaskExcThrad absracExcThrad = null;
askInsanc.isSubProcss()){
absracExcThrad = nw SubProcssTaskExcThrad(askInsanc);
}ls askInsanc.isDpndTask()){
absracExcThrad = nw DpndnTaskExcThrad(askInsanc);
}ls askInsanc.isCondiionsTask()){
absracExcThrad = nw CondiionsTaskExcThrad(askInsanc);
}ls {
absracExcThrad = nw MasrTaskExcThrad(askInsanc); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | }
Fuur<Boolan> fuur = askExcSrvic.submi(absracExcThrad);
acivTaskNod.puIfAbsn(absracExcThrad, fuur);
rurn absracExcThrad.gTaskInsanc();
}
/**
* find ask insanc in db.
* in cas submi mor han on sam nam ask in h sam im.
* @param askNam ask nam
* @rurn TaskInsanc
*/
priva TaskInsanc findTaskIfExiss(Sring askNam){
Lis<TaskInsanc> askInsancLis = procssSrvic.findValidTaskLisByProcssId(his.procssInsanc.gId());
for(TaskInsanc askInsanc : askInsancLis){
askInsanc.gNam().quals(askNam)){
rurn askInsanc;
}
}
rurn null;
}
/**
* ncapsulaion ask
* @param procssInsanc procss insanc
* @param nodNam nod nam
* @rurn TaskInsanc
*/
priva TaskInsanc craTaskInsanc(ProcssInsanc procssInsanc, Sring nodNam,
TaskNod askNod) {
TaskInsanc askInsanc = findTaskIfExiss(nodNam);
askInsanc == null){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | askInsanc = nw TaskInsanc();
// ask nam
askInsanc.sNam(nodNam);
//
askInsanc.sProcssDfiniionId(procssInsanc.gProcssDfiniionId());
//
askInsanc.sSa(ExcuionSaus.SUBMITTED_SUCCESS);
//
askInsanc.sProcssInsancId(procssInsanc.gId());
//
askInsanc.sTaskJson(JSON.oJSONSring(askNod));
//
askInsanc.sTaskTyp(askNod.gTyp());
//
askInsanc.sAlrFlag(Flag.NO);
//
askInsanc.sSarTim(nw Da());
//
askInsanc.sFlag(Flag.YES);
//
askInsanc.sRryTims(0);
//
askInsanc.sMaxRryTims(askNod.gMaxRryTims());
//
askInsanc.sRryInrval(askNod.gRryInrval());
//
askNod.gTaskInsancPrioriy() == null){
askInsanc.sTaskInsancPrioriy(Prioriy.MEDIUM);
}ls{
askInsanc.sTaskInsancPrioriy(askNod.gTaskInsancPrioriy()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | }
Sring procssWorkrGroup = procssInsanc.gWorkrGroup();
procssWorkrGroup = SringUils.isBlank(procssWorkrGroup) ? DEFAULT_WORKER_GROUP : procssWorkrGroup;
Sring askWorkrGroup = SringUils.isBlank(askNod.gWorkrGroup()) ? procssWorkrGroup : askNod.gWorkrGroup();
if (!procssWorkrGroup.quals(DEFAULT_WORKER_GROUP) && askWorkrGroup.quals(DEFAULT_WORKER_GROUP)) {
askInsanc.sWorkrGroup(procssWorkrGroup);
}ls {
askInsanc.sWorkrGroup(askWorkrGroup);
}
}
rurn askInsanc;
}
/**
* if all of h ask dpndnc ar skip, skip i oo.
* @param askNod
* @rurn
*/
priva boolan isTaskNodNdSkip(TaskNod askNod){
CollcionUils.isEmpy(askNod.gDpLis())){
rurn fals;
}
for(Sring dpNod : askNod.gDpLis()){
!skipTaskNodLis.conainsKy(dpNod)){
rurn fals;
}
}
rurn ru;
}
/**
* s ask nod skip if dpndnc all skip |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | * @param askNodsSkipLis
*/
priva void sTaskNodSkip(Lis<Sring> askNodsSkipLis){
for(Sring skipNod : askNodsSkipLis){
skipTaskNodLis.puIfAbsn(skipNod, dag.gNod(skipNod));
Collcion<Sring> posNodLis = DagHlpr.gSarVrx(skipNod, dag, complTaskLis);
Lis<Sring> posSkipLis = nw ArrayLis<>();
for(Sring pos : posNodLis){
TaskNod posNod = dag.gNod(pos);
isTaskNodNdSkip(posNod)){
posSkipLis.add(pos);
}
}
sTaskNodSkip(posSkipLis);
}
}
/**
* pars condiion ask find h branch procss
* s skip flag for anohr on.
* @param nodNam
* @rurn
*/
priva Lis<Sring> parsCondiionTask(Sring nodNam){
Lis<Sring> condiionTaskLis = nw ArrayLis<>();
TaskNod askNod = dag.gNod(nodNam);
!askNod.isCondiionsTask()){
rurn condiionTaskLis;
}
CondiionsParamrs condiionsParamrs =
JSONUils.parsObjc(askNod.gCondiionRsul(), CondiionsParamrs.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | TaskInsanc askInsanc = complTaskLis.g(nodNam);
askInsanc == null){
loggr.rror("ask insanc {} canno find, plas chck i!", nodNam);
rurn condiionTaskLis;
}
askInsanc.gSa().ypIsSuccss()){
condiionTaskLis = condiionsParamrs.gSuccssNod();
sTaskNodSkip(condiionsParamrs.gFaildNod());
}ls askInsanc.gSa().ypIsFailur()){
condiionTaskLis = condiionsParamrs.gFaildNod();
sTaskNodSkip(condiionsParamrs.gSuccssNod());
}ls{
condiionTaskLis.add(nodNam);
}
rurn condiionTaskLis;
}
/**
* pars pos nod lis of prvious nod
* if condiion nod: rurn procss according o h sings
* if pos nod compld, rurn pos nods of h compld nod
* @param prviousNodNam
* @rurn
*/
priva Lis<Sring> parsPosNodLis(Sring prviousNodNam){
Lis<Sring> posNodLis = nw ArrayLis<>();
TaskNod askNod = dag.gNod(prviousNodNam);
askNod != null && askNod.isCondiionsTask()){
rurn parsCondiionTask(prviousNodNam);
}
Collcion<Sring> posNodCollcion = DagHlpr.gSarVrx(prviousNodNam, dag, complTaskLis); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | Lis<Sring> posSkipLis = nw ArrayLis<>();
//
//
//
//
for(Sring posNod : posNodCollcion){
complTaskLis.conainsKy(posNod)){
TaskInsanc posTaskInsanc = complTaskLis.g(posNod);
dag.gNod(posNod).isCondiionsTask()){
Lis<Sring> condiionTaskNodLis = parsCondiionTask(posNod);
for(Sring condiions : condiionTaskNodLis){
posNodLis.addAll(parsPosNodLis(condiions));
}
}ls posTaskInsanc.gSa().ypIsSuccss()){
posNodLis.addAll(parsPosNodLis(posNod));
}ls{
posNodLis.add(posNod);
}
}ls isTaskNodNdSkip(dag.gNod(posNod))){
posSkipLis.add(posNod);
sTaskNodSkip(posSkipLis);
posSkipLis.clar();
}ls{
posNodLis.add(posNod);
}
}
rurn posNodLis;
}
/**
* submi pos nod |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | * @param parnNodNam parn nod nam
*/
priva void submiPosNod(Sring parnNodNam){
Lis<Sring> submiTaskNodLis = parsPosNodLis(parnNodNam);
Lis<TaskInsanc> askInsancs = nw ArrayLis<>();
for(Sring askNod : submiTaskNodLis){
askInsancs.add(craTaskInsanc(procssInsanc, askNod,
dag.gNod(askNod)));
}
//
for(TaskInsanc ask : askInsancs){
radyToSubmiTaskLis.conainsKy(ask.gNam())){
coninu;
}
complTaskLis.conainsKy(ask.gNam())){
loggr.info("ask {} has alrady run succss", ask.gNam());
coninu;
}
ask.gSa().ypIsPaus() || ask.gSa().ypIsCancl()){
loggr.info("ask {} soppd, h sa is {}", ask.gNam(), ask.gSa());
}ls{
addTaskToSandByLis(ask);
}
}
}
/**
* drmin whhr h dpndncis of h ask nod ar compl
* @rurn DpndRsul
*/
priva DpndRsul isTaskDpsCompl(Sring askNam) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | Collcion<Sring> sarNods = dag.gBginNod();
//
sarNods.conains(askNam)){
rurn DpndRsul.SUCCESS;
}
TaskNod askNod = dag.gNod(askNam);
Lis<Sring> dpNamLis = askNod.gDpLis();
for(Sring dpsNod : dpNamLis ){
!dag.conainsNod(dpsNod)
|| skipTaskNodLis.conainsKy(dpsNod)
|| forbiddnTaskLis.conainsKy(dpsNod)){
coninu;
}
//
!complTaskLis.conainsKy(dpsNod)){
rurn DpndRsul.WAITING;
}
ExcuionSaus dpTaskSa = complTaskLis.g(dpsNod).gSa();
dpTaskSa.ypIsPaus() || dpTaskSa.ypIsCancl()){
rurn DpndRsul.WAITING;
}
//
askNod.isCondiionsTask()){
coninu;
}
!dpndTaskSuccss(dpsNod, askNam)){
rurn DpndRsul.FAILED;
}
}
loggr.info("askNam: {} complDpndTaskLis: {}", askNam, Arrays.oSring(complTaskLis.kyS().oArray())); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | rurn DpndRsul.SUCCESS;
}
/**
* dpnd nod is compld, bu hr nd chck h condiion ask branch is h nx nod
* @param dpndNodNam
* @param nxNodNam
* @rurn
*/
priva boolan dpndTaskSuccss(Sring dpndNodNam, Sring nxNodNam){
dag.gNod(dpndNodNam).isCondiionsTask()){
//
Lis<Sring> nxTaskLis = parsCondiionTask(dpndNodNam);
!nxTaskLis.conains(nxNodNam)){
rurn fals;
}
}ls {
ExcuionSaus dpTaskSa = complTaskLis.g(dpndNodNam).gSa();
dpTaskSa.ypIsFailur()){
rurn fals;
}
}
rurn ru;
}
/**
* qury ask insanc by compl sa
* @param sa sa
* @rurn ask insanc lis
*/
priva Lis<TaskInsanc> gComplTaskBySa(ExcuionSaus sa){
Lis<TaskInsanc> rsulLis = nw ArrayLis<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | for (Map.Enry<Sring, TaskInsanc> nry: complTaskLis.nryS()) {
nry.gValu().gSa() == sa){
rsulLis.add(nry.gValu());
}
}
rurn rsulLis;
}
/**
* whr hr ar ongoing asks
* @param sa sa
* @rurn ExcuionSaus
*/
priva ExcuionSaus runningSa(ExcuionSaus sa){
sa == ExcuionSaus.READY_STOP ||
sa == ExcuionSaus.READY_PAUSE ||
sa == ExcuionSaus.WAITTING_THREAD){
//
rurn sa;
}ls{
rurn ExcuionSaus.RUNNING_EXEUTION;
}
}
/**
* xiss failur ask,conains submi failur、dpndncy failur,xcu failur(rry afr)
*
* @rurn Boolan whhr has faild ask
*/
priva boolan hasFaildTask(){
his.askFaildSubmi){
rurn ru; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | }
his.rrorTaskLis.siz() > 0){
rurn ru;
}
rurn his.dpndFaildTask.siz() > 0;
}
/**
* procss insanc failur
*
* @rurn Boolan whhr procss insanc faild
*/
priva boolan procssFaild(){
hasFaildTask()) {
procssInsanc.gFailurSragy() == FailurSragy.END){
rurn ru;
}
if (procssInsanc.gFailurSragy() == FailurSragy.CONTINUE) {
rurn radyToSubmiTaskLis.siz() == 0 || acivTaskNod.siz() == 0;
}
}
rurn fals;
}
/**
* whhr ask for waiing hrad
* @rurn Boolan whhr has waiing hrad ask
*/
priva boolan hasWaiingThradTask(){
Lis<TaskInsanc> waiingLis = gComplTaskBySa(ExcuionSaus.WAITTING_THREAD);
rurn CollcionUils.isNoEmpy(waiingLis);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | /**
* prpar for paus
* 1,faild rry ask in h prparaion quu , rurns o failur dircly
* 2,xiss paus ask,complmn no compld, pnding submission of asks, rurn o suspnsion
* 3,succss
* @rurn ExcuionSaus
*/
priva ExcuionSaus procssRadyPaus(){
hasRryTaskInSandBy()){
rurn ExcuionSaus.FAILURE;
}
Lis<TaskInsanc> pausLis = gComplTaskBySa(ExcuionSaus.PAUSE);
CollcionUils.isNoEmpy(pausLis)
|| !isComplmnEnd()
|| radyToSubmiTaskLis.siz() > 0){
rurn ExcuionSaus.PAUSE;
}ls{
rurn ExcuionSaus.SUCCESS;
}
}
/**
* gnra h las procss insanc saus by h asks sa
* @rurn procss insanc xcuion saus
*/
priva ExcuionSaus gProcssInsancSa(){
ProcssInsanc insanc = procssSrvic.findProcssInsancById(procssInsanc.gId());
ExcuionSaus sa = insanc.gSa();
acivTaskNod.siz() > 0 || rryTaskExiss()){
// aciv a
rurn runningSa(sa); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | }
// procss failur
procssFaild()){
rurn ExcuionSaus.FAILURE;
}
// waiing hrad
hasWaiingThradTask()){
rurn ExcuionSaus.WAITTING_THREAD;
}
// paus
sa == ExcuionSaus.READY_PAUSE){
rurn procssRadyPaus();
}
// sop
sa == ExcuionSaus.READY_STOP){
Lis<TaskInsanc> sopLis = gComplTaskBySa(ExcuionSaus.STOP);
Lis<TaskInsanc> killLis = gComplTaskBySa(ExcuionSaus.KILL);
CollcionUils.isNoEmpy(sopLis)
|| CollcionUils.isNoEmpy(killLis)
|| !isComplmnEnd()){
rurn ExcuionSaus.STOP;
}ls{
rurn ExcuionSaus.SUCCESS;
}
}
// succss
sa == ExcuionSaus.RUNNING_EXEUTION){
Lis<TaskInsanc> killTasks = gComplTaskBySa(ExcuionSaus.KILL);
radyToSubmiTaskLis.siz() > 0){
//asks curr |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | rurn ExcuionSaus.RUNNING_EXEUTION;
}ls CollcionUils.isNoEmpy(killTasks)){
// asks may
rurn ExcuionSaus.FAILURE;
}ls{
// if h w
rurn ExcuionSaus.SUCCESS;
}
}
rurn sa;
}
/**
* whhr sandby ask lis hav rry asks
* @rurn
*/
priva boolan rryTaskExiss() {
boolan rsul = fals;
for(Sring askNam : radyToSubmiTaskLis.kyS()){
TaskInsanc ask = radyToSubmiTaskLis.g(askNam);
ask.gSa().ypIsFailur()){
rsul = ru;
brak;
}
}
rurn rsul;
}
/**
* whhr complmn nd
* @rurn Boolan whhr is complmn nd
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | priva boolan isComplmnEnd() {
!procssInsanc.isComplmnDaa()){
rurn ru;
}
ry {
Map<Sring, Sring> cmdParam = JSONUils.oMap(procssInsanc.gCommandParam());
Da ndTim = DaUils.gSchdulDa(cmdParam.g(CMDPARAM_COMPLEMENT_DATA_END_DATE));
rurn procssInsanc.gSchdulTim().quals(ndTim);
} cach (Excpion ) {
loggr.rror("complmn nd faild ",);
rurn fals;
}
}
/**
* updaProcssInsanc procss insanc sa
* afr ach bach of asks is xcud, h saus of h procss insanc is updad
*/
priva void updaProcssInsancSa() {
ExcuionSaus sa = gProcssInsancSa();
procssInsanc.gSa() != sa){
loggr.info(
"work flow procss insanc [id: {}, nam:{}], sa chang from {} o {}, cmd yp: {}",
procssInsanc.gId(), procssInsanc.gNam(),
procssInsanc.gSa(), sa,
procssInsanc.gCommandTyp());
ProcssInsanc insanc = procssSrvic.findProcssInsancById(procssInsanc.gId());
insanc.sSa(sa);
insanc.sProcssDfiniion(procssInsanc.gProcssDfiniion());
procssSrvic.updaProcssInsanc(insanc);
procssInsanc = insanc; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | }
}
/**
* g ask dpndncy rsul
* @param askInsanc ask insanc
* @rurn DpndRsul
*/
priva DpndRsul gDpndRsulForTask(TaskInsanc askInsanc){
rurn isTaskDpsCompl(askInsanc.gNam());
}
/**
* add ask o sandby lis
* @param askInsanc ask insanc
*/
priva void addTaskToSandByLis(TaskInsanc askInsanc){
loggr.info("add ask o sand by lis: {}", askInsanc.gNam());
radyToSubmiTaskLis.puIfAbsn(askInsanc.gNam(), askInsanc);
}
/**
* rmov ask from sand by lis
* @param askInsanc ask insanc
*/
priva void rmovTaskFromSandbyLis(TaskInsanc askInsanc){
loggr.info("rmov ask from sand by lis: {}", askInsanc.gNam());
radyToSubmiTaskLis.rmov(askInsanc.gNam());
}
/**
* has rry ask in sandby
* @rurn Boolan whhr has rry ask in sandby
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | priva boolan hasRryTaskInSandBy(){
for (Map.Enry<Sring, TaskInsanc> nry: radyToSubmiTaskLis.nryS()) {
nry.gValu().gSa().ypIsFailur()){
rurn ru;
}
}
rurn fals;
}
/**
* submi and wach h asks, unil h work flow sop
*/
priva void runProcss(){
// submi sar nod
submiPosNod(null);
boolan sndTimWarning = fals;
whil(!procssInsanc.isProcssInsancSop()){
// snd warn
!sndTimWarning && chckProcssTimOu(procssInsanc) ){
alrManagr.sndProcssTimouAlr(procssInsanc,
procssSrvic.findProcssDfinById(procssInsanc.gProcssDfiniionId()));
sndTimWarning = ru;
}
for(Map.Enry<MasrBasTaskExcThrad,Fuur<Boolan>> nry: acivTaskNod.nryS()) {
Fuur<Boolan> fuur = nry.gValu();
TaskInsanc ask = nry.gKy().gTaskInsanc();
!fuur.isDon()){
coninu;
}
// nod moni
ask = his.procssSrvic.findTaskInsancById(ask.gId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | ask == null){
his.askFaildSubmi = ru;
acivTaskNod.rmov(nry.gKy());
coninu;
}
// nod moni
ask.gSa().ypIsFinishd()){
acivTaskNod.rmov(nry.gKy());
}
loggr.info("ask :{}, id:{} compl, sa is {} ",
ask.gNam(), ask.gId(), ask.gSa());
// nod succ
ask.gSa() == ExcuionSaus.SUCCESS){
complTaskLis.pu(ask.gNam(), ask);
submiPosNod(ask.gNam());
coninu;
}
// nod fail
ask.gSa().ypIsFailur()){
ask.gSa() == ExcuionSaus.NEED_FAULT_TOLERANCE){
his.rcovrTolrancFaulTaskLis.add(ask);
}
ask.askCanRry()){
addTaskToSandByLis(ask);
}ls{
complTaskLis.pu(ask.gNam(), ask);
ask.isCondiionsTask()
|| DagHlpr.havCondiionsAfrNod(ask.gNam(), dag)) {
submiPosNod(ask.gNam());
}ls{ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | rrorTaskLis.pu(ask.gNam(), ask);
procssInsanc.gFailurSragy() == FailurSragy.END){
killThOhrTasks();
}
}
}
coninu;
}
// ohr sa
complTaskLis.pu(ask.gNam(), ask);
}
// snd alr
CollcionUils.isNoEmpy(his.rcovrTolrancFaulTaskLis)){
alrManagr.sndAlrWorkrTolrancFaul(procssInsanc, rcovrTolrancFaulTaskLis);
his.rcovrTolrancFaulTaskLis.clar();
}
// updaPro
// failur p
// if a ask
rrorTaskLis.siz() > 0){
for(Map.Enry<Sring, TaskInsanc> nry: complTaskLis.nryS()) {
TaskInsanc complTask = nry.gValu();
complTask.gSa()== ExcuionSaus.PAUSE){
complTask.sSa(ExcuionSaus.KILL);
complTaskLis.pu(nry.gKy(), complTask);
procssSrvic.updaTaskInsanc(complTask);
}
}
}
canSubmiTaskToQuu()){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | submiSandByTask();
}
ry {
Thrad.slp(Consans.SLEEP_TIME_MILLIS);
} cach (InrrupdExcpion ) {
loggr.rror(.gMssag(),);
}
updaProcssInsancSa();
}
loggr.info("procss:{} nd, sa :{}", procssInsanc.gId(), procssInsanc.gSa());
}
/**
* whhr chck procss im ou
* @param procssInsanc ask insanc
* @rurn ru if im ou of procss insanc > running im of procss insanc
*/
priva boolan chckProcssTimOu(ProcssInsanc procssInsanc) {
procssInsanc.gTimou() == 0 ){
rurn fals;
}
Da now = nw Da();
long runningTim = DaUils.diffMin(now, procssInsanc.gSarTim());
rurn runningTim > procssInsanc.gTimou();
}
/**
* whhr can submi ask o quu
* @rurn boolan
*/
priva boolan canSubmiTaskToQuu() {
rurn OSUils.chckRsourc(masrConfig.gMasrMaxCpuloadAvg(), masrConfig.gMasrRsrvdMmory()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | }
/**
* clos h on going asks
*/
priva void killThOhrTasks() {
loggr.info("kill calld on : {}, num: {}", procssInsanc.gId(),
acivTaskNod.siz());
for (Map.Enry<MasrBasTaskExcThrad, Fuur<Boolan>> nry : acivTaskNod.nryS()) {
MasrBasTaskExcThrad askExcThrad = nry.gKy();
Fuur<Boolan> fuur = nry.gValu();
TaskInsanc askInsanc = askExcThrad.gTaskInsanc();
askInsanc = procssSrvic.findTaskInsancById(askInsanc.gId());
askInsanc != null && askInsanc.gSa().ypIsFinishd()){
coninu;
}
if (!fuur.isDon()) {
// rcord ki
loggr.info("kill procss insanc, id: {}, ask: {}", procssInsanc.gId(), askExcThrad.gTaskInsanc().gId());
// kill nod
askExcThrad.kill();
}
}
}
/**
* whhr h rry inrval is imd ou
* @param askInsanc ask insanc
* @rurn Boolan
*/
priva boolan rryTaskInrvalOvrTim(TaskInsanc askInsanc){
askInsanc.gSa() != ExcuionSaus.FAILURE){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | rurn ru;
}
askInsanc.gId() == 0 ||
askInsanc.gMaxRryTims() ==0 ||
askInsanc.gRryInrval() == 0 ){
rurn ru;
}
Da now = nw Da();
long faildTimInrval = DaUils.diffrSc(now, askInsanc.gEndTim());
// ask rry dos no ovr im, rurn fals
rurn askInsanc.gRryInrval() * SEC_2_MINUTES_TIME_UNIT < faildTimInrval;
}
/**
* handling h lis of asks o b submid
*/
priva void submiSandByTask(){
for(Map.Enry<Sring, TaskInsanc> nry: radyToSubmiTaskLis.nryS()) {
TaskInsanc ask = nry.gValu();
DpndRsul dpndRsul = gDpndRsulForTask(ask);
DpndRsul.SUCCESS == dpndRsul){
rryTaskInrvalOvrTim(ask)){
submiTaskExc(ask);
rmovTaskFromSandbyLis(ask);
}
}ls DpndRsul.FAILED == dpndRsul){
// if h d
dpndFaildTask.pu(nry.gKy(), ask);
rmovTaskFromSandbyLis(ask);
loggr.info("ask {},id:{} dpnd rsul : {}",ask.gNam(), ask.gId(), dpndRsul);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | }
}
/**
* g rcovry ask insanc
* @param askId ask id
* @rurn rcovry ask insanc
*/
priva TaskInsanc gRcovryTaskInsanc(Sring askId){
!SringUils.isNoEmpy(askId)){
rurn null;
}
ry {
Ingr inId = Ingr.valuOf(askId);
TaskInsanc ask = procssSrvic.findTaskInsancById(inId);
ask == null){
loggr.rror("sar nod id canno b found: {}", askId);
}ls {
rurn ask;
}
}cach (Excpion ){
loggr.rror("g rcovry ask insanc faild ",);
}
rurn null;
}
/**
* g sar ask insanc lis
* @param cmdParam command param
* @rurn ask insanc lis
*/
priva Lis<TaskInsanc> gSarTaskInsancLis(Sring cmdParam){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | Lis<TaskInsanc> insancLis = nw ArrayLis<>();
Map<Sring, Sring> paramMap = JSONUils.oMap(cmdParam);
paramMap != null && paramMap.conainsKy(CMDPARAM_RECOVERY_START_NODE_STRING)){
Sring[] idLis = paramMap.g(CMDPARAM_RECOVERY_START_NODE_STRING).spli(Consans.COMMA);
for(Sring nodId : idLis){
TaskInsanc ask = gRcovryTaskInsanc(nodId);
ask != null){
insancLis.add(ask);
}
}
}
rurn insancLis;
}
/**
* pars "SarNodNamLis" from cmd param
* @param cmdParam command param
* @rurn sar nod nam lis
*/
priva Lis<Sring> parsSarNodNam(Sring cmdParam){
Lis<Sring> sarNodNamLis = nw ArrayLis<>();
Map<Sring, Sring> paramMap = JSONUils.oMap(cmdParam);
paramMap == null){
rurn sarNodNamLis;
}
paramMap.conainsKy(CMDPARAM_START_NODE_NAMES)){
sarNodNamLis = Arrays.asLis(paramMap.g(CMDPARAM_START_NODE_NAMES).spli(Consans.COMMA));
}
rurn sarNodNamLis;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,615 | [Bug][master] After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail | 1.run workflow
2.After the task is executed successfully, but the next task has not been submitted, stop the master,the workflow will fail



**Which version of Dolphin Scheduler:**
-[1.3.2-release]
| https://github.com/apache/dolphinscheduler/issues/3615 | https://github.com/apache/dolphinscheduler/pull/3947 | ccdaee9c04d5eb2a23ad85cdc5d56150babf57c6 | 4f94943b2d04c03c2dd9366cf3550f1595a1964a | "2020-08-27T09:08:41Z" | java | "2020-10-19T08:50:13Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | * gnra sar nod nam lis from parsing command param;
* if "SarNodIdLis" xiss in command param, rurn SarNodIdLis
* @rurn rcovry nod nam lis
*/
priva Lis<Sring> gRcovryNodNamLis(){
Lis<Sring> rcovryNodNamLis = nw ArrayLis<>();
CollcionUils.isNoEmpy(rcovrNodIdLis)) {
for (TaskInsanc ask : rcovrNodIdLis) {
rcovryNodNamLis.add(ask.gNam());
}
}
rurn rcovryNodNamLis;
}
/**
* gnra flow dag
* @param procssDfiniionJson procss dfiniion json
* @param sarNodNamLis sar nod nam lis
* @param rcovryNodNamLis rcovry nod nam lis
* @param dpNodTyp dpnd nod yp
* @rurn ProcssDag procss dag
* @hrows Excpion xcpion
*/
public ProcssDag gnraFlowDag(Sring procssDfiniionJson,
Lis<Sring> sarNodNamLis,
Lis<Sring> rcovryNodNamLis,
TaskDpndTyp dpNodTyp)hrows Excpion{
rurn DagHlpr.gnraFlowDag(procssDfiniionJson, sarNodNamLis, rcovryNodNamLis, dpNodTyp);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,966 | Call submodule, send mail problem | Call the submodule, run the option to send an email whether it succeeds or fails, each submodule sends an email, the total end of sending an email, it should be OK as long as the total end of sending an email
调用子模块,运行选择无论成功失败都发送邮件,每个子模块发送一封邮件,应该是总的结束了发送一封邮件

| https://github.com/apache/dolphinscheduler/issues/3966 | https://github.com/apache/dolphinscheduler/pull/3972 | ccc8ba1167f4b447ee4c19bee42b813c32f61027 | 7a088b7325e173c2419398d3a5c3785839c4b72a | "2020-10-21T09:20:21Z" | java | "2020-10-22T08:09:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/AlertManager.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.utils;
import org.apache.dolphinscheduler.common.enums.AlertType;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.ShowType;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.DaoFactory;
import org.apache.dolphinscheduler.dao.entity.Alert;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,966 | Call submodule, send mail problem | Call the submodule, run the option to send an email whether it succeeds or fails, each submodule sends an email, the total end of sending an email, it should be OK as long as the total end of sending an email
调用子模块,运行选择无论成功失败都发送邮件,每个子模块发送一封邮件,应该是总的结束了发送一封邮件

| https://github.com/apache/dolphinscheduler/issues/3966 | https://github.com/apache/dolphinscheduler/pull/3972 | ccc8ba1167f4b447ee4c19bee42b813c32f61027 | 7a088b7325e173c2419398d3a5c3785839c4b72a | "2020-10-21T09:20:21Z" | java | "2020-10-22T08:09:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/AlertManager.java | import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
/**
* alert manager
*/
public class AlertManager {
/**
* logger of AlertManager
*/
private static final Logger logger = LoggerFactory.getLogger(AlertManager.class);
/**
* alert dao
*/
private AlertDao alertDao = DaoFactory.getDaoInstance(AlertDao.class);
/**
* command type convert chinese
*
* @param commandType command type
* @return command name
*/
private String getCommandCnName(CommandType commandType) {
switch (commandType) {
case RECOVER_TOLERANCE_FAULT_PROCESS:
return "recover tolerance fault process"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,966 | Call submodule, send mail problem | Call the submodule, run the option to send an email whether it succeeds or fails, each submodule sends an email, the total end of sending an email, it should be OK as long as the total end of sending an email
调用子模块,运行选择无论成功失败都发送邮件,每个子模块发送一封邮件,应该是总的结束了发送一封邮件

| https://github.com/apache/dolphinscheduler/issues/3966 | https://github.com/apache/dolphinscheduler/pull/3972 | ccc8ba1167f4b447ee4c19bee42b813c32f61027 | 7a088b7325e173c2419398d3a5c3785839c4b72a | "2020-10-21T09:20:21Z" | java | "2020-10-22T08:09:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/AlertManager.java | case RECOVER_SUSPENDED_PROCESS:
return "recover suspended process";
case START_CURRENT_TASK_PROCESS:
return "start current task process";
case START_FAILURE_TASK_PROCESS:
return "start failure task process";
case START_PROCESS:
return "start process";
case REPEAT_RUNNING:
return "repeat running";
case SCHEDULER:
return "scheduler";
case COMPLEMENT_DATA:
return "complement data";
case PAUSE:
return "pause";
case STOP:
return "stop";
default:
return "unknown type";
}
}
/**
* process instance format
*/
private static final String PROCESS_INSTANCE_FORMAT =
"\"id:%d\"," +
"\"name:%s\"," +
"\"job type: %s\"," +
"\"state: %s\"," + |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,966 | Call submodule, send mail problem | Call the submodule, run the option to send an email whether it succeeds or fails, each submodule sends an email, the total end of sending an email, it should be OK as long as the total end of sending an email
调用子模块,运行选择无论成功失败都发送邮件,每个子模块发送一封邮件,应该是总的结束了发送一封邮件

| https://github.com/apache/dolphinscheduler/issues/3966 | https://github.com/apache/dolphinscheduler/pull/3972 | ccc8ba1167f4b447ee4c19bee42b813c32f61027 | 7a088b7325e173c2419398d3a5c3785839c4b72a | "2020-10-21T09:20:21Z" | java | "2020-10-22T08:09:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/AlertManager.java | "\"recovery:%s\"," +
"\"run time: %d\"," +
"\"start time: %s\"," +
"\"end time: %s\"," +
"\"host: %s\"" ;
/**
* get process instance content
* @param processInstance process instance
* @param taskInstances task instance list
* @return process instance format content
*/
public String getContentProcessInstance(ProcessInstance processInstance,
List<TaskInstance> taskInstances){
String res = "";
if(processInstance.getState().typeIsSuccess()){
res = String.format(PROCESS_INSTANCE_FORMAT,
processInstance.getId(),
processInstance.getName(),
getCommandCnName(processInstance.getCommandType()),
processInstance.getState().toString(),
processInstance.getRecovery().toString(),
processInstance.getRunTimes(),
DateUtils.dateToString(processInstance.getStartTime()),
DateUtils.dateToString(processInstance.getEndTime()),
processInstance.getHost()
);
res = "[" + res + "]";
}else if(processInstance.getState().typeIsFailure()){
List<LinkedHashMap> failedTaskList = new ArrayList<>();
for(TaskInstance task : taskInstances){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,966 | Call submodule, send mail problem | Call the submodule, run the option to send an email whether it succeeds or fails, each submodule sends an email, the total end of sending an email, it should be OK as long as the total end of sending an email
调用子模块,运行选择无论成功失败都发送邮件,每个子模块发送一封邮件,应该是总的结束了发送一封邮件

| https://github.com/apache/dolphinscheduler/issues/3966 | https://github.com/apache/dolphinscheduler/pull/3972 | ccc8ba1167f4b447ee4c19bee42b813c32f61027 | 7a088b7325e173c2419398d3a5c3785839c4b72a | "2020-10-21T09:20:21Z" | java | "2020-10-22T08:09:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/AlertManager.java | if(task.getState().typeIsSuccess()){
continue;
}
LinkedHashMap<String, String> failedTaskMap = new LinkedHashMap();
failedTaskMap.put("process instance id", String.valueOf(processInstance.getId()));
failedTaskMap.put("process instance name", processInstance.getName());
failedTaskMap.put("task id", String.valueOf(task.getId()));
failedTaskMap.put("task name", task.getName());
failedTaskMap.put("task type", task.getTaskType());
failedTaskMap.put("task state", task.getState().toString());
failedTaskMap.put("task start time", DateUtils.dateToString(task.getStartTime()));
failedTaskMap.put("task end time", DateUtils.dateToString(task.getEndTime()));
failedTaskMap.put("host", task.getHost());
failedTaskMap.put("log path", task.getLogPath());
failedTaskList.add(failedTaskMap);
}
res = JSONUtils.toJson(failedTaskList);
}
return res;
}
/**
* getting worker fault tolerant content
*
* @param processInstance process instance
* @param toleranceTaskList tolerance task list
* @return worker tolerance content
*/
private String getWorkerToleranceContent(ProcessInstance processInstance, List<TaskInstance> toleranceTaskList){
List<LinkedHashMap<String, String>> toleranceTaskInstanceList = new ArrayList<>();
for(TaskInstance taskInstance: toleranceTaskList){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,966 | Call submodule, send mail problem | Call the submodule, run the option to send an email whether it succeeds or fails, each submodule sends an email, the total end of sending an email, it should be OK as long as the total end of sending an email
调用子模块,运行选择无论成功失败都发送邮件,每个子模块发送一封邮件,应该是总的结束了发送一封邮件

| https://github.com/apache/dolphinscheduler/issues/3966 | https://github.com/apache/dolphinscheduler/pull/3972 | ccc8ba1167f4b447ee4c19bee42b813c32f61027 | 7a088b7325e173c2419398d3a5c3785839c4b72a | "2020-10-21T09:20:21Z" | java | "2020-10-22T08:09:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/AlertManager.java | LinkedHashMap<String, String> toleranceWorkerContentMap = new LinkedHashMap();
toleranceWorkerContentMap.put("process name", processInstance.getName());
toleranceWorkerContentMap.put("task name", taskInstance.getName());
toleranceWorkerContentMap.put("host", taskInstance.getHost());
toleranceWorkerContentMap.put("task retry times", String.valueOf(taskInstance.getRetryTimes()));
toleranceTaskInstanceList.add(toleranceWorkerContentMap);
}
return JSONUtils.toJson(toleranceTaskInstanceList);
}
/**
* send worker alert fault tolerance
*
* @param processInstance process instance
* @param toleranceTaskList tolerance task list
*/
public void sendAlertWorkerToleranceFault(ProcessInstance processInstance, List<TaskInstance> toleranceTaskList){
try{
Alert alert = new Alert();
alert.setTitle("worker fault tolerance");
alert.setShowType(ShowType.TABLE);
String content = getWorkerToleranceContent(processInstance, toleranceTaskList);
alert.setContent(content);
alert.setAlertType(AlertType.EMAIL);
alert.setCreateTime(new Date());
alert.setAlertGroupId(processInstance.getWarningGroupId() == null ? 1:processInstance.getWarningGroupId());
alert.setReceivers(processInstance.getProcessDefinition().getReceivers());
alert.setReceiversCc(processInstance.getProcessDefinition().getReceiversCc());
alertDao.addAlert(alert);
logger.info("add alert to db , alert : {}", alert.toString());
}catch (Exception e){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,966 | Call submodule, send mail problem | Call the submodule, run the option to send an email whether it succeeds or fails, each submodule sends an email, the total end of sending an email, it should be OK as long as the total end of sending an email
调用子模块,运行选择无论成功失败都发送邮件,每个子模块发送一封邮件,应该是总的结束了发送一封邮件

| https://github.com/apache/dolphinscheduler/issues/3966 | https://github.com/apache/dolphinscheduler/pull/3972 | ccc8ba1167f4b447ee4c19bee42b813c32f61027 | 7a088b7325e173c2419398d3a5c3785839c4b72a | "2020-10-21T09:20:21Z" | java | "2020-10-22T08:09:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/AlertManager.java | logger.error("send alert failed:{} ", e.getMessage());
}
}
/**
* send process instance alert
* @param processInstance process instance
* @param taskInstances task instance list
*/
public void sendAlertProcessInstance(ProcessInstance processInstance,
List<TaskInstance> taskInstances){
boolean sendWarnning = false;
WarningType warningType = processInstance.getWarningType();
switch (warningType){
case ALL:
if(processInstance.getState().typeIsFinished()){
sendWarnning = true;
}
break;
case SUCCESS:
if(processInstance.getState().typeIsSuccess()){
sendWarnning = true;
}
break;
case FAILURE:
if(processInstance.getState().typeIsFailure()){
sendWarnning = true;
}
break;
default:
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,966 | Call submodule, send mail problem | Call the submodule, run the option to send an email whether it succeeds or fails, each submodule sends an email, the total end of sending an email, it should be OK as long as the total end of sending an email
调用子模块,运行选择无论成功失败都发送邮件,每个子模块发送一封邮件,应该是总的结束了发送一封邮件

| https://github.com/apache/dolphinscheduler/issues/3966 | https://github.com/apache/dolphinscheduler/pull/3972 | ccc8ba1167f4b447ee4c19bee42b813c32f61027 | 7a088b7325e173c2419398d3a5c3785839c4b72a | "2020-10-21T09:20:21Z" | java | "2020-10-22T08:09:55Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/AlertManager.java | if(!sendWarnning){
return;
}
Alert alert = new Alert();
String cmdName = getCommandCnName(processInstance.getCommandType());
String success = processInstance.getState().typeIsSuccess() ? "success" :"failed";
alert.setTitle(cmdName + " " + success);
ShowType showType = processInstance.getState().typeIsSuccess() ? ShowType.TEXT : ShowType.TABLE;
alert.setShowType(showType);
String content = getContentProcessInstance(processInstance, taskInstances);
alert.setContent(content);
alert.setAlertType(AlertType.EMAIL);
alert.setAlertGroupId(processInstance.getWarningGroupId());
alert.setCreateTime(new Date());
alert.setReceivers(processInstance.getProcessDefinition().getReceivers());
alert.setReceiversCc(processInstance.getProcessDefinition().getReceiversCc());
alertDao.addAlert(alert);
logger.info("add alert to db , alert: {}", alert.toString());
}
/**
* send process timeout alert
*
* @param processInstance process instance
* @param processDefinition process definition
*/
public void sendProcessTimeoutAlert(ProcessInstance processInstance, ProcessDefinition processDefinition) {
alertDao.sendProcessTimeoutAlert(processInstance, processDefinition);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.collections.BeanMap;
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent;
import org.apache.dolphinscheduler.api.dto.resources.filter.ResourceFilter; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | import org.apache.dolphinscheduler.api.dto.resources.visitor.ResourceTreeVisitor;
import org.apache.dolphinscheduler.api.dto.resources.visitor.Visitor;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ProgramType;
import org.apache.dolphinscheduler.common.enums.ResourceType;
import org.apache.dolphinscheduler.common.utils.*;
import org.apache.dolphinscheduler.dao.entity.*;
import org.apache.dolphinscheduler.dao.mapper.*;
import org.apache.dolphinscheduler.dao.utils.ResourceProcessDefinitionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import static org.apache.dolphinscheduler.common.Constants.*;
/**
* resources service
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | public class ResourcesService extends BaseService {
private static final Logger logger = LoggerFactory.getLogger(ResourcesService.class);
@Autowired
private ResourceMapper resourcesMapper;
@Autowired
private UdfFuncMapper udfFunctionMapper;
@Autowired
private TenantMapper tenantMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private ResourceUserMapper resourceUserMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
/**
* create directory |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | *
* @param loginUser login user
* @param name alias
* @param description description
* @param type type
* @param pid parent id
* @param currentDir current directory
* @return create directory result
*/
@Transactional(rollbackFor = Exception.class)
public Result createDirectory(User loginUser,
String name,
String description,
ResourceType type,
int pid,
String currentDir) {
Result result = new Result();
if (!PropertyUtils.getResUploadStartupState()){
logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState());
putMsg(result, Status.HDFS_NOT_STARTUP);
return result;
}
String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name):String.format("%s/%s",currentDir,name);
result = verifyResourceName(fullName,type,loginUser);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
if (pid != -1) {
Resource parentResource = resourcesMapper.selectById(pid); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | if (parentResource == null) {
putMsg(result, Status.PARENT_RESOURCE_NOT_EXIST);
return result;
}
if (!hasPerm(loginUser, parentResource.getUserId())) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
}
Date now = new Date();
Resource resource = new Resource(pid,name,fullName,true,description,name,loginUser.getId(),type,0,now,now);
try {
resourcesMapper.insert(resource);
putMsg(result, Status.SUCCESS);
Map<Object, Object> dataMap = new BeanMap(resource);
Map<String, Object> resultMap = new HashMap<String, Object>();
for (Map.Entry<Object, Object> entry: dataMap.entrySet()) {
if (!"class".equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue());
}
}
result.setData(resultMap);
} catch (DuplicateKeyException e) {
logger.error("resource directory {} has exist, can't recreate", fullName);
putMsg(result, Status.RESOURCE_EXIST);
return result;
} catch (Exception e) {
logger.error("resource already exists, can't recreate ", e);
throw new RuntimeException("resource already exists, can't recreate");
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | createDirecotry(loginUser,fullName,type,result);
return result;
}
/**
* create resource
*
* @param loginUser login user
* @param name alias
* @param desc description
* @param file file
* @param type type
* @param pid parent id
* @param currentDir current directory
* @return create result code
*/
@Transactional(rollbackFor = Exception.class)
public Result createResource(User loginUser,
String name,
String desc,
ResourceType type,
MultipartFile file,
int pid,
String currentDir) {
Result result = new Result();
if (!PropertyUtils.getResUploadStartupState()){
logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState());
putMsg(result, Status.HDFS_NOT_STARTUP);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | }
if (pid != -1) {
Resource parentResource = resourcesMapper.selectById(pid);
if (parentResource == null) {
putMsg(result, Status.PARENT_RESOURCE_NOT_EXIST);
return result;
}
if (!hasPerm(loginUser, parentResource.getUserId())) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
}
if (file.isEmpty()) {
logger.error("file is empty: {}", file.getOriginalFilename());
putMsg(result, Status.RESOURCE_FILE_IS_EMPTY);
return result;
}
String fileSuffix = FileUtils.suffix(file.getOriginalFilename());
String nameSuffix = FileUtils.suffix(name);
if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) {
/**
* rename file suffix and original suffix must be consistent
*/
logger.error("rename file suffix and original suffix must be consistent: {}", file.getOriginalFilename());
putMsg(result, Status.RESOURCE_SUFFIX_FORBID_CHANGE);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | if (Constants.UDF.equals(type.name()) && !JAR.equalsIgnoreCase(fileSuffix)) {
logger.error(Status.UDF_RESOURCE_SUFFIX_NOT_JAR.getMsg());
putMsg(result, Status.UDF_RESOURCE_SUFFIX_NOT_JAR);
return result;
}
if (file.getSize() > Constants.MAX_FILE_SIZE) {
logger.error("file size is too large: {}", file.getOriginalFilename());
putMsg(result, Status.RESOURCE_SIZE_EXCEED_LIMIT);
return result;
}
String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name):String.format("%s/%s",currentDir,name);
if (checkResourceExists(fullName, 0, type.ordinal())) {
logger.error("resource {} has exist, can't recreate", name);
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
Date now = new Date();
Resource resource = new Resource(pid,name,fullName,false,desc,file.getOriginalFilename(),loginUser.getId(),type,file.getSize(),now,now);
try {
resourcesMapper.insert(resource);
putMsg(result, Status.SUCCESS);
Map<Object, Object> dataMap = new BeanMap(resource);
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<Object, Object> entry: dataMap.entrySet()) {
if (!"class".equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | result.setData(resultMap);
} catch (Exception e) {
logger.error("resource already exists, can't recreate ", e);
throw new RuntimeException("resource already exists, can't recreate");
}
if (!upload(loginUser, fullName, file, type)) {
logger.error("upload resource: {} file: {} failed.", name, file.getOriginalFilename());
putMsg(result, Status.HDFS_OPERATION_ERROR);
throw new RuntimeException(String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename()));
}
return result;
}
/**
* check resource is exists
*
* @param fullName fullName
* @param userId user id
* @param type type
* @return true if resource exists
*/
private boolean checkResourceExists(String fullName, int userId, int type ){
List<Resource> resources = resourcesMapper.queryResourceList(fullName, userId, type);
if (resources != null && resources.size() > 0) {
return true;
}
return false;
}
/**
* update resource |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | * @param loginUser login user
* @param resourceId resource id
* @param name name
* @param desc description
* @param type resource type
* @param file resource file
* @return update result code
*/
@Transactional(rollbackFor = Exception.class)
public Result updateResource(User loginUser,
int resourceId,
String name,
String desc,
ResourceType type,
MultipartFile file) {
Result result = new Result();
if (!PropertyUtils.getResUploadStartupState()){
logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState());
putMsg(result, Status.HDFS_NOT_STARTUP);
return result;
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
if (!hasPerm(loginUser, resource.getUserId())) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | }
if (file == null && name.equals(resource.getAlias()) && desc.equals(resource.getDescription())) {
putMsg(result, Status.SUCCESS);
return result;
}
String originFullName = resource.getFullName();
String originResourceName = resource.getAlias();
String fullName = String.format("%s%s",originFullName.substring(0,originFullName.lastIndexOf("/")+1),name);
if (!originResourceName.equals(name) && checkResourceExists(fullName, 0, type.ordinal())) {
logger.error("resource {} already exists, can't recreate", name);
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
if (file != null) {
if (file.isEmpty()) {
logger.error("file is empty: {}", file.getOriginalFilename());
putMsg(result, Status.RESOURCE_FILE_IS_EMPTY);
return result;
}
String fileSuffix = FileUtils.suffix(file.getOriginalFilename());
String nameSuffix = FileUtils.suffix(name);
if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) {
/**
* rename file suffix and original suffix must be consistent
*/
logger.error("rename file suffix and original suffix must be consistent: {}", file.getOriginalFilename()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | putMsg(result, Status.RESOURCE_SUFFIX_FORBID_CHANGE);
return result;
}
if (Constants.UDF.equals(type.name()) && !JAR.equalsIgnoreCase(FileUtils.suffix(originFullName))) {
logger.error(Status.UDF_RESOURCE_SUFFIX_NOT_JAR.getMsg());
putMsg(result, Status.UDF_RESOURCE_SUFFIX_NOT_JAR);
return result;
}
if (file.getSize() > Constants.MAX_FILE_SIZE) {
logger.error("file size is too large: {}", file.getOriginalFilename());
putMsg(result, Status.RESOURCE_SIZE_EXCEED_LIMIT);
return result;
}
}
String tenantCode = getTenantCode(resource.getUserId(),result);
if (StringUtils.isEmpty(tenantCode)){
return result;
}
String originHdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(),tenantCode,originFullName);
try {
if (!HadoopUtils.getInstance().exists(originHdfsFileName)) {
logger.error("{} not exist", originHdfsFileName);
putMsg(result,Status.RESOURCE_NOT_EXIST);
return result;
}
} catch (IOException e) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | logger.error(e.getMessage(),e);
throw new ServiceException(Status.HDFS_OPERATION_ERROR);
}
if (!resource.isDirectory()) {
String originSuffix = FileUtils.suffix(originFullName);
String suffix = FileUtils.suffix(fullName);
boolean suffixIsChanged = false;
if (StringUtils.isBlank(suffix) && StringUtils.isNotBlank(originSuffix)) {
suffixIsChanged = true;
}
if (StringUtils.isNotBlank(suffix) && !suffix.equals(originSuffix)) {
suffixIsChanged = true;
}
if (suffixIsChanged) {
Map<String, Object> columnMap = new HashMap<>();
columnMap.put("resources_id", resourceId);
List<ResourcesUser> resourcesUsers = resourceUserMapper.selectByMap(columnMap);
if (CollectionUtils.isNotEmpty(resourcesUsers)) {
List<Integer> userIds = resourcesUsers.stream().map(ResourcesUser::getUserId).collect(Collectors.toList());
List<User> users = userMapper.selectBatchIds(userIds);
String userNames = users.stream().map(User::getUserName).collect(Collectors.toList()).toString();
logger.error("resource is authorized to user {},suffix not allowed to be modified", userNames);
putMsg(result,Status.RESOURCE_IS_AUTHORIZED,userNames);
return result;
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | Date now = new Date();
resource.setAlias(name);
resource.setFullName(fullName);
resource.setDescription(desc);
resource.setUpdateTime(now);
if (file != null) {
resource.setFileName(file.getOriginalFilename());
resource.setSize(file.getSize());
}
try {
resourcesMapper.updateById(resource);
if (resource.isDirectory()) {
List<Integer> childrenResource = listAllChildren(resource,false);
if (CollectionUtils.isNotEmpty(childrenResource)) {
String matcherFullName = Matcher.quoteReplacement(fullName);
List<Resource> childResourceList = new ArrayList<>();
Integer[] childResIdArray = childrenResource.toArray(new Integer[childrenResource.size()]);
List<Resource> resourceList = resourcesMapper.listResourceByIds(childResIdArray);
childResourceList = resourceList.stream().map(t -> {
t.setFullName(t.getFullName().replaceFirst(originFullName, matcherFullName));
t.setUpdateTime(now);
return t;
}).collect(Collectors.toList());
resourcesMapper.batchUpdateResource(childResourceList);
if (ResourceType.UDF.equals(resource.getType())) {
List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(childResIdArray);
if (CollectionUtils.isNotEmpty(udfFuncs)) {
udfFuncs = udfFuncs.stream().map(t -> {
t.setResourceName(t.getResourceName().replaceFirst(originFullName, matcherFullName)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | t.setUpdateTime(now);
return t;
}).collect(Collectors.toList());
udfFunctionMapper.batchUpdateUdfFunc(udfFuncs);
}
}
}
} else if (ResourceType.UDF.equals(resource.getType())) {
List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(new Integer[]{resourceId});
if (CollectionUtils.isNotEmpty(udfFuncs)) {
udfFuncs = udfFuncs.stream().map(t -> {
t.setResourceName(fullName);
t.setUpdateTime(now);
return t;
}).collect(Collectors.toList());
udfFunctionMapper.batchUpdateUdfFunc(udfFuncs);
}
}
putMsg(result, Status.SUCCESS);
Map<Object, Object> dataMap = new BeanMap(resource);
Map<String, Object> resultMap = new HashMap<>(5);
for (Map.Entry<Object, Object> entry: dataMap.entrySet()) {
if (!Constants.CLASS.equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue());
}
}
result.setData(resultMap);
} catch (Exception e) {
logger.error(Status.UPDATE_RESOURCE_ERROR.getMsg(), e);
throw new ServiceException(Status.UPDATE_RESOURCE_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | }
if (originResourceName.equals(name) && file == null) {
return result;
}
if (file != null) {
if (!upload(loginUser, fullName, file, type)) {
logger.error("upload resource: {} file: {} failed.", name, file.getOriginalFilename());
putMsg(result, Status.HDFS_OPERATION_ERROR);
throw new RuntimeException(String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename()));
}
if (!fullName.equals(originFullName)) {
try {
HadoopUtils.getInstance().delete(originHdfsFileName,false);
} catch (IOException e) {
logger.error(e.getMessage(),e);
throw new RuntimeException(String.format("delete resource: %s failed.", originFullName));
}
}
return result;
}
String destHdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(),tenantCode,fullName);
try {
logger.info("start hdfs copy {} -> {}", originHdfsFileName, destHdfsFileName);
HadoopUtils.getInstance().copy(originHdfsFileName, destHdfsFileName, true, true);
} catch (Exception e) {
logger.error(MessageFormat.format("hdfs copy {0} -> {1} fail", originHdfsFileName, destHdfsFileName), e);
putMsg(result,Status.HDFS_COPY_FAIL); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | throw new ServiceException(Status.HDFS_COPY_FAIL);
}
return result;
}
/**
* query resources list paging
*
* @param loginUser login user
* @param type resource type
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @return resource list page
*/
public Map<String, Object> queryResourceListPaging(User loginUser, int direcotryId, ResourceType type, String searchVal, Integer pageNo, Integer pageSize) {
HashMap<String, Object> result = new HashMap<>(5);
Page<Resource> page = new Page(pageNo, pageSize);
int userId = loginUser.getId();
if (isAdmin(loginUser)) {
userId= 0;
}
if (direcotryId != -1) {
Resource directory = resourcesMapper.selectById(direcotryId);
if (directory == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
}
IPage<Resource> resourceIPage = resourcesMapper.queryResourcePaging(page,
userId,direcotryId, type.ordinal(), searchVal); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | PageInfo pageInfo = new PageInfo<Resource>(pageNo, pageSize);
pageInfo.setTotalCount((int)resourceIPage.getTotal());
pageInfo.setLists(resourceIPage.getRecords());
result.put(Constants.DATA_LIST, pageInfo);
putMsg(result,Status.SUCCESS);
return result;
}
/**
* create direcoty
* @param loginUser login user
* @param fullName full name
* @param type resource type
* @param result Result
*/
private void createDirecotry(User loginUser,String fullName,ResourceType type,Result result){
String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
String directoryName = HadoopUtils.getHdfsFileName(type,tenantCode,fullName);
String resourceRootPath = HadoopUtils.getHdfsDir(type,tenantCode);
try {
if (!HadoopUtils.getInstance().exists(resourceRootPath)) {
createTenantDirIfNotExists(tenantCode);
}
if (!HadoopUtils.getInstance().mkdir(directoryName)) {
logger.error("create resource directory {} of hdfs failed",directoryName);
putMsg(result,Status.HDFS_OPERATION_ERROR);
throw new RuntimeException(String.format("create resource directory: %s failed.", directoryName));
}
} catch (Exception e) {
logger.error("create resource directory {} of hdfs failed",directoryName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | putMsg(result,Status.HDFS_OPERATION_ERROR);
throw new RuntimeException(String.format("create resource directory: %s failed.", directoryName));
}
}
/**
* upload file to hdfs
*
* @param loginUser login user
* @param fullName full name
* @param file file
*/
private boolean upload(User loginUser, String fullName, MultipartFile file, ResourceType type) {
String fileSuffix = FileUtils.suffix(file.getOriginalFilename());
String nameSuffix = FileUtils.suffix(fullName);
if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) {
return false;
}
String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
String localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString());
String hdfsFilename = HadoopUtils.getHdfsFileName(type,tenantCode,fullName);
String resourcePath = HadoopUtils.getHdfsDir(type,tenantCode);
try {
if (!HadoopUtils.getInstance().exists(resourcePath)) {
createTenantDirIfNotExists(tenantCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | }
org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(file, localFilename);
HadoopUtils.getInstance().copyLocalToHdfs(localFilename, hdfsFilename, true, true);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return false;
}
return true;
}
/**
* query resource list
*
* @param loginUser login user
* @param type resource type
* @return resource list
*/
public Map<String, Object> queryResourceList(User loginUser, ResourceType type) {
Map<String, Object> result = new HashMap<>(5);
int userId = loginUser.getId();
if(isAdmin(loginUser)){
userId = 0;
}
List<Resource> allResourceList = resourcesMapper.queryResourceListAuthored(userId, type.ordinal(),0);
Visitor resourceTreeVisitor = new ResourceTreeVisitor(allResourceList);
result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren());
putMsg(result,Status.SUCCESS);
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | * query resource list by program type
*
* @param loginUser login user
* @param type resource type
* @return resource list
*/
public Map<String, Object> queryResourceByProgramType(User loginUser, ResourceType type, ProgramType programType) {
Map<String, Object> result = new HashMap<>(5);
String suffix = ".jar";
int userId = loginUser.getId();
if(isAdmin(loginUser)){
userId = 0;
}
if (programType != null) {
switch (programType) {
case JAVA:
break;
case SCALA:
break;
case PYTHON:
suffix = ".py";
break;
}
}
List<Resource> allResourceList = resourcesMapper.queryResourceListAuthored(userId, type.ordinal(),0);
List<Resource> resources = new ResourceFilter(suffix,new ArrayList<>(allResourceList)).filter();
Visitor resourceTreeVisitor = new ResourceTreeVisitor(resources);
result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren());
putMsg(result,Status.SUCCESS);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | }
/**
* delete resource
*
* @param loginUser login user
* @param resourceId resource id
* @return delete result code
* @throws Exception exception
*/
@Transactional(rollbackFor = Exception.class)
public Result delete(User loginUser, int resourceId) throws Exception {
Result result = new Result();
if (!PropertyUtils.getResUploadStartupState()){
logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState());
putMsg(result, Status.HDFS_NOT_STARTUP);
return result;
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
logger.error("resource file not exist, resource id {}", resourceId);
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
if (!hasPerm(loginUser, resource.getUserId())) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
String tenantCode = getTenantCode(resource.getUserId(),result); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | if (StringUtils.isEmpty(tenantCode)){
return result;
}
List<Map<String, Object>> list = processDefinitionMapper.listResources();
Map<Integer, Set<Integer>> resourceProcessMap = ResourceProcessDefinitionUtils.getResourceProcessDefinitionMap(list);
Set<Integer> resourceIdSet = resourceProcessMap.keySet();
List<Integer> allChildren = listAllChildren(resource,true);
Integer[] needDeleteResourceIdArray = allChildren.toArray(new Integer[allChildren.size()]);
if (resource.getType() == (ResourceType.UDF)) {
List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(needDeleteResourceIdArray);
if (CollectionUtils.isNotEmpty(udfFuncs)) {
logger.error("can't be deleted,because it is bound by UDF functions:{}",udfFuncs.toString());
putMsg(result,Status.UDF_RESOURCE_IS_BOUND,udfFuncs.get(0).getFuncName());
return result;
}
}
if (resourceIdSet.contains(resource.getPid())) {
logger.error("can't be deleted,because it is used of process definition");
putMsg(result, Status.RESOURCE_IS_USED);
return result;
}
resourceIdSet.retainAll(allChildren);
if (CollectionUtils.isNotEmpty(resourceIdSet)) {
logger.error("can't be deleted,because it is used of process definition");
for (Integer resId : resourceIdSet) {
logger.error("resource id:{} is used of process definition {}",resId,resourceProcessMap.get(resId));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | putMsg(result, Status.RESOURCE_IS_USED);
return result;
}
String hdfsFilename = HadoopUtils.getHdfsFileName(resource.getType(), tenantCode, resource.getFullName());
resourcesMapper.deleteIds(needDeleteResourceIdArray);
resourceUserMapper.deleteResourceUserArray(0, needDeleteResourceIdArray);
HadoopUtils.getInstance().delete(hdfsFilename, true);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* verify resource by name and type
* @param loginUser login user
* @param fullName resource full name
* @param type resource type
* @return true if the resource name not exists, otherwise return false
*/
public Result verifyResourceName(String fullName, ResourceType type,User loginUser) {
Result result = new Result();
putMsg(result, Status.SUCCESS);
if (checkResourceExists(fullName, 0, type.ordinal())) {
logger.error("resource type:{} name:{} has exist, can't create again.", type, fullName);
putMsg(result, Status.RESOURCE_EXIST);
} else {
Tenant tenant = tenantMapper.queryById(loginUser.getTenantId());
if(tenant != null){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | String tenantCode = tenant.getTenantCode();
try {
String hdfsFilename = HadoopUtils.getHdfsFileName(type,tenantCode,fullName);
if(HadoopUtils.getInstance().exists(hdfsFilename)){
logger.error("resource type:{} name:{} has exist in hdfs {}, can't create again.", type, fullName,hdfsFilename);
putMsg(result, Status.RESOURCE_FILE_EXIST,hdfsFilename);
}
} catch (Exception e) {
logger.error(e.getMessage(),e);
putMsg(result,Status.HDFS_OPERATION_ERROR);
}
}else{
putMsg(result,Status.TENANT_NOT_EXIST);
}
}
return result;
}
/**
* verify resource by full name or pid and type
* @param fullName resource full name
* @param id resource id
* @param type resource type
* @return true if the resource full name or pid not exists, otherwise return false
*/
public Result queryResource(String fullName,Integer id,ResourceType type) {
Result result = new Result();
if (StringUtils.isBlank(fullName) && id == null) {
logger.error("You must input one of fullName and pid");
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | }
if (StringUtils.isNotBlank(fullName)) {
List<Resource> resourceList = resourcesMapper.queryResource(fullName,type.ordinal());
if (CollectionUtils.isEmpty(resourceList)) {
logger.error("resource file not exist, resource full name {} ", fullName);
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
putMsg(result, Status.SUCCESS);
result.setData(resourceList.get(0));
} else {
Resource resource = resourcesMapper.selectById(id);
if (resource == null) {
logger.error("resource file not exist, resource id {}", id);
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
Resource parentResource = resourcesMapper.selectById(resource.getPid());
if (parentResource == null) {
logger.error("parent resource file not exist, resource id {}", id);
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
putMsg(result, Status.SUCCESS);
result.setData(parentResource);
}
return result;
}
/**
* view resource file online |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | *
* @param resourceId resource id
* @param skipLineNum skip line number
* @param limit limit
* @return resource content
*/
public Result readResource(int resourceId, int skipLineNum, int limit) {
Result result = new Result();
if (!PropertyUtils.getResUploadStartupState()){
logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState());
putMsg(result, Status.HDFS_NOT_STARTUP);
return result;
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
logger.error("resource file not exist, resource id {}", resourceId);
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
String nameSuffix = FileUtils.suffix(resource.getAlias());
String resourceViewSuffixs = FileUtils.getResourceViewSuffixs();
if (StringUtils.isNotEmpty(resourceViewSuffixs)) {
List<String> strList = Arrays.asList(resourceViewSuffixs.split(","));
if (!strList.contains(nameSuffix)) {
logger.error("resource suffix {} not support view, resource id {}", nameSuffix, resourceId);
putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | }
}
String tenantCode = getTenantCode(resource.getUserId(),result);
if (StringUtils.isEmpty(tenantCode)){
return result;
}
String hdfsFileName = HadoopUtils.getHdfsResourceFileName(tenantCode, resource.getFullName());
logger.info("resource hdfs path is {} ", hdfsFileName);
try {
if(HadoopUtils.getInstance().exists(hdfsFileName)){
List<String> content = HadoopUtils.getInstance().catFile(hdfsFileName, skipLineNum, limit);
putMsg(result, Status.SUCCESS);
Map<String, Object> map = new HashMap<>();
map.put(ALIAS, resource.getAlias());
map.put(CONTENT, String.join("\n", content));
result.setData(map);
}else{
logger.error("read file {} not exist in hdfs", hdfsFileName);
putMsg(result, Status.RESOURCE_FILE_NOT_EXIST,hdfsFileName);
}
} catch (Exception e) {
logger.error("Resource {} read failed", hdfsFileName, e);
putMsg(result, Status.HDFS_OPERATION_ERROR);
}
return result;
}
/**
* create resource file online
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | * @param loginUser login user
* @param type resource type
* @param fileName file name
* @param fileSuffix file suffix
* @param desc description
* @param content content
* @return create result code
*/
@Transactional(rollbackFor = Exception.class)
public Result onlineCreateResource(User loginUser, ResourceType type, String fileName, String fileSuffix, String desc, String content,int pid,String currentDirectory) {
Result result = new Result();
if (!PropertyUtils.getResUploadStartupState()){
logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState());
putMsg(result, Status.HDFS_NOT_STARTUP);
return result;
}
String nameSuffix = fileSuffix.trim();
String resourceViewSuffixs = FileUtils.getResourceViewSuffixs();
if (StringUtils.isNotEmpty(resourceViewSuffixs)) {
List<String> strList = Arrays.asList(resourceViewSuffixs.split(","));
if (!strList.contains(nameSuffix)) {
logger.error("resouce suffix {} not support create", nameSuffix);
putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW);
return result;
}
}
String name = fileName.trim() + "." + nameSuffix;
String fullName = currentDirectory.equals("/") ? String.format("%s%s",currentDirectory,name):String.format("%s/%s",currentDirectory,name); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | result = verifyResourceName(fullName,type,loginUser);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
Date now = new Date();
Resource resource = new Resource(pid,name,fullName,false,desc,name,loginUser.getId(),type,content.getBytes().length,now,now);
resourcesMapper.insert(resource);
putMsg(result, Status.SUCCESS);
Map<Object, Object> dataMap = new BeanMap(resource);
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<Object, Object> entry: dataMap.entrySet()) {
if (!Constants.CLASS.equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue());
}
}
result.setData(resultMap);
String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
result = uploadContentToHdfs(fullName, tenantCode, content);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
throw new RuntimeException(result.getMsg());
}
return result;
}
/**
* updateProcessInstance resource
*
* @param resourceId resource id
* @param content content
* @return update result cod |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | */
@Transactional(rollbackFor = Exception.class)
public Result updateResourceContent(int resourceId, String content) {
Result result = new Result();
if (!PropertyUtils.getResUploadStartupState()){
logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState());
putMsg(result, Status.HDFS_NOT_STARTUP);
return result;
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
logger.error("read file not exist, resource id {}", resourceId);
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
String nameSuffix = FileUtils.suffix(resource.getAlias());
String resourceViewSuffixs = FileUtils.getResourceViewSuffixs();
if (StringUtils.isNotEmpty(resourceViewSuffixs)) {
List<String> strList = Arrays.asList(resourceViewSuffixs.split(","));
if (!strList.contains(nameSuffix)) {
logger.error("resource suffix {} not support updateProcessInstance, resource id {}", nameSuffix, resourceId);
putMsg(result, Status.RESOURCE_SUFFIX_NOT_SUPPORT_VIEW);
return result;
}
}
String tenantCode = getTenantCode(resource.getUserId(),result);
if (StringUtils.isEmpty(tenantCode)){
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | }
resource.setSize(content.getBytes().length);
resource.setUpdateTime(new Date());
resourcesMapper.updateById(resource);
result = uploadContentToHdfs(resource.getFullName(), tenantCode, content);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
throw new RuntimeException(result.getMsg());
}
return result;
}
/**
* @param resourceName resource name
* @param tenantCode tenant code
* @param content content
* @return result
*/
private Result uploadContentToHdfs(String resourceName, String tenantCode, String content) {
Result result = new Result();
String localFilename = "";
String hdfsFileName = "";
try {
localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString());
if (!FileUtils.writeContent2File(content, localFilename)) {
logger.error("file {} fail, content is {}", localFilename, content);
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
hdfsFileName = HadoopUtils.getHdfsResourceFileName(tenantCode, resourceName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | String resourcePath = HadoopUtils.getHdfsResDir(tenantCode);
logger.info("resource hdfs path is {} ", hdfsFileName);
HadoopUtils hadoopUtils = HadoopUtils.getInstance();
if (!hadoopUtils.exists(resourcePath)) {
createTenantDirIfNotExists(tenantCode);
}
if (hadoopUtils.exists(hdfsFileName)) {
hadoopUtils.delete(hdfsFileName, false);
}
hadoopUtils.copyLocalToHdfs(localFilename, hdfsFileName, true, true);
} catch (Exception e) {
logger.error(e.getMessage(), e);
result.setCode(Status.HDFS_OPERATION_ERROR.getCode());
result.setMsg(String.format("copy %s to hdfs %s fail", localFilename, hdfsFileName));
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* download file
*
* @param resourceId resource id
* @return resource content
* @throws Exception exception
*/
public org.springframework.core.io.Resource downloadResource(int resourceId) throws Exception {
if (!PropertyUtils.getResUploadStartupState()){ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | logger.error("resource upload startup state: {}", PropertyUtils.getResUploadStartupState());
throw new RuntimeException("hdfs not startup");
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
logger.error("download file not exist, resource id {}", resourceId);
return null;
}
if (resource.isDirectory()) {
logger.error("resource id {} is directory,can't download it", resourceId);
throw new RuntimeException("cant't download directory");
}
int userId = resource.getUserId();
User user = userMapper.selectById(userId);
if(user == null){
logger.error("user id {} not exists", userId);
throw new RuntimeException(String.format("resource owner id %d not exist",userId));
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if(tenant == null){
logger.error("tenant id {} not exists", user.getTenantId());
throw new RuntimeException(String.format("The tenant id %d of resource owner not exist",user.getTenantId()));
}
String tenantCode = tenant.getTenantCode();
String hdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(), tenantCode, resource.getFullName());
String localFileName = FileUtils.getDownloadFilename(resource.getAlias());
logger.info("resource hdfs path is {} ", hdfsFileName);
HadoopUtils.getInstance().copyHdfsToLocal(hdfsFileName, localFileName, false, true);
return org.apache.dolphinscheduler.api.utils.FileUtils.file2Resource(localFileName);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | /**
* list all file
*
* @param loginUser login user
* @param userId user id
* @return unauthorized result code
*/
public Map<String, Object> authorizeResourceTree(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
return result;
}
List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId);
List<ResourceComponent> list ;
if (CollectionUtils.isNotEmpty(resourceList)) {
Visitor visitor = new ResourceTreeVisitor(resourceList);
list = visitor.visit().getChildren();
}else {
list = new ArrayList<>(0);
}
result.put(Constants.DATA_LIST, list);
putMsg(result,Status.SUCCESS);
return result;
}
/**
* unauthorized file
*
* @param loginUser login user
* @param userId user id
* @return unauthorized result code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | */
public Map<String, Object> unauthorizedFile(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
return result;
}
List<Resource> resourceList = resourcesMapper.queryResourceExceptUserId(userId);
List<Resource> list ;
if (resourceList != null && resourceList.size() > 0) {
Set<Resource> resourceSet = new HashSet<>(resourceList);
List<Resource> authedResourceList = resourcesMapper.queryAuthorizedResourceList(userId);
getAuthorizedResourceList(resourceSet, authedResourceList);
list = new ArrayList<>(resourceSet);
}else {
list = new ArrayList<>(0);
}
Visitor visitor = new ResourceTreeVisitor(list);
result.put(Constants.DATA_LIST, visitor.visit().getChildren());
putMsg(result,Status.SUCCESS);
return result;
}
/**
* unauthorized udf function
*
* @param loginUser login user
* @param userId user id
* @return unauthorized result code
*/
public Map<String, Object> unauthorizedUDFFunction(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(5); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | if (checkAdmin(loginUser, result)) {
return result;
}
List<UdfFunc> udfFuncList = udfFunctionMapper.queryUdfFuncExceptUserId(userId);
List<UdfFunc> resultList = new ArrayList<>();
Set<UdfFunc> udfFuncSet = null;
if (CollectionUtils.isNotEmpty(udfFuncList)) {
udfFuncSet = new HashSet<>(udfFuncList);
List<UdfFunc> authedUDFFuncList = udfFunctionMapper.queryAuthedUdfFunc(userId);
getAuthorizedResourceList(udfFuncSet, authedUDFFuncList);
resultList = new ArrayList<>(udfFuncSet);
}
result.put(Constants.DATA_LIST, resultList);
putMsg(result,Status.SUCCESS);
return result;
}
/**
* authorized udf function
*
* @param loginUser login user
* @param userId user id
* @return authorized result code
*/
public Map<String, Object> authorizedUDFFunction(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
if (checkAdmin(loginUser, result)) {
return result;
}
List<UdfFunc> udfFuncs = udfFunctionMapper.queryAuthedUdfFunc(userId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | result.put(Constants.DATA_LIST, udfFuncs);
putMsg(result,Status.SUCCESS);
return result;
}
/**
* authorized file
*
* @param loginUser login user
* @param userId user id
* @return authorized result
*/
public Map<String, Object> authorizedFile(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>(5);
if (checkAdmin(loginUser, result)){
return result;
}
List<Resource> authedResources = resourcesMapper.queryAuthorizedResourceList(userId);
Visitor visitor = new ResourceTreeVisitor(authedResources);
logger.info(JSON.toJSONString(visitor.visit(), SerializerFeature.SortField));
String jsonTreeStr = JSON.toJSONString(visitor.visit().getChildren(), SerializerFeature.SortField);
logger.info(jsonTreeStr);
result.put(Constants.DATA_LIST, visitor.visit().getChildren());
putMsg(result,Status.SUCCESS);
return result;
}
/**
* get authorized resource list
*
* @param resourceSet resource set
* @param authedResourceList authorized resource list |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | */
private void getAuthorizedResourceList(Set<?> resourceSet, List<?> authedResourceList) {
Set<?> authedResourceSet = null;
if (CollectionUtils.isNotEmpty(authedResourceList)) {
authedResourceSet = new HashSet<>(authedResourceList);
resourceSet.removeAll(authedResourceSet);
}
}
/**
* get tenantCode by UserId
*
* @param userId user id
* @param result return result
* @return
*/
private String getTenantCode(int userId,Result result){
User user = userMapper.selectById(userId);
if (user == null) {
logger.error("user {} not exists", userId);
putMsg(result, Status.USER_NOT_EXIST,userId);
return null;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (tenant == null){
logger.error("tenant not exists");
putMsg(result, Status.TENANT_NOT_EXIST);
return null;
}
return tenant.getTenantCode();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,958 | [Bug][api] files should not be created successfully in the directory of the authorized file | 1. Authorize user A's /pg_cxc/pg_1.sh file to user B
2. User B can successfully create files in the pg_cxc directory

### Expected result
Since only the files in the directory are authorized, user B does not have the permission of the directory pg_cxc
**Which version of Dolphin Scheduler:**
-[1.3.2]
| https://github.com/apache/dolphinscheduler/issues/3958 | https://github.com/apache/dolphinscheduler/pull/3980 | 075d1638d0e46f6b6dd3658a6188ea482a0f4802 | 292b0fce0b5fc621a3355d43e989950dceeecd7e | "2020-10-21T02:56:58Z" | java | "2020-10-23T06:58:17Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ResourcesService.java | /**
* list all children id
* @param resource resource
* @param containSelf whether add self to children list
* @return all children id
*/
List<Integer> listAllChildren(Resource resource,boolean containSelf){
List<Integer> childList = new ArrayList<>();
if (resource.getId() != -1 && containSelf) {
childList.add(resource.getId());
}
if(resource.isDirectory()){
listAllChildren(resource.getId(),childList);
}
return childList;
}
/**
* list all children id
* @param resourceId resource id
* @param childList child list
*/
void listAllChildren(int resourceId,List<Integer> childList){
List<Integer> children = resourcesMapper.listChildren(resourceId);
for(int chlidId:children){
childList.add(chlidId);
listAllChildren(chlidId,childList);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,956 | [Bug][Master] When running a task, the resource file is lost, which results in an error | When running a shell task, the resource file is lost, which results in an error
TaskParams
Taskparams does not have a resourcelist. When converting, the content of resourcelist will be lost
Not only shell tasks, param parameters in other task types may be overridden
The code is as follows:
VarPoolUtils#setTaskNodeLocalParams
```
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
```
| https://github.com/apache/dolphinscheduler/issues/3956 | https://github.com/apache/dolphinscheduler/pull/3957 | 8fd3932bff374a03ef159bd2a2f495728c8e5d4e | 05b248f8e3323434c83851d26b1fcf6dc61eef4e | "2020-10-20T11:23:46Z" | java | "2020-10-24T09:50:33Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/TaskParams.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.task;
import java.util.Map;
public class TaskParams { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,956 | [Bug][Master] When running a task, the resource file is lost, which results in an error | When running a shell task, the resource file is lost, which results in an error
TaskParams
Taskparams does not have a resourcelist. When converting, the content of resourcelist will be lost
Not only shell tasks, param parameters in other task types may be overridden
The code is as follows:
VarPoolUtils#setTaskNodeLocalParams
```
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
```
| https://github.com/apache/dolphinscheduler/issues/3956 | https://github.com/apache/dolphinscheduler/pull/3957 | 8fd3932bff374a03ef159bd2a2f495728c8e5d4e | 05b248f8e3323434c83851d26b1fcf6dc61eef4e | "2020-10-20T11:23:46Z" | java | "2020-10-24T09:50:33Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/TaskParams.java | private String rawScript;
private Map<String, String>[] localParams;
public void setRawScript(String rawScript) {
this.rawScript = rawScript;
}
public void setLocalParams(Map<String, String>[] localParams) {
this.localParams = localParams;
}
public String getRawScript() {
return rawScript;
}
public void setLocalParamValue(String prop, Object value) {
if (localParams == null || value == null) {
return;
}
for (int i = 0; i < localParams.length; i++) {
if (localParams[i].get("prop").equals(prop)) {
localParams[i].put("value", (String)value);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,956 | [Bug][Master] When running a task, the resource file is lost, which results in an error | When running a shell task, the resource file is lost, which results in an error
TaskParams
Taskparams does not have a resourcelist. When converting, the content of resourcelist will be lost
Not only shell tasks, param parameters in other task types may be overridden
The code is as follows:
VarPoolUtils#setTaskNodeLocalParams
```
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
```
| https://github.com/apache/dolphinscheduler/issues/3956 | https://github.com/apache/dolphinscheduler/pull/3957 | 8fd3932bff374a03ef159bd2a2f495728c8e5d4e | 05b248f8e3323434c83851d26b1fcf6dc61eef4e | "2020-10-20T11:23:46Z" | java | "2020-10-24T09:50:33Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/task/TaskParams.java | }
}
public void setLocalParamValue(Map<String, Object> propToValue) {
if (localParams == null || propToValue == null) {
return;
}
for (int i = 0; i < localParams.length; i++) {
String prop = localParams[i].get("prop");
if (propToValue.containsKey(prop)) {
localParams[i].put("value",(String)propToValue.get(prop));
}
}
}
public String getLocalParamValue(String prop) {
if (localParams == null) {
return null;
}
for (int i = 0; i < localParams.length; i++) {
String tmpProp = localParams[i].get("prop");
if (tmpProp.equals(prop)) {
return localParams[i].get("value");
}
}
return null;
}
public Map<String, String>[] getLocalParams() {
return localParams;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,956 | [Bug][Master] When running a task, the resource file is lost, which results in an error | When running a shell task, the resource file is lost, which results in an error
TaskParams
Taskparams does not have a resourcelist. When converting, the content of resourcelist will be lost
Not only shell tasks, param parameters in other task types may be overridden
The code is as follows:
VarPoolUtils#setTaskNodeLocalParams
```
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
```
| https://github.com/apache/dolphinscheduler/issues/3956 | https://github.com/apache/dolphinscheduler/pull/3957 | 8fd3932bff374a03ef159bd2a2f495728c8e5d4e | 05b248f8e3323434c83851d26b1fcf6dc61eef4e | "2020-10-20T11:23:46Z" | java | "2020-10-24T09:50:33Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/VarPoolUtils.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.task.TaskParams;
import java.text.ParseException;
import java.util.Map;
public class VarPoolUtils { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,956 | [Bug][Master] When running a task, the resource file is lost, which results in an error | When running a shell task, the resource file is lost, which results in an error
TaskParams
Taskparams does not have a resourcelist. When converting, the content of resourcelist will be lost
Not only shell tasks, param parameters in other task types may be overridden
The code is as follows:
VarPoolUtils#setTaskNodeLocalParams
```
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
```
| https://github.com/apache/dolphinscheduler/issues/3956 | https://github.com/apache/dolphinscheduler/pull/3957 | 8fd3932bff374a03ef159bd2a2f495728c8e5d4e | 05b248f8e3323434c83851d26b1fcf6dc61eef4e | "2020-10-20T11:23:46Z" | java | "2020-10-24T09:50:33Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/VarPoolUtils.java | /**
* getTaskNodeLocalParam
* @param taskNode taskNode
* @param prop prop
* @return localParamForProp
*/
public static Object getTaskNodeLocalParam(TaskNode taskNode, String prop) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return null;
}
return taskParams.getLocalParamValue(prop);
}
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,956 | [Bug][Master] When running a task, the resource file is lost, which results in an error | When running a shell task, the resource file is lost, which results in an error
TaskParams
Taskparams does not have a resourcelist. When converting, the content of resourcelist will be lost
Not only shell tasks, param parameters in other task types may be overridden
The code is as follows:
VarPoolUtils#setTaskNodeLocalParams
```
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
```
| https://github.com/apache/dolphinscheduler/issues/3956 | https://github.com/apache/dolphinscheduler/pull/3957 | 8fd3932bff374a03ef159bd2a2f495728c8e5d4e | 05b248f8e3323434c83851d26b1fcf6dc61eef4e | "2020-10-20T11:23:46Z" | java | "2020-10-24T09:50:33Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/VarPoolUtils.java | }
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param propToValue propToValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, Map<String, Object> propToValue) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(propToValue);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
/**
* convertVarPoolToMap
* @param propToValue propToValue
* @param varPool varPool
* @throws ParseException ParseException
*/
public static void convertVarPoolToMap(Map<String, Object> propToValue, String varPool) throws ParseException {
if (varPool == null || propToValue == null) {
return;
}
String[] splits = varPool.split("\\$VarPool\\$");
for (String kv : splits) {
String[] kvs = kv.split(",");
if (kvs.length == 2) {
propToValue.put(kvs[0], kvs[1]); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,956 | [Bug][Master] When running a task, the resource file is lost, which results in an error | When running a shell task, the resource file is lost, which results in an error
TaskParams
Taskparams does not have a resourcelist. When converting, the content of resourcelist will be lost
Not only shell tasks, param parameters in other task types may be overridden
The code is as follows:
VarPoolUtils#setTaskNodeLocalParams
```
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
```
| https://github.com/apache/dolphinscheduler/issues/3956 | https://github.com/apache/dolphinscheduler/pull/3957 | 8fd3932bff374a03ef159bd2a2f495728c8e5d4e | 05b248f8e3323434c83851d26b1fcf6dc61eef4e | "2020-10-20T11:23:46Z" | java | "2020-10-24T09:50:33Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/VarPoolUtils.java | } else {
throw new ParseException(kv, 2);
}
}
}
/**
* convertPythonScriptPlaceholders
* @param rawScript rawScript
* @return String
* @throws StringIndexOutOfBoundsException StringIndexOutOfBoundsException
*/
public static String convertPythonScriptPlaceholders(String rawScript) throws StringIndexOutOfBoundsException {
int len = "${setShareVar(${".length();
int scriptStart = 0;
while ((scriptStart = rawScript.indexOf("${setShareVar(${", scriptStart)) != -1) {
int start = -1;
int end = rawScript.indexOf('}', scriptStart + len);
String prop = rawScript.substring(scriptStart + len, end);
start = rawScript.indexOf(',', end);
end = rawScript.indexOf(')', start);
String value = rawScript.substring(start + 1, end);
start = rawScript.indexOf('}', start) + 1;
end = rawScript.length();
String replaceScript = String.format("print(\"${{setValue({},{})}}\".format(\"%s\",%s))", prop, value);
rawScript = rawScript.substring(0, scriptStart) + replaceScript + rawScript.substring(start, end);
scriptStart += replaceScript.length();
}
return rawScript;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,956 | [Bug][Master] When running a task, the resource file is lost, which results in an error | When running a shell task, the resource file is lost, which results in an error
TaskParams
Taskparams does not have a resourcelist. When converting, the content of resourcelist will be lost
Not only shell tasks, param parameters in other task types may be overridden
The code is as follows:
VarPoolUtils#setTaskNodeLocalParams
```
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
```
| https://github.com/apache/dolphinscheduler/issues/3956 | https://github.com/apache/dolphinscheduler/pull/3957 | 8fd3932bff374a03ef159bd2a2f495728c8e5d4e | 05b248f8e3323434c83851d26b1fcf6dc61eef4e | "2020-10-20T11:23:46Z" | java | "2020-10-24T09:50:33Z" | dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/VarPoolUtilsTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import org.apache.dolphinscheduler.common.model.TaskNode;
import java.util.concurrent.ConcurrentHashMap;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class VarPoolUtilsTest { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,956 | [Bug][Master] When running a task, the resource file is lost, which results in an error | When running a shell task, the resource file is lost, which results in an error
TaskParams
Taskparams does not have a resourcelist. When converting, the content of resourcelist will be lost
Not only shell tasks, param parameters in other task types may be overridden
The code is as follows:
VarPoolUtils#setTaskNodeLocalParams
```
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
```
| https://github.com/apache/dolphinscheduler/issues/3956 | https://github.com/apache/dolphinscheduler/pull/3957 | 8fd3932bff374a03ef159bd2a2f495728c8e5d4e | 05b248f8e3323434c83851d26b1fcf6dc61eef4e | "2020-10-20T11:23:46Z" | java | "2020-10-24T09:50:33Z" | dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/VarPoolUtilsTest.java | private static final Logger logger = LoggerFactory.getLogger(VarPoolUtilsTest.class);
@Test
public void testSetTaskNodeLocalParams() {
String taskJson = "{\"conditionResult\":\"{\\\"successNode\\\":[\\\"\\\"],\\\"failedNode\\\":[\\\"\\\"]}\","
+ "\"conditionsTask\":false,\"depList\":[],\"dependence\":\"{}\",\"forbidden\":false,\"id\":\"tasks-75298\",\"maxRetryTimes\":0,\"name\":\"a1\","
+ "\"params\":\"{\\\"rawScript\\\":\\\"print(\\\\\\\"this is python task \\\\\\\",${p0})\\\","
+ "\\\"localParams\\\":[{\\\"prop\\\":\\\"p1\\\",\\\"direct\\\":\\\"IN\\\",\\\"type\\\":\\\"VARCHAR\\\",\\\"value\\\":\\\"1\\\"}],"
+ "\\\"resourceList\\\":[]}\",\"preTasks\":\"[]\",\"retryInterval\":1,\"runFlag\":\"NORMAL\",\"taskInstancePriority\":\"MEDIUM\","
+ "\"taskTimeoutParameter\":{\"enable\":false,\"interval\":0},\"timeout\":\"{\\\"enable\\\":false,\\\"strategy\\\":\\\"\\\"}\","
+ "\"type\":\"PYTHON\",\"workerGroup\":\"default\"}";
TaskNode taskNode = JSONUtils.parseObject(taskJson, TaskNode.class);
VarPoolUtils.setTaskNodeLocalParams(taskNode, "p1", "test1"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,956 | [Bug][Master] When running a task, the resource file is lost, which results in an error | When running a shell task, the resource file is lost, which results in an error
TaskParams
Taskparams does not have a resourcelist. When converting, the content of resourcelist will be lost
Not only shell tasks, param parameters in other task types may be overridden
The code is as follows:
VarPoolUtils#setTaskNodeLocalParams
```
/**
* setTaskNodeLocalParams
* @param taskNode taskNode
* @param prop LocalParamName
* @param value LocalParamValue
*/
public static void setTaskNodeLocalParams(TaskNode taskNode, String prop, Object value) {
String taskParamsJson = taskNode.getParams();
TaskParams taskParams = JSONUtils.parseObject(taskParamsJson, TaskParams.class);
if (taskParams == null) {
return;
}
taskParams.setLocalParamValue(prop, value);
taskNode.setParams(JSONUtils.toJsonString(taskParams));
}
```
| https://github.com/apache/dolphinscheduler/issues/3956 | https://github.com/apache/dolphinscheduler/pull/3957 | 8fd3932bff374a03ef159bd2a2f495728c8e5d4e | 05b248f8e3323434c83851d26b1fcf6dc61eef4e | "2020-10-20T11:23:46Z" | java | "2020-10-24T09:50:33Z" | dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/VarPoolUtilsTest.java | Assert.assertEquals(VarPoolUtils.getTaskNodeLocalParam(taskNode, "p1"), "test1");
ConcurrentHashMap<String, Object> propToValue = new ConcurrentHashMap<String, Object>();
propToValue.put("p1", "test2");
VarPoolUtils.setTaskNodeLocalParams(taskNode, propToValue);
Assert.assertEquals(VarPoolUtils.getTaskNodeLocalParam(taskNode, "p1"), "test2");
}
@Test
public void testConvertVarPoolToMap() throws Exception {
String varPool = "p1,66$VarPool$p2,69$VarPool$";
ConcurrentHashMap<String, Object> propToValue = new ConcurrentHashMap<String, Object>();
VarPoolUtils.convertVarPoolToMap(propToValue, varPool);
Assert.assertEquals((String)propToValue.get("p1"), "66");
Assert.assertEquals((String)propToValue.get("p2"), "69");
logger.info(propToValue.toString());
}
@Test
public void testConvertPythonScriptPlaceholders() throws Exception {
String rawScript = "print(${p1});\n${setShareVar(${p1},3)};\n${setShareVar(${p2},4)};";
rawScript = VarPoolUtils.convertPythonScriptPlaceholders(rawScript);
Assert.assertEquals(rawScript, "print(${p1});\n"
+ "print(\"${{setValue({},{})}}\".format(\"p1\",3));\n"
+ "print(\"${{setValue({},{})}}\".format(\"p2\",4));");
logger.info(rawScript);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.dao.utils;
import org.apache.dolphinscheduler.common.enums.TaskDependType;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
import org.apache.dolphinscheduler.common.process.ProcessDag;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessData;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
* dag tools
*/
public class DagHelper {
private static final Logger logger = LoggerFactory.getLogger(DagHelper.class);
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | * generate flow node relation list by task node list;
* Edges that are not in the task Node List will not be added to the result
* @param taskNodeList taskNodeList
* @return task node relation list
*/
public static List<TaskNodeRelation> generateRelationListByFlowNodes(List<TaskNode> taskNodeList) {
List<TaskNodeRelation> nodeRelationList = new ArrayList<>();
for (TaskNode taskNode : taskNodeList) {
String preTasks = taskNode.getPreTasks();
List<String> preTaskList = JSONUtils.toList(preTasks, String.class);
if (preTaskList != null) {
for (String depNodeName : preTaskList) {
if (null != findNodeByName(taskNodeList, depNodeName)) {
nodeRelationList.add(new TaskNodeRelation(depNodeName, taskNode.getName()));
}
}
}
}
return nodeRelationList;
}
/**
* generate task nodes needed by dag
* @param taskNodeList taskNodeList
* @param startNodeNameList startNodeNameList
* @param recoveryNodeNameList recoveryNodeNameList
* @param taskDependType taskDependType
* @return task node list
*/
public static List<TaskNode> generateFlowNodeListByStartNode(List<TaskNode> taskNodeList, List<String> startNodeNameList,
List<String> recoveryNodeNameList, TaskDependType taskDependType) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | List<TaskNode> destFlowNodeList = new ArrayList<>();
List<String> startNodeList = startNodeNameList;
if(taskDependType != TaskDependType.TASK_POST
&& CollectionUtils.isEmpty(startNodeList)){
logger.error("start node list is empty! cannot continue run the process ");
return destFlowNodeList;
}
List<TaskNode> destTaskNodeList = new ArrayList<>();
List<TaskNode> tmpTaskNodeList = new ArrayList<>();
if (taskDependType == TaskDependType.TASK_POST
&& CollectionUtils.isNotEmpty(recoveryNodeNameList)) {
startNodeList = recoveryNodeNameList;
}
if (CollectionUtils.isEmpty(startNodeList)) {
tmpTaskNodeList = taskNodeList;
} else {
for (String startNodeName : startNodeList) {
TaskNode startNode = findNodeByName(taskNodeList, startNodeName);
List<TaskNode> childNodeList = new ArrayList<>();
if (startNode == null) {
logger.error("start node name [{}] is not in task node list [{}] ",
startNodeName,
taskNodeList
);
continue;
} else if (TaskDependType.TASK_POST == taskDependType) {
childNodeList = getFlowNodeListPost(startNode, taskNodeList);
} else if (TaskDependType.TASK_PRE == taskDependType) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | childNodeList = getFlowNodeListPre(startNode, recoveryNodeNameList, taskNodeList);
} else {
childNodeList.add(startNode);
}
tmpTaskNodeList.addAll(childNodeList);
}
}
for (TaskNode taskNode : tmpTaskNodeList) {
if (null == findNodeByName(destTaskNodeList, taskNode.getName())) {
destTaskNodeList.add(taskNode);
}
}
return destTaskNodeList;
}
/**
* find all the nodes that depended on the start node
* @param startNode startNode
* @param taskNodeList taskNodeList
* @return task node list
*/
private static List<TaskNode> getFlowNodeListPost(TaskNode startNode, List<TaskNode> taskNodeList) {
List<TaskNode> resultList = new ArrayList<>();
for (TaskNode taskNode : taskNodeList) {
List<String> depList = taskNode.getDepList();
if (null != depList && null != startNode && depList.contains(startNode.getName())) {
resultList.addAll(getFlowNodeListPost(taskNode, taskNodeList));
}
}
resultList.add(startNode);
return resultList; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | }
/**
* find all nodes that start nodes depend on.
* @param startNode startNode
* @param recoveryNodeNameList recoveryNodeNameList
* @param taskNodeList taskNodeList
* @return task node list
*/
private static List<TaskNode> getFlowNodeListPre(TaskNode startNode, List<String> recoveryNodeNameList, List<TaskNode> taskNodeList) {
List<TaskNode> resultList = new ArrayList<>();
List<String> depList = new ArrayList<>();
if (null != startNode) {
depList = startNode.getDepList();
resultList.add(startNode);
}
if (CollectionUtils.isEmpty(depList)) {
return resultList;
}
for (String depNodeName : depList) {
TaskNode start = findNodeByName(taskNodeList, depNodeName);
if (recoveryNodeNameList.contains(depNodeName)) {
resultList.add(start);
} else {
resultList.addAll(getFlowNodeListPre(start, recoveryNodeNameList, taskNodeList));
}
}
return resultList;
}
/**
* generate dag by start nodes and recovery nodes |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | * @param processDefinitionJson processDefinitionJson
* @param startNodeNameList startNodeNameList
* @param recoveryNodeNameList recoveryNodeNameList
* @param depNodeType depNodeType
* @return process dag
* @throws Exception if error throws Exception
*/
public static ProcessDag generateFlowDag(String processDefinitionJson,
List<String> startNodeNameList,
List<String> recoveryNodeNameList,
TaskDependType depNodeType) throws Exception {
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
List<TaskNode> taskNodeList = new ArrayList<>();
if (null != processData) {
taskNodeList = processData.getTasks();
}
List<TaskNode> destTaskNodeList = generateFlowNodeListByStartNode(taskNodeList, startNodeNameList, recoveryNodeNameList, depNodeType);
if (destTaskNodeList.isEmpty()) {
return null;
}
List<TaskNodeRelation> taskNodeRelations = generateRelationListByFlowNodes(destTaskNodeList);
ProcessDag processDag = new ProcessDag();
processDag.setEdges(taskNodeRelations);
processDag.setNodes(destTaskNodeList);
return processDag;
}
/**
* parse the forbidden task nodes in process definition.
* @param processDefinitionJson processDefinitionJson
* @return task node map |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | */
public static Map<String, TaskNode> getForbiddenTaskNodeMaps(String processDefinitionJson){
Map<String, TaskNode> forbidTaskNodeMap = new ConcurrentHashMap<>();
ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class);
List<TaskNode> taskNodeList = new ArrayList<>();
if (null != processData) {
taskNodeList = processData.getTasks();
}
for(TaskNode node : taskNodeList){
if(node.isForbidden()){
forbidTaskNodeMap.putIfAbsent(node.getName(), node);
}
}
return forbidTaskNodeMap;
}
/**
* find node by node name
* @param nodeDetails nodeDetails
* @param nodeName nodeName
* @return task node
*/
public static TaskNode findNodeByName(List<TaskNode> nodeDetails, String nodeName) {
for (TaskNode taskNode : nodeDetails) {
if (taskNode.getName().equals(nodeName)) {
return taskNode;
}
}
return null;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | * get start vertex in one dag
* it would find the post node if the start vertex is forbidden running
* @param parentNodeName previous node
* @param dag dag
* @param completeTaskList completeTaskList
* @return start Vertex list
*/
public static Collection<String> getStartVertex(String parentNodeName, DAG<String, TaskNode, TaskNodeRelation> dag,
Map<String, TaskInstance> completeTaskList){
if(completeTaskList == null){
completeTaskList = new HashMap<>();
}
Collection<String> startVertexs = null;
if(StringUtils.isNotEmpty(parentNodeName)){
startVertexs = dag.getSubsequentNodes(parentNodeName);
}else{
startVertexs = dag.getBeginNode();
}
List<String> tmpStartVertexs = new ArrayList<>();
if(startVertexs!= null){
tmpStartVertexs.addAll(startVertexs);
}
for(String start : startVertexs){
TaskNode startNode = dag.getNode(start);
if(!startNode.isForbidden() && !completeTaskList.containsKey(start)){
continue;
}
Collection<String> postNodes = getStartVertex(start, dag, completeTaskList); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | for(String post : postNodes){
TaskNode postNode = dag.getNode(post);
if(taskNodeCanSubmit(postNode, dag, completeTaskList)){
tmpStartVertexs.add(post);
}
}
tmpStartVertexs.remove(start);
}
return tmpStartVertexs;
}
/**
* the task can be submit when all the depends nodes are forbidden or complete
* @param taskNode taskNode
* @param dag dag
* @param completeTaskList completeTaskList
* @return can submit
*/
public static boolean taskNodeCanSubmit(TaskNode taskNode,
DAG<String, TaskNode, TaskNodeRelation> dag,
Map<String, TaskInstance> completeTaskList) {
List<String> dependList = taskNode.getDepList();
if(dependList == null){
return true;
}
for(String dependNodeName : dependList){
TaskNode dependNode = dag.getNode(dependNodeName);
if(!dependNode.isForbidden() && !completeTaskList.containsKey(dependNodeName)){
return false;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,929 | [Bug][master/worker] After the master and worker are fault-tolerant, the process instance fails after the task instance is successfully executed | ### Steps to reproduce
1. Start 2 master services (master1, master2), 2 worker services (worker1, worker2)
2. Run the workflow, the process instance runs in master1, and the task runs in worker1
3. Stop master1, worker1 services
4. After fault tolerance, the process instance runs on master2 and the task runs on worker2. After all tasks are executed successfully, the process instance status is failed
============================================
### 复现步骤
1.启动2个master服务(master1,master2)、2个worker服务(worker1,worker2)
2.运行工作流,流程实例在master1运行,任务在worker1运行
3.停止master1,worker1服务
4.容错后,流程实例在master2运行,任务在worker2运行,所有任务执行成功后,流程实例状态为失败



**Which branch**
-[1.3.3-release] | https://github.com/apache/dolphinscheduler/issues/3929 | https://github.com/apache/dolphinscheduler/pull/3999 | c11d97f7786eb72d601769a2ba3e1f97453f7c87 | 6caac0f36623cee4fa1cb2edfc35c7db87b08aa9 | "2020-10-16T08:52:08Z" | java | "2020-10-27T09:37:59Z" | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/DagHelper.java | return true;
}
/***
* build dag graph
* @param processDag processDag
* @return dag
*/
public static DAG<String, TaskNode, TaskNodeRelation> buildDagGraph(ProcessDag processDag) {
DAG<String,TaskNode,TaskNodeRelation> dag = new DAG<>();
if (CollectionUtils.isNotEmpty(processDag.getNodes())){
for (TaskNode node : processDag.getNodes()){
dag.addNode(node.getName(),node);
}
}
if (CollectionUtils.isNotEmpty(processDag.getEdges())){
for (TaskNodeRelation edge : processDag.getEdges()){
dag.addEdge(edge.getStartNode(),edge.getEndNode());
}
}
return dag;
}
/**
* get process dag
* @param taskNodeList task node list
* @return Process dag
*/
public static ProcessDag getProcessDag(List<TaskNode> taskNodeList) {
List<TaskNodeRelation> taskNodeRelations = new ArrayList<>(); |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.