Skip to content

Commit 71de64d

Browse files
committed
Revert "[fix] Resource upload in dev branch (#35)"
This reverts commit 85a1dfa
1 parent 778b130 commit 71de64d

7 files changed

Lines changed: 28 additions & 29 deletions

File tree

RELEASE.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ upload package to PyPi. You could first install and upgrade them by:
3939
# Install or upgrade dependencies
4040
python3 -m pip install --upgrade pip build twine
4141

42+
# Configuration during the releasing
43+
VERSION=<VERSION> # The version of the package you want to release, e.g. 1.2.3
44+
REMOTE=<REMOTE> # The git remote name, we usually use `origin` or `remote`
45+
4246
# Change version
4347
# For macOS
4448
sed -i '' "s/__version__ = \".*\"/__version__ = \"${VERSION}\"/" src/pydolphinscheduler/__init__.py
@@ -47,8 +51,6 @@ sed -i "s/__version__ = \".*\"/__version__ = \"${VERSION}\"/" src/pydolphinsched
4751
git commit -am "Release v${VERSION}"
4852

4953
# Add Tag
50-
VERSION=<VERSION> # The version of the package you want to release, e.g. 1.2.3
51-
REMOTE=<REMOTE> # The git remote name, we usually use `origin` or `remote`
5254
git tag -a "${VERSION}" -m "Release v${VERSION}"
5355
git push "${REMOTE}" --tags
5456

@@ -68,9 +70,9 @@ based to the specific tag, and set it as pre-release.
6870
```shell
6971
svn co https://dist.apache.org/repos/dist/dev/dolphinscheduler/ release/dolphinscheduler
7072
mkdir -p release/dolphinscheduler/python/"${VERSION}"
71-
cp dolphinscheduler-python-src-"${VERSION}"* release/dolphinscheduler/python/"${VERSION}"
73+
cp dist/dolphinscheduler-python-src-"${VERSION}"* release/dolphinscheduler/python/"${VERSION}"
7274

73-
cd release/dolphinscheduler && svn add python && svn commit python -m "Release Apache DolphinScheduler-SDK-Python version ${VERSION}"
75+
cd release/dolphinscheduler && svn add python/"${VERSION}" && svn commit python -m "Release Apache DolphinScheduler-SDK-Python version ${VERSION}"
7476
```
7577

7678
### Vote Mail

src/pydolphinscheduler/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class Time(str):
119119
class ResourceKey(str):
120120
"""Constants for key of resource."""
121121

122-
NAME = "resourceName"
122+
ID = "id"
123123

124124

125125
class Symbol(str):

src/pydolphinscheduler/core/resource.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,19 @@ def get_info_from_database(self):
5555
)
5656
return gateway.query_resources_file_info(self.user_name, self.name)
5757

58-
def get_fullname_from_database(self):
59-
"""Get resource fullname from java gateway."""
60-
return self.get_info_from_database().getFullName()
58+
def get_id_from_database(self):
59+
"""Get resource id from java gateway."""
60+
return self.get_info_from_database().getId()
6161

