def un_test_prediction_execution():
    config = _get_config()
    logger.info("CONFIG:")
    logger.info(pprint.pformat(config))
    gordo_prediction_execution_provider = GordoPredictionExecutionProvider(dummy_provider, dummy_prediction_forwarder, config)
    project_name: str = config.get("projects", ["no-projects-in-config"])[0]
    model_name: str = "lol"
    logger.info("Prediction for project_name={project_name} and model_name={model_name}")
    from_time = datetime_from_rfc3339("2019-01-02T00:00:00Z")
    to_time = datetime_from_rfc3339("2019-02-02T00:00:00Z")
    time_range = TimeRange(from_time=from_time, to_time=to_time)
    data = None
    sensor_data: SensorData = SensorData(time_range=time_range, data=data)
    prediction_data = gordo_prediction_execution_provider.execute_prediction(project_name=project_name, model_name=model_name, sensor_data=sensor_data)
    assert prediction_data != None
Beispiel #2
0
def test_to_from_datetime():
    date_object = datetime.datetime(
        2001, 1, 1, 1, 1, 1, 1000, tzinfo=latigo.rfc3339.tzinfo(-83, "-01:23")
    )
    date_string = rfc3339_from_datetime(date_object)
    # logger.info(date_string)
    assert date_object == datetime_from_rfc3339(date_string)
Beispiel #3
0
def test_seconds_resolution():
    date_object = datetime.datetime(
        2001, 1, 1, 1, 1, 1, 0, tzinfo=latigo.rfc3339.UTC_TZ
    )
    date_string = rfc3339_from_datetime(date_object)
    # logger.info(date_string)
    for date_string in [
        "2001-01-01T01:01:01.000000Z",
        "2001-01-01T01:01:01.00000Z",
        "2001-01-01T01:01:01.0000Z",
        "2001-01-01T01:01:01.000Z",
        "2001-01-01T01:01:01.00Z",
        "2001-01-01T01:01:01.0Z",
        "2001-01-01T01:01:01Z",
    ]:
        assert date_object == datetime_from_rfc3339(date_string)
            "authority_host_url":
            environ.get("LATIGO_TIME_SERIES_IMS_SUBSCRIPTION_AUTH_HOST_URL",
                        not_found),
            "client_id":
            environ.get("LATIGO_TIME_SERIES_IMS_SUBSCRIPTION_CLIENT_ID",
                        not_found),
            "client_secret":
            environ.get("LATIGO_TIME_SERIES_IMS_SUBSCRIPTION_CLIENT_SECRET",
                        not_found)
        },
    }
    # fmt: on


name: str = "latigo_integration_test"
from_time = datetime_from_rfc3339("2019-01-02T00:00:00Z")
to_time = datetime_from_rfc3339("2019-11-02T00:00:00Z")
time_range = TimeRange(from_time=from_time, to_time=to_time)

tag_list = [
    LatigoSensorTag(name="tag_name_1", asset="tag_asset_1"),
    LatigoSensorTag(name="tag_name_2", asset="tag_asset_2")
]
spec: SensorDataSpec = SensorDataSpec(tag_list=tag_list)

# actual_tag_list = [LatigoSensorTag(name="GRA-STAT-20-1310_G01.ST", asset="1755-gra")]
# actual_tag_list = [LatigoSensorTag(name="GRA-FOI -13-0979.PV", asset="GRA")]
actual_tag_list = [
    LatigoSensorTag(name="PT-13005/MeasA/PRIM", asset="1101-sfb")
]
# ioc-preprod.ginkgrog-b17