in reply to Using MCE to write to multiple files.
...number of output files are not consistent with the size of my input ie....what's wrong?
What is supposed to happen?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using MCE to write to multiple files.
by etheleon (Novice) on Nov 22, 2014 at 03:57 UTC | |
| [reply] |
by Anonymous Monk on Nov 22, 2014 at 05:03 UTC | |
since the array @data_input held 10 elements, i should get 10 files output but i don't. Um, there is @input_data, and it has 100 elements, :) But ok, are you using fork or threads? Try getting MCE to choose fork, then repeat your test with treads ... if there is a difference between the two, then there is a bug in one of the backends, or it hasn't finished running If both fork/threads backends behave the same, then there might be a problem with your logic I've not scrutinized your code, but $tmp{$chunk_id} stuff looks like it will never make any difference :) But if you want something to compare, try
| [reply] [d/l] [select] |
by BrowserUk (Patriarch) on Nov 22, 2014 at 13:23 UTC | |
Damn! That's a complicated way of doing something very simple. It took me forever to work out where $chunkIds originated. They start life as an integer list wrapped in a anonymous array:
And get past individually to AddJob() here:
Where they get pushed individually, but wrapped in individual anonymous arrays, onto the queue here:
Then those anonymous array refs get dequeued here:
And the individual integer are then unwrapped from them here:
Before being passed to where they actually get used to number some files here:
All of that to achieve the equivalent of:
Here's a simpler version that avoids the obfuscation:
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
by marioroy (Prior) on Dec 13, 2014 at 01:42 UTC | |
It seems that output order is not necessary for the use-case. The issue mentioned may be coming from say $output (not appending \n to the file for me, instead getting a GLOB message to STDOUT). Btw, I ran your code and it ran fine. I only changed say $output to print $output "\n"; All files had 10 results -- all identical -- all same size. Back to MCE, the following processes @input_data in parallel. Am using the MCE::Loop Model versus using the Core API.
Notice how mce_loop wraps around the serial code to enable parallelism. Also see https://metacpan.org/pod/MCE::Loop#GATHERING-DATA if wanting to gather data back to the Manager process. | [reply] [d/l] |
by etheleon (Novice) on Nov 24, 2014 at 08:12 UTC | |
| [reply] |
by Anonymous Monk on Nov 24, 2014 at 10:32 UTC | |