I have a ReportingCommand written in Python, and the SPL that feeds it is slowish.
To minimize visual churn on the screen, I don't want my command to provide intermediate results: I just want the reduce() method to get run once when all the data is ready to process.
I am using SCP 2, and I have my command annotated with run_in_preview=False, but reduce() is still getting run multiple times (with more and more input records, and preview=True is in self.metadata).
The SPL:
sourcetype=whr:sap:abap:audit | stats count, values(sourcetype) as sourcetype by sid | append [ | inputlookup whirlpool_sap_instances ] | sapabapsummarize
The command
@Configuration(requires_preop=True, run_in_preview=False)
class SapAbapSummarizeCommand(ReportingCommand):
@Configuration()
def map(self, records):
self.logger.info('SapAbapSummarizeCommand.map, phase = %s', self.phase)
r_count = 0
for record in records:
r_count = r_count + 1
yield record
self.logger.info('SapAbapSummarizeCommand.map done: %d', r_count)
@Configuration(run_in_preview=False)
def reduce(self, records):
self.logger.info('SapAbapSummarizeCommand.reduce, phase = %s', self.phase)
self.logger.info('SapAbapSummarizeCommand.reduce, metadata = %s', self.metadata)
r_count = 0
for record in records:
r_count = r_count + 1
# (other processing)
self.logger.info('SapAbapSummarizeCommand.reduce done: %d', r_count)
commands.conf:
[sapabapsummarize]
filename = sap_abap_summarize.py
chunked = true
How do I get reduce to know that all the results are in? The 'Preview' flag in the metadata is always True.
... View more