Add debug msg when creating an output dir fails.
Clarify error message for mem allocation failure.
Add handle_app_failure() & handle_worker_failure().
All failures now go through handle_failure().  It calls handle_app_failure() and
handle_worker_failure() based on the type of failure. This simplifies code and
removes the use of goto.
Catch memory allocation failures before access.
Also update the functions to return a value signaling this failure.
Clean up WQ_RESULT_* codes. Expose them to user.
The WQ_RESULT_* codes will only signal app-level failures.
Remove WQ_RESULT_FUNCTION_FAIL.
We already return the task exit code as return_status. So the application can
check to see if the return_status indicates task execution failure.
Update the local data structure when we evict files from the worker's cache.