SciTheSqrl
Feb. 22, 2021 07:44:10
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 !
tpetrick
Feb. 23, 2021 12:31:49
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.
SciTheSqrl
March 2, 2021 10:09:30
Thanks tpetrick !
That what I was looking for !