1
0
mirror of https://github.com/facebook/proxygen.git synced 2026-10-30 05:48:31 +03:00
Commit Graph

2 Commits

Author SHA1 Message Date
Arjun Chaturvedi
8e8bd960e9 CMake and Docker changes for thrift-python migration.
Summary:
Changes to support the thrift-py-deprecated to thrift-python migration in the OSS build environment.

Changes:
1. CMakeLists.txt — Complete migration to thrift-python:
   - Remove include(FBThriftPyLibrary), all add_fbthrift_py_library() targets
   - Add 15 add_fbthrift_python_library() targets with correct NAMESPACE
     values matching mstch_python generator output paths
   - Add all transitive thrift deps (fb303, common, mpls, Address, link,
     prbs, io_stats, fboss, bcm_config, asic_config)
   - Key insight: NAMESPACE must be <namespace_py3>.<basename> to match
     the generator's output directory structure

2. Consumer cmake files — switch to add_fb_thrift_python_executable:
   - AsicConfigV2ConfigCli.cmake (+ add wedge800bact.py to SOURCES)
   - PlatformMappingGenUnitTest.cmake
   - PlatformMappingGenNoRegressionTest.cmake
   - PlatformMappingV2ConfigCli.cmake

3. Address.thrift —
   - Replace `package;` with `package "facebook.com/network/address"`
   - Remove thrift.AllowLegacyMissingUris (unnecessary with non-empty package)
   - Required because struct "Address" collides with module name "Address"
     when package is empty

4. CMakeLists.txt — Detect Python sysconfig -march flag and apply to
   CMAKE_CXX_FLAGS to avoid F14LinkCheck ABI mismatch with folly-python.

5. run-getdeps.py — detect -march flag from Python sysconfig and propagate
   to CXXFLAGS for all dependency builds. Required because Cython extensions
   inherit -march=x86-64-v2 from Python 3.12 sysconfig on CentOS Stream 9,
   but cmake does not.

8. Dockerfiles — install Cython, wheel, auditwheel, patchelf, setuptools,
   filelock for building folly-python/fbthrift-python Cython extensions and
   wheels. Install Python 3.12 as system default on CentOS (required >= 3.10).

   OK : 6
   FAILED : 0
   SKIPPED : 0                                                                                                                                                                                                                                                                  TIMEOUT : 0

./bin/run_test.py link --agent-run-mode multi_switch --hw-agent-bin-path /opt/fboss/bin/fboss_hw_agent-sai_impl --config /opt/fboss/share/link_test_configs/montblanc.materialized_JSON --qsfp-config /opt/fboss/share/qsfp_test_configs/montblanc.materialized_JSON  --filter AgentEnsembleQsfpFsdbTest.* 2>&1 | tee "coldboot_Test.log"
...
Removed '/etc/systemd/system/multi-user.target.wants/fboss_hw_agent_oss@0.service'.
Removed '/etc/systemd/system/fboss_hw_agent_oss@0.service'.
Cleaning up qsfp_service_oss
Cleaning up fsdb_service_oss
Cleaning up FBOSS HW Agent Service for index=0...
Running all tests took 0:12:14.758873 between 2026-03-31 14:07:59.506379 and 2026-03-31 14:20:14.265252
[       OK ] warm_boot.AgentEnsembleQsfpFsdbTest.tcvr (33887 ms)
[       OK ] warm_boot.AgentEnsembleQsfpFsdbTest.phy (33943 ms)
[       OK ] warm_boot.AgentEnsembleQsfpFsdbTest.portState (25910 ms)
[       OK ] warm_boot.AgentEnsembleQsfpFsdbTest.portStateWithResetHold (53598 ms)

   OK : 4
   FAILED : 0
   SKIPPED : 0
   TIMEOUT : 0

[root@fboss330347219.ash6 /opt/fboss]# ./bin/run_test.py sai_agent   --agent-run-mode multi_switch   --num-npus 2   --hw-agent-bin-path /opt/fboss/bin/fboss_hw_agent-sai_impl   --filter '*AgentEmpty*:*Vlan*'   --config /opt/fboss/share/hw_test_configs/montblanc.agent.materialized_JSON   --qsfp-config /opt/fboss/share/qsfp_test_configs/montblanc.materialized_JSON   --skip-known-bad-tests "brcm/13.3.0.0_dnx_odp/13.3.0.0_dnx_odp/jericho3"   2>&1 | tee "test_output_$(date +%Y%m%d_%H%M%S).log"
...
Failed to stop fboss_hw_agent@0.service: Unit fboss_hw_agent@0.service not loaded.
Failed to stop fboss_hw_agent_for_testing_0.service: Unit fboss_hw_agent_for_testing_0.service not loaded.
Removed '/etc/systemd/system/multi-user.target.wants/fboss_hw_agent_oss@0.service'.
Removed '/etc/systemd/system/fboss_hw_agent_oss@0.service'.
Failed to stop fboss_hw_agent@1.service: Unit fboss_hw_agent@1.service not loaded.
Failed to stop fboss_hw_agent_for_testing_1.service: Unit fboss_hw_agent_for_testing_1.service not loaded.
Removed '/etc/systemd/system/multi-user.target.wants/fboss_hw_agent_oss@1.service'.
Removed '/etc/systemd/system/fboss_hw_agent_oss@1.service'.
Cleaning up FBOSS HW Agent Service for index=0...
Cleaning up FBOSS HW Agent Service for index=1...
Running all tests took 0:02:01.342550 between 2026-03-27 15:48:31.906896 and 2026-03-27 15:50:33.249446
[       OK ] warm_boot.AgentEmptyTest.CheckInit (13025 ms)
[       OK ] warm_boot.AgentEmptyVoqTest.CheckInit (12780 ms)

   OK : 2
   FAILED : 0
   SKIPPED : 0
   TIMEOUT : 0
```

Reviewed By: joseph5wu

Differential Revision: D98059537

fbshipit-source-id: 849a9699d0f73fde30ecceb07f60e0a210d51344
2026-04-06 16:24:49 -07:00
Arjun Chaturvedi
f3bb52f35f Fix OSS build and add thrift-python CMake module
Summary:
Fix fbthrift-python OSS build (getdeps) on CentOS Stream 9 with Python 3.12,
Cython 3.2.4, GCC 12 (gcc-toolset-12). Also add a generic CMake module
(FBThriftPythonLibrary.cmake) for any project migrating from
thrift-py-deprecated to thrift-python.

Build fixes (xplat/thrift/lib/python/CMakeLists.txt + setup.py + manifests):
1. Add EVENT__LIBRARY_TYPE=STATIC to libevent-python manifest
2. Add lib64 search paths for folly .pxd files (CentOS/RHEL/Fedora)
3. unset(_folly_pxd_file CACHE) to prevent stale CMake cache
4. Add __PYX_ENUM_CLASS_DECL= define (cython/cython#5973)
5. Add CWD to Cython include path in setup.py

CMake module (opensource/fbcode_builder/CMake/FBThriftPythonLibrary.cmake):
Generic, project-agnostic module with three components:
- fb_find_thrift_python_runtime(): discovers thrift-python and folly-python
  site-packages at configure time; auto-installs fbthrift-python wheel from
  getdeps build output if not pip-installed
- add_fbthrift_python_library(): generates thrift_types.py via mstch_python
  generator; drops FBThrift::thrift_py from DEPENDS (C extensions resolved
  at runtime)
- add_fb_thrift_python_executable(): drop-in for add_fb_python_executable();
  forces TYPE dir (C extensions cannot load from zip) + post-build symlinks
  thrift/python/ and folly/ into bundled output directory

Reviewed By: createdbysk

Differential Revision: D98036616

fbshipit-source-id: 7fa4be1cb4a3495b66672e2a69f0b47aa6b32e92
2026-04-01 10:25:08 -07:00