Home
TeamSite
clean jobs and...
w18111
we have a lot of pending jobs in our system, which are very old.. we want to be able to end these jobs & unlock files if applicable... is there any easy way to do this ?
any sample scripts?
TIA
Find more posts tagged with
Comments
nipper
Hey
Since you paid for
this
you can use it.
This DOES NOT DO ANY FILTERING, IT DELETES EVERYTHING. So put some code in to read the date or something and don't blow it all away.
You can also put a getFiles call in and unlock the files before the rmjob is executed. You will also may need to get the active task for GetFiles.
Adam Stoller
This will remove all jobs from the system:
use strict;
use warnings;
use File::Temp qw(tempfile);
use TeamSite::Config;
(my $iwhome = TeamSite::Config::iwgethome()) =~ tr|\\|/|;
my($fh, $fname) = tempfile(UNLINK => 1);
print $fh qq(<wfquery><active/></wfquery>\n);
close($fh);
my
@jobids
= qx($iwhome/bin/iwqueryjobs < $fname);
chomp(
@jobids)
;
my $jlist = "$iwhome/bin/iwrmjob ";
while(
@jobids){
$jlist .= shift(
@jobids)
. q{ };
if (length($jlist) > 256){
# ensure you do not exceed max command line length or arg count
print "$jlist\n";
# if you want to see something printed out
qx($iwhome/bin/$jlist);
$jlist = (
@jobids)
? "$iwhome/bin/iwrmjob " : q{};
}
}
print "$jlist\n";
# if you want to see something printed out
qx($iwhome/bin/$jlist) if ($jlist ne q{});
You should be able to augment the query based on activationtime, but a few quick tries I just made didn't seem to work - maybe you'll have better luck with it.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
w18111
I am almost there, but I have a question...... is there an easy way to enumerate tasks associated with a job, i.e. I know I could manually do iwgetwfobj to get an XML out of the job details, but is there an WF Object to do something like $job->GetTasks() ??
thx..
jbonifaci
perldoc TeamSite::WFworkflow.
iw_store
Hi,
Parse that XML file using XML parsers to get TaskIds.