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
Refactor methods which violate the deeply nested loops #5450
Conversation
39dabbf
to
3804cf2
Compare
19d26cd
to
8ccc0bc
Compare
545957e
to
b767891
Compare
for my $worker (keys %taken) { | ||
my $ji = $taken{$worker}; | ||
if ($prio > 0) { | ||
# this means we will by default increase the offset per half-assigned job, | ||
# so if we miss 1/25 jobs, we'll bump by +24 | ||
log_debug "Discarding job $ji->{id} (with priority $prio) due to incomplete parallel cluster" | ||
. ', reducing priority by ' | ||
. STARVATION_PROTECTION_PRIORITY_OFFSET; | ||
$j->{priority_offset} += STARVATION_PROTECTION_PRIORITY_OFFSET; | ||
} | ||
else { | ||
# don't "take" the worker, but make sure it's not | ||
# used for another job and stays around | ||
log_debug "Holding worker $worker for job $ji->{id} to avoid starvation"; | ||
$allocated_workers->{$worker} = $ji->{id}; | ||
} | ||
|
||
_allocate_worker_with_priority($prio, $ji, $j, $allocated_workers, $worker); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now maybe we can go one step further
_allocate_worker_with_priority($prio, $taken{$_}, $j, $allocated_workers, $_) for keys %taken;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no sure. I see $ji
in use below in the code
It would be useful to introduce changes step by step and rerun the failing test, to see which change is the culprit. |
e9210ed
to
800d73b
Compare
still failed tidy. Please tidy and consider to mark your PR as ready for review |
Simply extract parts of the subroutines which causes perlcritic to complain about deeply nested loops. https://progress.opensuse.org/issues/138416 Signed-off-by: ybonatakis <ybonatakis@suse.com>
800d73b
to
de41fba
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #5450 +/- ##
=======================================
Coverage 98.37% 98.37%
=======================================
Files 389 389
Lines 37751 37769 +18
=======================================
+ Hits 37139 37157 +18
Misses 612 612 ☔ View full report in Codecov by Sentry. |
Simply extract parts of the subroutines which causes perlcritic to complain about deeply nested loops.
https://progress.opensuse.org/issues/138416