Is it possible for a task to fail fast (asynchronously) for missing external dependencies?

I have an integration test task which I typically run along with some other tasks. For example, I would run ‘gradle test intTest’. The intTest task depends on an external database which isn’t available sometimes. However, the build typically takes 5 or more minutes to reach the point where it discovers that the database isn’t available. When it does it fails. Then I go and reset the database and rerun the tests (which then test). This can add a lot of waste to my development cycle.

I would like to be able to tell the intTest task that it has a verification step which should be run asynchronously that can mark it as failed before it is run normally. This step may depend on other tasks having been completed (it might for instance use a compiled class to do its verification). When the verification fails, I would want a message to be cached so that when the intTask is supposed to be run, it can immediately fail with that message.

I think this is a general use feature. I can imagine a build task that depends on a URL being accessible (such as a Sonar system that may only be accessible through SSH). If the developer forgets to login to SSH the build will fail, but perhaps only after a timeout. Starting this timeout asynchronously could significantly reduce their apparent build time.