pcvs.backend.profile module
- class pcvs.backend.profile.Profile(name, scope=None)[source]
Bases:
object
A profile represents the most complete object the user can provide.
It is built upon 5 components, called configuration blocks (or basic blocks), one of each kind (compiler, runtime, machine, criterion & group) and gathers all required information to start a validation process. A profile object is the basic representation to be manipulated by the user.
Note
A profile object can be confused with
pcvs.helpers.system.MetaConfig
. While both are carrying the whole user configuration, a Profile object is used to build/manipulate it, while a Metaconfig is the actual internal representation of a complete run config.- Parameters:
- check(allow_legacy=True)[source]
Ensure profile meets scheme requirements, as a concatenation of 5 configuration block schemes.
- Raises:
FormatError – A ‘kind’ is missing from profile OR incorrect profile.
- clone(clone)[source]
Duplicate a valid profile into the current one.
- Parameters:
clone (
Profile
) – a valid profile object
- property compiler
Access the ‘compiler’ section.
- Returns:
the ‘compiler’ dict segment
- Return type:
- property criterion
Access the ‘criterion’ section.
- Returns:
the ‘criterion’ dict segment
- Return type:
- delete()[source]
Remove the current profile from disk.
It does not destroy the Python object, though.
- dump()[source]
Return the full profile content as a single regular dict.
This function loads the profile on disk first.
- Returns:
a regular dict for this profile
- Return type:
- edit()[source]
Open the editor to manipulate profile content.
- Parameters:
e (str) – an editor program to use instead of defaults
- Raises:
Exception – Something happened while editing the file
Warning
If the edition failed (validation failed) a rejected file is created in the current directory containing the rejected profile. Once manually edited, it may be submitted again through pcvs profile import.
- edit_plugin()[source]
Edit the ‘runtime.plugin’ section of the current profile.
- Parameters:
e (str) – an editor program to use instead of defaults
- Raises:
Exception – Something happened while editing the file.
Warning
If the edition failed (validation failed) a rejected file is created in the current directory containing the rejected profile. Once manually edited, it may be submitted again through pcvs profile import.
- fill(raw)[source]
Update the given profile with content stored in parameter.
- Parameters:
raw (dict) – tree of (key, values) pairs to update
- flush_to_disk()[source]
Write down profile to disk.
Also, ensure the filepath is valid and profile content is compliant with schemes.
- property full_name
Return fully-qualified profile name (scope + name).
- Returns:
the unique profile name.
- Return type:
- get_unique_id()[source]
Compute unique hash string identifying a profile.
This is required to make distinction between multiple profiles, based on its content (banks relies on such unicity).
- Returns:
an hashed version of profile content
- Return type:
- is_found()[source]
Check if the current profile exists on disk.
- Returns:
True if the file exist on disk
- Return type:
- load_from_disk()[source]
Load the profile from its representation on disk.
- Raises:
NotFoundError – profile does not exist
NotFoundError – profile path is not valid
- load_template(name='default')[source]
Populate the profile from templates of 5 basic config. blocks.
Filepath still need to be determined via retrieve_file() call.
- property machine
Access the ‘machine’ section.
- Returns:
the ‘machine’ dict segment
- Return type:
- property runtime
Access the ‘runtime’ section.
- Returns:
the ‘runtime’ dict segment
- Return type:
- split_into_configs(prefix, blocklist, scope=None)[source]
Convert the given profile into a list of basic blocks.
This is the reverse operation of creating a profile (not the ‘opposite’).
- Parameters:
- Raises:
AlreadyExistError – the created configuration block name already exist
- Returns:
list of created
ConfigurationBlock
- Return type: