I have a M/R script that goes directly from getInp...
# suitescript
m
I have a M/R script that goes directly from getInputData stage and directly to summarize. I can see the array being built that is sent to the map stage in the logs, but nothing happens in map or reduce. The only thing I can think of is it might come up against a memory limit? The script isn't showing as failed, but only has logs in in getInputData and summarize stages.
e
You'll probably have to share your
getInputData
and maybe your
map
stages.
m
Copy code
const getInputData = (inputContext) => {
        try {
            const inputBuilder = new InputBuilder();
            const inputBuilderModel = inputBuilder.initialize()
                .getDefaultPeriods()
                .getAgencies()
                .getItems()
                .getMonthlyLimits()
                .build();
            return inputBuilderModel;
        } catch (err) {
            log.emergency("scriptname->getInputData->error", err);
        }
    };

const map = (mapContext) => {
        log.debug("scriptname->map->mapContext", mapContext);
});
I didn't think it would be helpful because as you can see a lot of it is abstracted elsewhere.
But the first line of map is a debug log and it never reaches it. But I can see that it reaches the build stage and is looping through and building the model.
We rarely do so much logic in getInputData but in we were consolidating cascading mapreduce scripts into a single script. It worked fine in sandbox but once we moved to production this happens. It could be because there is more active customers in production.
It's not length of time because it finishes in 2 minutes.
This is what the build stage returns.
Copy code
this.build = function() {
            const inputResultsModel = [];
            ... do a bunch of logic
            return inputResultsModel;
        };
e
Any errors reported in
summarize
?
Believe it's
context.inputSummary.error
context
here being the input parameter to
summarize()
m
No...although I think I might have figured it out by following the logs more in depth. I think that there is an inner loop that pushes into the inputModel that in some cases much not be reached. So it appeared it was doing a lot but nothing was being added.
1
e
My next suggestion was going to be to log
inputBuilderModel
and
inputResultsModel
, just to make sure they contain exactly what you expect
m
It would be too much to log. But yeah I logged the count of items in it and it was zero. That got me to look deeper.
1
e
You could always log a slice of it (assuming an Array) instead of the whole thing; glad you've got a track
m
Yeah I have a chunked logging that I abstracted in a function and I use that earlier in the process where I want to actually know all the values. But it's not a bad idea to log at least 1 element to make sure the structure is what's expected. I was able to resolve. turns out there wasn't a fallback to default periods when it wasn't being determined by a specific shipdate.
1
e
Yeah my typical approach when stepping through big datasets like this is to log the total
length
then the first 3-5 elements, just to verify
m
Yeah at minimum the length would have been important I need to make at least that a practice. So relieved that was it, I was worried I was going to have to break it back out into 2 M/R scripts.