Skip to content

Dipowell/crud jobs v2 - #1202

Merged
Diamond (diamondpowell) merged 15 commits into
mainfrom
dipowell/crud-jobs-v2
Jun 2, 2026
Merged

Diamond (diamondpowell) merged 15 commits into
mainfrom
dipowell/crud-jobs-v2

Conversation

@diamondpowell

Copy link
Copy Markdown
Contributor

Add Job workload support to CRUD benchmarking framework

Summary

Adds Job workload support to the CRUD benchmarking framework - the third and final of three planned workload methods (deployment, statefulset, job). Measures K8s Job create/verify latency on AKS node pools.

Changes

modules/python/crud/workload_templates/job.yml

  • New K8s Job manifest template using nginx config validation for quick completion
  • Uses JOB_COMPLETIONS placeholder, configurable node affinity via label_selector

modules/python/crud/azure/node_pool_crud.py

  • Add job entry to WORKLOAD_CONFIG with template path, completions key, complete condition, and verify_pods_ready=False (jobs terminate after completion)
  • Add create_job() using unified _create_workloads helper

modules/python/crud/main.py

  • Add job subparser with --completions argument (distinct from --replicas)
  • Add elif command == "job" routing in handle_workload_operations

modules/python/clients/kubernetes_client.py

  • Add job/jobs to valid_conditions with ['complete', 'failed']
  • Add _check_job_condition and _is_job_condition_met for job status polling
  • Extend wait_for_condition to support Job resource type

steps/engine/crud/k8s/execute.yml

  • Add job script block (Azure-only, consistent with deployment/statefulset)

pipelines/perf-eval/GPU Benchmark/k8s-gpu-cluster-crud.yml

  • Add completions: 1 to matrix entries

Tests

test_azure_node_pool_crud.py:

  • test_create_job_success - happy path
  • test_create_job_failure - all fail to complete
  • test_create_job_no_client - returns early when k8s client unavailable
  • test_create_job_partial_success - continues on failures, returns False

test_kubernetes_client.py:

  • test_wait_for_condition_job_complete_success
  • test_wait_for_condition_job_failed
  • test_wait_for_condition_job_timeout
  • test_wait_for_condition_job_not_found

Add job.yml template for CRUD benchmarking using nginx config test
command (nginx -t) which completes quickly for benchmarking purposes.
- Add job to WORKLOAD_CONFIG with run-to-completion settings
- Add create_job method using unified _create_workloads helper
- Jobs use completions (not replicas) and skip pod readiness check
- Add job/jobs to valid_conditions with complete/failed states
- Add _check_job_condition for job status polling
- Add _is_job_condition_met to verify job completion/failure
- Add job handler to handle_workload_operations
- Add job subparser with --completions argument
- Jobs use --completions instead of --replicas
- Add job execution step to execute.yml (Azure-only)
- Add completions variable to GPU benchmark matrix
- test_create_job_success
- test_create_job_failure
- test_create_job_no_client
- test_create_job_partial_success

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Kubernetes Job workload support to the CRUD benchmarking framework alongside existing Deployment and StatefulSet workload paths.

Changes:

  • Adds a Job manifest template and Azure create_job() workload wiring.
  • Extends CLI, pipeline, and CRUD execution YAML to run Job workload operations.
  • Adds Kubernetes client condition polling support for Job resources and related tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
modules/python/crud/workload_templates/job.yml Adds the Kubernetes Job workload template.
modules/python/crud/azure/node_pool_crud.py Registers Job workload config and adds create_job().
modules/python/crud/main.py Adds Job CLI command and workload routing.
modules/python/clients/kubernetes_client.py Adds Job condition polling and manifest apply/update/delete support.
modules/python/tests/crud/test_azure_node_pool_crud.py Adds Azure CRUD Job creation tests.
modules/python/tests/clients/test_kubernetes_client.py Adds Job condition polling tests.
steps/engine/crud/k8s/execute.yml Adds Azure Job execution step.
pipelines/perf-eval/GPU Benchmark/k8s-gpu-cluster-crud.yml Adds Job completions matrix values.

