Skip to content

[Fix-17026][api] Fix the schedule-release-state from import workflowDefinition whose scheduled-release-state was online #17132

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

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

yingh0ng
Copy link
Contributor

Purpose of the pull request

close #17026

Brief change log

Verify this pull request

This change added tests and can be verified as follows:

  • Added import workflow definition tests on WorkflowDefinitionServiceTest.

Pull Request Notice

Pull Request Notice

If your pull request contains incompatible change, you should also add it to docs/docs/en/guide/upgrade/incompatible.md

@SbloodyS SbloodyS added this to the 3.3.1 milestone Apr 15, 2025
@SbloodyS SbloodyS added the bug Something isn't working label Apr 15, 2025
@nielifeng nielifeng requested a review from Copilot April 17, 2025 02:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request fixes the schedule-release-state when importing a workflow definition by ensuring that online schedules trigger an update via the scheduler API.

  • Updated test cases to cover various import scenarios (e.g., unauthorized project access, empty file content, missing parameters, duplicate names)
  • Revised Mockito argument usage in tests and added a new condition in the service implementation to trigger schedule updates when the release state is ONLINE.

Reviewed Changes

Copilot reviewed 2 out of 5 changed files in this pull request and generated no comments.

File Description
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/WorkflowDefinitionServiceTest.java Added tests to validate workflow definition import and updated Mockito matchers.
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java Included a conditional call to the scheduler API when the schedule’s release state is ONLINE.
Files not reviewed (3)
  • dolphinscheduler-api/src/test/resources/workflowImport/check_duplicate_name.json: Language not supported
  • dolphinscheduler-api/src/test/resources/workflowImport/check_importance_params.json: Language not supported
  • dolphinscheduler-api/src/test/resources/workflowImport/check_successful.json: Language not supported

Comment on lines 1591 to 1594
if (ReleaseState.ONLINE.equals(schedule.getReleaseState())) {
Project project = projectMapper.queryByCode(projectCode);
schedulerApi.insertOrUpdateScheduleTask(project.getId(), schedule);
}
Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need this since we don't allow to copy the online schedule workflow definition. We should keep the same logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see what you mean. We should throw an exception when the releaseState is online. This would prevent user confusion.
What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I think we should just import workflow with offline state. And marked in the document.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LGTM, thanks for the suggestion!

"environmentCode" : -1,
"environmentName" : null
}
} ]
Copy link
Member

Choose a reason for hiding this comment

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

Keep the blank in the last line.

"environmentCode" : -1,
"environmentName" : null
}
} ]
Copy link
Member

Choose a reason for hiding this comment

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

Keep the blank in the last line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working document test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] [schedule] Using Import Workflow with schedule releaseState=online, but workflow not starting
2 participants