components module
- components.autoscale_sensors(iam_role, s3_bucket_name, ansys_license_server='', virtual_sensor_img='', cpu=2, memory=2048, gpu=0, s3_IoT_key='DG-NG-sensor-data/')
Automatically create or destroy virtual sensors in an AWS Batch environment. This function can be used with or without an ANSYS license server. :rtype:
None
A connection to the Batch compute environment is established.
The general job definition for a virtual sensor is defined
Existing running virtual sensors (i.e. existing Batch jobs) are queried
New sensor is checked in an S3 Bucket
Objects are assumed to be named: <someName>_#.<csv> All of the object # are determined and assumed that a virtual sensor will be associated with each #. If there is no virtual sensor from step 3 associated with #, then a virtual sensor will be created. If there is a virtual sensor and no associated #, then the sensor will be destroyed.
Kill all sensors no longer associated with data.
Create all new sensors that do not exist, but data is now available.
- Parameters:
iam_role (str) – IAM rol to be assumed by virtual sensors.
s3_bucket_name (str) – The s3 bucket to look for data. #TODO: will add connections to all other TwinModules data sources. For meta data determination.
ansys_license_server (str, optional) – Use this license server ip address if applicable. The default is “”.
virtual_sensor_img (str, optional) – The container image to use (URL). The default is “”.
cpu (int, optional) – Required cpus needed for virtual sensor. The default is 2.
memory (int, optional) – Required RAM in MB needed for virtual sensor. The default is 2048.
gpu (int, optional) – Number of gpus needed by virtual sensor. Note the AWS Batch compute environment must be able to support gpus. The default is 0.
s3_IoT_key (str, optional) – The s3 key/folder to use for new data. The default is “DG-NG-sensor-data/”.
- Return type:
None