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

[Python] Supports creating or editing resources. #10823

Merged
merged 18 commits into from
Jul 12, 2022

Conversation

hiSandog
Copy link
Contributor

@hiSandog hiSandog commented Jul 7, 2022

Our company now deploy and manage scripts automatically through Python-gate, but resource files need to be maintained manually.We find it inconvenient.So, I think Python-gate should supports creating or editing resources.

close: #10822

@SbloodyS SbloodyS added improvement make more easy to user or prompt friendly backend labels Jul 7, 2022
@SbloodyS SbloodyS added this to the 3.0.0-beta-3 milestone Jul 7, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2022

Codecov Report

Merging #10823 (2a31b24) into dev (ae6aa53) will decrease coverage by 0.39%.
The diff coverage is 34.61%.

@@             Coverage Diff              @@
##                dev   #10823      +/-   ##
============================================
- Coverage     40.66%   40.26%   -0.40%     
- Complexity     4825     4853      +28     
============================================
  Files           913      944      +31     
  Lines         36306    37011     +705     
  Branches       3989     4049      +60     
============================================
+ Hits          14764    14903     +139     
- Misses        20068    20609     +541     
- Partials       1474     1499      +25     
Impacted Files Coverage Δ
.../org/apache/dolphinscheduler/common/Constants.java 83.33% <ø> (ø)
...heduler/api/service/impl/ResourcesServiceImpl.java 51.28% <33.33%> (+2.72%) ⬆️
...che/dolphinscheduler/api/python/PythonGateway.java 21.64% <100.00%> (+0.40%) ⬆️
...org/apache/dolphinscheduler/dao/entity/Tenant.java 49.01% <0.00%> (-23.71%) ⬇️
...olphinscheduler/plugin/task/emr/EmrParameters.java 50.00% <0.00%> (-21.43%) ⬇️
...dolphinscheduler/remote/command/CommandHeader.java 83.33% <0.00%> (-16.67%) ⬇️
.../org/apache/dolphinscheduler/dao/entity/Queue.java 36.17% <0.00%> (-15.45%) ⬇️
...nscheduler/api/service/impl/TenantServiceImpl.java 63.71% <0.00%> (-8.46%) ⬇️
...inscheduler/api/service/impl/QueueServiceImpl.java 67.05% <0.00%> (-7.64%) ⬇️
...er/master/dispatch/host/assign/RandomSelector.java 77.77% <0.00%> (-5.56%) ⬇️
... and 113 more

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 ae6aa53...2a31b24. Read the comment docs.

@zhongjiajie
Copy link
Member

@hiSandog can we hold this PR for a while until we merge #10792? I think maybe we write code and pass the Result type is not the correct way, So in #10792 I migrate all create or update user and tenant code in userService and TenantService. In pythonGateway.java only call one function tenantService.createTenantIfNotExists which will keep python gateway code more easy to read

@hiSandog
Copy link
Contributor Author

hiSandog commented Jul 7, 2022

@hiSandog can we hold this PR for a while until we merge #10792? I think maybe we write code and pass the Result type is not the correct way, So in #10792 I migrate all create or update user and tenant code in userService and TenantService. In pythonGateway.java only call one function tenantService.createTenantIfNotExists which will keep python gateway code more easy to read

ok

@hiSandog hiSandog reopened this Jul 8, 2022
@github-actions github-actions bot added the Python label Jul 9, 2022
@zhongjiajie
Copy link
Member

restart the failed tests

@zhongjiajie
Copy link
Member

BTW, I have review comment in #10823 (comment). I think maybe we should better add a new interface named createOrUpdateResource in ResourcesService.java, just like you add onlineCreateOrUpdateResourceWithDir to ResourcesService.java.

And in PythonGateway.java we just add code below code to keep it as simple as possible, WDYT?

    public Integer createOrUpdateResource(
            String userName, String fullName, String description, String resourceContent) {
        return resourceService.createOrUpdateResource(userName, fullName, description, resourceContent);
    }

@zhongjiajie
Copy link
Member

I restart the failed E2E test

@sonarcloud
Copy link

sonarcloud bot commented Jul 12, 2022

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 1 Code Smell

37.8% 37.8% Coverage
0.0% 0.0% Duplication

Copy link
Member

@zhongjiajie zhongjiajie left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@zhongjiajie zhongjiajie merged commit 59cd861 into apache:dev Jul 12, 2022
@zhongjiajie zhongjiajie changed the title [Improvement][Python] Python-gate supports creating or editing resources. [Python] Supports creating or editing resources. Jul 12, 2022
@zhongjiajie
Copy link
Member

well done, we currently supported create resource in python api now 👍 🎉 thanks again @hiSandog

zhongjiajie pushed a commit that referenced this pull request Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend improvement make more easy to user or prompt friendly Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement][Python] Python-gate supports creating or editing resources.
4 participants