Hi,
Is it possible to overload/make callback for “Delete Results From Disk” call from workitem context menu?
For some cases, it is not so easy just delete files from the disk if we are using wrappers or need an additional callback.
Thanks
Ostap
pdg.TypeRegistry.registerDirtyHandler( handler, handler_type = pdg.dirtyHandlerType.Any, scheduler_filter = [], node_filter = [], requires_outputs = False, is_global = False)
handler - Custom function defined by the user
handler_type - The type of dirty operation that should trigger the function. Can be any work item dirty, work item deletion, or work item deletion w/ file removal.
scheduler_filter - A list of scheduler type names. The handler is only called if the work item's scheduler matches the filter, or if the filter is empty
node_filter - A list of node type names. Handler is only called if the work item's node matches the filter, or if the filter is empty.
requires_outputs - If handler_type is pdg.dirtyHandlerType.Files and this flag is True, then the handler is only called if there are actual files being deleted.
is_global - If this is True, the handler is called only once at the beginning of the dirty, instead of for each work item, regardless of the number of items being dirtied.
def handler(work_item, file_list)
import pdg def simple_handler(work_item, file_list): print(work_item) print(file_list) def registerTypes(type_registry): # Prints for any work item that is dirtied, deleted or deleted + remove files type_registry.registerDirtyHandler(simple_handler) # Only prints for work items that are having their files deleted type_registry.registerDirtyHandler(simple_handler, handler_type=pdg.dirtyHandlerType.Files) # Only prints for work items that are having their files deleted, with at least one file being deleted type_registry.registerDirtyHandler( simple_handler, handler_type=pdg.dirtyHandlerType.Files, requires_outputs=True)
type_registry.registerDirtyHandler( simple_handler, handler_type=pdg.dirtyHandlerType.Files, skip_deletion=True)