ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/DBTools/scripts/crabclean
(Generate patch)

Comparing UserCode/OSUT3Analysis/DBTools/scripts/crabclean (file contents):
Revision 1.4 by ahart, Sat Mar 9 11:58:55 2013 UTC vs.
Revision 1.6 by ahart, Fri May 10 00:24:02 2013 UTC

# Line 21 | Line 21 | $outputDir = $ARGV[1] if !$opt{"dumb"} &
21  
22   if ($opt{"dataset"})
23    {
24 <    my $query = "select workingDirectory,location,dataset,user,creationTime from ntuple where dataset like '$dataset' order by creationTime";
24 >    my $queryDataset = $dataset;
25 >    $queryDataset =~ s/\*/%/g;
26 >    $queryDataset =~ s/(.*)/%$1%/g;
27 >    my $query = "select workingDirectory,location,dataset,user,creationTime from ntuple where dataset like '$queryDataset' order by creationTime";
28      $db->selectdb ("ntuple");
29      my $results = $db->query ($query);
30      if ($results->numrows () == 1)
# Line 35 | Line 38 | if ($opt{"dataset"})
38          print "Database entry does not exist.\n";
39          exit;
40        }
41 <    my %workingDir;
39 <    my %location;
40 <    print "Found multiple database entries matching\n";
41 <    print "\"$dataset\":\n";
42 <    for (my $i = 1; $i <= $results->numrows (); $i++)
41 >    if ($results->numrows () > 1)
42        {
43 <        my @row = $results->fetchrow ();
44 <        $workingDir{"$i"} = $row[0];
45 <        $location{"$i"} = $row[1];
46 <        printf "(%2d) $row[2]\n", $i;
47 <        print "     created by $row[3] on $row[4]\n";
48 <      }
49 <    print "\nWhich entry would you like to use?: ";
50 <    my $response = <STDIN>;
51 <    $response =~ s/[ \t\n]//g;
52 <    if (!(exists $workingDir{$response}))
53 <      {
54 <        print "Your selection \"$response\" was not a valid option! Quitting.\n";
55 <        exit;
43 >        my %workingDir;
44 >        my %location;
45 >        print "Found multiple database entries matching\n";
46 >        print "\"$dataset\":\n";
47 >        for (my $i = 1; $i <= $results->numrows (); $i++)
48 >          {
49 >            my @row = $results->fetchrow ();
50 >            $workingDir{"$i"} = $row[0];
51 >            $location{"$i"} = $row[1];
52 >            printf "(%2d) $row[2]\n", $i;
53 >            print "     created by $row[3] on $row[4]\n";
54 >          }
55 >        print "\nWhich entry would you like to use?: ";
56 >        my $response = <STDIN>;
57 >        $response =~ s/[ \t\n]//g;
58 >        if (!(exists $workingDir{$response}))
59 >          {
60 >            print "Your selection \"$response\" was not a valid option! Quitting.\n";
61 >            exit;
62 >          }
63 >        $crabDir = "$workingDir{$response}/ntuple";
64 >        $outputDir = $location{$response};
65        }
58    $crabDir = "$workingDir{$response}/ntuple";
59    $outputDir = $location{$response};
66    }
67  
68   if (!(-e $outputDir) || !(-d $outputDir))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines