Setup a work_item as failed in a python script top in-proces

   1104   2   0
User Avatar
Member
48 posts
Joined: Aug. 2017
Offline
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 !
Edited by SciTheSqrl - Feb. 22, 2021 07:46:25

Attachments:
fail_item.hiplc (115.3 KB)

User Avatar
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.
User Avatar
Member
48 posts
Joined: Aug. 2017
Offline
Thanks tpetrick !
That what I was looking for !
  • Quick Links