Changeset 1704 in ProjectBuilder for devel/pb/bin/pb


Ignore:
Timestamp:
Mar 7, 2013, 9:51:51 PM (11 years ago)
Author:
Bruno Cornec
Message:
  • launchvm now is able to launch multiple VMs (but still one VE/RM at a time)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1703 r1704  
    837837    pb_build2v("vm","build");
    838838} elsif ($action =~ /^launchvm$/) {
    839     pb_launchv("vm",$ENV{'PBV'},0);
     839    my $pm;
     840    my $all_ok = 1;
     841    if (defined $pbparallel) {
     842        $pm = new Parallel::ForkManager($pbparallel);
     843   
     844        # Set which port the VM/RM will use to communicate
     845        $pm->run_on_start(\&pb_set_port);
     846        $pm->run_on_finish(sub { my ($pid, $code, $id, $signal, $dump) = @_;
     847                            $all_ok = 0 unless (($code == 0) && ($signal == 0) && ($dump == 0));
     848                        });
     849    }
     850
     851    my $counter = 0;
     852    foreach my $v (split(/,/,$ENV{'PBV'})) {
     853        $counter++;
     854        # Modulo pbparallel
     855        $counter = 1 if ((defined $pbparallel) && ($counter > $pbparallel));
     856        $pm->start($counter) and next if (defined $pbparallel);
     857
     858        pb_launchv("vm",$v,0);
     859    }
     860    $pm->wait_all_children if (defined $pbparallel);
     861    die "Aborting, one or more of the children failed." if ((not $all_ok) && ($Global::pb_stop_on_error));
    840862} elsif ($action =~ /^launchve$/) {
    841863    pb_launchv("ve",$ENV{'PBV'},0);
Note: See TracChangeset for help on using the changeset viewer.