in src/lookoutequipment/dataset.py [0:0]
def __init__(self,
dataset_name,
access_role_arn,
component_fields_map=None,
component_root_dir=None):
"""
Create a new instance to configure all the attributes necessary to
manage a Lookout for Equipment dataset.
Parameters:
dataset_name (string):
the name of the dataset to manage
component_fields_map (string):
the mapping of the different fields associated to this
dataset. Either ``component_root_dir`` or
``component_fields_map`` must be provided. Defaults to None.
component_root_dir (string):
the root location where the sensor data are stored. Either
``component_root_dir`` or ``component_fields_map`` must be
provided. Defaults to None. Can be a local folder or an S3
location.
access_role_arn (string):
the ARN of a role that will allow Lookout for Equipment to
read data from the data source bucket on S3
"""
# Parameters consistency checks:
if (component_fields_map is None) and (component_root_dir is None):
raise Exception((
'``component_root_dir`` and ``component_fields_map``'
' cannot both be set to None'
))
# Schema definition:
if component_fields_map is not None:
self._dataset_schema = create_data_schema(component_fields_map)
elif component_root_dir is not None:
if component_root_dir[:5] == 's3://':
self._dataset_schema = create_data_schema_from_s3_path(component_root_dir)
else:
self._dataset_schema = create_data_schema_from_dir(component_root_dir)
# Initializing other attributes:
self._dataset_name = dataset_name
self.client = boto3.client('lookoutequipment')
self._role_arn = access_role_arn
self._ingestion_job_id = None
self._ingestion_response = {}
self._components_list = None
self._schema = None