pcvs.orchestration.publishers module

class pcvs.orchestration.publishers.Publisher(prefix=None)[source]

Bases: object

Manage result publication and storage on disk.

Jobs are submitted to a publisher, forming a set of ready-to-be-flushed elements. Every time generate_file is invoked, tests are dumped to a file named after pcvs_rawdat<id>.json, where id is a automatic increment. Then, pool is emptied and waiting for new tests. This way, a single manager manages multiple files.

Variables
  • scheme – path to test result scheme

  • increment – used within filename

  • fn_fmt – filename format string

  • _layout – hierarchical representation of tests within the file

  • _destpath – target filepath

add(json)[source]

Add a new job to be published.

Parameters

json (json) – the Test() JSON.

empty_entries()[source]

Empty the publisher from all saved jobs.

flush()[source]

Flush down saved JSON-based jobs to a single file.

The Publisher is then reset for the next flush (next file).

fn_fmt = 'pcvs_rawdat{:>04d}.json'
property format

Return format type (currently only ‘json’ is supported).

Returns

format as printable string

Return type

str

increment = 0
scheme = None
validate(stream)[source]

Ensure the test results layout saved is compliant with standards.

Parameters

stream – content to validate against publisher scheme.

Type

stream: dict or str