pcvs.backend.bank module

pcvs.backend.bank.BANKS: Dict[str, str] = {}
Variables

BANKS – list of available banks when PCVS starts up

class pcvs.backend.bank.Bank(path: Optional[str] = None, token: str = '')[source]

Bases: Bank

Representation of a PCVS result datastore.

Stored as a Git repo, a bank hold multiple results to be scanned and used to analyse benchmarks result over time. A single bank can manipulate namespaces (referred as ‘projects’). The namespace is provided by suffixing @proj to the original name.

Parameters
  • root (str) – the root bank directory

  • repo (Pygit2.Repository) – the Pygit2 handle

  • config (MetaDict) – when set, configuration file of the just-submitted archive

  • rootree (Pygit2.Object) – When set, root handler to the next commit to insert

  • locked (bool) – Serialize Bank manipulation among multiple processes

  • proj_name (str) – extracted default-proj from initial token

build_target_branch_name(tag: Optional[str] = None, hash: Optional[str] = None) str[source]

Compute the target branch to store data.

This is used to build the exact Git branch name based on:
  • default-proj

  • unique profile hash, used to run the validation

Parameters

tag (str) – overridable default-proj (if different)

Returns

fully-qualified target branch name

Return type

str

property default_project
exists() bool[source]

Check if the bank is stored in PATH_BANK file.

Verification is made either on name or path.

Returns

True if both the bank exist and globally registered

Return type

bool

get_count()[source]

TODO:

load_config_from_dict(s: dict) None[source]

TODO:

load_config_from_file(path: str) None[source]

Load the configuration file associated with the archive to process.

Parameters

path (str) – the configuration file path

load_config_from_str(s: str) None[source]

Load the configuration data associated with the archive to process.

Parameters

s (str) – the configuration data

property name: str

Get bank name.

Returns

the exact label (without default-project suffix)

Return type

str

name_exist() bool[source]

Check if the bank name is registered into PATH_BANK file.

Returns

True if the name (lowered) is in the keys()

Return type

bool

path_exist() bool[source]

Check if the bank path is registered into PATH_BANK file.

Returns

True if the path is known.

Return type

bool

property prefix: Optional[str]

Get path to bank directory.

Returns

absolute path to directory

Return type

str

save_from_archive(tag: str, archivepath: str) None[source]

Extract results from the archive, if used to export results.

This is basically the same as BanK.save_from_buildir() except the archive is extracted first.

Parameters
  • tag (str) – overridable default project (if different)

  • archivepath (str) – archive path

save_from_buildir(tag: str, buildpath: str) None[source]

Extract results from the given build directory & store into the bank.

Parameters
  • tag (str) – overridable default project (if different)

  • buildpath (str) – the directory where PCVS stored results

save_to_global() None[source]

Store the current bank into PATH_BANK file.

show() None[source]

Print the bank on stdout.

Note

This function does not use log.IOManager

Store a new bank to the global system.

Parameters
  • name (str) – bank label

  • path (str) – path to bank directory

pcvs.backend.bank.flush_to_disk() None[source]

Update the PATH_BANK file with in-memory object.

Raises

IOError – Unable to properly manipulate the tree layout

pcvs.backend.bank.init() None[source]

Bank interface detection.

Called when program initializes. Detects defined banks in PATH_BANK

pcvs.backend.bank.list_banks() dict[source]

Accessor to bank dict (outside of this module).

Returns

dict of available banks.

Return type

dict

Remove a bank from the global management system.

Parameters

name (str) – bank name