Revert "Multi-thread grades generation"
This reverts commit 2e5b2af4d8
.
This commit is contained in:
parent
2e5b2af4d8
commit
b8d4ff1a58
@ -2,7 +2,6 @@
|
||||
|
||||
use v5.10.1;
|
||||
use strict;
|
||||
use threads;
|
||||
use warnings;
|
||||
use Carp;
|
||||
use Pod::Usage;
|
||||
@ -99,38 +98,7 @@ sub grades_generate
|
||||
my @trace_dirs = grep { ( ! /^\./ ) && -d "$basedir/$year/$project_id/traces/$_" } readdir($dh);
|
||||
closedir $dh;
|
||||
|
||||
my @ths;
|
||||
my $max_ths = 4;
|
||||
my $login_by_threads = @logins / $max_ths;
|
||||
|
||||
for (my $i = 0; $i < $max_ths; $i++)
|
||||
{
|
||||
my @partlogin = @logins[($i*$login_by_threads) .. (($i+1)*$login_by_threads - 1)];
|
||||
push @ths, threads->create(\&do_grade_generation, $grading, $year, $project_id, $groups, \@trace_dirs, @partlogin);
|
||||
}
|
||||
|
||||
if ($login_by_threads * $max_ths < @logins)
|
||||
{
|
||||
my @partlogin = @logins[$login_by_threads * $max_ths .. $#logins];
|
||||
push @ths, threads->create(\&do_grade_generation, $grading, $year, $project_id, $groups, \@trace_dirs, @partlogin);
|
||||
}
|
||||
|
||||
for my $th (@ths) {
|
||||
$th->join();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub do_grade_generation
|
||||
{
|
||||
my $grading = shift;
|
||||
my $year = shift;
|
||||
my $project_id = shift;
|
||||
my $groups = shift;
|
||||
my @trace_dirs = @{ shift() };
|
||||
|
||||
for my $login (@_)
|
||||
for my $login (@logins)
|
||||
{
|
||||
my @files;
|
||||
|
||||
@ -189,6 +157,8 @@ sub do_grade_generation
|
||||
|
||||
$grading->reset();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub grades_new_bonus
|
||||
|
Reference in New Issue
Block a user