LookoutEquipmentDataset¶
- class src.lookoutequipment.dataset.LookoutEquipmentDataset(dataset_name, access_role_arn, component_fields_map=None, component_root_dir=None)¶
A class to manage Lookout for Equipment datasets
Attributes
components_list
list
of components part of the schema of this datasetdataset_name
string
with the name given to the datasetdataset_schema
string
with a JSON-formatted string describing the data schema the dataset must conform toingestion_job_id
string
the ID of the data ingestion jobingestion_job_response
string
with a JSON-formatted string describing the response details of a data ingestion job.role_arn
string
containing the role ARN necessary to access the S3 location where the datasets are storedschema
dict
dictionnary containing the schema of this dataset if it was already created in Lookout for EquipmentMethods
__init__
(dataset_name, access_role_arn[, …])Create a new instance to configure all the attributes necessary to manage a Lookout for Equipment dataset.
create
()Creates a Lookout for Equipment dataset
delete
([force_delete])Deletes the dataset
get_component_field_map
(component)ingest_data
(bucket, prefix[, wait, sleep_time])Ingest data from an S3 location into the dataset
List all the models trained with this dataset
poll_data_ingestion
([sleep_time])This function polls the data ingestion describe API and prints a status until the ingestion is done.
- __init__(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
orcomponent_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
orcomponent_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
- create()¶
Creates a Lookout for Equipment dataset
- Returns
Response of the create dataset API
- Return type
string
- delete(force_delete=True)¶
Deletes the dataset
- Parameters
force_delete (boolean) – if set to True, also delete all the models that are using this dataset before deleting it. Otherwise, this method will list the attached models (Default: True)
- get_component_field_map(component)¶
- ingest_data(bucket, prefix, wait=False, sleep_time=60)¶
Ingest data from an S3 location into the dataset
- Parameters
bucket (string) – Bucket name where the data to ingest are located
prefix (string) – Actual location inside the aforementioned bucket
wait (Boolean) – If True, this function will wait for the ingestion to finish (default to False)
sleep_time (integer) – how many seconds should we wait before polling again when the
wait
parameter is True (default: 60)
- Returns
Response of the start ingestion job API call (if
wait
is False) or of the actual finished ingestion job (ifwait
is True)- Return type
string
- list_models()¶
List all the models trained with this dataset
- Returns
A list with the names of every models trained with this dataset
- Return type
list of strings
- poll_data_ingestion(sleep_time=60)¶
This function polls the data ingestion describe API and prints a status until the ingestion is done.
- Parameters
sleep_time (integer) – How many seconds should we wait before polling again (default: 60)