-
Notifications
You must be signed in to change notification settings - Fork 25
ipfixprobed: fix config2args #279
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
Conversation
fix queue size and workers affinity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fixes Python 3.6 compatibility and improves CPU and DPDK argument handling in the config2args script.
- Updated type hints to use
List[int]for Python 3.6 compatibility - Refactored
get_cpus_for_pci_devicefor missing NUMA node files and adjusted subprocess API - Enhanced DPDK plugin argument assembly with primary CPU affinity and queue parameters
Comments suppressed due to low confidence (2)
init/config2args.py:69
- The
numa_nodevalue remains a string after reading; cast it to an integer (e.g.,numa_node = int(numa_path.read_text().strip())) to avoid type mismatch when comparing or using it.
numa_node = numa_path.read_text().strip()
init/config2args.py:67
- Defaulting
numa_nodeto 0 when the path doesn't exist changes behavior; please add unit tests for both missing NUMA files and-1cases to ensure correct defaults.
numa_node = 0
| raise ValueError("Not enough CPUs available for the number of RX queues") | ||
| workers_cpu_list = cpu_list[:rx_queues] | ||
|
|
||
| # Main parameter for DPDK with $eal_opts |
Copilot
AI
May 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indexing workers_cpu_list[0] without checking if the list is non-empty can lead to IndexError; add a guard (e.g., if not workers_cpu_list: ...) before accessing it.
| # Main parameter for DPDK with $eal_opts | |
| # Main parameter for DPDK with $eal_opts | |
| if not workers_cpu_list: | |
| raise ValueError("workers_cpu_list is empty. Ensure it contains at least one CPU.") |
| if first_cpu is not None: | ||
| primary_param = f"-i \"dpdk@{first_cpu};p={','.join(str(i) for i in range(nic_count))};" | ||
| else: | ||
| primary_param = f"-i \"dpdk;p={','.join(str(i) for i in range(nic_count))};" |
Copilot
AI
May 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The None check is redundant because first_cpu is always assigned an integer; simplify the logic by removing this conditional.
| if first_cpu is not None: | |
| primary_param = f"-i \"dpdk@{first_cpu};p={','.join(str(i) for i in range(nic_count))};" | |
| else: | |
| primary_param = f"-i \"dpdk;p={','.join(str(i) for i in range(nic_count))};" | |
| primary_param = f"-i \"dpdk@{first_cpu};p={','.join(str(i) for i in range(nic_count))};" |
Fix queue size and workers affinity for DPDK
Script is now compatible with python3.6