public static Instruction saveReplaceThreadID(Instruction inst,String pattern,String replacement) throws DMLRuntimeException {
  if (inst instanceof MRJobInstruction) {
    MRJobInstruction mrinst=(MRJobInstruction)inst;
    mrinst.updateInstructionThreadID(pattern,replacement);
  }
 else   if (inst instanceof VariableCPInstruction) {
    inst.updateInstructionThreadID(pattern,replacement);
  }
  return inst;
}

public static Instruction saveReplaceThreadID ( Instruction inst , String pattern , String replacement ) throws DMLRuntimeException { if ( inst instanceof MRJobInstruction ) { MRJobInstruction mrinst = ( MRJobInstruction ) inst ; mrinst . updateInstructionThreadID ( pattern , replacement ) ; } else if ( inst instanceof VariableCPInstruction ) { inst . updateInstructionThreadID ( pattern , replacement ) ; } return inst ; }
in - place replacement of thread ids in filenames , functions names etc
