Hi, I would like to know if there is a way to mark a work_item inside a python script top node as CookedFail ?
On the doc, pdg.WorkItem.cookSubItem() seem to be the closest function that do that but it throw me an exception when I try to call it. ('_pdg.WorkItem' object has no atttribute cookSubItem)
http://share.scimunk.com/000629_hindie_HntkbRyHeJ_2021-02-22_13-43-10.png [share.scimunk.com]
Thanks you for any help !
Setup a work_item as failed in a python script top in-proces
1104 2 0- SciTheSqrl
- Member
- 48 posts
- Joined: Aug. 2017
- Offline
- tpetrick
- Staff
- 585 posts
- Joined: May 2014
- Offline
The cookSubItem API function was added in a very recent build of 18.5 and is specifically for working with batches, not regular work items. You can raise pdg.CookError("message") to cause the script to fail for a particular work item with a message.
Alternatively, if you're just trying to use the Python Script to validate some attributes or files on a work item, you may be able to use the Error TOP instead. That node will let you write an expression that conditionally creates either a warning or error message, at either the node level or for a specific subset of work items. If you're using it to create a work item failure, the failure message is stored as a string attribute on the item and the work item is marked as failed.
Alternatively, if you're just trying to use the Python Script to validate some attributes or files on a work item, you may be able to use the Error TOP instead. That node will let you write an expression that conditionally creates either a warning or error message, at either the node level or for a specific subset of work items. If you're using it to create a work item failure, the failure message is stored as a string attribute on the item and the work item is marked as failed.
- SciTheSqrl
- Member
- 48 posts
- Joined: Aug. 2017
- Offline
-
- Quick Links