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)
Possible to select successorset symbolically?
pbenn
TS 6.1 SP1 Sol 9
I'm trying to write an external task that can select a successor task symbolically. I understand I can just return the transition index from the script, but, due to some post processing that is done on the jobspec file I use, it is impossible to know for sure the ordering of successorsets in the task at run time.
Is it possible to select the transition symbolically, as opposed to by index?
jobspec code fragment. I want irc_checkClose.ipl to select/return the successorset to run by name.
<externaltask owner="xxxx" readonly="f" name="jobEnd" description="Should Job End?">
<areavpath v="/default/main/IRC/CCMC/WORKAREA/CCMC/" />
- <successors>
- <successorset description="Clean up temporary files">
<succ v="RemoveAllTmps" />
</successorset>
- <successorset description="English SEP">
<succ v="AttachIRCCostEstimate_Eng" />
</successorset>
</successors>
<command v="/cms/iw-home/iw-perl/bin/iwperl /iwmnt/default/main/IRC/CCMC/WORKAREA/CCMC/cgi-bin/irc_checkClose.ipl" />
</externaltask>
Find more posts tagged with
Comments
pbenn
Sorry, reading a bit more documentation. Is SelectTransition what I'm looking for? As in:
($success, $immediatetask) = SelectTransition($which, $comment)
Comment should be specified in UTF-8 encoding.
Selects a transition for this task. $success is a
boolean and $immediatetask is a possibly invalid
TeamSite::WFtask to run.
where $which is my transiton name?
Thanks,
P.
Adam Stoller
jobspec code fragment. I want irc_checkClose.ipl to select/return the successorset to run by name.<externaltask owner="xxxx" readonly="f" name="jobEnd" description="Should Job End?">
<areavpath v="/default/main/IRC/CCMC/WORKAREA/CCMC/" />
<successors>
<successorset description="Clean up temporary files">
<succ v="RemoveAllTmps" />
</successorset>
<successorset description="English SEP">
<succ v="AttachIRCCostEstimate_Eng" />
</successorset>
</successors>
<command v="/cms/iw-home/iw-perl/bin/iwperl /iwmnt/default/main/IRC/CCMC/WORKAREA/CCMC/cgi-bin/irc_checkClose.ipl" />
</externaltask>
I suppose you might be able to parse the workflow's XML code on the fly and determine the index associated with a given description - but I think that's a lot of work for something that might be easier to do in some other manner.
Are you saying that you're generating the WFT or job specification file (JSF) on the fly? and that as such the externaltask could be defined with different numbers of potential successors?
Is there a reason you cannot list all the possible successors statically within the WFT / JSF ?
Is there a set number of variations that are possible?
Can you give an example of the different sets of successorsets you might have for this task [plain text is fine, XML not necessary] and explain how your script is supposed to know what it wants to callback to?
If you're generating the WFT you could just as easily generate a parameter to be passed into the script - either directly or via a task-level variable - in fact (
thinking about this while writing...
), you could generate task-level variables to match your successorsets using the description as the key:
<variable key="Clean up temporary files" value="0"/>
<variable key="English SEP" value="1"/>
or using successor task names as the keys:
<variable key="RemoveAllTmps" value="0"/>
<variable key="AttachIRCCostEstimate_Eng" value="1"/>
So if you know the description or task name that you want to call back to you could retrieve it's value from the task's variables and then do a callback with that value.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Adam Stoller
Hmm - you should probably file a doc bug on WFtask.pm since nowhere in the description does it explain what
$which
is for - however, if you look at the code - you'll see that SelectTransition calls
iwtaskselect -a
taskid
"$which" "
comment
"
and if you look at the help for
iwtaskselect
you'll see:
usage: iwtaskselect [-h] [-v] [-s servername] taskID
#choice
[comment]
-h Print this message
-v Print version
-s servername Use servername as TeamSite server
taskID ID of task to change
#choice Successor set number to activate
[comment] Optional comment
so
$which
appears to be the same as
#choice
which leaves you exactly where you were before -- needing the successorset's index number.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
pbenn
The dynamic nature of my jobspec is related to the fact that we have slightly different task ownership/workflow/workareas in development, test and production environments. The subtleties of the changes required are such that I developed a build process that uses XML:
imple and template jobspec files to construct the final run time jobspec. If you have used XML:
imple, you'll know that it does not preseve ordering of the output, so I wrote code to output elements according to the jobspec DTD, but not according to the original file layout. I know (now) there are other ways to do this, but the combimation of requirements/time pressure it was the best option
Anyway, yes, I thought that passing in the transition argument/variable would be a possibility. I will always know the number of transitions at compile time, just not the ordering. I like the task variable approach, which is closest to the symbolic approach I was looking for. It's pretty cool actually.
Thanks,
P.
pbenn
Oooh, am I going to regret this? I could just check the WFTask directly for successor order ... ick
Dump from my WFTask variable:
0 TeamSite::WFtask=HASH(0x3897c0)
'id' => 200075
'xml' => ARRAY(0x61a74c)
0 'externaltask'
<...>
23 'successors'
24 ARRAY(0x5ba304)
0 HASH(0x5b5084)
empty hash
1 'successorset'
2 ARRAY(0x5b908c)
0 HASH(0x5b51f8)
'description' => 'Clean up temporary files'
1 'succ'
2 ARRAY(0x5ba4f0)
0 HASH(0x5b527c)
'v' => 200083
3 'successorset'
4 ARRAY(0x5ba580)
0 HASH(0x5b52dc)
'description' => 'English SEP'
1 'succ'
2 ARRAY(0x5ba550)
0 HASH(0x5b5360)
'v' => 200076
25 'transitionmade'
26 ARRAY(0x5ba5d4)
0 HASH(0x5b53c0)
'v' => '-1'
27 'command'
28 ARRAY(0x5ba604)
0 HASH(0x5b5420)
'v' => '/cms/iw-home/iw-perl/bin/iwperl /iwmnt/default/main/IRC/CCMC/WORKAREA/CCMC/cgi-bin/irc_checkClose.ipl'
Adam Stoller
You can do that - but it's outside the API and thus not guaranteed to work across versions of the product (although, admittedly it is unlikely to change for *this* type of workflow ... when the "new" workflow system shows up (6.7 and beyond) lots of things are likely to change - especially something like this.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com