vhistblock module

The module vhistblock contains the class VhistBlock, which provides a convenience wrapper around the classes VhistSection, TempDir and Logger. VhistBlock has been designed to be used with python’s with-statement. You can write:

from pyvhist.vhistblock import VhistBlock

vhistfile = "output.vhist"
with VhistBlock(vhistfile) as vb:
    doStuff()

It automatically creates a VhistSection object, replaces stdout and stderr with a logger, which automatically adds the programs output to the workflow step, catches and records exceptions thrown by your code and records the time spent inside the with code block. It also creates a TempDir instance, which will be used by the block to create temporary files.

class pyvhist.vhistblock.VhistBlock(vhistFilename, rootFilename=None, title=None, description=None, comment=None, command=getCommandline(), host=getHostname(), user=getUser(), tool=getTool(), toolpath=getToolpath())
__init__(vhistFilename, rootFilename=None, title=None, description=None, comment=None, command=getCommandline(), host=getHostname(), user=getUser(), tool=getTool(), toolpath=getToolpath())

Creates a vhist block.

title, description, comment, command, host, user, tool and toolpath are the same as the arguments of the VhistSection constructor. These keyword arguments will be forwarded to the created workflow step.

Previous topic

vhistfile module

Next topic

userattrs module

This Page