24 |
|
printHelp ($ARGV[0]) if $opt{"help"}; |
25 |
|
printHelp () if $argc != 2 && $ARGV[0] ne "createOther"; |
26 |
|
printHelp () if $ARGV[0] ne "create" && $ARGV[0] ne "createOther" && $ARGV[0] ne "update" && $ARGV[0] ne "finish" && $ARGV[0] ne "deprecate" && $ARGV[0] ne "uploadRelease" && $ARGV[0] ne "deleteEntry"; |
27 |
– |
if ($ARGV[0] eq "create" && datasetExists ($ARGV[1])) |
28 |
– |
{ |
29 |
– |
print "Dataset name already exists in the database!\n"; |
30 |
– |
exit; |
31 |
– |
} |
27 |
|
if (($ARGV[0] eq "create" || $ARGV[0] eq "finish") && !$opt{"location"}) |
28 |
|
{ |
29 |
|
print "The directory containing the ntuples must be given!\n"; |
66 |
|
$status = "deprecated" if $ARGV[0] eq "deprecate"; |
67 |
|
$opt{"format"} = "BEAN" if $ARGV[0] eq "create" && !$opt{"format"}; |
68 |
|
dbUpdate ($id, $fullDataset, $ENV{"USER"}, $opt{"format"}, $opt{"location"}, $opt{"fileList"}, $status, $opt{"comment"}, $opt{"pyConfig"}, $opt{"crabCfg"}, $opt{"jsonFile"}, $opt{"lumiSummary"}, $opt{"release"}) if !$opt{"other"}; |
69 |
< |
dbUpdateOther ($id, $opt{"comment"}) if $opt{"other"}; |
69 |
> |
dbUpdateOther ($id, $opt{"comment"}, $ENV{"USER"}) if $opt{"other"}; |
70 |
|
dbDelete ($id) if $ARGV[0] eq "deleteEntry" && !$opt{"other"}; |
71 |
|
dbDeleteOther ($id) if $ARGV[0] eq "deleteEntry" && $opt{"other"}; |
72 |
|
} |
276 |
|
my $id = 1; |
277 |
|
$id = $row[0] + 1 if $results->numrows (); |
278 |
|
|
279 |
< |
$query = "insert into ntuple (id, dataset, creationTime, lastUpdateTime, user, format, location, fileList, nFiles, sizeInGB, status, comment, pset, crabCfg, jsonFile, lumiSummary, version) values ($id, '$dataset', now(), now(), '$user', '$format', '$fullLocation', '$fileList', $nFiles, $size, '$status', '$comment', '$pset', '$crabCfg', '$jsonFile', '$lumiSummary', '$release')"; |
279 |
> |
$query = "insert into ntuple (id, dataset, creationTime, lastUpdateTime, lastUpdateUser, user, format, location, fileList, nFiles, sizeInGB, status, comment, pset, crabCfg, jsonFile, lumiSummary, version) values ($id, '$dataset', now(), now(), '$user', '$user', '$format', '$fullLocation', '$fileList', $nFiles, $size, '$status', '$comment', '$pset', '$crabCfg', '$jsonFile', '$lumiSummary', '$release')"; |
280 |
|
} |
281 |
|
if ($id > 0) |
282 |
|
{ |
285 |
|
|
286 |
|
$values .= ", dataset='$dataset'" if $dataset; |
287 |
|
$values .= ", lastUpdateTime=now()"; |
288 |
+ |
$values .= ", lastUpdateUser='$user'"; |
289 |
|
$values .= ", format='$format'" if $format; |
290 |
|
$values .= ", location='$fullLocation'" if $location; |
291 |
|
$values .= ", fileList='$fileList'" if $fileList; |
312 |
|
{ |
313 |
|
my $id = shift; |
314 |
|
my $comment = shift; |
315 |
+ |
my $user = shift; |
316 |
|
|
317 |
|
$comment = addSlashes ($comment); |
318 |
|
|
319 |
< |
my $query = "update other set lastUpdateTime=now(), comment='$comment' where id=$id"; |
319 |
> |
my $query = "update other set lastUpdateTime=now(), lastUpdateUser='$user', comment='$comment' where id=$id"; |
320 |
|
$db->selectdb ("ntuple"); |
321 |
|
my $results = $db->query ($query); |
322 |
|
|
534 |
|
} |
535 |
|
|
536 |
|
sub |
540 |
– |
datasetExists |
541 |
– |
{ |
542 |
– |
my $dataset = shift; |
543 |
– |
|
544 |
– |
my $query = "select id from ntuple where dataset='$dataset'"; |
545 |
– |
$db->selectdb ("ntuple"); |
546 |
– |
my $results = $db->query ($query); |
547 |
– |
|
548 |
– |
return $results->numrows (); |
549 |
– |
} |
550 |
– |
|
551 |
– |
sub |
537 |
|
dbOtherCreate |
538 |
|
{ |
539 |
|
my $user = shift; |
570 |
|
$location = addSlashes ($location); |
571 |
|
$comment = addSlashes ($comment); |
572 |
|
|
573 |
< |
my $query = "insert into other (id, creationTime, lastUpdateTime, user, location, nFiles, sizeInGB, comment) values ($id, now(), now(), '$user', '$location', $nFiles, $size, '$comment')"; |
573 |
> |
my $query = "insert into other (id, creationTime, lastUpdateTime, lastUpdateUser, user, location, nFiles, sizeInGB, comment) values ($id, now(), now(), '$user', '$user', '$location', $nFiles, $size, '$comment')"; |
574 |
|
$db->selectdb ("ntuple"); |
575 |
|
my $results = $db->query ($query); |
576 |
|
|