Repository: biopython/biopython

Issue:
Update NCBIWWW.py
<!--- Please read each of the following items and confirm by replacing
 !--the [ ] with a [X] --->

- [X] I hereby agree to dual licence this and any previous contributions under both
the _Biopython License Agreement_ **AND** the _BSD 3-Clause License_.

- [X] I have read the ``CONTRIBUTING.rst`` file, have run ``pre-commit``
locally, and understand that continuous integration checks will be used to
confirm the Biopython unit tests and style checks pass with these changes.

- [ ] I have added my name to the alphabetical contributors listings in the files
``NEWS.rst`` and ``CONTRIB.rst`` as part of this pull request, am listed
already, or do not wish to be listed. (*This acknowledgement is optional.*)

<!--- Briefly describe the changes included in this pull request below
 !--- starting with 'Closes #...' if appropriate --->

Closes #4595

A warning was added, that is thrown when the BLAST search takes more than 10 minutes


Discussion:
Trying to do black style by hand is silly of me...
It depends on how you have set your warnings filter. The default behavior is to show warnings only once per module per line, even on subsequent calls to the module. I thought this was the intended behavior here. A warning each poll cycle would be quite verbose.

My personal favorite solution would be that the warning could be issued for each new call to the module but, as I have understood, this would require to define a custom filter.

If you want to see each warning every time you need to set your warnings filter like so:
```python
import warnings

warnings.simplefilter('always')
```
In this case once (by default) is probably enough, but should we get any feedback wanting more warnings, we could add the request ID to the message to ensure the warning messages are different each time.
>  we could add the request ID to the message to ensure the warning messages are different each time.

I think this is a good solution. It is confusing if there is a warning after 10 minutes the first time, but the second call to qblast emits no warning no matter how long qblast takes.
Can you make that suggested change @AstraBert? Something like this (untested):

```python
            warnings.warn(
                f"BLAST request {rid} is taking longer than 10 minutes, consider re-issuing it",
                BiopythonWarning,
            )
```
Ok,

I tried with @peterjc code and here's the log for two calls of the `qblast` function within the same script:

```bash
Loading data...
Loaded
Starting BLAST for sequence zizina1_1
 /home/starsinthesky/miniforge3/lib/python3.10/site-packages/Bio/Blast/NCBIWWW.py:281: BiopythonWarning: BLAST request V0KYN85H016 is taking longer than 10 minutes, consider re-issuing it
  warnings.warn(
Writing BLAST for sequence zizina1_1
Finished
Starting BLAST for sequence zizina1_2
/home/starsinthesky/miniforge3/lib/python3.10/site-packages/Bio/Blast/NCBIWWW.py:281: BiopythonWarning: BLAST request V0M4HSZW016 is taking longer than 10 minutes, consider re-issuing it
  warnings.warn(
Writing BLAST for sequence zizina1_2
Finished
```

So, @mdehoon, I guess this can solve our doubt about whether the warning will be issued only once or more than once, if the function is called multiple times: it will be definitely thrown every time the function is called **and** exceeds the 10 minutes threshold. Apologies for the confusion I made beforehand, but I forgot to mention that I allowed all the warnings with the option suggested by @MarkusPiotrowski in his comment. 
I will then proceed with integrating the suggested change! 

All the best,
Astra

Resolving patch:
diff --git a/Bio/Blast/NCBIWWW.py b/Bio/Blast/NCBIWWW.py
--- a/Bio/Blast/NCBIWWW.py
+++ b/Bio/Blast/NCBIWWW.py
@@ -280,7 +280,7 @@ def qblast(
         # Throw a warning if search takes longer than ten minutes
         if elapsed >= 600:
             warnings.warn(
-                "Search is taking longer than 10 minutes, consider re-issuing it",
+                f"BLAST request {rid} is taking longer than 10 minutes, consider re-issuing it",
                 BiopythonWarning,
             )
 


Test patch: