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

fix: support conn_pool ping before init | add missing dep in py3.6 #339

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

wey-gu
Copy link
Contributor

@wey-gu wey-gu commented Apr 25, 2024

In NebulaGraph repo ci test, ping was done before the connection pool's init, this was broken in recent changes.
This change fixed it.

issue 1:

a. connection_pool cannot be ping() without init()

b. dependency issue:

  • http2 was added, it relied on httpcore-->anyio-->contextvars(only needed when python < 3.7)
  • in setup.py, there were httpx[http2] >= 0.22.0, ensures httpcore-->anyio BUT NOT contextvars

WHY this issue(a, or b) was not found? It could be due to a dirty cache, see issue 2 hided issue 1.

Action: added this dep handling in setup.py

issue 2:

dirty cache in gh runner in /home/vesoft/actions-runner/_work/_temp/_github_home/.local

docker run --rm -e "HOME=/github/home" -v "/home/vesoft/actions-runner/_work/_temp/_github_home":"/github/home" -it vesoft/nebula-dev:centos7

bash-4.2# pip3 freeze | grep nebula
nebula3-python==3.5.1

>>> sys.path
['', '/usr/lib64/python36.zip', '/usr/lib64/python3.6', '/usr/lib64/python3.6/lib-dynload', '/github/home/.local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/site-packages', '/usr/lib64/python3.6/site-packages', '/usr/lib/python3.6/site-packages']
>>> import nebula3
>>> nebula3.__file__
'/github/home/.local/lib/python3.6/site-packages/nebula3/__init__.py'

WHY .local exist unexpected nebula3-python package? It could be caused by attempts of pip3 install --user:

bash-4.2# pip3 install --user nebula2-python
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting nebula2-python
  Downloading https://files.pythonhosted.org/packages/49/a8/75bf56857e3d42f33d569b449be3435f82b783a4d57fcaab34349cc029bd/nebula2_python-2.6.1-py3-none-any.whl (301kB)
    100% |████████████████████████████████| 307kB 1.2MB/s
Requirement already satisfied: pytz in /github/home/.local/lib/python3.6/site-packages (from nebula2-python)
Requirement already satisfied: six in /github/home/.local/lib/python3.6/site-packages (from nebula2-python)
Requirement already satisfied: future in /github/home/.local/lib/python3.6/site-packages (from nebula2-python)
Requirement already satisfied: httplib2 in /github/home/.local/lib/python3.6/site-packages (from nebula2-python)
Requirement already satisfied: pyparsing!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,<4,>=2.4.2; python_version > "3.0" in /github/home/.local/lib/python3.6/site-packages (from httplib2->nebula2-python)
Installing collected packages: nebula2-python
Successfully installed nebula2-python-2.6.1

bash-4.2# pip3 uninstall nebula2-python -y
Uninstalling nebula2-python-2.6.1:
  Successfully uninstalled nebula2-python-2.6.1

And in vesoft-inc/nebua, it's doing so(install 3.5.1 with pip3 install --user

install-nebula-py: install-deps
	git clone --branch release-3.5 https://github.com/vesoft-inc/nebula-python $(CURR_DIR)/nebula-python
	cd $(CURR_DIR)/nebula-python \
		&& pip3 install --user . -i $(PYPI_MIRROR) --upgrade
	rm -rf $(CURR_DIR)/nebula-python

Action: force to remove unexpected nebula3-python packages before installation first, we need to ensure .local is cleaned in runner cache.

@@ -86,6 +86,8 @@ def init(self, configs=None):
configs, SessionPoolConfig
), 'wrong type of SessionPoolConfig, try this: `from nebula3.Config import SessionPoolConfig`'
self._configs = configs
else:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was added during self-reflection, previously my attempt to support omitting the session pool config was not completed

wey-gu added 2 commits April 25, 2024 11:29
httpcore-->anyio-->contextvars when it's < python3.7
Whoile this was not properly handled by setup.py

Thus this failed, somehow it rollback to .local cache
in ci runner.
@wey-gu wey-gu requested review from Nicole00 and HarrisChu April 25, 2024 05:48
@wey-gu wey-gu changed the title fix: support conn_pool ping before init fix: support conn_pool ping before init | add missing dep in py3.6 Apr 25, 2024
@wey-gu wey-gu merged commit 0803838 into master Apr 25, 2024
10 checks passed
@wey-gu wey-gu deleted the fix_conn_pool_ping_before_init branch April 25, 2024 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants