[Bio] / FortyEight / get_number_of_external_jobs.pl Repository:
ViewVC logotype

Diff of /FortyEight/get_number_of_external_jobs.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5, Mon Nov 5 20:45:47 2007 UTC revision 1.6, Wed Jan 9 21:40:06 2008 UTC
# Line 22  Line 22 
22  use Job48;  use Job48;
23  use Mail::Mailer;  use Mail::Mailer;
24    
25    print "Jobs: ",$FIG_Config::fortyeight_jobs , "\n";
26    
27  my @jobs = Job48::all_jobs();  my @jobs = Job48::all_jobs();
28    print "Jobs: ",$FIG_Config::fortyeight_jobs , "\n";
29  my $exclude = { batch => 1 ,  my $exclude = { batch => 1 ,
30                  olson => 1 ,                  olson => 1 ,
31                  mkubal => 1 ,                  mkubal => 1 ,
# Line 73  Line 74 
74  print "Jobs in current job directory = ". scalar @jobs ."\n";  print "Jobs in current job directory = ". scalar @jobs ."\n";
75  print "Excluded jobs = $nr_excluded\n";  print "Excluded jobs = $nr_excluded\n";
76  print "External jobs = $nr_external\n";  print "External jobs = $nr_external\n";
77    
78    my $dbm = get_dbm();
79    #print scalar @{ get_user($dbm , "awilke") } , "\n";
80    print scalar @{ get_user($dbm) } , " Users\n";
81    print scalar @{ get_organisations($dbm) } , " Organisations\n";
82    
83    sub get_user
84    {
85        my($dbm, $user) = @_;
86    
87    
88    
89        my $users;
90        if ( $user ){
91          $users = $dbm->User->get_objects({ login => $user });
92        }
93        else{
94          $users = $dbm->User->get_objects();
95        }
96        if ($users && @$users)
97        {
98            return $users;
99        }
100    }
101    
102    
103    sub get_organisations{
104      my ($dbm, $org) = @_;
105      my $organisations = $dbm->Organisation->get_objects();
106      return $organisations;
107    }
108    
109    sub get_dbm{
110    
111      my $old_env = $ENV{DBHOST};
112      $ENV{DBHOST} = 'bioseed.mcs.anl.gov';
113      my $dbm;
114      eval {
115        $dbm = DBMaster->new('FortyEight_WebApplication');
116      };
117      if ($@)
118        {
119          if ($@ =~ /No database name given/)
120            {
121              $dbm = DBMaster->new(-database => 'FortyEight_WebApplication');
122            }
123          else
124            {
125              die $@;
126            }
127        }
128      return undef unless $dbm;
129      $ENV{DBHOST} = $old_env;
130    
131      return $dbm;
132    }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3