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)
Want to get the just completed task's id
infoForDj
Hi,
I have an external task(FailureHandler Task) which gets activated on timeout of all other tasks. In the script called by this FailureHandler Task, I want to find out which task(upon timeout of which task)has activated this FailureHandler Task. Is there a way to achieve this?
Thanks,
Dhruv
Find more posts tagged with
Comments
gzevin
how about calling your external task with a parameter (that could be the task name, in fact) ?
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
saumil
Hi Dhruv,
Have you tried using TeamSite::WFworkflow::GetParentTask() .
It suppose to work, i have not tried yet.
Saumil Shah
Technical Associate
Mahindra and British Telecom
+0919819890479
saumil
Hi Dhruv,
Sorry for that, i forgot to mention , it will only work for nested job.
I have some option, i am looking for best.
i will reply you when get it.
Saumil Shah
Technical Associate
Mahindra and British Telecom
+0919819890479
infoForDj
Hi,
I didnt get that. How do we call an external task with a parameter?Please give an example.
Thanks,
Dhruv
saumil
Hi Dhruv,
One possible solution is, In your external task you create object of each possible predecessor task.
Fetch Activation time of valid predecessor task by WFTask::GetActivationTime() and get the task with latest activation time.
That is your predecessor task.
Saumil Shah
Technical Associate
Mahindra and British Telecom
+0919819890479
gzevin
when you describe the script name in the external task XML, you could say something like"
"myexternaltask.ipl parameter"
your parameter could be that task name. The external task will get that parameter.
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
Adam Stoller
Try using the oft-overlooked
wfvarstartop
element for your tasks - and have the externaltask script check that variable.
(note: this is so oft-overlooked, I've never used it - so the following is theoretical at this point until/unless someone verifies it ;-)
The workflow template code would look something like this:
<workflow ...>
<variables>
<variable key="lastTask" value=""/>
</variables>
<usertask name="myusertask-1" ...>
<timeout v="+000005">
<succ v="handle_error"/>
</timeout>
...
<wfvarstartop op="set" name="lastTask" value="myusertask-1"/>
...
</usertask>
<usertask name="myusertask-2" ...>
<timeout v="+000005">
<succ v="handle_error"/>
</timeout>
...
<wfvarstartop op="set" name="lastTask" value="myusertask-2"/>
...
</usertask>
<cgitask name="mycgitask-1" ...>
<timeout v="+000005">
<succ v="handle_error"/>
</timeout>
...
<wfvarstartop op="set" name="lastTask" value="mycgitask-1"/>
...
</cgitask>
<externaltask name="handle_error" ...>
...
<command v="/path/to/some/script.ipl"/>
<!-- NOTE: do NOT use wfvarstartup on THIS task -->
...
</externaltask>
...
</workflow>
The externaltask script could then use something like this:
...
use TeamSite::WFtask;
use TeamSite::WFworkflow;
my($jobid, $taskid) =
@ARGV
;
my $job = new TeamSite::WFworkflow($jobid);
my $task = new TeamSite::WFtask($taskid);
if (!$task->IsValid()){
# error
}
...
my $lastTask = $job->GetVariable("lastTask");
if (!defined($lastTask) || $lastTask eq ""){
# error
}
my($success, $ltask) = $job->GetTaskByName($lastTask);
if (!$success){
# error
}
...
$task->CallBack(...);
exit(0);
Comprende?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
navjot
Hi ghoti,
You have recommended to use this element.
<wfvarstartop op="set" name="lastTask" value="mycgitask-1"/>
I am also in tyhe similar requiremtn but tried to look into the DTD docs for it's use. but i couldn't find this element in DTD. What version are you talking about? I am using Teamsite 6.0 iwwf.dtd and this element is not there. However, eastartop is there. what's the use of this?
TIA
Navjot Singh
Adam Stoller
Which DTD are you looking at? You should be looking at iwwf.dtd
The element is documented in the WF manual (around page 125 or 126)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
navjot
thanks ghoti,
i was surely looking at the wrong dtd. my mistake.
thanks
navi