Skip to content

Commit bee4a5b

Browse files
maryamtahhanclaude
andcommitted
fix: resolve __AUTO_DETECT__ in paths and metadata for external mode
When test_model is passed as '__AUTO_DETECT__' via import_playbook, it has extra vars precedence which cannot be overridden. Introduce actual_model variable to properly resolve the model name from external endpoints and use it in all result paths and metadata files. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Maryam Tahhan <mtahhan@redhat.com>
1 parent faf80d7 commit bee4a5b

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

automation/test-execution/ansible/llm-benchmark-auto.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,16 @@
134134
- name: Use endpoint model if test_model not provided or set to auto-detect
135135
ansible.builtin.set_fact:
136136
test_model: "{{ endpoint_model }}"
137+
actual_model: "{{ endpoint_model }}"
137138
cacheable: true
138139
when: test_model is not defined or test_model == '__AUTO_DETECT__'
139140

141+
- name: Set actual_model to test_model if explicitly provided
142+
ansible.builtin.set_fact:
143+
actual_model: "{{ test_model }}"
144+
cacheable: true
145+
when: test_model is defined and test_model != '__AUTO_DETECT__'
146+
140147
- name: Validate test_model matches endpoint if provided
141148
ansible.builtin.assert:
142149
that:
@@ -151,7 +158,12 @@
151158

152159
- name: Display model source
153160
ansible.builtin.debug:
154-
msg: "Detected model from endpoint: {{ test_model }}"
161+
msg: "Detected model from endpoint: {{ actual_model }}"
162+
163+
- name: Set actual_model for managed mode
164+
ansible.builtin.set_fact:
165+
actual_model: "{{ test_model }}"
166+
when: vllm_mode == 'managed'
155167

156168
- name: Display auto-config test information
157169
ansible.builtin.debug:
@@ -160,7 +172,7 @@
160172
- "Auto-Configured LLM Test"
161173
- "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
162174
- "Test Run ID: {{ test_run_id }}"
163-
- "Model: {{ test_model }}{{ ' (detected from endpoint)' if (vllm_mode == 'external' and test_model is defined) else '' }}"
175+
- "Model: {{ actual_model }}{{ ' (detected from endpoint)' if vllm_mode == 'external' else '' }}"
164176
- "Workload: {{ workload_type }}"
165177
- "Requested Cores: {{ requested_cores }}"
166178
- "DUT: {{ groups['dut'][0] }} ({{ hostvars[groups['dut'][0]]['ansible_host'] }})"
@@ -322,7 +334,7 @@
322334
become: true
323335
vars:
324336
test_run_id: "{{ hostvars['localhost']['test_run_id'] }}"
325-
test_model: "{{ hostvars['localhost']['test_model'] }}"
337+
actual_model: "{{ hostvars['localhost']['actual_model'] }}"
326338
core_configuration: "{{ hostvars['localhost']['core_configuration'] }}"
327339

328340
roles:
@@ -339,7 +351,7 @@
339351
gather_facts: false
340352
vars:
341353
test_run_id: "{{ hostvars['localhost']['test_run_id'] }}"
342-
test_model: "{{ hostvars['localhost']['test_model'] }}"
354+
actual_model: "{{ hostvars['localhost']['actual_model'] }}"
343355
core_configuration: "{{ hostvars['localhost']['core_configuration'] }}"
344356

345357
tasks:
@@ -356,7 +368,7 @@
356368
"tensor_parallel": {{ core_configuration.tensor_parallel }},
357369
"omp_num_threads": {{ core_configuration.omp_num_threads | default('null') }},
358370
"omp_threads_bind": {{ core_configuration.omp_threads_bind | default('null') }},
359-
"model": "{{ test_model }}",
371+
"model": "{{ actual_model }}",
360372
"model_source": "{{ 'auto-detected' if hostvars['localhost']['vllm_mode'] == 'external' else 'specified' }}",
361373
"workload": "{{ workload_type }}",
362374
"vllm_mode": "{{ hostvars['localhost']['vllm_mode'] }}",
@@ -365,22 +377,22 @@
365377
"test_duration": "{{ test_duration_string | default('unknown') }}",
366378
"test_duration_seconds": {{ test_duration_seconds | default('null') }}
367379
}
368-
dest: "{{ bench_config.results_dir }}/{{ test_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/test-metadata.json"
380+
dest: "{{ bench_config.results_dir }}/{{ actual_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/test-metadata.json"
369381

