Writing a program which uses single files to large to fit in the memory of normal desktops or laptops, I thought it would be nice to dispatch on the available memory relative to some expected required memory. In case the available memory is not enough to fit the data and overhead, the function should dispatch and use load only the first couple of entries. This preview should be enough to write a analysis routine on a laptop. Once everything is figured out, the routine could be submitted to a HPC cluster.
I have read the docs but need some clarification.
Some thing similar to vmstat -s | grep "free memory" | awk '{print $1 $2}'
I came up this
function getFreeMemory()
run(pipeline(`vmstat -s`, `grep "free memory"`, `awk '{print $1}'`))
end
However, running: freeMem = getFreeMemory()
prints the number and returns the ProcessChain:
8064912
Base.ProcessChain(Base.Process[Process(vmstat -s
, ProcessExited(0)), Process(grep 'free memory'
, ProcessExited(0)), Process(awk '{print $1}'
, ProcessExited(0))], Base.DevNull(), Base.DevNull(), Base.DevNull())
How could I catch the number (and discard the ProcessChain)?