Skip to content

Commit efed056

Browse files
committed
chore: remove multiple version docs build each time
1 parent b0967c6 commit efed056

7 files changed

Lines changed: 57 additions & 108 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,23 +117,18 @@ jobs:
117117
timeout-minutes: 15
118118
needs: lint
119119
runs-on: ubuntu-latest
120-
strategy:
121-
fail-fast: false
122-
matrix:
123-
env-list: [doc-build, doc-build-multi]
124120
steps:
125121
- uses: actions/checkout@v3
126122
- name: Set up Python
127123
uses: actions/setup-python@v4
128124
with:
129-
# need to pin to 3.10 cause sphinx-multiversion latest code have but gather equal than 3.11
130-
python-version: '3.10'
125+
python-version: 3.13
131126
- name: Install Dependences
132127
run: |
133128
python -m pip install --upgrade ${{ env.DEPENDENCES }}
134-
- name: Run Build Docs Tests ${{ matrix.env-list }}
129+
- name: Run Build Docs Tests
135130
run: |
136-
python -m tox -vv -e ${{ matrix.env-list }}
131+
python -m tox -vv -e doc-build
137132
local-ci:
138133
timeout-minutes: 15
139134
needs:

CONTRIBUTING.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,10 @@ GitHub. You may locally ensure docs could be built successfully in case the fail
177177

178178
### Build Document Automatically with tox
179179

180-
We integrated document build process into tox, you can build the latest document and all document(including history documents) via
181-
single command
180+
We integrated document build process into tox, and you can build the latest documentation via a single command.
182181

183182
```shell
184-
# Build the latest document in dev branch
185183
tox -e doc-build
186-
# Build all documents, which including the latest and all history documents
187-
tox -e doc-build-multi
188184
```
189185

