[Oar-commits] r2696 - in trunk/Oargrid: . debian

bzizou at users.gforge.inria.fr bzizou at users.gforge.inria.fr
Mon Mar 1 16:31:05 CET 2010


Author: bzizou
Date: 2010-03-01 16:31:05 +0100 (Mon, 01 Mar 2010)
New Revision: 2696

Modified:
   trunk/Oargrid/debian/changelog
   trunk/Oargrid/oargridsub
Log:
Oargrid now supports jobs having multiple types

Modified: trunk/Oargrid/debian/changelog
===================================================================
--- trunk/Oargrid/debian/changelog	2010-03-01 11:42:10 UTC (rev 2695)
+++ trunk/Oargrid/debian/changelog	2010-03-01 15:31:05 UTC (rev 2696)
@@ -1,3 +1,9 @@
+oargrid (2.2.4) unstable; urgency=low
+
+  * Oargrid now supports jobs having several types
+
+ -- Bruno Bzeznik <Bruno.Bzeznik at imag.fr>  Thu, 01 Mar 2010 15:53:01 +0100
+
 oargrid (2.2.3) unstable; urgency=low
 
   * Bugfix: oargridsub didn't work anymore with oar >= 2.3 

Modified: trunk/Oargrid/oargridsub
===================================================================
--- trunk/Oargrid/oargridsub	2010-03-01 11:42:10 UTC (rev 2695)
+++ trunk/Oargrid/oargridsub	2010-03-01 15:31:05 UTC (rev 2696)
@@ -28,7 +28,7 @@
 Usage oargridsub -s date [-q queue_name][-p program_to_run][-w walltime][-i identity_file][-T timeout][-d directory][-v][-V][-f file] DESC
     -s give the date of the begining of the reservation, ex: "2005-01-07 11:00:00" (default is NOW)
     -q give the queue
-    -t give the type
+    -t give the type (several -t are allowed)
     -p give the program to run
     -d give the directory where the program will be launched (default is "~")
     -w walltime of the reservation (default is "1:00:00")
@@ -82,7 +82,7 @@
 my $sos;
 my $verbose;
 my $queue;
-my $type;
+my @type;
 my $file;
 my $continue;
 my $version;
@@ -98,7 +98,7 @@
             "help|h" => \$sos,
             "verbose|v" => \$verbose,
             "queue|q=s" => \$queue,
-            "type|t=s" => \$type,
+            "type|t=s" => \@type,
             "file|f=s" => \$file,
             "FORCE|F" => \$continue,
             "VERSION|V" => \$version
@@ -151,8 +151,8 @@
         if (($content =~ m/QUEUE\s*=\s*\"(.+)\"\s*/m) && !defined($queue)){
             $queue = "$1";
         }
-        if (($content =~ m/TYPE\s*=\s*\"(.+)\"\s*/m) && !defined($type)){
-            $type = "$1";
+        if (($content =~ m/TYPE\s*=\s*\"(.+)\"\s*/m) && !@type){
+            push(@type,$1);
         }
         if ($content =~ m/DESC\s*=\s*\"(.+)\"\s*/m){
             my $tmpValue = $1;
@@ -188,9 +188,6 @@
 if (!defined($program)){
     $program = "";
 }
-if (!defined($type)){
-    $type = "";
-}
 
 
 print("DESC string : $argumentDescription\n") if (defined($verbose));
@@ -205,13 +202,14 @@
                     name => "",
                     env => "",
                     part => "",
-		    type => "",
+		    types => [],
                     rdef => ""
                   );
     my @tmpArray = split(":", $i);
     $tmpHash{clusterName} = shift(@tmpArray);
     $tmpHash{clusterName} =~ m/\s*(.+)\s*/m;
     $tmpHash{clusterName} = $1;
+    my @types;
     foreach my $j (@tmpArray){
         print "Scanning $j...\n" if (defined($verbose));
         if ($j =~ m/\s*rdef\s*=\s*(.+)/m){
@@ -237,7 +235,7 @@
         }elsif ($j =~ m/\s*name\s*=\s*(.+)/m){
             $tmpHash{name} = $1;
         }elsif ($j =~ m/\s*type\s*=\s*(.+)/m){
-            $tmpHash{type} = $1;
+            push(@types,$1);
         }
 	else {
 	  print "ERROR: $j: unknown keyword\n";
@@ -245,6 +243,7 @@
 	  exit(2);
 	}
     }
+    $tmpHash{types}=[ @types ];
     push(@clusterArguments, \%tmpHash);
 }
 
@@ -305,10 +304,17 @@
     if ($i->{queue} ne ""){
         $tmpQueue = $i->{queue};
     }
-    my $tmpType = $type;
-    if ($i->{type} ne ""){
-        $tmpType = $i->{type};
+    my $tmpType;
+    # Globals types
+    if (@type) {
+      foreach my $t (@type) {
+        $tmpType .= " -t ".$t;
+      }
     }
+    # Local types (only for that resources definition)
+    foreach my $t (@{$i->{types}}){
+       $tmpType .= " -t ".$t;
+    }
     my $resources_def = "";
     if ($i->{rdef} ne "") {
         $resources_def = $i->{rdef};
@@ -349,7 +355,7 @@
         #$cmd .= " --force-cpuset-name $cpuset_name";
     }
     if ($tmpType ne "") {
-      $cmd .= " -t ".$tmpType;
+      $cmd .= " ".$tmpType;
     }
     if ($i->{properties} ne ""){
         $property_string .= "(". $i->{properties} .")";




More information about the Oar-commits mailing list