openSUSE / docserv

A server for building and publishing documentation with DAPS
https://opensuse.github.io/docserv/
GNU General Public License v3.0
4 stars 3 forks source link

Traceback about missing d2d_out_dir #210

Closed ghost closed 5 years ago

ghost commented 5 years ago

Not quite sure why this is happening -- maybe d2d failed not so nicely?

Exception in thread Thread-9:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/site-packages/docserv/docserv.py", line 401, in worker
    deliverable.run(thread_id)
  File "/usr/lib/python3.6/site-packages/docserv/deliverable.py", line 212, in run
    self.iterate_commands(commands, n, thread_id)
  File "/usr/lib/python3.6/site-packages/docserv/deliverable.py", line 222, in ite
rate_commands
    commands[i], thread_id)
  File "/usr/lib/python3.6/site-packages/docserv/deliverable.py", line 329, in par
se_d2d_filelist
    logger.debug("Deliverable build results: %s", self.d2d_out_dir)
AttributeError: 'Deliverable' object has no attribute 'd2d_out_dir'
tomschr commented 5 years ago

Well, that error is raised when you don't have the d2d_out_dir member variable for an instance.

As far as I can see, it first appears in line 326, function parse_d2d_filelist of file src/docserv/deliverable.py (master). If this function is never called, no variable will be set for a Deliverable.

To avoid such errors, I always recommend to set all member variables inside __init__ like this:

class Deliverable:
    def __init__(self, parent, dc_file, dir_struct_paths, build_format, subdeliverables):
        # ...
        self.d2d_out_dir = "" # or better None ?

I don't know which would be the preferred default value of this variable.

ghost commented 5 years ago

... I have a local fix for this but still need to test/push/release.

It's just a try/except block that makes the build fail if the variable does not exist. :)

ghost commented 5 years ago

Let's declare this fixed because the traceback is gone. But iirc, the thread hangs may still be exist. So... closing this is a bit dodgy.