Repository: dmwm/wmcore
Issue: [MSTransferor] Failing RelVals with InputDatasets && Generating many alerts

**Impact of the bug**
MSTransferor

**Describe the bug**
While validating the WMCv2.2.0 I found that  we are now failing workflows which are having the combination of settings:
* "SubRequestType": "RelVal"
*  "InputDataset": "/\\*/\\*/\\*"

The error we observe is [1]. It is due to a line which was overlooked/removed during the refactoring of the MSTransferor's code to stop handling pileup data:
https://github.com/dmwm/WMCore/blob/af74fd58b50865142f58f7e93f250ee58c3e6cc5/src/python/WMCore/MicroService/MSTransferor/MSTransferor.py#L411-L414

Before it was like that:
https://github.com/dmwm/WMCore/blob/02dbc79a902de1010b3312b35da2cfc2845ab571/src/python/WMCore/MicroService/MSTransferor/MSTransferor.py#L445-L449

So currently if the `makeTransferRequest` method is called for a `RelVal` (obviously with input data) we will hit this bug.   
Need to be mentioned though, some of those workflows do pass through, because if the input data is already in place (e.g. due to previous validation campaigns)  the `makeTransferRequest` method is simply skipped. So we were quite lucky to find this bug with only one out of 6 possible workflows from our set of templates hitting the exception.  

As a consequence of the above mechanism an immediate alert is shot from here:
https://github.com/dmwm/WMCore/blob/af74fd58b50865142f58f7e93f250ee58c3e6cc5/src/python/WMCore/MicroService/MSTransferor/MSTransferor.py#L217

Which contributes to the already too many that we are having. 

**How to reproduce it**
Send a RelVal with InputDataset to testbed 

**Expected behavior**
To have the `rses` variable always defined also for RelVals with input data.

**Additional context and error message**
[1]
```
2023-04-12 13:27:51,715:INFO:MSTransferor: Handling data subscriptions for request: *****_TC_PY3_Data_LumiList_Apr2023_Val_Val_230407_165853_5503
2023-04-12 13:27:51,719:ERROR:MSTransferor: 	Error: local variable 'rses' referenced before assignment
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/WMCore/MicroService/MSTransferor/MSTransferor.py", line 214, in execute
    success, transfers = self.makeTransferRequest(wflow, rseList)
  File "/usr/local/lib/python3.8/site-packages/WMCore/MicroService/MSTransferor/MSTransferor.py", line 414, in makeTransferRequest
    if not rses:
UnboundLocalError: local variable 'rses' referenced before assignment

```

Changed files:
src/python/WMCore/MicroService/MSTransferor/MSTransferor.py

diff --git a/src/python/WMCore/MicroService/MSTransferor/MSTransferor.py b/src/python/WMCore/MicroService/MSTransferor/MSTransferor.py
index ddc31c339..56ef8d50f 100644
--- a/src/python/WMCore/MicroService/MSTransferor/MSTransferor.py
+++ b/src/python/WMCore/MicroService/MSTransferor/MSTransferor.py
@@ -411,6 +411,9 @@ class MSTransferor(MSCore):
             if not isRelVal(wflow.data):
                 # enforce RSE quota
                 rses = list(set(rseList) & self.rseQuotas.getAvailableRSEs())
+            else:
+                rses = rseList
+
             if not rses:
                 msg = f"Workflow: {wflow.getName()} could have data placed at: {rseList}, "
                 msg += "but those are all out of quota. Skipping it till next cycle"