Write pig meta data only when pig is avaliable

Write pig meta data only when pig is avaliable