File tree Expand file tree Collapse file tree 2 files changed +31
-10
lines changed
ads/opctl/operator/lowcode Expand file tree Collapse file tree 2 files changed +31
-10
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22# -*- coding: utf-8 -*--
33
4- # Copyright (c) 2023 Oracle and/or its affiliates.
4+ # Copyright (c) 2024 Oracle and/or its affiliates.
55# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66
77import json
@@ -24,7 +24,23 @@ def operate(operator_config: AnomalyOperatorConfig) -> None:
2424 from .model .factory import AnomalyOperatorModelFactory
2525
2626 datasets = AnomalyDatasets (operator_config .spec )
27- AnomalyOperatorModelFactory .get_model (operator_config , datasets ).generate_report ()
27+ try :
28+ AnomalyOperatorModelFactory .get_model (
29+ operator_config , datasets
30+ ).generate_report ()
31+ except Exception as e :
32+ if operator_config .spec .model == "auto" :
33+ logger .debug (
34+ f"Failed to forecast with error { e .args } . Trying again with model `autots`."
35+ )
36+ operator_config .spec .model = "autots"
37+ operator_config .spec .model_kwargs = dict ()
38+ datasets = AnomalyDatasets (operator_config .spec )
39+ AnomalyOperatorModelFactory .get_model (
40+ operator_config , datasets
41+ ).generate_report ()
42+ else :
43+ raise
2844
2945
3046def verify (spec : Dict , ** kwargs : Dict ) -> bool :
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22# -*- coding: utf-8 -*--
33
4- # Copyright (c) 2023 Oracle and/or its affiliates.
4+ # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
55# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66
77import json
@@ -29,13 +29,18 @@ def operate(operator_config: ForecastOperatorConfig) -> None:
2929 operator_config , datasets
3030 ).generate_report ()
3131 except Exception as e :
32- logger .debug (
33- f"Failed to forecast with error { e .args } . Trying again with model `prophet`."
34- )
35- operator_config .spec .model = "prophet"
36- ForecastOperatorModelFactory .get_model (
37- operator_config , datasets
38- ).generate_report ()
32+ if operator_config .spec .model == "auto" :
33+ logger .debug (
34+ f"Failed to forecast with error { e .args } . Trying again with model `prophet`."
35+ )
36+ operator_config .spec .model = "prophet"
37+ operator_config .spec .model_kwargs = dict ()
38+ datasets = ForecastDatasets (operator_config )
39+ ForecastOperatorModelFactory .get_model (
40+ operator_config , datasets
41+ ).generate_report ()
42+ else :
43+ raise
3944
4045
4146def verify (spec : Dict , ** kwargs : Dict ) -> bool :
You can’t perform that action at this time.
0 commit comments