190186
### Build Document Manually
@@ -202,15 +198,6 @@ cd pydolphinscheduler/docs/
202198
make clean && make html
203199
```
204200

205-
or if you want to build history documents, you should execute the command below
206-
207-
```shell
208-
# Fetch all history tags because we use tag to build history documents via [sphinx-multiversion](https://holzhaus.github.io/sphinx-multiversion/master/index.html)
209-
git fetch --tags
210-
cd pydolphinscheduler/docs/
211-
make clean && make multiversion
212-
```
213-
214201
## Unit Test
215202

216203
pydolphinscheduler using [pytest][pytest] to test our codebase. GitHub Action will run our test when you create

RELEASE.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ but we also have a [PyPi](#release-to-pypi) repository for Python package distri
3131
add check whether apache/dolphinscheduler commit is released, for some commit not release should revert the change
3232
* Run all test locally, `tox -e local-ci && tox -e local-integrate-test`, after you start dolphinscheduler to
3333
pass `local-integrate-test`
34-
* Remove `sphinx-multiversion` dependency in `setup.cfg`, we still can not fix this issue
35-
[Distribute tarball and wheel error with direct dependency](https://github.com/apache/dolphinscheduler/issues/12238)
3634

3735
## Build and Sign Package
3836

docs/Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
# Add opts `turn warnings into errors` strict sphinx-build behavior
2525
SPHINXOPTS ?= -W
2626
SPHINXBUILD ?= sphinx-build
27-
SPHINXMULTIVERSION ?= sphinx-multiversion
2827
SOURCEDIR = source
2928
BUILDDIR = build
3029

@@ -38,7 +37,3 @@ help:
3837
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
3938
%: Makefile
4039
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
41-
42-
# Create multiple version of docs
43-
multiversion:
44-
@$(SPHINXMULTIVERSION) "$(SOURCEDIR)" "$(BUILDDIR)/html"

docs/source/conf.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,10 @@
2626
# If extensions (or modules to document with autodoc) are in another directory,
2727
# add these directories to sys.path here. If the directory is relative to the
2828
# documentation root, use os.path.abspath to make it absolute, like shown here.
29-
import os
3029
import sys
3130
from pathlib import Path
3231

33-
# For sphinx-multiversion, we need to build API docs of the corresponding package version, related issue:
34-
# https://github.com/Holzhaus/sphinx-multiversion/issues/42
35-
pkg_src_dir = (
36-
Path(os.environ.get("SPHINX_MULTIVERSION_SOURCEDIR", default="."))
37-
.joinpath("../../src")
38-
.resolve()
39-
)
32+
pkg_src_dir = Path(__file__).resolve().parents[2].joinpath("src")
4033
sys.path.insert(0, str(pkg_src_dir))
4134

4235
from pydolphinscheduler import __version__ # noqa
@@ -76,26 +69,12 @@
7669
# Add inline tabbed content
7770
"sphinx_inline_tabs",
7871
"sphinx_copybutton",
79-
"sphinx_multiversion",
8072
"sphinx_github_changelog",
8173
]
8274

8375
# Add any paths that contain templates here, relative to this directory.
8476
templates_path = ["_templates"]
8577

86-
# sphinx_multiversion configuration
87-
html_sidebars = {
88-
"**": [
89-
"versioning.html",
90-
],
91-
}
92-
# Match all exists tag for pydolphinscheduler expect version 2.0.4(not release apache dolphinscheduler)
93-
smv_tag_whitelist = r"^(?!2.0.4)\d+\.\d+\.\d+$"
94-
smv_branch_whitelist = "main"
95-
smv_remote_whitelist = r"^(origin|upstream)$"
96-
smv_released_pattern = "^refs/tags/.*$"
97-
smv_outputdir_format = "versions/{ref.name}"
98-
9978
# List of patterns, relative to source directory, that match files and
10079
# directories to ignore when looking for source files.
10180
# This pattern also affects html_static_path and html_extra_path.

setup.cfg

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ doc =
109109
sphinx-click>=3.0
110110
sphinx-inline-tabs
111111
sphinx-copybutton>=0.4.0
112-
# Unreleased package have a feature we want(use correct version package for API ref), so we install from
113-
# GitHub directly, see also:
114-
# https://github.com/Holzhaus/sphinx-multiversion/issues/42#issuecomment-1210539786
115-
sphinx-multiversion @ git+https://github.com/Holzhaus/sphinx-multiversion#egg=sphinx-multiversion
116112
sphinx-github-changelog
117113
dev =
118114
# build
@@ -165,7 +161,6 @@ envlist =
165161
auto-lint
166162
lint
167163
doc-build
168-
doc-build-multi
169164
code-test
170165
integrate-test
171166
local-integrate-test
@@ -204,17 +199,6 @@ commands =
204199
commands_post =
205200
find {toxinidir}/docs -type f -name "environment.pickle" -exec rm -rf \{\} \;
206201

207-
[testenv:doc-build-multi]
208-
extras = doc
209-
commands =
210-
# Get all tags for `multiversion` subcommand
211-
git fetch --tags
212-
make -C {toxinidir}/docs clean
213-
make -C {toxinidir}/docs multiversion
214-
# Remove sensitive information from the generated documentation
215-
commands_post =
216-
find {toxinidir}/docs -type f -name "environment.pickle" -exec rm -rf \{\} \;
217-
218202
[testenv:integrate-test]
219203
extras = test
220204
commands =
@@ -227,7 +211,6 @@ setenv =
227211
commands =
228212
{[testenv:integrate-test]commands}
229213

230-
# local-ci do not build `doc-build-multi`
231214
[testenv:local-ci]
232215
extras = dev
233216
commands =

src/pydolphinscheduler/java_gateway.py

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -65,28 +65,11 @@ def __init__(
6565
auth_token: str | None = None,
6666
):
6767
self._gateway = None
68+
self._is_gateway_version_checked = False
6869
self.address = address or configuration.JAVA_GATEWAY_ADDRESS
6970
self.port = port or configuration.JAVA_GATEWAY_PORT
7071
self.auto_convert = auto_convert or configuration.JAVA_GATEWAY_AUTO_CONVERT
7172
self.auth_token = auth_token or configuration.JAVA_GATEWAY_AUTH_TOKEN
72-
gateway_version = "unknown"
73-
with contextlib.suppress(Py4JError):
74-
# 1. Java gateway version is too old: doesn't have method 'getGatewayVersion()'
75-
# 2. Error connecting to Java gateway
76-
gateway_version = self.get_gateway_version()
77-
if (
78-
not __version__.endswith("dev")
79-
and gateway_version
80-
and not version_match(Version.DS, gateway_version)
81-
):
82-
warnings.warn(
83-
f"Using unmatched version of pydolphinscheduler (version {__version__}) "
84-
f"and Java gateway (version {gateway_version}) may cause errors. "
85-
"We strongly recommend you to find the matched version "
86-
"(check: https://pypi.org/project/apache-dolphinscheduler)",
87-
UserWarning,
88-
stacklevel=2,
89-
)
9073

9174
@property
9275
def gateway(self) -> JavaGateway:
@@ -108,6 +91,35 @@ def gateway(self) -> JavaGateway:
10891
self._gateway = JavaGateway(gateway_parameters=gateway_parameters)
10992
return self._gateway
11093

94+
def _check_gateway_version(self):
95+
"""Warn once when Python SDK and Java gateway versions do not match."""
96+
if self._is_gateway_version_checked:
97+
return
98+
self._is_gateway_version_checked = True
99+
if __version__.endswith("dev"):
100+
return
101+
102+
gateway_version = "unknown"
103+
with contextlib.suppress(Py4JError):
104+
# 1. Java gateway version is too old: doesn't have method 'getGatewayVersion()'
105+
# 2. Error connecting to Java gateway
106+
gateway_version = self.gateway.entry_point.getGatewayVersion()
107+
if gateway_version and not version_match(Version.DS, gateway_version):
108+
warnings.warn(
109+
f"Using unmatched version of pydolphinscheduler (version {__version__}) "
110+
f"and Java gateway (version {gateway_version}) may cause errors. "
111+
"We strongly recommend you to find the matched version "
112+
"(check: https://pypi.org/project/apache-dolphinscheduler)",
113+
UserWarning,
114+
stacklevel=2,
115+
)
116+
117+
@property
118+
def entry_point(self):
119+
"""Return Java gateway entry point with lazy version validation."""
120+
self._check_gateway_version()
121+
return self.gateway.entry_point
122+
111123
def get_gateway_version(self):
112124
"""Get the java gateway version, expected to be equal with pydolphinscheduler."""
113125
return self.gateway.entry_point.getGatewayVersion()
@@ -120,69 +132,69 @@ def get_datasource(self, name: str, type: str | None = None):
120132
:param name: datasource name of the datasource to be queried
121133
:param type: datasource type of the datasource, only used to filter the result.
122134
"""
123-
return self.gateway.entry_point.getDatasource(name, type)
135+
return self.entry_point.getDatasource(name, type)
124136

125137
def get_resources_file_info(self, program_type: str, main_package: str):
126138
"""Get resources file info through java gateway."""
127-
return self.gateway.entry_point.getResourcesFileInfo(program_type, main_package)
139+
return self.entry_point.getResourcesFileInfo(program_type, main_package)
128140

129141
def create_or_update_resource(self, user_name: str, name: str, content: str):
130142
"""Create or update resource through java gateway."""
131-
return self.gateway.entry_point.createOrUpdateResource(user_name, name, content)
143+
return self.entry_point.createOrUpdateResource(user_name, name, content)
132144

133145
def query_resources_file_info(self, user_name: str, name: str):
134146
"""Get resources file info through java gateway."""
135-
return self.gateway.entry_point.queryResourcesFileInfo(user_name, name)
147+
return self.entry_point.queryResourcesFileInfo(user_name, name)
136148

137149
def query_environment_info(self, name: str):
138150
"""Get environment info through java gateway."""
139-
return self.gateway.entry_point.getEnvironmentInfo(name)
151+
return self.entry_point.getEnvironmentInfo(name)
140152

141153
def get_code_and_version(
142154
self, project_name: str, workflow_name: str, task_name: str
143155
):
144156
"""Get code and version through java gateway."""
145-
return self.gateway.entry_point.getCodeAndVersion(
157+
return self.entry_point.getCodeAndVersion(
146158
project_name, workflow_name, task_name
147159
)
148160

149161
def create_or_grant_project(
150162
self, user: str, name: str, description: str | None = None
151163
):
152164
"""Create or grant project through java gateway."""
153-
return self.gateway.entry_point.createOrGrantProject(user, name, description)
165+
return self.entry_point.createOrGrantProject(user, name, description)
154166

155167
def query_project_by_name(self, user: str, name: str):
156168
"""Query project through java gateway."""
157-
return self.gateway.entry_point.queryProjectByName(user, name)
169+
return self.entry_point.queryProjectByName(user, name)
158170

159171
def update_project(
160172
self, user: str, project_code: int, project_name: str, description: str
161173
):
162174
"""Update project through java gateway."""
163-
return self.gateway.entry_point.updateProject(
175+
return self.entry_point.updateProject(
164176
user, project_code, project_name, description
165177
)
166178

167179
def delete_project(self, user: str, code: int):
168180
"""Delete project through java gateway."""
169-
return self.gateway.entry_point.deleteProject(user, code)
181+
return self.entry_point.deleteProject(user, code)
170182

171183
def create_tenant(
172184
self, tenant_name: str, queue_name: str, description: str | None = None
173185
):
174186
"""Create tenant through java gateway."""
175-
return self.gateway.entry_point.createTenant(
187+
return self.entry_point.createTenant(
176188
tenant_name, description, queue_name
177189
)
178190

179191
def query_tenant(self, tenant_code: str):
180192
"""Query tenant through java gateway."""
181-
return self.gateway.entry_point.queryTenantByCode(tenant_code)
193+
return self.entry_point.queryTenantByCode(tenant_code)
182194

183195
def grant_tenant_to_user(self, user_name: str, tenant_code: str):
184196
"""Grant tenant to user through java gateway."""
185-
return self.gateway.entry_point.grantTenantToUser(user_name, tenant_code)
197+
return self.entry_point.grantTenantToUser(user_name, tenant_code)
186198

187199
def update_tenant(
188200
self,
@@ -193,13 +205,13 @@ def update_tenant(
193205
description: str | None = None,
194206
):
195207
"""Update tenant through java gateway."""
196-
return self.gateway.entry_point.updateTenant(
208+
return self.entry_point.updateTenant(
197209
user, tenant_id, code, queue_id, description
198210
)
199211

200212
def delete_tenant(self, user: str, tenant_id: int):
201213
"""Delete tenant through java gateway."""
202-
return self.gateway.entry_point.deleteTenantById(user, tenant_id)
214+
return self.entry_point.deleteTenantById(user, tenant_id)
203215

204216
def create_user(
205217
self,
@@ -212,7 +224,7 @@ def create_user(
212224
status: int,
213225
):
214226
"""Create user through java gateway."""
215-
return self.gateway.entry_point.createUser(
227+
return self.entry_point.createUser(
216228
name, password, email, phone, tenant, queue, status
217229
)
218230

@@ -231,13 +243,13 @@ def update_user(
231243
status: int,
232244
):
233245
"""Update user through java gateway."""
234-
return self.gateway.entry_point.updateUser(
246+
return self.entry_point.updateUser(
235247
name, password, email, phone, tenant, queue, status
236248
)
237249

238250
def delete_user(self, name: str, user_id: int):
239251
"""Delete user through java gateway."""
240-
return self.gateway.entry_point.deleteUser(name, user_id)
252+
return self.entry_point.deleteUser(name, user_id)
241253

242254
def get_dependent_info(
243255
self,
@@ -246,13 +258,13 @@ def get_dependent_info(
246258
task_name: str | None = None,
247259
):
248260
"""Get dependent info through java gateway."""
249-
return self.gateway.entry_point.getDependentInfo(
261+
return self.entry_point.getDependentInfo(
250262
project_name, workflow_name, task_name
251263
)
252264

253265
def get_workflow_info(self, user_name: str, project_name: str, workflow_name: str):
254266
"""Get workflow info through java gateway."""
255-
return self.gateway.entry_point.getWorkflowInfo(
267+
return self.entry_point.getWorkflowInfo(
256268
user_name, project_name, workflow_name
257269
)
258270

@@ -276,7 +288,7 @@ def create_or_update_workflow(
276288
other_params_json: str | None = None,
277289
):
278290
"""Create or update workflow through java gateway."""
279-
return self.gateway.entry_point.createOrUpdateWorkflow(
291+
return self.entry_point.createOrUpdateWorkflow(
280292
user_name,
281293
project_name,
282294
name,
@@ -305,7 +317,7 @@ def exec_workflow_instance(
305317
warning_group_id: int,
306318
):
307319
"""Exec workflow instance through java gateway."""
308-
return self.gateway.entry_point.execWorkflowInstance(
320+
return self.entry_point.execWorkflowInstance(
309321
user_name,
310322
project_name,
311323
workflow_name,

0 commit comments

Comments
 (0)