Repository: rucio/rucio

Issue:
Documentation build fails
Motivation
----------
Currently the documentation builds fail with 

```
Running Sphinx v1.6.5
making output directory...
loading translations [en]... done

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/rucio/envs/latest/local/lib/python2.7/site-packages/sphinx/cmdline.py", line 305, in main
    opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/rucio/envs/latest/local/lib/python2.7/site-packages/sphinx/application.py", line 196, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/rucio/envs/latest/local/lib/python2.7/site-packages/sphinx/application.py", line 456, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/rucio/envs/latest/local/lib/python2.7/site-packages/sphinx/registry.py", line 199, in load_extension
    raise ExtensionError(__('Could not import extension %s') % extname, err)
ExtensionError: Could not import extension rucio.common.doc.argparse.ext (exception: No module named rucio.common.doc.argparse.ext)

Extension error:
Could not import extension rucio.common.doc.argparse.ext (exception: No module named rucio.common.doc.argparse.ext)
```

I did not look too much into the issue yet, but I wonder why we added this `rucio.common.doc.argparse.ext` to the repository instead of using `sphinx-argparse`? @vingar do you maybe remember?


Discussion:

Resolving patch:
diff --git a/lib/rucio/daemons/reaper/reaper.py b/lib/rucio/daemons/reaper/reaper.py
--- a/lib/rucio/daemons/reaper/reaper.py
+++ b/lib/rucio/daemons/reaper/reaper.py
@@ -17,6 +17,7 @@
 # - Martin Barisits <martin.barisits@cern.ch>, 2016
 # - Thomas Beermann <thomas.beermann@cern.ch>, 2016
 # - Wen Guan <wguan.icedew@gmail.com>, 2016
+# - Dimitrios Christidis <dimitrios.christidis@cern.ch>, 2019
 
 '''
 Reaper is a daemon to manage file deletion.
@@ -360,11 +361,16 @@ def run(total_workers=1, chunk_size=100, threads_per_worker=None, once=False, gr
     """
     logging.info('main: starting processes')
 
-    rses_list = rse_core.list_rses()
+    all_rses = rse_core.list_rses()
     if rses:
-        rses = [rse for rse in rses_list if rse['rse'] in rses]
+        invalid = set(rses) - set([rse['rse'] for rse in all_rses])
+        if invalid:
+            msg = 'RSE{} {} cannot be found'.format('s' if len(invalid) > 1 else '',
+                                                    ', '.join([repr(rse) for rse in invalid]))
+            raise RSENotFound(msg)
+        rses = [rse for rse in all_rses if rse['rse'] in rses]
     else:
-        rses = rses_list
+        rses = all_rses
 
     if exclude_rses:
         excluded_rses = parse_expression(exclude_rses)
@@ -374,6 +380,10 @@ def run(total_workers=1, chunk_size=100, threads_per_worker=None, once=False, gr
         included_rses = parse_expression(include_rses)
         rses = [rse for rse in rses if rse in included_rses]
 
+    if not rses:
+        logging.error('Reaper: No RSEs found. Exiting.')
+        return
+
     logging.info('Reaper: This instance will work on RSEs: ' + ', '.join([rse['rse'] for rse in rses]))
 
     threads = []


Test patch: