🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
8 messages
8 total messages Started by Anne Wilson Fri, 05 Oct 2001 15:24
piping via newsfeeds problem
#54539
Author: Anne Wilson
Date: Fri, 05 Oct 2001 15:24
60 lines
3518 bytes
Hi there!

I am testing the possibility of using a news server to transmit
meteorological data products.  Since this data is binary, I use a simple
encoding to make it acceptable to INN for transmission.  My encoding
program is called 'makeArticle' and here's how I use it:

./makeArticle <  <rawFileName> | inews -h -S 


On the backend, I have written a program, called 'retrieveArtAsProd',
that takes an article token as input.  Then it uses the sm to grab the
article and decode it.  The idea is to get back the original data
product that I transmitted.

I am testing only on my local machine.  My program works great when I
run it from the command line, giving it an article token as input.  I
get back the identical data product that I posted via inews.  The
command looks like:

./retrieveArtAsProd <  <tokenFileName>  >  /opt/news/test/sent.out

However, when I try to get the same thing to happen via newsfeeds, the
end of the file is always chopped off.  Here is my newsfeeds entry:

test!:!*,unidata.hds\
        :Tc,Wn:\
        /opt/news/util/dataProdHandlers/retrieveArtAsProd >
/opt/news/test/sent.out

In this case, the file sent.out is always too short.  The chopping
always occurs on a byte that is a power of 8 boundary, e.g. in one case,
the product is chopped on byte 1100000 base 8, in another case it's
chopped on 2450000 base 8, and in a third case it's chopped on 2240000
base 8.   I've tried 'ctlinnd flush test!' and 'ctlinnd flush ""' to
ensure that nothing's hanging around in a buffer, but that doesn't make
any difference.

I believe my program is completely debugged, so at this point I'm not
even sure what to look at.  Any suggestions??

Also, there's another wierdness.  Sometimes when I post the data
product, the file sent.out never appears!  This is especially odd.  It
seems periodic - just sometimes for a little while my posting via inews
generates no resulting file.   I've done this up to three or four times
in a row.   Then if I wait a little while and post again the file is
created.  What the heck is up???

Any tips are greatly appreciated.  Thanks!!

Anne
-- 
***************************************************
Anne Wilson			UCAR Unidata Program		
anne@unidata.ucar.edu		       P.O. Box 3000
              			  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************
Re: piping via newsfeeds problem
#54558
Author: Jeffrey M. Vinocur
Date: Sat, 06 Oct 2001 22:35
40 lines
2195 bytes
In article <3BBDD092.D1CF35F8@unidata.ucar.edu>,
Anne Wilson  <anne@unidata.ucar.edu> wrote:
>
>I am testing the possibility of using a news server to transmit
>meteorological data products.

Interesting...should I ask why?


>test!:!*,unidata.hds\
>        :Tc,Wn:\
>        /opt/news/util/dataProdHandlers/retrieveArtAsProd >
>/opt/news/test/sent.out

You realize that every time you process an article it will
overwrite the previous result?


>In this case, the file sent.out is always too short.

Hmm.  Can you modify retrieveArtAsProd to always concatenate some
information to something like /opt/news/test/retrieve.log?  You
would probably know better than I what to log.


>Also, there's another wierdness.  Sometimes when I post the data
>product, the file sent.out never appears!  This is especially odd.  

Look in the "news" log file (should be in the same directory as
news.notice and friends).  There should be a line for each
article the server sees, and at the end of the line a list of
what feeds were notified of that article.  Check the log and see
if your posting appears at all, and if so if "test!" is listed as
an outbound feed.


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: piping via newsfeeds problem
#54561
Author: Andrew Gierth
Date: Sun, 07 Oct 2001 02:00
26 lines
1951 bytes
>>>>> "Jeffrey" == Jeffrey M Vinocur <jeff@litech.org> writes:

 >> test!:!*,unidata.hds\
 >> :Tc,Wn:\
 >> /opt/news/util/dataProdHandlers/retrieveArtAsProd >
 >> /opt/news/test/sent.out

 Jeffrey> You realize that every time you process an article it will
 Jeffrey> overwrite the previous result?

Actually, it won't; the sent.out file will be clobbered every time the
channel command is respawned (which happens if it exits, or the
channel is flushed or restarted, or if the newsfeeds file or active
file is reloaded, etc.)

My inclination, though, would be to have the channel program do all
the file manipulations (even if it's just a trivial script wrapper
round the real program).

My guess is that the problem is actually caused by failure to flush
the output _within_ the channel program (using ctlinnd won't help with
that).

-- 
Andrew.
Re: piping via newsfeeds problem
#54562
Author: Jeffrey M. Vinocur
Date: Sun, 07 Oct 2001 03:38
45 lines
2315 bytes
In article <87n134ryyq.fsf@erlenstar.demon.co.uk>,
Andrew Gierth  <andrew@erlenstar.demon.co.uk> wrote:
>>>>>> "Jeffrey" == Jeffrey M Vinocur <jeff@litech.org> writes:
>
> >> test!:!*,unidata.hds\
> >> :Tc,Wn:\
> >> /opt/news/util/dataProdHandlers/retrieveArtAsProd >
> >> /opt/news/test/sent.out
>
> Jeffrey> You realize that every time you process an article it will
> Jeffrey> overwrite the previous result?
>
>Actually, it won't; the sent.out file will be clobbered every time the
>channel command is respawned

Oh, duh.  I wasn't paying enough attention.  (It registered that
she's using a channel feed, but since I *just* wrote a script
that required a program feed, I had that in mind anyway.)


>My inclination, though, would be to have the channel program do all
>the file manipulations

Agreed, definitely.  


>(even if it's just a trivial script wrapper round the real
>program).

Especially since INN has to spawn a shell anyway to do the
redirection, no?


>My guess is that the problem is actually caused by failure to flush
>the output _within_ the channel program (using ctlinnd won't help with
>that).

Hmm, makes sense.  Question to the OP...in what language are you
coding?


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: piping via newsfeeds problem
#54575
Author: Anne Wilson
Date: Mon, 08 Oct 2001 19:59
52 lines
3006 bytes
"Jeffrey M. Vinocur" wrote:
> 
> In article <3BBDD092.D1CF35F8@unidata.ucar.edu>,
> Anne Wilson  <anne@unidata.ucar.edu> wrote:
> >
> >I am testing the possibility of using a news server to transmit
> >meteorological data products.
> 
> Interesting...should I ask why?
> 

Sure.  We currently maintain our own network of sites at universities
and labs that run our own home grown software to transmit data products
for the purpose of research and education in atmospheric sciences. 
Currently we have over 160 pariticpating sites in this particular
network.  (Other networks have been set up using the same software.) 
I'm investigating the next generation.  INN looks great in many ways. 
The devil may be lurking in the details.

I posted to this group many months ago about this work.  I often get
pulled off on other stuff.  I need a few more of me...


> >Also, there's another wierdness.  Sometimes when I post the data
> >product, the file sent.out never appears!  This is especially odd.
> 
> Look in the "news" log file (should be in the same directory as
> news.notice and friends).  There should be a line for each
> article the server sees, and at the end of the line a list of
> what feeds were notified of that article.  Check the log and see
> if your posting appears at all, and if so if "test!" is listed as
> an outbound feed.
> 

I did see that the article was posted in the log.  I glanced at the
'news' file, but I'll take a better look.

Anne

> --
> Jeffrey M. Vinocur
> jeff@litech.org

-- 
***************************************************
Anne Wilson			UCAR Unidata Program		
anne@unidata.ucar.edu		       P.O. Box 3000
              			  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************
Re: piping via newsfeeds problem
#54576
Author: Anne Wilson
Date: Mon, 08 Oct 2001 20:23
71 lines
3900 bytes
Andrew Gierth wrote:
> 
> >>>>> "Jeffrey" == Jeffrey M Vinocur <jeff@litech.org> writes:
> 
>  >> test!:!*,unidata.hds\
>  >> :Tc,Wn:\
>  >> /opt/news/util/dataProdHandlers/retrieveArtAsProd >
>  >> /opt/news/test/sent.out
> 
>  Jeffrey> You realize that every time you process an article it will
>  Jeffrey> overwrite the previous result?
> 
> Actually, it won't; the sent.out file will be clobbered every time the
> channel command is respawned (which happens if it exits, or the
> channel is flushed or restarted, or if the newsfeeds file or active
> file is reloaded, etc.)
> 

Yeah, it appends.

> My inclination, though, would be to have the channel program do all
> the file manipulations (even if it's just a trivial script wrapper
> round the real program).
> 
> My guess is that the problem is actually caused by failure to flush
> the output _within_ the channel program (using ctlinnd won't help with
> that).
> 

mmm, that could be.  But, why would it work properly from the command
line?  What's different?

Also, Jeffrey mentioned having the program log some info.  I did have it
log byte counts to stderr and it appeared to be processing the entire
data product.  Clearly, I'll have to get more information out of it.

Like you both pointed out, I will ultimately need unique file names. 
I'll have to extract some information out of the data product for that
purpose.  

The way our current system works is cool, although difficult for users
who are non computer people.  We use regular expressions to match
products IDs.  Portions of the regular expression can be parenthesized,
and those parts of the product ID that match the parenthesized portion
of the regexp can be used in the file name.  This all happens via a
configuration file.  here's an example that uses the 2nd and 3rd
parenthesized expression in the file name (the product ID is something
like L2-<something>/KWBC/yyyymmddhhmmss):

^L2-([^/]*)/(....)/([0-9][0-9][0-9][0-9][0-1][0-9][0-3][0-9][0-2][0-9][0-5][0-9][0-9][0-9]) 
FILE    data/nexradII/compressed/\2/\3.raw

It would be nice if I could do something similar via newsfeeds, but
that's looking doubtful to me at this point.  Since I need to run
products through this "decoder" anyway, maybe that's the way to handle
extracting such info...  

Anne

> --
> Andrew.

-- 
***************************************************
Anne Wilson			UCAR Unidata Program		
anne@unidata.ucar.edu		       P.O. Box 3000
              			  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************
Re: piping via newsfeeds problem
#54581
Author: Anne Wilson
Date: Mon, 08 Oct 2001 20:28
34 lines
2145 bytes
"Jeffrey M. Vinocur" wrote:
>
> >(even if it's just a trivial script wrapper round the real
> >program).
> 
> Especially since INN has to spawn a shell anyway to do the
> redirection, no?
> 

I guess so - good point.


> >My guess is that the problem is actually caused by failure to flush
> >the output _within_ the channel program (using ctlinnd won't help with
> >that).
> 
> Hmm, makes sense.  Question to the OP...in what language are you
> coding?
> 

I'm currently writing in C.   

Thanks, Jeffrey and Andrew!  I really appreciate the help.

Anne
-- 
***************************************************
Anne Wilson			UCAR Unidata Program		
anne@unidata.ucar.edu		       P.O. Box 3000
              			  Boulder, CO  80307
----------------------------------------------------
Unidata WWW server       http://www.unidata.ucar.edu/
****************************************************
Re: piping via newsfeeds problem
#54584
Author: Jeffrey M. Vinocur
Date: Mon, 08 Oct 2001 21:26
41 lines
2397 bytes
In article <3BC20B5E.5571C5AC@unidata.ucar.edu>,
Anne Wilson  <anne@unidata.ucar.edu> wrote:
>Andrew Gierth wrote:
>> 
>> My guess is that the problem is actually caused by failure to flush
>> the output _within_ the channel program (using ctlinnd won't help with
>> that).
>
>mmm, that could be.  But, why would it work properly from the command
>line?  What's different?

If you run it on the commandline as 

  cat | ./retrieveArtAsProd > /opt/news/test/sent.out

And then manually paste the storage token into stdin, do you get
the truncated file?  And then if you give it ^D do you get the
rest?


>parenthesized expression in the file name (the product ID is something
>like L2-<something>/KWBC/yyyymmddhhmmss):
>
>^L2-([^/]*)/(....)/([0-9][0-9][0-9][0-9][0-1][0-9][0-3][0-9][0-2][0-9][0-5][0-9][0-9][0-9]) 
>FILE    data/nexradII/compressed/\2/\3.raw
>
>It would be nice if I could do something similar via newsfeeds, but

*laugh*  I think that might be a bit much.  The decoder has all
of the same information that INN does (in fact, more), anyway.

Actually...if you want to use a channel feed you need the decoder
(or a wrapper thereon) to open the appropriate file anyway,
because otherwise it will all go to the same file.



-- 
Jeffrey M. Vinocur
jeff@litech.org
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads