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

Migrate build repo code from using Python 3.7 to 3.9 version #3351

Closed
peterzhuamazon opened this issue Mar 28, 2023 · 17 comments
Closed

Migrate build repo code from using Python 3.7 to 3.9 version #3351

peterzhuamazon opened this issue Mar 28, 2023 · 17 comments
Assignees
Labels
Build Libraries & Interfaces dependencies Pull requests that update a dependency file enhancement New Enhancement python upgrade Python Upgrade python Pull requests that update Python code upgrade v2.9.0

Comments

@peterzhuamazon
Copy link
Member

peterzhuamazon commented Mar 28, 2023

Migrate build repo code from using Python 3.7 to 3.9 version.

Python3.7 support will ends on 2023/06/23.
https://endoflife.date/python

Note: 3.9 Ends in 2 years and 5 months (05 Oct 2025)

We need to migrate the code to Python 3.9 for the highest stability possible.

Acceptance Criteria:

  1. All the build code should be using 3.9
  2. Moving from 3.7 to 3.9 in the build repo, updating the pipfile and lock file.
  3. Test all the existing workflows with the new python version.
  4. Update all the CI images to use Python 3.9.
  5. Testing the compilation of the cpython with centos docker image.

Thanks.

@peterzhuamazon peterzhuamazon added the enhancement New Enhancement label Mar 28, 2023
@github-actions github-actions bot added the untriaged Issues that have not yet been triaged label Mar 28, 2023
@Divyaasm Divyaasm removed the untriaged Issues that have not yet been triaged label Mar 28, 2023
@Divyaasm Divyaasm changed the title Migrate build repo code from using Python 3.7 to 3.8 version Migrate build repo code from using Python 3.7 to 3.11 version Mar 28, 2023
@peterzhuamazon
Copy link
Member Author

The version 3.11 is currently feature adding version.
It is not stable enough for the production use.
@bbarani I would recommend using version 3.10 if we really want to go that high, but in my personal experience the most stable one is 3.9 version after 3.8.

Thanks.

@prudhvigodithi prudhvigodithi changed the title Migrate build repo code from using Python 3.7 to 3.11 version Migrate build repo code from using Python 3.7 to 3.9 version May 1, 2023
@rishabh6788
Copy link
Collaborator

[TRIAGE] This is pre-req for #1563.
We also need to upgrade pip from v21 to v23 to accommodate python upgrade.
Tagging @peterzhuamazon.

@peterzhuamazon
Copy link
Member Author

peterzhuamazon commented Jun 20, 2023

It might benefit to change the default emulation buildx to cross compilation:

PRs:

@peterzhuamazon
Copy link
Member Author

peterzhuamazon commented Jun 22, 2023

Able to get the pip packages freeze version and didnt change behaviors on all the isort/flake8/mypy/pytest results.

% pipenv run isort --check .
Skipped 24 files

% pipenv run flake8 .

% pipenv run mypy .
Success: no issues found in 375 source files

Able to build/assemble artifacts for OS and OSD.

% curl https://localhost:9200/ -ku admin:admin
{
  "name" : "dev-dsk-zhujiaxi-2a-c8d595b4.us-west-2.amazon.com",
  "cluster_name" : "opensearch",
  "cluster_uuid" : "gxjxiKG0Qbu3mdKhHAQqMw",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.8.0",
    "build_type" : "tar",
    "build_hash" : "db90a415ff2fd428b4f7b3f800a51dc229287cb4",
    "build_date" : "2023-06-22T17:07:14.480104Z",
    "build_snapshot" : false,
    "lucene_version" : "9.6.0",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}
{"overall":{"since":"2023-06-22T18:46:13.818Z","state":"green","title":"Green","nickname":"Looking good","icon":"success","uiColor":"secondary"}

Able to run integTest on OS and OSD:

2023-06-22 19:37:52 INFO     | geospatial           | with-security        | PASS  |
2023-06-22 19:37:52 INFO     | geospatial           | without-security     | PASS  |

2023-06-22 20:29:31 INFO     | alertingDashboards   | with-security        | PASS  |
2023-06-22 20:29:31 INFO     | alertingDashboards   | without-security     | PASS  |

@peterzhuamazon
Copy link
Member Author

% pipenv run python --version
Python 3.9.7
Installing dependencies from Pipfile.lock (9f5fbd)...
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
% pipenv run pip freeze
atomicwrites==1.4.1
attrs==23.1.0
Cerberus==1.3.4
certifi==2023.5.7
cfgv==3.3.1
chardet==5.1.0
charset-normalizer==2.1.1
click==8.1.3
coverage==4.5.4
DataProperty==0.55.1
decorator==5.1.1
distlib==0.3.6
distro==1.8.0
exceptiongroup==1.1.1
filelock==3.12.2
flake8==3.9.2
identify==2.5.24
idna==3.4
importlib-metadata==4.12.0
iniconfig==2.0.0
isort==5.12.0
jproperties==2.1.1
maison==1.4.0
mbstrdecoder==1.1.3
mccabe==0.6.1
mypy==0.971
mypy-extensions==1.0.0
nodeenv==1.8.0
packaging==23.1
pathspec==0.11.1
pathvalidate==2.5.2
platformdirs==3.7.0
pluggy==1.2.0
pre-commit==2.15.0
psutil==5.9.5
py==1.11.0
pycodestyle==2.7.0
pydantic==1.10.9
pyflakes==2.3.1
pytablewriter==0.64.2
pytest==7.1.3
pytest-cov==2.10.1
python-dateutil==2.8.2
pytz==2023.3
PyYAML==5.4.1
requests==2.28.1
retry==0.9.2
ruamel.yaml==0.17.32
ruamel.yaml.clib==0.2.7
ruyaml==0.91.0
six==1.16.0
sortedcontainers==2.4.0
tabledata==1.3.1
tcolorpy==0.1.3
toml==0.10.2
tomli==2.0.1
typed-ast==1.5.4
typepy==1.3.1
types-PyYAML==5.4.12
types-requests==2.31.0.1
types-urllib3==1.26.25.13
typing_extensions==4.6.3
urllib3==1.26.16
validators==0.20.0
virtualenv==20.23.1
yamlfix==1.0.1
yamllint==1.27.1
zipp==3.8.1

@peterzhuamazon
Copy link
Member Author

peterzhuamazon commented Jun 29, 2023

Windows Python3.9 Build and Assemble Runs now:

$ python3
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.release()
'10'
>>> import os
>>> os.name
'nt'
>>>

$ curl https://localhost:9200 -ku admin:admin
{
  "name" : "EC2AMAZ-D5JNNTJ",
  "cluster_name" : "opensearch",
  "cluster_uuid" : "OCLI5GC0SKCA5CRnarNnTw",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.8.0",
    "build_type" : "zip",
    "build_hash" : "db90a415ff2fd428b4f7b3f800a51dc229287cb4",
    "build_date" : "2023-06-29T20:03:07.832804700Z",
    "build_snapshot" : false,
    "lucene_version" : "9.6.0",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

$ curl localhost:5601/api/status -ku admin:admin
{"name":"EC2AMAZ-D5JNNTJ","uuid":"d2d0dc8a-ae48-444e-9a3b-9d79351bce0c","version":{"number":"2.8.0","build_hash":"8bd48f16ad37a5dfa805234223e
4d5bffa926abe","build_number":1,"build_snapshot":false},"status":{"overall":{"since":"2023-06-29T22:14:23.028Z","state":"green","title":"Gree
n","nickname":"Looking good","icon":"success","uiColor":"secondary"},"statuses":[{"id":"core:opensearch@2.8.0","message":"OpenSearch is avail
able","since":"2023-06-29T22:14:23.028Z","state":"green","icon":"success","uiColor":"secondary"}......

@peterzhuamazon
Copy link
Member Author

Also just fyi once we go to 3.9 all client release that uses this image release-centos7-clients-v3 needs to be upgraded to release-centos7-clients-v4.

@peterzhuamazon
Copy link
Member Author

We are starting the Python 3.9 Upgrade now, as Jenkins instance will be unstable from now on.
Start time: 2023/07/05 4:29 PM PST.
ETA: 3hrs

An email to the team has been sent out last week.
A msg to the public slack channel was also sent.

Thanks.

@peterzhuamazon
Copy link
Member Author

Test deployment staging:

+ ./build.sh manifests/2.9.0/opensearch-2.9.0.yml -d tar --component OpenSearch -p linux -a x64

Installing dependencies in . ...

Warning: the environment variable LANG is not set!

We recommend setting this in ~/.profile (or equivalent) for proper expected behavior.

Creating a virtualenv for this project...

Pipfile: /var/jenkins/workspace/Python39-test-distribution-build-opensearch-zhujiaxi@2/Pipfile

Using /usr/local/bin/python3.9 (3.9.7) to create virtualenv...

created virtual environment CPython3.9.7.final.0-64 in 483ms

  creator CPython3Posix(dest=/usr/share/opensearch/.local/share/virtualenvs/Python39-test-distribution-build-opensearc-QLML_HWD, clear=False, no_vcs_ignore=False, global=False)

  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/usr/share/opensearch/.local/share/virtualenv)

    added seed packages: pip==23.1.2, setuptools==67.8.0, wheel==0.40.0

  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

@peterzhuamazon
Copy link
Member Author

Verified all build and assemble on all platforms are running well.

@peterzhuamazon
Copy link
Member Author

All docker actions are running ok with no issues.

@peterzhuamazon
Copy link
Member Author

Will send to production and check gradle check.

@gaiksaya
Copy link
Member

gaiksaya commented Jul 6, 2023

@peterzhuamazon We need to update developer guide too to use python 3.9 https://github.com/opensearch-project/opensearch-build/blob/main/DEVELOPER_GUIDE.md#python-37

@peterzhuamazon
Copy link
Member Author

Jenkins deploy success on production host and the migration deployment is complete.

@gaiksaya
Copy link
Member

gaiksaya commented Jul 7, 2023

Adding meta task to update all 1-click release process: #3712

@bbarani
Copy link
Member

bbarani commented Jul 21, 2023

@peterzhuamazon Can we close this issue now?

@gaiksaya gaiksaya unpinned this issue Jul 25, 2023
@peterzhuamazon
Copy link
Member Author

Yes @bbarani we have just completed all the changes now, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Libraries & Interfaces dependencies Pull requests that update a dependency file enhancement New Enhancement python upgrade Python Upgrade python Pull requests that update Python code upgrade v2.9.0
Projects
Development

No branches or pull requests

5 participants