Background Job
バックグラウンドジョブ
バックグラウンドジョブは、ページやAPIの応答とは別にサーバーが実行するタスクで、ジョブを開始する場合があります。応答はジョブの完了前に終了することがあります。
accepted request -> persisted job ID -> runner attempt -> terminal result; bounded retryGET /jobs/job_482accepted request -> persisted job ID -> runner attempt -> terminal result; bounded retryJOBもう一つの例
レポートリクエストはジョブ `report-204` を作成し、ステータスリンクを返信します。Kubernetes のジョブは、レポートが成功するか再試行制限に達するまで実行し、その最終状態を記録して停止します。
主な部分
- 01ジョブIDおよび保存された入力
- 02承認済みまたはキュー状態
- 03ランナーと試行
- 04進行状況またはハートビート
- 05成功または失敗の状態
- 06結果および復旧パス
以下の場合に使用します
遅い作業がユーザーの応答後に完了できる場合は、バックグラウンドジョブを使用します。入力、識別情報、ステータス、最終結果を保存してください。
以下の場合は使用しないでください
結果がすぐに必要な場合は使用しないでください。ランナーは失敗したジョブを再試行することがあります。料金、メール、その他の影響を繰り返す前に安全ルールを追加してください。
コードで使用する名前
accepted request -> persisted job ID -> runner attempt -> terminal result; bounded retry 出荷前に
Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.
Outcome:Complete the task with バックグラウンドジョブ (Background Job)。 User context:レポートリクエストはジョブ `report-204` を作成し、ステータスリンクを返信します。Kubernetes のジョブは、レポートが成功するか再試行制限に達するまで実行し、その最終状態を記録して停止します。 Technical concept or control:バックグラウンドジョブ (Background Job)。 Why it fits:遅い作業がユーザーの応答後に完了できる場合は、バックグラウンドジョブを使用します。入力、識別情報、ステータス、最終結果を保存してください。 Do not use it when:結果がすぐに必要な場合は使用しないでください。ランナーは失敗したジョブを再試行することがあります。料金、メール、その他の影響を繰り返す前に安全ルールを追加してください。 Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary):単一の公式標準が全体の用語を管理するわけではありません。その意味はチーム、プラットフォーム、またはフレームワークによって変わる可能性があります。 Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.
このリクエストを確認する
Review how バックグラウンドジョブ (Background Job) is used now. Definition: バックグラウンドジョブは、ページやAPIの応答とは別にサーバーが実行するタスクで、ジョブを開始する場合があります。応答はジョブの完了前に終了することがあります。 Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, list the evidence, gaps, severity, and the smallest safe fix.