This is an automated email from the ASF dual-hosted git repository. zhongjiajie pushed a commit to branch commercial in repository https://gitbox.apache.org/repos/asf/dolphinscheduler-sdk-python.git
commit 6de3a70c1cb85ce1d431d14947a10b74b47a7442 Author: Jay Chung <[email protected]> AuthorDate: Mon Sep 18 18:44:04 2023 +0800 resource need project attribute --- src/pydolphinscheduler/core/resource.py | 4 ++++ src/pydolphinscheduler/java_gateway.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pydolphinscheduler/core/resource.py b/src/pydolphinscheduler/core/resource.py index 6833efa..3e04f9b 100644 --- a/src/pydolphinscheduler/core/resource.py +++ b/src/pydolphinscheduler/core/resource.py @@ -22,6 +22,7 @@ from typing import Optional from pydolphinscheduler.exceptions import PyDSParamException from pydolphinscheduler.java_gateway import gateway from pydolphinscheduler.models import Base +from pydolphinscheduler import configuration class Resource(Base): @@ -38,11 +39,13 @@ class Resource(Base): def __init__( self, name: str, + project: Optional[str] = configuration.WORKFLOW_PROJECT, content: Optional[str] = None, description: Optional[str] = None, user_name: Optional[str] = None, ): super().__init__(name, description) + self.project = project self.content = content self.user_name = user_name self._resource_code = None @@ -66,6 +69,7 @@ class Resource(Base): "`user_name` and `content` are required when create or update resource from python gate." ) gateway.create_or_update_resource( + self.project, self.user_name, self.name, self.content, diff --git a/src/pydolphinscheduler/java_gateway.py b/src/pydolphinscheduler/java_gateway.py index 4b1476e..736c1d7 100644 --- a/src/pydolphinscheduler/java_gateway.py +++ b/src/pydolphinscheduler/java_gateway.py @@ -103,11 +103,11 @@ class GatewayEntryPoint: return self.gateway.entry_point.getResourcesFileInfo(program_type, main_package) def create_or_update_resource( - self, user_name: str, name: str, content: str, description: Optional[str] = None + self, project_name: str, user_name: str, name: str, content: str, description: Optional[str] = None ): """Create or update resource through java gateway.""" return self.gateway.entry_point.createOrUpdateResource( - user_name, name, description, content + user_name, name, description, content, project_name ) def query_resources_file_info(self, user_name: str, name: str):
