简体   繁体   中英

Persisting data across SuiteScript 2.0 map/reduce stages

I am continually beating my head up against this desired feature, but I can't seem to find it in any of the NS2.x documentation.

I would like to persist script-runtime data across the multiple stages in the map/reduce architecture. For example: start time of getInputData stage, number of records processed, configuration data, etc.

However, all features seem to be designed to prevent this. Much of it (such as the configuration data) I've put into cache storage (via N/cache interface), but this comes with problems such as cache persisting across instances of the script running that will use an outdated or other-deployment configuration. I've had to create a per-session key of date/timestamp+user to keep things unique where necessary.

There is a Session object off of the N/runtime module, but this blanks itself out between stages, so it does not run on a true execution instance scope-- which is what I would expect a "session" to be. I have verified this with Debug trace that show the Session object to be non-blank at end of getInputData() stage, but completely empty when reaching the summary() stage. Even writing to the summaryContext does not seem useful or helpful, as only brief summary data can be written there.

Any help (or pointing to an already-answered question) would be useful; I can't seem to find this discussed anywhere on NetSuite help forums or on StackOverflow at all.

Why not store what you want on a document using the N/file? I mean it's expensive, but should work without any conflicts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM