va-big-data-genomics / trellisdata

Python package with classes and methods used in implementing a Trellis data management system.
MIT License
0 stars 1 forks source link

AttributeError: 'DatabaseQuery' object has no attribute 'job_request' #3

Closed pbilling closed 1 year ago

pbilling commented 1 year ago

To support the new method of mapping database queries to job requests, I've added a new job_request attribute to the DatabaseQuery class. In the __init__() function for the class, the default value is job_request=None, however when queries are populated from a yaml file, without a job_request value specified, I get this error where the instance doesn't seem to have the attribute at all. I've encountered similar issues before and I'm wondering if, when class instances are loaded from YAML, the defined __init__() function isn't used.

pbilling commented 1 year ago

Current workaround is to define job_request (and all attributes) in YAML, even for null values, by adding the line job_request = null which will be loaded as job_request = None in Python.

Related issue regarding null/None values: https://stackoverflow.com/questions/30134110/how-can-i-output-blank-value-in-python-yaml-file