mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
bin/ci: crnm: Sanitize n_colums value
The number of columns should never be less than 1, otherwise we can
break the script such as:
```
Traceback (most recent call last):
File "/var/home/guilherme/projects/mesa/bin/ci/ci_run_n_monitor.py", line 734, in <module>
main()
File "/var/home/guilherme/projects/mesa/bin/ci/ci_run_n_monitor.py", line 713, in main
target_job_id, ret, exec_t = monitor_pipeline(
^^^^^^^^^^^^^^^^^
File "/var/home/guilherme/projects/mesa/bin/ci/ci_run_n_monitor.py", line 221, in monitor_pipeline
cancel_jobs(project, to_cancel)
File "/var/home/guilherme/projects/mesa/bin/ci/ci_run_n_monitor.py", line 400, in cancel_jobs
print_formatted_list(cancelled_jobs, indentation=8)
File "/var/home/guilherme/projects/mesa/bin/ci/gitlab_gql.py", line 373, in print_formatted_list
step = (len(elements) // n_columns) + 1
~~~~~~~~~~~~~~^^~~~~~~~~~~
ZeroDivisionError: integer division or modulo by zero
```
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35250>
This commit is contained in:
parent
b1d81a7df1
commit
e942d1e9e4
1 changed files with 1 additions and 1 deletions
|
|
@ -369,7 +369,7 @@ def print_formatted_list(elements: list[str], indentation: int = 0) -> None:
|
|||
return
|
||||
column_separator_size = 2
|
||||
column_width: int = len(max(elements, key=len)) + column_separator_size
|
||||
n_columns: int = (h_size - indentation) // column_width
|
||||
n_columns: int = max((h_size - indentation) // column_width, 1)
|
||||
step = (len(elements) // n_columns) + 1
|
||||
rows = [elements[i::step] for i in range(step)]
|
||||
for line in rows:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue