You can't. At least not using built-in capabilities. This feature is only partly implemented in Gearmand and the PHP module does not expose this functionality. See this discussion on the feature.
People have tried different things, including:
- Use node.js and its timeout capabilities
- Use
at
utility - Use another queuing system - beanstalkd
When it comes to tracking failures - again, you can't, AFAIK. See my answer on handling retries in Gearman for a possible solution.