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=None, token='')[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=None, hash=None)[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: str

Get project set as default when none are provided.

Returns:

the project name (as a Ref branch)

Return type:

str

exists()[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]

Get the number of projects managed by this bank handle.

Returns:

number of projects

Return type:

int

property name: str

Get bank name.

Returns:

the exact label (without default-project suffix)

Return type:

str

name_exist()[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()[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, archivepath, msg=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

Return type:

None

save_from_buildir(tag, buildpath, msg=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

Return type:

None

save_new_run(target_project, path)[source]
Return type:

None

save_new_run_from_instance(target_project, hdl, msg=None)[source]

Create a new node into the bank for the given project, based on the open result handler.

Parameters:
  • target_project (str) – valid project (=branch)

  • hdl (class:BuildDirectoryManager) – the result build directory handler

Return type:

None

save_to_global()[source]

Store the current bank into PATH_BANK file.

Return type:

None

show(stringify=False)[source]

Print the bank on stdout. :rtype: Optional[str]

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

Return type:

None

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

Update the PATH_BANK file with in-memory object.

Raises:

IOError – Unable to properly manipulate the tree layout

Return type:

None

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

Bank interface detection.

Called when program initializes. Detects defined banks in PATH_BANK

Return type:

None

pcvs.backend.bank.list_banks()[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

Return type:

None