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 1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8 -*--
3
3
4
- # Copyright (c) 2023 Oracle and/or its affiliates.
4
+ # Copyright (c) 2024 Oracle and/or its affiliates.
5
5
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
6
7
7
import json
@@ -24,7 +24,23 @@ def operate(operator_config: AnomalyOperatorConfig) -> None:
24
24
from .model .factory import AnomalyOperatorModelFactory
25
25
26
26
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
28
44
29
45
30
46
def verify (spec : Dict , ** kwargs : Dict ) -> bool :
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8 -*--
3
3
4
- # Copyright (c) 2023 Oracle and/or its affiliates.
4
+ # Copyright (c) 2023, 2024 Oracle and/or its affiliates.
5
5
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
6
7
7
import json
@@ -29,13 +29,18 @@ def operate(operator_config: ForecastOperatorConfig) -> None:
29
29
operator_config , datasets
30
30
).generate_report ()
31
31
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
39
44
40
45
41
46
def verify (spec : Dict , ** kwargs : Dict ) -> bool :
You can’t perform that action at this time.
0 commit comments