tardis.interfaces.siteadapter module
- class tardis.interfaces.siteadapter.ResourceStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
Enum
Status of the resource at the resource provider (batch system, cloud provider, etc.)
- Booting = 1
- Deleted = 4
- Error = 5
- Running = 2
- Stopped = 3
- class tardis.interfaces.siteadapter.SiteAdapter[source]
Bases:
object
Abstract base class defining the interface for SiteAdapters which provide access to various Cloud APIs and batch systems in order to manage opportunistic resources.
- property configuration: AttributeDict
Property to provide access to SiteAdapter specific configuration. :return: returns the Site Adapter specific configuration :rtype: AttributeDict
- abstract async deploy_resource(resource_attributes: AttributeDict) AttributeDict [source]
Abstract method to define the interface to deploy a new resource at a resource provider. :param resource_attributes: Contains describing attributes of the resource, defined in the
Drone
implementation! :type resource_attributes: AttributeDict :return: Contains updated describing attributes of the resource. :rtype: AttributeDict
- drone_environment(drone_uuid: str, meta_data_translation_mapping: AttributeDict) dict [source]
Method to get the drone environment to be exported to batch jobs providing the actual resources in the overlay batch system. It translates units of drone meta data into a format the overlay batch system is expecting. Also, the drone_uuid is added for matching drones to actual resources provided in the overlay batch system. :param drone_uuid: The unique id which is assigned to every drone on creation :type drone_uuid: str :param meta_data_translation_mapping: Mapping used for the meta data translation :type meta_data_translation_mapping: dict :return: Translated :rtype: dict
- property drone_heartbeat_interval: int
Property that returns the configuration parameter drone_heartbeat_interval. It describes the time between two consecutive updates of the drone status. :return: The heartbeat interval of the drone :rtype: int
- property drone_minimum_lifetime: [<class 'int'>, None]
Property that returns the configuration parameter drone_minimum_lifetime. It describes the minimum lifetime before a drone is automatically going into draining mode. :return: The minimum lifetime of the drone :rtype: int, None
- drone_uuid(uuid: str) str [source]
Returns the drone uuid consisting of the lower case site name and the first 10 bytes of uuid4 due to constraints on length of a full DNS name (253 bytes). :param uuid: The first 10 bytes of a uuid4 :type uuid: str :return: The drone uuid consisting of the lower case site name and the first 10 bytes of uuid4. :rtype: str
- abstract handle_exceptions()[source]
Abstract method defining the interface to handle exception occurring during interacting with the resource provider. :return: None
- static handle_response(response, key_translator: dict, translator_functions: dict, **additional_content)[source]
Method to handle the responses of the resource provider and translating it to a uniform format. :param response: A dictionary containing the response of the resource provider. :type response: dict :param key_translator: A dictionary containing the translation of keys of the original response of the provider in keys of the common format. :type key_translator: dict :param translator_functions: A dictionary containing functions to transform value of the original response of the provider into values of the common format. :type translator_functions: dict :param additional_content: Additional content to be put into response, which is not part of the original response of the resource provider. :return: Translated response of the resource provider in a common format. :rtype: dict
- property machine_meta_data: AttributeDict
Property to access the machine_meta_data (like cores, memory and disk) of a resource. :return: The machine_meta_data of a resource. :rtype: AttributeDict
- property machine_type: str
Property to access the machine_type (flavour) of a resource and ensuring that all sub-classes of the SiteAdapter have a _machine_type class variable . :return: The machine_type of a resource. :rtype: str
- property machine_type_configuration: AttributeDict
Property to access the machine_type_configuration (arguments of the API calls to the provider) of a resource. :return: The machine_type_configuration of a resource. :rtype: AttributeDict
- abstract async resource_status(resource_attributes: AttributeDict) AttributeDict [source]
Abstract method to define the interface to check the status of resources at a resource provider. :param resource_attributes: Contains describing attributes of the resource, defined in the
Drone
implementation! :type resource_attributes: AttributeDict :return: Contains updated describing attributes of the resource. :rtype: AttributeDict
- property site_configuration: AttributeDict
Property that returns the generic site configuration. This corresponds to the Sites section in the yaml configuration. For example: .. code-block:
Sites: - name: MySiteName_1 adapter: MyAdapter2Use quota: 123 drone_minimum_lifetime: 3600
- Returns
The generic site configuration
- Return type
- property site_name: str
Property to access the site_name of a resource and ensuring that all sub-classes of the SiteAdapter have a _site_name class variable. :return: The site_name of a resource. :rtype: str
- abstract async stop_resource(resource_attributes: AttributeDict) None [source]
Abstract method to define the interface to stop resources at a resource provider. :param resource_attributes: Contains describing attributes of the resource, defined in the
Drone
implementation! :type resource_attributes: AttributeDict :return: None
- abstract async terminate_resource(resource_attributes: AttributeDict) None [source]
Abstract method to define the interface to terminate resources at a resource provider. :param resource_attributes: Contains describing attributes of the resource, defined in the
Drone
implementation! :type resource_attributes: AttributeDict :return: None
- class tardis.interfaces.siteadapter.SiteConfigurationModel(*, name: str, adapter: str, quota: Optional[int] = inf, drone_minimum_lifetime: Optional[ConstrainedIntValue] = None, drone_heartbeat_interval: Optional[ConstrainedIntValue] = 60)[source]
Bases:
BaseModel
pydantic BaseModel for the input validation of the generic site configuration