Issue
When a cloud hook is running a drush cr
while another job is executing a drush command that is using drush cache, an error can occur:
Started drupal cache rebuild for *** [success]
Cache rebuild complete.
In Filesystem.php line 181: Failed to remove directory "/home/***/.drush/cache/factory": rmdir(/home/****/.drush/cache/factory): Directory not empty
Resolution
The solution is to isolate the cache directory between processes using the DRUSH_PATHS_CACHE_DIRECTORY
variable