js.output.write

From Web Computing Documentation
Jump to: navigation, search

Description

Writes the given string to the selected output.

js.output.write( name, string )


name The name of the selected output.

string The string to be written to the output.


During the lifetime of a workunit the application needs to save the resulting data of the computation. The data can be saved into output streams that are handled by the framework. These streams are moved to persistent storage during checkpointing and uploaded as the result of the workunit once it ends.

You can save data at your convinience. The more often you can produce and save data the more protection checkpointing will offer you against premature interruptions. js.output.write appends the output stream identified by the name parameter. You can also use js.output.writeLine.

Examples

var tempResult = calculate(input);
js.output.write("solution", tempResult);

The output streams are handled by the framework. You can write to as many output streams as you wish, and they can have arbitrary names. You don't need to create or initiate these streams, you can simply use js.output.write to refer to them at any time.

These streams are saved during checkpointing. What happens to these streams once the workunit finishes is determined by the work source module. If the module requests results corresponding to the name of the streams (ie. solution), they will be uploaded, while the other streams will simply be discarded.

Personal tools
Modules