PTL’s manager() call with expect=True doesn’t work as expected. It will set the requested attributes, but it won’t make sure they are set to the correct thing. It will call expect(), but it does with op=SET. This will make sure the attributes are set, but not necessarily set to the correct thing.
My first thought is to change op=SET to op=EQ. This would work for everything but booleans. You can set a boolean to ‘t’ or ‘f’ or ‘1’ and it will correctly be set to ‘True’ or ‘False’. This means when we do our expect() on the boolean, we’d be looking for the value of ‘t’ and get the value of ‘True’. We can’t just assume any value of ‘t’, ‘1’, or 1 is a boolean because 1 is a valid value for a numeric attribute. You can set strings to ‘t’.
The thing is how do we determine if an attribute is a boolean or not. I see several ways each with their own drawbacks
Do a status() on the object first and look for attributes that have the values of ‘True’ or ‘False’. The downsides here is it will have a false positive for string attributes which just happen to be set to ‘True’ or ‘False’. This also has the overhead of an extra status() call. I guess we don’t have to call expect(). The real purpose of expect is to check several times if an attribute has the correct value. Once we call qmgr, the values are going to be correctly set or not. We could just check the values in the return of that status() call. This means we’re reimplementing some of expect() in manager().
PBS has all of its attributes and builtin resources in XML files as part of its source tree. There is nothing saying that PTL can’t parse those XML files to find the attribute and resource types. The downside here is we’d then have more of a dependence on the PBS source tree and we’d have to query the types of custom resources by doing a status() on the resources.
Keep a separate list of boolean attribute and resources in PTL for this purpose. This is just horrible. Keeping separate lists will immediately go stale the instant someone adds a new boolean attribute. This also still doesn’t give us the custom resources. Those will still need to be queried.
Can anyone else think of a better way to do this?
I’m not sure what the right answer is. They all have downsides. Out of the 3 options I came up with, I’d lean towards 1.