internal rewrite to be more unittest/setup friendly
internal rewrite to be more unittest/setup friendly

pyfarm/pyfarm-core,guidow/pyfarm-agent,pyfarm/pyfarm-agent,pyfarm/pyfarm-agent,guidow/pyfarm-agent,pyfarm/pyfarm-agent,guidow/pyfarm-agent