pytorch_pfn_extras.writing.ThreadQueueWriter#

class pytorch_pfn_extras.writing.ThreadQueueWriter(savefun=<function save>, fs=None, out_dir='', task=None)#

Bases: QueueWriter[Thread]

Snapshot writer that uses a thread queue.

This class creates a thread and a queue by threading and queue modules respectively. The thread will be a consumer of the queue, and the main thread will be a producer of the queue.

Methods

__init__([savefun, fs, out_dir, task])

consume(q)

create_consumer(q)

create_queue()

create_task(savefun)

finalize()

Finalizes the writer.

initialize(out_dir)

save(filename, out_dir, target, savefun, ...)

__init__(savefun=<function save>, fs=None, out_dir='', task=None)#
Parameters:
  • savefun (Callable[[...], None]) –

  • fs (Optional[Any]) –

  • out_dir (str) –

  • task (Optional[Callable[[...], None]]) –

Return type:

None

create_consumer(q)#
Parameters:

q (queue.Queue[_QueUnit]) –

Return type:

Thread

create_queue()#
Return type:

queue.Queue[_QueUnit]