Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Bug] [api] After the workflow is exported and imported again, no newly imported task definition appears on the workflow definition page #14397

Closed
3 tasks done
penggeyuanlishe opened this issue Jun 22, 2023 · 2 comments · Fixed by #14398
Assignees
Labels
bug Something isn't working

Comments

@penggeyuanlishe
Copy link
Contributor

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

Create a workflow "testImport":
image-20230622145541802

The workflow has a task definition "testShell":
image-20230622145656524

Export the workflow and import it again:
image-20230622145840607

No task definition related to the imported workflow "testImport(1)_import_20230622145806508" was found in the task definition page:
image-20230622145928440

What you expected to happen

On the task definition page, you should list the newly imported workflow "testImport(1)_import_20230622145806508" and the associated task definition "testShell".

How to reproduce

Refer to "What happened"

Anything else

No response

Version

3.1.x

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@penggeyuanlishe
Copy link
Contributor Author

#14398
上述方案思路如下:
查看任务定义页面的接口:
image-20230622175406766

找到对应源码,发现该接口的 taskExecuteType 有默认值,为 "BATCH":
image-20230622180920272

继续跟踪源码,找到对应的SQL语句:
image-20230622181035358

由于 taskExecuteType 有默认值"BATCH",不会为空,所以and td.task_execute_type = #{taskExecuteType.code}该代码将会执行。到数据库一看,刚才导入的工作流对应的 task_execute_type 果然为空:
image-20230622181336899

排查原因,发现在 org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl#checkAndImport 方法中,
org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog 类的构造方法,未将该值赋值进去,所以导致 TaskDefinitionLog 对象中的 taskExecuteType 并未赋值,因此存入数据库中即为 null 。
image-20230622181647773

于是,解决方案便是修改该构造方法:
image-20230622181943695

@rickchengx
Copy link
Contributor

@penggeyuanlishe thanks for your excellent work

IT-Kwj pushed a commit to IT-Kwj/dolphinscheduler that referenced this issue Jul 14, 2023
zhongjiajie pushed a commit that referenced this issue Jul 20, 2023
biaoma-ty pushed a commit to Kasma-Inc/dolphinscheduler that referenced this issue Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants