Skip to content

Conversation

@rajchiluveru
Copy link
Contributor

Added task to generate input JSON file for multibench run.

SUMMARY

Crucible command accepts single input json file, hence updating role to generate the input json file with required benchmarks and other key:value pair data.

ISSUE TYPE

Enhanced Feature

@rajchiluveru rajchiluveru requested a review from a team as a code owner November 26, 2025 17:24
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

📝 Walkthrough

Walkthrough

Adds a new Jinja2 JSON template and an Ansible task to render it, renames nb_iterations to num_samples, and updates the default multibench_script_dir to include a daily subdirectory.

Changes

Cohort / File(s) Change Summary
Role defaults
roles/multibench_run/defaults/main.yml
Renamed public variable nb_iterationsnum_samples; updated multibench_script_dir from /root/crucible-examples/multibench/openshift/example-A to /root/crucible-examples/multibench/openshift/example-A/daily.
Task addition
roles/multibench_run/tasks/main.yml
Added task "Generate input json file for multibench run" that renders templates/all-in-one.json.j2 to {{ multibench_script_dir }}/all-in-one.json with mode 0644, delegated to multibench_host and using privilege escalation consistent with adjacent tasks.
New template
roles/multibench_run/templates/all-in-one.json.j2
Added Jinja2 template producing an all-in-one JSON with two benchmark configurations (iperf, uperf), mv-params, endpoints (Kubernetes-based), run-params, tags, tool-params, and templated placeholders for ocp_host, multibench_script_dir, and num_samples.
Documentation
roles/multibench_run/README.md
Added notes about daily multibench jobs using /root/crucible-examples/multibench/openshift/example-A/daily, example reg-c2j-config.py command and YAML snippet, and minor formatting adjustments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Validate JSON generation from all-in-one.json.j2 (commas, quoting, Jinja2 rendering with provided variables).
  • Search repository for occurrences of nb_iterations to ensure rename to num_samples is complete.
  • Verify updated multibench_script_dir and new delegated task location do not break downstream automation or permissions on multibench_host.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: adding a task to generate an input JSON file for multibench runs, which is the core objective of the PR.
Description check ✅ Passed The description clearly relates to the changeset by explaining the purpose of generating the input JSON file and the role's enhancement for multibench functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch input_json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce77f64 and 4090104.

📒 Files selected for processing (1)
  • roles/multibench_run/tasks/main.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: dci/check
  • GitHub Check: Sanity Check (stable-2.18)
  • GitHub Check: Ansible-lint Check
  • GitHub Check: Sanity Check (stable-2.9)

@softwarefactory-project-zuul
Copy link

@softwarefactory-project-zuul
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4090104 and 582d361.

📒 Files selected for processing (2)
  • roles/multibench_run/defaults/main.yml (1 hunks)
  • roles/multibench_run/templates/all-in-one.json.j2 (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: dci/check
  • GitHub Check: Sanity Check (stable-2.18)
  • GitHub Check: Ansible-lint Check
  • GitHub Check: Sanity Check (stable-2.9)
🔇 Additional comments (1)
roles/multibench_run/defaults/main.yml (1)

4-4: LGTM!

The path update to include the /daily subdirectory aligns with the new template-driven workflow.

@softwarefactory-project-zuul
Copy link

@softwarefactory-project-zuul
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 582d361 and c27f7e9.

📒 Files selected for processing (2)
  • roles/multibench_run/defaults/main.yml (1 hunks)
  • roles/multibench_run/templates/all-in-one.json.j2 (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • roles/multibench_run/templates/all-in-one.json.j2
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: dci/check
  • GitHub Check: Sanity Check (stable-2.18)
  • GitHub Check: Ansible-lint Check
  • GitHub Check: Sanity Check (stable-2.9)
🔇 Additional comments (1)
roles/multibench_run/defaults/main.yml (1)

1-1: No references to the old variable name found in the codebase.

The search for nb_iterations returns no results across the repository. This indicates that either:

  1. All references to the old variable name have been properly updated, or
  2. The variable name is new and was never used elsewhere

Similarly, multibench_script_dir is only defined in this defaults file and not referenced elsewhere, suggesting the path change does not impact other parts of the codebase that depend on hardcoded paths.

Without evidence of remaining references to nb_iterations or hardcoded paths that need updating, the original review comment's concern cannot be substantiated.

@dcibot
Copy link
Collaborator

dcibot commented Nov 26, 2025

nsilla
nsilla previously approved these changes Nov 27, 2025
Copy link
Contributor

@nsilla nsilla left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
roles/multibench_run/templates/all-in-one.json.j2 (1)

764-766: Consider using the multibench_tags variable here.

The defaults/main.yml defines multibench_tags, but this template hardcodes the tag. If you'd like to allow custom tags, you could template this section:

     "tags": {
-        "automation": "ansible"
+{% for key, value in multibench_tags.items() %}
+        "{{ key }}": "{{ value }}"{% if not loop.last %},{% endif %}
+
+{% endfor %}
     },

Or use the to_json filter for simpler output: "tags": {{ multibench_tags | to_json }},

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c27f7e9 and f60b6ca.

📒 Files selected for processing (1)
  • roles/multibench_run/templates/all-in-one.json.j2 (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-15T23:08:36.322Z
Learnt from: tonyskapunk
Repo: redhatci/ansible-collection-redhatci-ocp PR: 725
File: roles/deploy_cr/tasks/main.yml:7-10
Timestamp: 2025-07-15T23:08:36.322Z
Learning: In Ansible, the `default(omit)` filter only works when a variable is undefined, not when it's set to the string "omit". For the deploy_cr role in ansible-collection-redhatci-ocp, cluster-scoped resources should not define the dc_namespace variable at all, rather than setting it to the string "omit".

Applied to files:

  • roles/multibench_run/templates/all-in-one.json.j2
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: dci/check
  • GitHub Check: Sanity Check (stable-2.18)
  • GitHub Check: Sanity Check (stable-2.9)
  • GitHub Check: Ansible-lint Check
🔇 Additional comments (4)
roles/multibench_run/templates/all-in-one.json.j2 (4)

1-739: Benchmark configurations look solid.

The iperf and uperf benchmark definitions are correctly structured. The repetitive per-ID param blocks are verbose but clear. If this template grows, you might consider Jinja2 loops to reduce duplication, but for now it's perfectly acceptable.


741-758: Endpoints configuration uses template variables correctly.

The ocp_host and multibench_script_dir placeholders are well placed. Just ensure the referenced nodeSelector-worker*.json files exist in the multibench_script_dir or are created as part of the setup.


760-763: Nice fix on num-samples.

Using {{ multibench_sample | default(3) }} aligns with the pattern in config.ini.j2 and provides a sensible fallback.


767-782: Tool parameters look good.

The sysstat and procstat configurations are fine. Minor nit: the params array items (lines 771-776) have slightly different indentation than the rest of the file, but it's purely cosmetic.

@softwarefactory-project-zuul
Copy link

@dcibot
Copy link
Collaborator

dcibot commented Nov 27, 2025

Copy link
Contributor

@ramperher ramperher left a comment

Choose a reason for hiding this comment

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

LGTM. Is this JSON file directly taken by run.sh script? Don't you need to pass it as argument? I assume so.
If that's correct, I'd propose to update the README, at least this paragraph:

If you want to customize the scenarios, you can edit the run.sh file which defines the previous layout of test. You can edit the resources requested by the pods (clients or servers), in order to have a Guaranteed QoS. You can change the variable multibench_script to keep several scenarios ready and easily switch from one to another.

Because, now, the source to define the scenario would not be run.sh, but all-in-one.json.

@rajchiluveru
Copy link
Contributor Author

LGTM. Is this JSON file directly taken by run.sh script? Don't you need to pass it as argument? I assume so. If that's correct, I'd propose to update the README, at least this paragraph:

If you want to customize the scenarios, you can edit the run.sh file which defines the previous layout of test. You can edit the resources requested by the pods (clients or servers), in order to have a Guaranteed QoS. You can change the variable multibench_script to keep several scenarios ready and easily switch from one to another.

Because, now, the source to define the scenario would not be run.sh, but all-in-one.json.

Yes, this json file will be passed as argument to run-daily.sh script.Please see below

[root@multibench-vm daily]# tail -2 run-daily.sh 

crucible run $SCRIPT_DIR/all-in-one.json
[root@multibench-vm daily]# pwd
/root/crucible-examples/multibench/openshift/example-A/daily
[root@multibench-vm daily]#

@dcibot
Copy link
Collaborator

dcibot commented Nov 27, 2025

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
roles/multibench_run/README.md (3)

31-33: Fix code fence language identifier.

The example command is bash/shell, not YAML. Update the code fence to match the content type.

-```yaml
+```bash
 /root/regulus/bin/reg-c2j-config.py --name iperf,uperf ...
-```
+```

24-29: Clarify the workflow scope for run.sh vs. all-in-one.json.

The section transitions from describing run.sh customization to the daily workflow with all-in-one.json, but doesn't clearly delineate which workflow each approach applies to. This could confuse readers about which path to take.

Consider restructuring to explicitly state: (1) run.sh is for the default/example-A workflow, and (2) all-in-one.json is the new approach for daily jobs. This aligns better with the PR's goal of documenting the JSON-based workflow as the primary input source.


25-25: Minor stylistic improvement.

"In order to" can be more concise. Consider rewording to simply "to":

- You can edit the resources requested by the pods (clients or servers), in order to have a Guaranteed QoS.
+ You can edit the resources requested by the pods (clients or servers), to have a Guaranteed QoS.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f60b6ca and 3780dca.

📒 Files selected for processing (1)
  • roles/multibench_run/README.md (2 hunks)
🧰 Additional context used
🪛 LanguageTool
roles/multibench_run/README.md

[style] ~25-~25: Consider a more concise word here.
Context: ...ested by the pods (clients or servers), in order to have a Guaranteed QoS. You can change t...

(IN_ORDER_TO_PREMIUM)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: dci/check
  • GitHub Check: Sanity Check (stable-2.18)
  • GitHub Check: Sanity Check (stable-2.9)
  • GitHub Check: Ansible-lint Check

@softwarefactory-project-zuul
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
roles/multibench_run/README.md (1)

16-16: Update README table to match the new default multibench_script_dir.

The documentation on line 16 still shows the old path without the /daily subdirectory, but the default in defaults/main.yml has been updated to /root/crucible-examples/multibench/openshift/example-A/daily. Update the README table to reflect this change.

♻️ Duplicate comments (1)
roles/multibench_run/defaults/main.yml (1)

4-4: Path mismatch between setup and runtime confirmed—must be corrected.

The setup playbook clones the repository to /root/crucible-example (singular) and manipulates paths like /root/crucible-example/multibench/openshift/example-A/ (lines 55, 62, 71, 85 of playbooks/multibench_setup_host.yml). However, the default in roles/multibench_run/defaults/main.yml line 4 specifies /root/crucible-examples/multibench/openshift/example-A/daily (plural + /daily).

Additionally, the README documents the default path as /root/crucible-examples/multibench/openshift/example-A (plural, without /daily), reserving the /daily subdirectory specifically for daily jobs. The current default incorrectly commits to the daily-only path for all runs.

This will cause runtime failures when the role attempts to write config files to a non-existent path. Either:

  1. Update the setup playbook to clone to the plural path /root/crucible-examples, or
  2. Revert the default to the non-daily path and make /daily configurable for daily-specific jobs.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3780dca and 6e19ffd.

📒 Files selected for processing (4)
  • roles/multibench_run/README.md (2 hunks)
  • roles/multibench_run/defaults/main.yml (1 hunks)
  • roles/multibench_run/tasks/main.yml (1 hunks)
  • roles/multibench_run/templates/all-in-one.json.j2 (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • roles/multibench_run/templates/all-in-one.json.j2
  • roles/multibench_run/tasks/main.yml
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-24T21:40:17.028Z
Learnt from: tonyskapunk
Repo: redhatci/ansible-collection-redhatci-ocp PR: 715
File: roles/copy_and_render/tasks/main.yml:18-24
Timestamp: 2025-06-24T21:40:17.028Z
Learning: The copy_and_render role in the ansible-collection-redhatci-ocp repository is designed to work only with relative paths for car_source_dir, not absolute paths. This is an intentional design constraint.

Applied to files:

  • roles/multibench_run/defaults/main.yml
🪛 LanguageTool
roles/multibench_run/README.md

[style] ~25-~25: Consider a more concise word here.
Context: ...ested by the pods (clients or servers), in order to have a Guaranteed QoS. You can change t...

(IN_ORDER_TO_PREMIUM)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: dci/check
  • GitHub Check: Sanity Check (stable-2.9)
  • GitHub Check: Sanity Check (stable-2.18)
  • GitHub Check: Ansible-lint Check
🔇 Additional comments (1)
roles/multibench_run/defaults/main.yml (1)

1-1: Variable rename is consistent.

The change from nb_iterations to num_samples aligns with the template and task updates.

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.

5 participants