Testing parallel processing inline

One problem with running things from html service with google.script.run is that you don't have access to logging and execution log, so it's difficult to debug. I like to run my profile components inline first to make sure they work. Here's how you can simulate running this stuff from google.script.run in the context of a normal apps script.

This function takes your profile and executes the named function, and passes over the data just as would happen if it was called from google.script.run.

We can call that, passing each of the individual run profiles, and emulate passing the data from the previous stage just as happens when being orchestrated by the html service. Of course you can only run one thing at once, but this allows you to test all your profiles in a much more visible environment.

Notice that I use functions to set up the profiles. I use exactly the same ones when running this for real. That way I can be sure I'm testing what I'm planning to use in real life. Here's the example for the reduce function.