Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5ef7ebee87
Fetching contributors…

Cannot retrieve contributors at this time

executable file 83 lines (64 sloc) 2.175 kb
#!/usr/bin/env perl
#use strict;
#use warnings;
##H List pending transfer and delete requests
##H Options:
##H -db : DBParam file (required)
use Getopt::Long;
use PHEDEX::Core::Help;
use PHEDEX::Core::DB;
use PHEDEX::Core::Formats;
use PHEDEX::Core::Timing;
use File::Path;
use File::Basename;
use Date::Calc qw ( Today Time_to_Date Delta_Days );
my %args;
&GetOptions ("db=s" => \$args{DBCONFIG},
"out=s" => \$args{OUT},
"help|h" => sub { &usage() });
# Script name
my $me = fileparse($0);
# Check arguments.
if (!$args{DBCONFIG})
die "Insufficient parameters, use -h for help.\n";
if (!$args{OUT})
$args{OUT} = "/tmp/$me.out"
open(OUT,">$args{OUT}") || die "Cannot open $args{OUT}: $!";
my $self = { DBCONFIG => $args{DBCONFIG} };
my $dbh = &connectToDatabase ($self);
my $now = &mytimeofday();
my $sqlx = qq{
select substr(min(,0,20) dst_node, substr(min(,0,20) src_node, dataset, xq.time_create
from t_xfer_request xq
left join t_xfer_path xp on xp.fileid = xq.fileid and xp.destination = xq.destination
join t_dps_file f on = xq.fileid
join t_adm_node n on = f.node
join t_adm_node dn on = xq.destination
join t_dps_block b on = f.inblock
join t_dps_dataset ds on = b.dataset
where xp.fileid is null and xq.state = 0 and xq.time_create < ((sysdate - to_date('01-JAN-1970','DD-MON-YYYY')) * (86400) - 600)
group by,,, xq.time_create
order by,,, xq.time_create
$dbh->{LongReadLen} = 3000;
my $q = &dbexec($dbh, $sqlx);
my $date = `date`;
print OUT "Report generated: $date\n";
printf OUT ("%-22s %-22s %-120s %-4s\n","DESTINATION","SOURCE","BLOCK","DAYS");
print OUT "\n";
while (my $r = $q->fetchrow_arrayref) {
my ($dest, $source, $dataset, $create) = @$r;
# get current GMT date
($ty,$tm,$td) = Today(1);
($cy,$cm,$cd,undef) = Time_to_Date($create);
#next unless ($dataset =~ /MC_/);
printf OUT ("%-22s %-22s %-120s %-4s\n",$dest, $source, $dataset, Delta_Days($ty,$tm,$td,$cy,$cm,$cd));
&disconnectFromDatabase($self, $dbh, 1);
Jump to Line
Something went wrong with that request. Please try again.