…lure check

- Add delete-before-create for jobs in node_pool_crud.py to handle
  completed job reuse when retrying benchmarks
- Remove status.failed > 0 fallback in _is_job_condition_met to avoid
  premature failure detection while jobs may still be retrying
@diamondpowell
Diamond (diamondpowell) force-pushed the dipowell/crud-jobs-v2 branch 3 times, most recently from 27f1e1e to 48c6e66 Compare May 28, 2026 16:36
Comment thread modules/python/crud/main.py Resolved
Remove duplicate argument definitions from job_parser by inheriting
from workload_common_parser, matching the pattern used by deployment
and statefulset subcommands.

The job parser now inherits --replicas from workload_common_parser
which jobs don't use, but this is harmless - the argument is simply
ignored in the job handler.
…nd wait_for_condition

Refactor wait_for_job_completed to call _is_job_condition_met so both
code paths share the same condition-checking logic. This also fixes the
status.failed > 0 bug (now properly checks job conditions instead of
counters).
Update test mocks to include spec.completions and proper Failed condition
objects, matching the new _is_job_condition_met helper behavior.
@diamondpowell
Diamond (diamondpowell) force-pushed the dipowell/crud-jobs-v2 branch 4 times, most recently from a03ffc0 to 119d8c4 Compare June 1, 2026 23:37
…tions

The debug logs said 'waiting...' but these functions don't wait -
they return False and let the caller's loop handle the retry.
Removes logs from _check_deployment_condition, _check_statefulset_condition,
and _check_job_condition for consistency.
@diamondpowell
Diamond (diamondpowell) merged commit 0942186 into main Jun 2, 2026
3 checks passed
@diamondpowell
Diamond (diamondpowell) deleted the dipowell/crud-jobs-v2 branch June 2, 2026 05:23
Pablo Trivino (PabloTriv) pushed a commit that referenced this pull request Jun 12, 2026
Add Job workload support to CRUD benchmarking framework

## Summary

Adds Job workload support to the CRUD benchmarking framework - the third
and final of three planned workload methods (`deployment`,
`statefulset`, `job`). Measures K8s Job create/verify latency on AKS
node pools.

## Changes

`modules/python/crud/workload_templates/job.yml`
- New K8s Job manifest template using nginx config validation for quick
completion
- Uses `JOB_COMPLETIONS` placeholder, configurable node affinity via
label_selector

`modules/python/crud/azure/node_pool_crud.py`
- Add `job` entry to `WORKLOAD_CONFIG` with template path, completions
key, `complete` condition, and `verify_pods_ready=False` (jobs terminate
after completion)
- Add `create_job()` using unified `_create_workloads` helper

`modules/python/crud/main.py`
- Add `job` subparser with `--completions` argument (distinct from
`--replicas`)
- Add `elif command == "job"` routing in `handle_workload_operations`

`modules/python/clients/kubernetes_client.py`
- Add `job`/`jobs` to `valid_conditions` with `['complete', 'failed']`
- Add `_check_job_condition` and `_is_job_condition_met` for job status
polling
- Extend `wait_for_condition` to support Job resource type

`steps/engine/crud/k8s/execute.yml`
- Add `job` script block (Azure-only, consistent with
deployment/statefulset)

`pipelines/perf-eval/GPU Benchmark/k8s-gpu-cluster-crud.yml`
- Add `completions: 1` to matrix entries

## Tests

`test_azure_node_pool_crud.py`:
- `test_create_job_success` - happy path
- `test_create_job_failure` - all fail to complete
- `test_create_job_no_client` - returns early when k8s client
unavailable
- `test_create_job_partial_success` - continues on failures, returns
False

`test_kubernetes_client.py`:
- `test_wait_for_condition_job_complete_success`
- `test_wait_for_condition_job_failed`
- `test_wait_for_condition_job_timeout`
- `test_wait_for_condition_job_not_found`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants