[Bio] / RAST / mg_stats.pl Repository:
ViewVC logotype

View of /RAST/mg_stats.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Fri May 2 18:38:36 2008 UTC (11 years, 6 months ago) by paarmann
Branch: MAIN
CVS Tags: mgrast_dev_02212011, rast_rel_2014_0912, rast_rel_2008_06_18, rast_rel_2008_06_16, rast_rel_2008_07_21, rast_rel_2010_0928, rast_2008_0924, rast_rel_2008_09_30, rast_rel_2010_0526, rast_rel_2014_0729, rast_rel_2009_05_18, mgrast_rel_2008_0923, rast_rel_2009_0925, rast_rel_2010_1206, rast_rel_2010_0118, mgrast_rel_2008_0924, rast_rel_2009_02_05, rast_rel_2011_0119, mgrast_rel_2008_0625, rast_rel_2008_12_18, rast_rel_2008_08_07, mgrast_rel_2008_1110_v2, rast_rel_2008_10_09, rast_release_2008_09_29, mgrast_rel_2008_0806, mgrast_rel_2008_0919, rast_rel_2009_07_09, rast_rel_2010_0827, mgrast_rel_2008_1110, myrast_33, rast_rel_2011_0928, rast_rel_2008_09_29, mgrast_rel_2008_0917, rast_rel_2008_10_29, mgrast_dev_02222011, rast_rel_2009_03_26, rast_rel_2008_11_24, HEAD
script to report number of internal and external jobs

#!/usr/bin/env perl

use strict;
use warnings; 

use Getopt::Long;
use DirHandle;

use FIG_Config;
use FIG;



# usage message 
sub usage {
  my $error = shift;
  print "Usage: $0 -dir job_directory\n";
  print "Error: $error\n" if($error);
  exit;
}

# get command line parameters
my %options = ();
GetOptions (\%options, "dir=s" ); 

my $job_dir = $options{dir} || '/vol/metagenome-48-hour/Jobs.prod';
-d $job_dir or &usage("Job directory $job_dir not found.");


print "Generating MGRAST usage stats from $job_dir.\n";

# black list of internal users
my $internal = { 'paarmann' => 1,
		 'mkubal' => 1,
		 'awilke' => 1,
		 'olson' => 1,
		 'rsdsu' => 1,
		 'redwards' => 1,
	       };
		 
my $count_total = 0;
my $count_ext = 0;
my $count_int = 0;

my $dh = new DirHandle($job_dir);
while (defined($_ = $dh->read())) {
  next unless /^\d+$/;
  my $id = $_;
  my $dir = "$job_dir/$_";
  my $user = &FIG::file_head("$dir/USER", 1) || '';
  chomp $user;
  unless($user) {
    print STDERR "Job $_ has an empty user file.\n";
    next;
  } 
  
  $count_total++;

  if (exists($internal->{$user})) {
    $count_int++;
  }
  else {
    $count_ext++;
  }
}

print "Total number of jobs: $count_total\n";
print "Number of jobs from external sources: $count_ext\n";
print "Number of jobs from internal sources: $count_int\n";

exit 1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3