-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiplex output to files? #59
Comments
Hmmm I'm cool with having it in core recs, just not certain what the interface should be... I think it seems reasonable to me to have multiplex be able to do it... Another options would be to add a -o flag to all recs commands, like --filename-key that lets you output to a named file (which seems reasonable) and then let multiplex be able to interpolate command names based on a clumping record... Would be cool to have the latter, but the former is much more usable. I'll also ping @amling to see what he thinks |
I'm also not sure the right combination of primitives to pull this off, Something we've thought about previously was having line output commands That's sort of the minimum of multiplex+tocsv not destroying the data. End-to-end this makes it:
We could also split --file into --file-key (-f) and --file-eval (-F) and
Keith On Wed, May 06, 2015 at 10:31:11AM -0700, Ben Bernard wrote:
|
Keith and I talked about this for a long while today... we think probably the best thing to do is to build it into multiplex...
would output to a file named foo-FOO_VALUE for each clump, with the output of tocsv Similarly you could use -O to provide evalable perl to generate the filename
We thought about tofiles for a long time, but in the end it just seemed to be duplicating multiplex clumping without much value.... Thoughts? |
Sounds good! I agree about duplicating the multiplex clumping without much value, and that's why I also had settled on option one instead of option two when thinking this through. Unless you or Keith have a burning desire to implement this, I'll probably take a swing at it in the next few weeks. |
Occasionally I reach for
recs multiplex
when I want to split a record stream into multiple files. For example,recs multiplex -k foo -- recs-tocsv
works great, except all of the CSV output goes to stdout. When I'm using an output format without a distinct marker to split on, I usually work around this limitation using some combination ofrecs
piped toparallel
running therecs to...
command.recs chain
andrecs generate
seem like they would almost allow me to multiplex to separate files, but eithergenerate
needs to support outputting non-records orchain
needs to support some sort of interpolation likegenerate
(ick).In terms of supporting this feature, I see two options:
multiplex
itself. Something like--output-filename-key=<keyspec>
or--output-filename=<snippet>
on which output is written to for each group. The filename key or evaluated snippet would be added to the set of keys records are grouped upon.multiplex
to do this, for example:recs multiplex -k foo -- recs-tofiles -k filename -- recs-tocsv
I think option one is cleaner than option two, both in terms of implementation and command line syntax. Option two however is implementable outside of core recs.
Is this feature worth having in core recs? General thoughts?
The text was updated successfully, but these errors were encountered: