Ticket #1210 (closed defect: suspended)

Opened 9 years ago

Last modified 7 years ago

Validation doesn't like including description in definition

Reported by: RayPlante Owned by: RayPlante
Priority: normal Milestone:
Component: pex_policy Keywords:
Cc: rplante Blocked By:
Blocking: Project: LSST
Version Number:
How to repeat:

Grab attached files and type:

   python policybug.py

Description

While attempting to merge defaults loaded from a dictionary, I get the following error:

lsst.pex.exceptions.exceptionsLib.LsstCppException: 0: lsst::pex::policy::DictionaryError \
   thrown at src/Dictionary.cc:337 in \ 
   void lsst::pex::policy::Definition::validateRecurse(const std::string&, \
                                                       const lsst::pex::policy::Policy&, 
                                                       lsst::pex::policy::ValidationError*) const
0: Message: Malformed dictionary: Unknown Dictionary property found at jobDataset: description

This occurs because policy apparently doesn't like the appearance of a "description" within a parameter definition--i.e. for "jobDataset". If I comment this out, the error occurs for another definition.

This bug apparently occurs because of a coding error in Definition::validateRecurse() in Dictionary.cc. The exception is raised near the end of this function because Dictionary::KW_DESCRIPTION is not included in the list of "okay" parameters that can appear in a definition. I have not tested this.

Attachments

policybug.py (248 bytes) - added by RayPlante 9 years ago.
script to reproduce bug
DataTriggeredScheduler_dict.paf (2.8 KB) - added by RayPlante 9 years ago.
dictionary
isr-joboffice.paf (1.1 KB) - added by RayPlante 9 years ago.
policy file

Change History

comment:1 Changed 9 years ago by DefaultCC Plugin

  • Cc rplante added

Changed 9 years ago by RayPlante

script to reproduce bug

Changed 9 years ago by RayPlante

dictionary

Changed 9 years ago by RayPlante

policy file

comment:2 Changed 9 years ago by bbaker

  • Status changed from new to assigned

comment:3 Changed 9 years ago by bbaker

  • Status changed from assigned to inTicketWork

This happens when a sub-policy is defined only as a policy, with no internal Dictionary:

sub_policy: {
    type: policy
    description: "could be any policy"
}

Further, if you attach that dictionary to a policy for future validation (for example, with Policy::mergeDefaults(), Policy::setDictionary(), or Policy::Policy(bool, Dictionary, path)), it won't allow you to set subvalues:

>>> p = Policy()
>>> d = Dictionary("that_simple_one_above.paf")
>>> p.setDictionary(d)
>>> p.set("sub_policy.foo", "bar")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/bbaker/source/policy/tickets/1210/python/lsst/pex/policy/policyLib.py", line 2056, in _Policy_set
    _Policy_wrap_set(p, name, value)
  File "/home/bbaker/source/policy/tickets/1210/python/lsst/pex/policy/policyLib.py", line 970, in set
    return _policyLib.Policy_set(*args)
lsst.pex.exceptions.exceptionsLib.LsstCppException: 0: lsst::pex::policy::DictionaryError thrown at src/Dictionary.cc:588 in lsst::pex::policy::Definition* lsst::pex::policy::Dictionary::makeDef(const std::string&) const
0: Message: Malformed dictionary: empty_sub.dictionary not found.

comment:4 Changed 9 years ago by bbaker

  • Status changed from inTicketWork to inStandardsReview
  • Owner changed from bbaker to RayPlante

Fixed two things:

  • description is now okay in an otherwise empty definition
  • instead of waiting until the Dictionary is used, do some integrity checking up-front. There is still some checking that only happens when a particular Definition is actually used, because of deferred parsing of Definitions; we should move that to load-time as well.

comment:5 Changed 7 years ago by rhl

  • Status changed from inStandardsReview to closed
  • Resolution set to suspended

pex_policy is replaced by pex_config

Note: See TracTickets for help on using tickets.