splunk / splunk/splunk-sdk-python

JSONResultsReader iterator called on oneshot search does not iterate with for loop.

Đang mở
#678 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug
Ngôn ngữ chính
Python
Star
743
Fork
387
Merge trung bình
42 phút
Pull request đã merge (30 ngày)
4

Mô tả

Describe the bug
JSONResultsReader iterator called on oneshot search does not iterate with for loop.

To Reproduce
-run a oneshot search, the notice the for content/command[s] fails.

reader = JSONResultsReader(result_stream)
for item in reader:
    print(item)

Expected behavior
iterate through the results and take action on.

Logs or Screenshots
If applicable, add logs or screenshots to help explain your problem.

Splunk (please complete the following information):

  • Version: Splunk Enterprise 9.1.1
  • OS: Rocky Linux 9.6
  • Deployment: Distributed/Clustered SH's and IDX's architecture

SDK (please complete the following information):

  • Version: [2.1.0 and 2.1.1]
  • Language Runtime Version: Python 3.12.3
  • OS: Ubuntu 24.04.2 LTS

Additional context
This issue is only impacting the "oneshot" type search, with "normal" type search successfully yields an iterable "reader" for reader = JSONResultsReader(result_stream).

The workaround is to do:

reader = JSONResultsReader(result_stream)
reader2 = list(reader)
for item in reader2:
    print(item)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Start by reproducing the provided JSONResultsReader snippet with both oneshot and normal searches, then inspect the JSONResultsReader iterator entry point and any existing tests. Done means a reader from a oneshot search supports direct for-loop iteration without first converting it to a list, with coverage for the differing search modes.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.