apyfal.configuration

See also Configuration

Manages Accelerator and CSP configuration

Notes

The “accelerator.conf” file provided with this package can be used as sample for creation of user configuration files.

Use of this file is optional. All parameters can also be passed to API class. Non specified ones will use default values.

API search automatically search for “accelerator.conf” in current working directory, or in current user home directory. A custom path to configuration file can also be passed to classes.

apyfal.configuration.create_configuration(configuration_file)[source]

Create a configuration instance

Parameters:configuration_file (apyfal.configuration.Configuration, path-like object or file-like object) – Configuration to use. Path-like object can be path, URL or cloud object URL.
class apyfal.configuration.Configuration(configuration_file=None)[source]

Accelerator configuration.

Mapping of configuration sections. On section access, never raises KeyError but returns at least an empty section.

Sections are mapping of parameters. On parameter access, never raises KeyError but returns a default value of None.

If a configuration section name contain dot (ex: “host.csp”), it is a subsection and accessing parameter performs the follow: - Tries to get parameter from this section (“host.csp”) - If parameter value is None, tries to get value from

parent section (“host”)

Trying to setting an parameter to None does nothing and keep previous value. Use “del” to delete an parameter to set a reset an parameter value.

Parameters:configuration_file (apyfal.configuration.Configuration, path-like object or file-like object) – If None, use default values. Path-like object can be path, URL or cloud object URL.
DEFAULT_CONFIG_FILE = 'accelerator.conf'

Default name for configuration file (Used for file detection)

access_token

Patched method

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
get_host_configurations(*args, **kwargs)

Patched method

get_host_requirements(host_type, accelerator)[source]

Gets accelerators requirements to use with host.

Parameters:
  • host_type (str) – Host type.
  • accelerator (str) – Name of the accelerator
Returns:

AcceleratorClient requirements for host.

Return type:

dict

items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
values() → an object providing a view on D's values
write(fileobject)[source]

Write configuration file.

Parameters:fileobject (file-like object) – file-like object open in text mode.
apyfal.configuration.accelerator_executable_available()[source]

Returns True if accelerator executable available locally.

Returns:Accelerator executable found.
Return type:bool
apyfal.configuration.ACCELERATOR_EXECUTABLE = '/opt/accelize/accelerator/accelerator'

Accelerator Executable path

apyfal.configuration.ACCELERATOR_TMP_ROOT = '/dev/shm'

Accelerator temporary directory root

apyfal.configuration.APYFAL_HOME = '/home/docs/.apyfal'

Apyfal directory in user home

apyfal.configuration.METERING_SERVER = 'https://master.metering.accelize.com'

Metering server URL

apyfal.configuration.METERING_TMP = '/tmp/meteringServer'

Metering Server temporary directory

apyfal.configuration.METERING_CLIENT_CONFIG = '/etc/sysconfig/meteringclient'

Metering Client configuration

apyfal.configuration.METERING_CREDENTIALS = '/etc/accelize/credentials.json'

Metering Credentials JSON file

apyfal.configuration.APYFAL_CERT_CRT = '/home/docs/.ssh/ApyfalCertificate.crt'

Apyfal generated self signed wildcard certificate files