This is a helper class/context manager used with the pdg.AttributeOwner.lockAttributes method. The method returns an instance of this context manager, which makes it safe to manipulate the work item’s attributes outside of a node callback method. Node and scheduler methods will already ensure that the work item is safe to access.
For example:
with work_item.lockAttributes(): work_item.setIntAttrib("scheduler_jobid", 10) work_item.setStringAttrib("scheduler_type", "custom")