Repository: dmwm/wmcore
Issue: ReqMgr2MS 'info' API returning 500 Internal Server Error

**Impact of the bug**
ReqMgr2MS

**Describe the bug**
I'm still investigating where and what exactly the error is. However, it looks like that if we request `info` for a given request that has already been handled by MSTransferor, it returns a `500 Internal Server Error` to the end user. There are no traces in the logs besides the DEBUG log where the transferinfo document gets requested.
 
**How to reproduce it**
Assign a workflow, wait MSTransferor to process it, then make a GET request to:
https://alancc7-cloud1.cern.ch/ms-transferor/data/info?request=amaltaro_StepChain_DupOutMod_Jan2020_Val_200121_121530_5515

**Expected behavior**
This API should return a very short summary of the service, and the TRANSFER document for the request provided (if it exists).

**Additional context and error message**
All I see in the logs is:
```
2020-01-21 12:26:39,760:INFO:MSManager: Total transferor execution time: 208.38 secs
2020-01-21 12:27:21,991:DEBUG:Service: getData: 
	url: transferinfo/amaltaro_StepChain_DupOutMod_Jan2020_Val_200121_121530_5515
	verb: GET
	incoming_headers: {}
	data: {}

```


Changed files:
src/python/WMCore/MicroService/Unified/MSManager.py, src/python/WMCore/MicroService/Unified/MSMonitor.py, src/python/WMCore/MicroService/Service/Data.py

diff --git a/src/python/WMCore/MicroService/Service/Data.py b/src/python/WMCore/MicroService/Service/Data.py
index 6ea048c28..61e9b57dc 100644
--- a/src/python/WMCore/MicroService/Service/Data.py
+++ b/src/python/WMCore/MicroService/Service/Data.py
@@ -90,7 +90,10 @@ class Data(with_metaclass(Singleton, RESTEntity, object)):
                'microservice': self.mgr.__class__.__name__}
 
         if kwds.get('API') == "status":
-            res.update(self.mgr.status(kwds.get("service")))
+            detail = kwds.get("detail", True)
+            if detail not in (True, "true", "True", "TRUE"):
+                detail = False
+            res.update(self.mgr.status(detail))
         elif kwds.get('API') == "info":
             res.update(self.mgr.info(kwds.get("request")))
         return results(res)
diff --git a/src/python/WMCore/MicroService/Unified/MSManager.py b/src/python/WMCore/MicroService/Unified/MSManager.py
index a91db8e75..c2e2dcd1c 100644
--- a/src/python/WMCore/MicroService/Unified/MSManager.py
+++ b/src/python/WMCore/MicroService/Unified/MSManager.py
@@ -156,34 +156,34 @@ class MSManager(object):
         :param reqName: request name
         :return: data transfer information for this request
         """
+        data = {"request": reqName, "transferDoc": None}
         if reqName:
             # obtain the transfer information for a given request records from couchdb for given request
             if 'monitor' in self.services:
-                data = self.msMonitor.reqmgrAux.getTransferInfo(reqName)
+                transferDoc = self.msMonitor.reqmgrAux.getTransferInfo(reqName)
             elif 'transferor' in self.services:
-                data = self.msTransferor.reqmgrAux.getTransferInfo(reqName)
-            if not data:
-                data = {"request": reqName}
-        else:
-            data = {"request": ""}
+                transferDoc = self.msTransferor.reqmgrAux.getTransferInfo(reqName)
+            if transferDoc:
+                # it's always a single document in Couch
+                data['transferDoc'] = transferDoc[0]
         return data
 
     def delete(self, request):
         "Delete request in backend"
         pass
 
-    def status(self, service=None):
+    def status(self, detail):
         """
         Return the current status of a MicroService and a summary
         of its last execution activity.
-        :param service: string with the service name.
-            Supported names are: transferor or monitor
+        :param detail: boolean used to retrieve some extra information
+          regarding the service
         :return: a dictionary
         """
         data = {"status": "OK"}
-        if service and service == "transferor":
+        if detail and 'transferor' in self.services:
             data.update(self.statusTrans)
-        elif service and service == "monitor":
+        elif detail and 'monitor' in self.services:
             data.update(self.statusMon)
         return data
 
diff --git a/src/python/WMCore/MicroService/Unified/MSMonitor.py b/src/python/WMCore/MicroService/Unified/MSMonitor.py
index d754bcd10..c9a07b08a 100644
--- a/src/python/WMCore/MicroService/Unified/MSMonitor.py
+++ b/src/python/WMCore/MicroService/Unified/MSMonitor.py
@@ -136,7 +136,7 @@ class MSMonitor(MSCore):
         :param transferRecords: list of transfer records
         """
         # FIXME: create concurrent phedex calls using multi_getdata
-        tstamp = time.time()
+        tstamp = int(time.time())
         for doc in transferRecords:
             self.logger.debug("Checking transfers for: %s", doc['workflowName'])
             for rec in doc.get('transfers', []):