Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Deleting old Workflows
bturns
TS 5.5.2
Solaris 8
Has anyone developed a tool that will delete all workflows older than a certain date?
Thanks,
Brian
Find more posts tagged with
Comments
Migrateduser
I think you mean jobs, not workflows? I made a tool that reported old jobs (may be posted here somewhere) - it would probably be easy to extend it to iwrmjob. Let me know if you want the code (Perl).
bturns
Yeah, I mean jobs. Please do send the perl my way. THanks.
Adam Stoller
What are you basing the age of the job on?
The creation / instantiation date of the job or the activation date of the currently active task?
I'd imagine that the latter is probably more accurate for distinguishing "slow processing" from abandoned.
It should be elatively easy to write this using the existing Perl modules and one callout to iwrmjob with a list of id's to remove (I don't believe there's a Perl cover for that)
Unfortunately I don't seem to be able to connect to my solaris machine right now, or else I'd take a whack at writing it. However, I'll be interested in seeing JimmyFat's code...
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
aga1296
Pls send me the code for me to
njmahesh@yahoo.com
.
Thanks in advance
Mahesh
Adam Stoller
Here's some code I just whipped up which you can use as the basis for what you're looking to do. As it's written, it should provide a status of the last activation timestamp for each active task, showing how long ago it was that it was activated.
#!/usr/iw-home/iw-perl/bin/iwperl -w
use strict;
use TeamSite::WFsystem;
use TeamSite::WFtask;
use Date::Manip;
my $wfsys = new TeamSite::WFsystem;
my $atasks = $wfsys->GetActiveTasks();
my $now = time();
foreach my $task (
@$atasks){
my $activated = $task->GetActivationTime();
my $age = age($activated);
printf("%d:%d: last activation: %s (%s ago)\n",
$task->GetWorkflowId(),
$task->GetId(),
scalar(localtime($activated)),
$age);
}
sub age{
my $then = shift;
my
@tdiff
= split(/:/, DateCalc("now", scalar(localtime($then))));
my $strdiff = "";
my
@parts
= (qw(year month week day hour minute second));
my $v = 0;
for (my $i = 0; $i <
@tdiff
; $i++){
if (($v = $tdiff[$i]) > 0){
$strdiff .= sprintf("%d %s%s ", $v, $parts[$i], ($v > 1) ? "s" : "");
}
}
$strdiff =~ s/\s*$//;
return $strdiff;
}
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com