Skip to content

[Improvement][Log] optimize task log path to reduce task running time#6731

Merged
CalvinKirs merged 9 commits intoapache:devfrom
choucmei:dev
Nov 17, 2021
Merged

[Improvement][Log] optimize task log path to reduce task running time#6731
CalvinKirs merged 9 commits intoapache:devfrom
choucmei:dev

Conversation

@choucmei
Copy link
Copy Markdown
Contributor

@choucmei choucmei commented Nov 7, 2021

Purpose of the pull request

close #6665

  • Reduce the creation of log directories
  • Consider that schedulerTime may be null,and taskExecutionContext does not have submitTime, so use firstSubmitTime as the task log path

Brief change log

  1. Use firstSubmitTime as the task log path
  2. TaskLogName: [taskAppId=TASK-798_1-4084-15210] -> [taskAppId=TASK-20211107-798_1-4084-15210]
  3. TaskLogPath: /logs/defintion/code_defintion_version/processInstanceId/taskInstanceId.log->/logs/YYYYMMDD/defintion-code_defintion_version-processInstanceId-taskInstanceId.log

Verify this pull request

LoggerUtils,LogUtilsTest is already covered by existing tests,
others pass local test.

* Reduce the creation of log directories
* Consider that schedulerTime may be null,and taskExecutionContext does not have submitTime, so use firstSubmitTime as the task log path
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 7, 2021

Codecov Report

Merging #6731 (4180dcd) into dev (9113817) will increase coverage by 0.03%.
The diff coverage is 75.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##                dev    #6731      +/-   ##
============================================
+ Coverage     41.83%   41.87%   +0.03%     
- Complexity     3618     3622       +4     
============================================
  Files           641      641              
  Lines         25895    25922      +27     
  Branches       2795     2797       +2     
============================================
+ Hits          10833    10854      +21     
- Misses        14081    14085       +4     
- Partials        981      983       +2     
Impacted Files Coverage Δ
.../org/apache/dolphinscheduler/common/Constants.java 79.16% <ø> (ø)
...pache/dolphinscheduler/common/utils/DateUtils.java 81.10% <ø> (ø)
...che/dolphinscheduler/common/utils/LoggerUtils.java 0.00% <0.00%> (ø)
...ver/master/runner/task/ConditionTaskProcessor.java 0.00% <0.00%> (ø)
...ver/master/runner/task/DependentTaskProcessor.java 0.00% <0.00%> (ø)
...server/master/runner/task/SwitchTaskProcessor.java 0.00% <0.00%> (ø)
...eduler/server/worker/runner/TaskExecuteThread.java 0.00% <0.00%> (ø)
...phinscheduler/server/log/TaskLogDiscriminator.java 87.50% <100.00%> (ø)
...apache/dolphinscheduler/server/utils/LogUtils.java 92.30% <100.00%> (+3.41%) ⬆️
...rg/apache/dolphinscheduler/api/utils/PageInfo.java 61.81% <0.00%> (+9.31%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9113817...4180dcd. Read the comment docs.

@lenboo
Copy link
Copy Markdown
Contributor

lenboo commented Nov 8, 2021

well done!
But there are some code style errors, can you fix them?

@CalvinKirs
Copy link
Copy Markdown
Member

@choucmei
Copy link
Copy Markdown
Contributor Author

choucmei commented Nov 8, 2021

well done!
But there are some code style errors, can you fix them?

Of course, this is my mistake.

Comment on lines +266 to +268



Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the extra blank lines and only keep one blank line

public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";



Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the extra blank lines and only keep one blank line.

BTW, @zhongjiajie can you please set up a code style rule to only allow at most one blank line between member fields / methods?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 , would try today

/**
* get specify date
*/
public static Date getSpecifyDate(int year, int month, int date) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, this method is only for test, it's not necessary to add this method to increase maintainers' burden, please just move it into the test.

@zhongjiajie
Copy link
Copy Markdown
Member

Hi @choucmei code look good to me now, but unit test failed, could you take a look and fix it?

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

61.9% 61.9% Coverage
0.0% 0.0% Duplication

@zhongjiajie
Copy link
Copy Markdown
Member

@CalvinKirs Seem CI green, could you rebase again and merge it?

Copy link
Copy Markdown
Member

@CalvinKirs CalvinKirs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @lenboo PTAL

@CalvinKirs CalvinKirs added this to the 2.0.1-release milestone Nov 17, 2021
Copy link
Copy Markdown
Member

@ruanwenjun ruanwenjun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I have test on standalone, it works well.

@CalvinKirs CalvinKirs merged commit f564687 into apache:dev Nov 17, 2021
@zhongjiajie
Copy link
Copy Markdown
Member

@CalvinKirs Sooooo fast! 🚀

@davidzollo
Copy link
Copy Markdown
Contributor

good job

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement][Log] optimize task log path to reduce task running time

8 participants