6262
def create_or_update_resource(self):
6363
"""Create or update resource via java gateway."""
6464
if not self.content or not self.user_name:
6565
raise PyDSParamException(
6666
"`user_name` and `content` are required when create or update resource from python gate."
6767
)
68-
return gateway.create_or_update_resource(
68+
gateway.create_or_update_resource(
6969
self.user_name,
7070
self.name,
7171
self.content,
72+
self.description,
7273
)

src/pydolphinscheduler/core/task.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,20 +267,18 @@ def resource_list(self) -> List[Dict[str, Resource]]:
267267
for res in self._resource_list:
268268
if type(res) == str:
269269
resources.add(
270-
Resource(
271-
name=res, user_name=self.user_name
272-
).get_fullname_from_database()
270+
Resource(name=res, user_name=self.user_name).get_id_from_database()
273271
)
274-
elif type(res) == dict and ResourceKey.NAME in res:
272+
elif type(res) == dict and res.get(ResourceKey.ID) is not None:
275273
warnings.warn(
276274
"""`resource_list` should be defined using List[str] with resource paths,
277275
the use of ids to define resources will be remove in version 3.2.0.
278276
""",
279277
DeprecationWarning,
280278
stacklevel=2,
281279
)
282-
resources.add(res.get(ResourceKey.NAME))
283-
return [{ResourceKey.NAME: r} for r in resources]
280+
resources.add(res.get(ResourceKey.ID))
281+
return [{ResourceKey.ID: r} for r in resources]
284282

285283
@property
286284
def user_name(self) -> Optional[str]:

src/pydolphinscheduler/java_gateway.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,13 @@ def get_resources_file_info(self, program_type: str, main_package: str):
116116
"""Get resources file info through java gateway."""
117117
return self.gateway.entry_point.getResourcesFileInfo(program_type, main_package)
118118

119-
def create_or_update_resource(self, user_name: str, name: str, content: str):
119+
def create_or_update_resource(
120+
self, user_name: str, name: str, content: str, description: Optional[str] = None
121+
):
120122
"""Create or update resource through java gateway."""
121-
return self.gateway.entry_point.createOrUpdateResource(user_name, name, content)
123+
return self.gateway.entry_point.createOrUpdateResource(
124+
user_name, name, description, content
125+
)
122126

123127
def query_resources_file_info(self, user_name: str, name: str):
124128
"""Get resources file info through java gateway."""

tests/core/test_task.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def test_task_timeout(value: timedelta, expect: Tuple[int, str]):
147147
},
148148
{
149149
"localParams": ["foo", "bar"],
150-
"resourceList": [{"resourceName": 1}],
150+
"resourceList": [{"id": 1}],
151151
"dependence": {"foo", "bar"},
152152
"waitStartTimeout": {"foo", "bar"},
153153
"conditionResult": {"foo": ["bar"]},
@@ -156,7 +156,7 @@ def test_task_timeout(value: timedelta, expect: Tuple[int, str]):
156156
],
157157
)
158158
@patch(
159-
"pydolphinscheduler.core.resource.Resource.get_fullname_from_database",
159+
"pydolphinscheduler.core.resource.Resource.get_id_from_database",
160160
return_value=1,
161161
)
162162
@patch(
@@ -480,11 +480,11 @@ def test_task_obtain_res_plugin_exception(m_get_content, m_code_version, attr):
480480
[
481481
(
482482
["/dev/test.py"],
483-
[{"resourceName": 1}],
483+
[{"id": 1}],
484484
),
485485
(
486-
["/dev/test.py", {"resourceName": 2}],
487-
[{"resourceName": 1}, {"resourceName": 2}],
486+
["/dev/test.py", {"id": 2}],
487+
[{"id": 1}, {"id": 2}],
488488
),
489489
],
490490
)
@@ -493,7 +493,7 @@ def test_task_obtain_res_plugin_exception(m_get_content, m_code_version, attr):
493493
return_value=(123, 1),
494494
)
495495
@patch(
496-
"pydolphinscheduler.core.resource.Resource.get_fullname_from_database",
496+
"pydolphinscheduler.core.resource.Resource.get_id_from_database",
497497
return_value=1,
498498
)
499499
@patch(

tests/integration/test_resources.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ def tmp_user():
4545
user.delete()
4646

4747

48-
@pytest.mark.skip(
49-
"activate it when dolphinscheduler default resource center is local file"
50-
)
5148
def test_create_or_update(tmp_user):
5249
"""Test create or update resource to java gateway."""
5350
resource = Resource(name=name, content=content, user_name=UNIT_TEST_USER_NAME)
@@ -56,9 +53,6 @@ def test_create_or_update(tmp_user):
5653
assert result.getAlias() == name
5754

5855

59-
@pytest.mark.skip(
60-
"activate it when dolphinscheduler default resource center is local file"
61-
)
6256
def test_get_resource_info(tmp_user):
6357
"""Test get resource info from java gateway."""
6458
resource = Resource(name=name, user_name=UNIT_TEST_USER_NAME)

0 commit comments

Comments
 (0)