Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/multinode-inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# The test scenario is randomly selected.
# The inputs are printed to stdout in GitHub step output key=value format.

import argparse
from dataclasses import dataclass
import random
import typing as t
Expand Down Expand Up @@ -43,6 +44,16 @@ class Scenario:


def main() -> None:

parser = argparse.ArgumentParser(
description='Randomly picks a multinode scenario to execute')
parser.add_argument(
'--output-summary', '-s',
type=argparse.FileType('w', encoding='UTF-8'),
default=None,
help="Write a markdown summary table of selected inputs to a file (use '-' to write to stdout)")
args = parser.parse_args()

scenario = random_scenario()
inputs = {
"os_distribution": scenario.os_release.distribution,
Expand All @@ -57,6 +68,8 @@ def main() -> None:
}
for name, value in inputs.items():
write_output(name, value)
if args.output_summary:
write_summary(inputs, args.output_summary)


def random_scenario() -> Scenario:
Expand Down Expand Up @@ -84,5 +97,13 @@ def write_output(name: str, value: str) -> None:
print(f"{name}={value}")


def write_summary(inputs: dict, output: t.TextIO):
print(
'| Input | Value |\n'
'| -----: | :---- |', file=output)
for key, value in inputs.items():
print(f'| **{key}** | `{value}` |', file=output)


if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion .github/workflows/stackhpc-multinode-periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
- name: Generate inputs for multinode workflow
id: generate-inputs
run: |
python3 .github/workflows/multinode-inputs.py >> $GITHUB_OUTPUT
python3 .github/workflows/multinode-inputs.py -s "$GITHUB_STEP_SUMMARY" \
| tee -a "$GITHUB_OUTPUT"

- name: Display generated inputs
run: |
Expand Down
Loading