370382
# Skip result fetching when running as part of a core sweep
371383
# The collect-sweep-results.yml playbook will fetch all results at once
372384
- name: Ensure local results directory exists
373385
ansible.builtin.file:
374-
path: "{{ hostvars['localhost']['local_results_base'] }}/{{ test_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}"
386+
path: "{{ hostvars['localhost']['local_results_base'] }}/{{ actual_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}"
375387
state: directory
376388
mode: "0755"
377389
delegate_to: localhost
378390
when: is_core_sweep is not defined or not is_core_sweep
379391

380392
- name: Fetch results to local machine
381393
ansible.posix.synchronize:
382-
src: "{{ bench_config.results_dir }}/{{ test_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/"
383-
dest: "{{ hostvars['localhost']['local_results_base'] }}/{{ test_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/"
394+
src: "{{ bench_config.results_dir }}/{{ actual_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/"
395+
dest: "{{ hostvars['localhost']['local_results_base'] }}/{{ actual_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/"
384396
mode: pull
385397
recursive: true
386398
when: is_core_sweep is not defined or not is_core_sweep
@@ -392,8 +404,8 @@
392404
ansible.builtin.command:
393405
cmd: >-
394406
python3 {{ playbook_dir }}/scripts/extract_benchmark_timings.py
395-
{{ hostvars['localhost']['local_results_base'] }}/{{ test_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/benchmarks.json
396-
{{ hostvars['localhost']['local_results_base'] }}/{{ test_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/test-metadata.json
407+
{{ hostvars['localhost']['local_results_base'] }}/{{ actual_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/benchmarks.json
408+
{{ hostvars['localhost']['local_results_base'] }}/{{ actual_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/test-metadata.json
397409
delegate_to: localhost
398410
register: timing_extraction
399411
changed_when: false
@@ -416,7 +428,7 @@
416428
- "Configuration: {{ core_configuration.name }}"
417429
- " CPUs: {{ core_configuration.cpuset_cpus }}"
418430
- " NUMA: {{ core_configuration.cpuset_mems }}"
419-
- "Results: {{ '~/benchmark-results' if hostvars['localhost']['is_awx_job'] else 'results/llm' }}/{{ test_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/"
431+
- "Results: {{ '~/benchmark-results' if hostvars['localhost']['is_awx_job'] else 'results/llm' }}/{{ actual_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/"
420432
- "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
421433
when: is_core_sweep is not defined or not is_core_sweep
422434

@@ -455,7 +467,7 @@
455467
roles:
456468
- role: results_collector
457469
vars:
458-
log_collection_dest: "{{ playbook_dir }}/../../../results/llm/{{ test_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/"
470+
log_collection_dest: "{{ playbook_dir }}/../../../results/llm/{{ hostvars['localhost']['actual_model'] | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_configuration.name }}/"
459471
journald_identifier: "vllm-{{ workload_type }}-{{ core_configuration.cores }}c-tp{{ core_configuration.tensor_parallel }}"
460472
log_filename_prefix: "vllm-server"
461473
journald_time_range: "1 hour ago"

automation/test-execution/ansible/roles/benchmark_guidellm/tasks/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@
6363
ansible.builtin.set_fact:
6464
use_guidellm_container: "{{ guidellm_cfg.use_container | default(true) | bool }}"
6565

66+
- name: Set model name for results path (prefer actual_model if available)
67+
ansible.builtin.set_fact:
68+
resolved_model: "{{ actual_model | default(test_model) }}"
69+
6670
- name: Set results path
6771
ansible.builtin.set_fact:
68-
results_path: "{{ bench_config.results_dir }}/{{ test_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_cfg.name }}"
72+
results_path: "{{ bench_config.results_dir }}/{{ resolved_model | replace('/', '__') }}/{{ workload_type }}-{{ test_run_id }}/{{ core_cfg.name }}"
6973

7074
- name: Create results directory for this test
7175
ansible.builtin.file:

0 commit comments

Comments
 (0)