function [OK, serVal, serWarnings] = remoteRetrievalSerDeser(key, keysToRemove)
% Retrieve value from value store
% val is either the stored value, or any error thrown

% Copyright 2021 The MathWorks, Inc.

wc = parallel.internal.general.WarningsCollector();
try
    [OK, val] = spmdlang.remoteRetrievalPlain(parallel.internal.pool.optionallyDeserialize(key), keysToRemove);
    serVal = parallel.internal.pool.optionallySerialize(val);
catch E
    serVal = parallel.internal.pool.optionallySerialize(E);
    OK = false;
end
serWarnings = parallel.internal.pool.optionallySerialize(wc.Warnings);


end
