Changeset 27583

Show
Ignore:
Timestamp:
10.06.2013 10:22:19 (6 years ago)
Author:
jmt12
Message:

Adding code to differentiate between workers in a cluster - all of which preport to be worker 0

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/bin/script/hadoop_report.pl

    r27560 r27583  
    213213  $row_counter++; 
    214214  # For each compute node record 
     215  my $known_workers = {}; 
    215216  foreach my $worker_id (sort keys %{$node_records}) 
    216217  { 
     
    218219    my $node_id = $row_counter; 
    219220    $row_counter++; 
    220     print CSVOUT $node_id . ',W' . $node_record->{'cpu'} . ',' . $node_record->{'host'} . ',' . $node_record->{'start'} . ',' . $node_record->{'end'} . ',' . $node_record->{'cpu_time'} . ",0,1,NA\n"; 
     221    my $csv_worker_id = 'W' . $node_record->{'cpu'}; 
     222    # Ensure we haven't used this id before - this should never trigger for 
     223    # multicore CPUs, but will for clusters (as nearly all nodes will report 
     224    # themselves as 'W0') 
     225    if (defined $known_workers->{$csv_worker_id}) 
     226    { 
     227      # Find a different worker id as this one is already in use 
     228      my $counter = 0; 
     229      $csv_worker_id = 'W' . $counter; 
     230      while (defined $known_workers->{$csv_worker_id}) 
     231      { 
     232        $counter++; 
     233        $csv_worker_id = 'W' . $counter; 
     234      } 
     235    } 
     236    $known_workers->{$csv_worker_id} = 1; 
     237    print CSVOUT $node_id . ',' . $csv_worker_id . ',' . $node_record->{'host'} . ',' . $node_record->{'start'} . ',' . $node_record->{'end'} . ',' . $node_record->{'cpu_time'} . ",0,1,NA\n"; 
    221238    # List the child task records 
    222239    foreach my $taskno (sort keys %{$task_records})