Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use global TF request counter in request ID #116

Merged
merged 2 commits into from
Nov 5, 2024
Merged
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
2 changes: 2 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- epel-9-x86_64
- epel-9-aarch64
enable_net: false
osh_diff_scan_after_copr_build: false
actions:
create-archive:
- hatch build -t sdist
Expand All @@ -48,6 +49,7 @@ jobs:
- epel-9-x86_64
- epel-9-aarch64
enable_net: false
osh_diff_scan_after_copr_build: false
list_on_homepage: true
preserve_project: true
release_suffix: "{PACKIT_PROJECT_BRANCH}"
Expand Down
15 changes: 13 additions & 2 deletions newa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ def render_template(
raise Exception("Could not render template.") from exc


def global_request_counter() -> Iterator[int]:
i = 1
while True:
yield i
i += 1


gen_global_request_counter = global_request_counter()


@define
class Settings:
""" Class storing newa settings """
Expand Down Expand Up @@ -790,8 +800,9 @@ def merge_combination_data(
# now build Request instances
total = len(filtered_combinations)
for combination in filtered_combinations:
yield Request(id=f'REQ-{next(recipe_id_gen)}.{total}',
**combination)
yield Request(
id=f'REQ-{next(recipe_id_gen)}.{total}.{next(gen_global_request_counter)}',
**combination)


@define
Expand Down
2 changes: 1 addition & 1 deletion newa/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ def cmd_report(ctx: CLIContext) -> None:
launch_description += f'{jira_id}: '
launch_description += f'{len(jira_execute_job_mapping[jira_id])} request(s) in total:'
jira_description = launch_description.replace('<br>', '\n')
for req in sorted(results.keys()):
for req in sorted(results.keys(), key=lambda x: int(x.split('.')[-1])):
# it would be nice to use hyperlinks in launch description however we
# would hit description length limit. Therefore using plain text
launch_description += "<br>{id}: {state}, {result}".format(**results[req])
Expand Down
Loading