dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[DSIP-23][TaskPlugin] Add Lifecycle method to TaskPlugin

Open ruanwenjun opened this issue 2 years ago • 6 comments

Search before asking

  • [X] I had searched in the issues and found no similar feature requirement.

Description

Right now, we have define some methods at the Task plugin, e.g. init, handle, cancel.

There are no close methods, so it's not convenient if we need to close some resource after the task plugin executes.

So it's needed to add Lifecycle interface to do this.

Are you willing to submit a PR?

  • [X] Yes I am willing to submit a PR!

Code of Conduct

ruanwenjun avatar Sep 07 '23 10:09 ruanwenjun

Hello, I have a question. Resource close will occur during task execution, so there shouldn't be any need to pay attention to it in the lifecycle of task plugins, such as sqltask. @ruanwenjun Image

niumy0701 avatar Nov 03 '25 02:11 niumy0701

Hello, I have a question. Resource close will occur during task execution, so there shouldn't be any need to pay attention to it in the lifecycle of task plugins, such as sqltask. @ruanwenjun Image

We should close the resource in the task lifecycle method rather than in the task plugin, this can help to avoid resource leak problem.

ruanwenjun avatar Nov 03 '25 02:11 ruanwenjun

Hello, I have a question. Resource close will occur during task execution, so there shouldn't be any need to pay attention to it in the lifecycle of task plugins, such as sqltask. @ruanwenjun Image

We should close the resource in the task lifecycle method rather than in the task plugin, this can help to avoid resource leak problem.

@ruanwenjun Yes, different tasks use resources differently, so it should be reasonable to close them after using resources in the handle method, right?

niumy0701 avatar Nov 03 '25 03:11 niumy0701

@niumy0701 Yes, the resource leak has occured in many task plugins.

ruanwenjun avatar Nov 10 '25 09:11 ruanwenjun

Hello, I have a question. Resource close will occur during task execution, so there shouldn't be any need to pay attention to it in the lifecycle of task plugins, such as sqltask. @ruanwenjun Image

We should close the resource in the task lifecycle method rather than in the task plugin, this can help to avoid resource leak problem.

@ruanwenjun ok, Can we first add a close method to AbstractTask, and then implement the close method for the task plugin that needs to close the resource

niumy0701 avatar Nov 17 '25 03:11 niumy0701

Hello, I have a question. Resource close will occur during task execution, so there shouldn't be any need to pay attention to it in the lifecycle of task plugins, such as sqltask. @ruanwenjun Image

We should close the resource in the task lifecycle method rather than in the task plugin, this can help to avoid resource leak problem.

@ruanwenjun ok, Can we first add a close method to AbstractTask, and then implement the close method for the task plugin that needs to close the resource

Considering plugin upgrade compatibility, make modifications based on the plugins that require resource closure. dms: Depends on #17723 emr: Depends on #17724 sagemaker: Depends on #17725

niumy0701 avatar Nov 20 '25 06:11 niumy0701