Login  Register

Re: Re: Re: Re: can't get 2 processor in 1 pipeline to work

Posted by James Liang on May 13, 2011; 12:14am
URL: https://discuss.orbeon.com/can-t-get-2-processor-in-1-pipeline-to-work-tp3514050p3519029.html

Thanks everyone for helping me sort this out!  I've got it working.

I am still a bit unclear why the solution worked :)  One of the
changes I made to dir2.xpl was to include a null-serializer to sink
the input (see below).

Notice that  the output of null-serializer is not fed into the input
of the the directory-scanner.  Yet, both processors were executed in
sequence.  So why is it ok that sometimes the output of one processor
doesn't need to feed into another?

This issue isn't critical.  I just feel like there is still a gap in
my understanding of the pipeline evaluation strategy.

dir2.xpl:

<p:config
        xmlns:p="http://www.orbeon.com/oxf/pipeline"
        xmlns:sql="http://orbeon.org/oxf/xml/sql"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:oxf="http://www.orbeon.com/oxf/processors"
        xmlns:xi="http://www.w3.org/2001/XInclude">

  <p:param type="input" name="instance" />
  <p:param type="input" name="dir_result" />
  <p:param type="output" name="data" />
       
  <p:processor name="oxf:null-serializer">
      <p:input name="data" href="#dir_result"/>
  </p:processor>
       
  <p:processor name="oxf:directory-scanner">
    <!-- The configuration can often be inline -->
    <p:input name="config">
      <config>
        <base-directory>file:.</base-directory>
        <include>**/*.sh</include>
        <case-sensitive>false</case-sensitive>
      </config>
    </p:input>
    <p:output name="data" ref="data" debug="" />
  </p:processor>
       
</p:config>


-Thanks,
James



On Thu, May 12, 2011 at 12:55 AM, Florian Schmitt
<[hidden email]> wrote:

> James,
>
>> Unfortunately, connecting the 2 processors did not work.
>
> hmm - ok. I think connecting the processors is only part of the
> solution. In your example code, the output of the second processor is
> still in no way dependend on the output of the first one, so "lazy
> evaluation" still may omit the first processor when generating the
> output of the second one.
>
> If this is correct, one solution would be to make the output of both
> processors relevant to the reslut of the XPL, for example by aggregating
> them (using the identity processor [1]), or by evaluating the content of
> the first processor's output. In pseudocode:
>
> p:pipeline input=in output=out
>    p:processor id=first, input=#in output=firstresult (true|false)
>    p:choose href=#firstresult
>        p:when test=true
>            p:processor id=second output=finalresult ref=out
>        p:otherwise
>           (generate null document, throw exception or anything else)
>   /p:choose
> /p:pipeline
>
> Another (and easier) solution would be to let the "Null serializer" [2]
> consume the output of the first processor. This way, the XPL engine has
> to access the output of the first processor, but just to discard it.
> Pseudocode again:
>
> p:pipeline input=in output=out
>    p:processor id=first, input=#in output=firstresult
>    p:nullserializer input=#firstresult (no output, sort of /dev/null)
>
>    p:processor id=second output=finalresult ref=out
> /p:pipeline
>
> If the second processor depends on the succesful execution of the first
> one, i would recommend using p:choose (as in my first example) to
> express this dependency explicitly in the XPL code.
>
> HTW (hope this works ;) )
> florian
>
>
> [1]
> http://wiki.orbeon.com/forms/doc/developer-guide/processors-other#TOC-Identity-processor
> [2]
> http://wiki.orbeon.com/forms/doc/developer-guide/processors-other-serializers#TOC-Null-serializer
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws