input_data list: バルク系APIで補助情報を取得してAPI呼び出しを100倍削減#1490
Draft
Conversation
Co-authored-by: yuji38kwmt <6350027+yuji38kwmt@users.noreply.github.com>
Co-authored-by: yuji38kwmt <6350027+yuji38kwmt@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize input data list API for bulk supplementary data retrieval
Nov 18, 2025
input_data list: バルク系APIで補助情報を取得してAPI呼び出しを200倍削減
yuji38kwmt
reviewed
Nov 18, 2025
| logger.debug(f"入力データの{initial_index}件目から{initial_index + len(sub_input_data_list) - 1}件目に紐づく補助情報を取得します。") | ||
|
|
||
| # バルク系APIを使用して複数の入力データIDの補助情報を一度に取得 | ||
| supplementary_data_list, _ = self.service.api.get_supplementary_data_in_bulk(self.project_id, query_params={"input_data_id": sub_input_data_id_list}) |
Collaborator
There was a problem hiding this comment.
@copilot get_supplementary_data_in_bulk APIのquery params であるinput_data_idに渡せる最大のinput_data_idは100個です。
また input_data_idには、カンマ区切りで指定する必要があります。
Contributor
Author
There was a problem hiding this comment.
ご指摘ありがとうございます。APIの100件制限に対応しました。
変更内容:
- 最大100個のinput_data_idを1回のAPIで処理するように修正
- URLクエリ長の計算ロジックを削除し、シンプルな実装に変更
- input_data_idをカンマ区切りでAPIに渡す処理を追加
コミット: 08cb720
Co-authored-by: yuji38kwmt <6350027+yuji38kwmt@users.noreply.github.com>
Copilot
AI
changed the title
Nov 18, 2025
input_data list: バルク系APIで補助情報を取得してAPI呼び出しを200倍削減input_data list: バルク系APIで補助情報を取得してAPI呼び出しを100倍削減
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--with_supplementary_data_countオプション使用時、各入力データIDごとにgetSupplementaryDataListAPIを呼び出していたため、1000件で1000回のAPI呼び出しが発生していました。変更内容
AddingDetailsToInputData.add_supplementary_data_count_to_input_data_list()をバルク系APIgetSupplementaryDataInBulkを使用するように変更パフォーマンス
実装例
影響範囲
annofabcli input_data list --with_supplementary_data_countannofabcli input_data list_all --with_supplementary_data_countFixes
input_data list: バルク系APIで補助情報を取得する #1472Original prompt
input_data list: バルク系APIで補助情報を取得する #1472💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.