Hi,I wanted to know how do we detrmine the number of active workflows in the TeamSite. Thanks,Madhur
Alternatively the iwqueryjobs command in conjunction with a query definition file would do it./usr/iw-home/bin/iwqueryjobs < /tmp/active_jobs.xml | wc -lif the file /tmp/active_jobs.xml looks like the attached file
#!/usr1/iw-home/iw-perl/bin/iwperluse strict;use warnings;use TeamSite::WFsystem;use TeamSite::WFworkflow;use TeamSite::Config;my $VERBOSE = 0;my $DRYRUN = 0;my $DAYS_OLD = 365 * 5;for( my $i = 0; $i <= $#ARGV; $i++ ) { if( $ARGV[$i] =~ /^-v[erbose]*$/ ) { $VERBOSE = 1; next; } if( $ARGV[$i] =~ /^-s[imulate]*$/ ) { $DRYRUN = 1; next; } if( $ARGV[$i] =~ /^-d[ays]*$/ ) { $DAYS_OLD = $ARGV[++$i]; next; }}my $iwhome = TeamSite::Config::iwgethome();my $rmcmd = "$iwhome/bin/iwrmjob";my $system = TeamSite::WFsystem->new;my $wfs = $system->GetActiveWorkflows;my $time = time;# Diff is days x hours x mins x secondsmy $diff = $DAYS_OLD * 24 * 60 * 60;my $limit = ( $time - $diff );print "DATE THRESHOLD: " . localtime( $limit ) . " ($DAYS_OLD days old)\n";print "TOTAL WORKFLOWS: " . @{$wfs} . "\n";my $removed = 0;foreach my $activeWorkFlow ( @{$wfs} ) { next unless( $activeWorkFlow->IsValid ); my $activationTime = $activeWorkFlow->GetActivationTime; my $wfID = $activeWorkFlow->GetId; if( $VERBOSE ) { print "Workflow $wfID was activated on " . localtime( $activationTime ) . "\n"; print "TIME: $time\n"; print "ACTIVATION TIME: $activationTime\n"; print "DIFF: $diff\n"; print "TIME - DIFF: $limit\n"; } if( $limit > $activationTime ) { print "Workflow $wfID is older than $DAYS_OLD days old and will be deleted\n" if $VERBOSE; print "\tDeleting $wfID...\n"; $removed++; unless( $DRYRUN ) { my @ans; eval { @ans = `$rmcmd $wfID 2>&1`; }; foreach my $lines ( @ans ) { print $lines; } print $@ if $@; } } print "\n" if $VERBOSE;}print "TOTAL DELETED: $removed\n";