public static ArrayList<String> exportResultVariables(long workerID,LocalVariableMap vars,ArrayList<String> resultVars) throws DMLRuntimeException, IOException {
  ArrayList<String> ret=new ArrayList<String>();
  for (  String rvar : resultVars) {
    Data dat=vars.get(rvar);
    if (dat != null && dat.getDataType() == DataType.MATRIX) {
      MatrixObject mo=(MatrixObject)dat;
      if (mo.isDirty()) {
        mo.exportData();
        ret.add(ProgramConverter.serializeDataObject(rvar,mo));
      }
    }
  }
  return ret;
}

public static ArrayList < String > exportResultVariables ( long workerID , LocalVariableMap vars , ArrayList < String > resultVars ) throws DMLRuntimeException , IOException { ArrayList < String > ret = new ArrayList < String > ( ) ; for ( String rvar : resultVars ) { Data dat = vars . get ( rvar ) ; if ( dat != null && dat . getDataType ( ) == DataType . MATRIX ) { MatrixObject mo = ( MatrixObject ) dat ; if ( mo . isDirty ( ) ) { mo . exportData ( ) ; ret . add ( ProgramConverter . serializeDataObject ( rvar , mo ) ) ; } } } return ret ; }
for remote spark parfor workers . this is a simplified version compared to mr .
