-
Couldn't load subscription status.
- Fork 59
Extended operator errors and added forecast specific exceptions #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
prasankh commented Sep 29, 2023
- Introduced OperatorSchemaYamlError, ForecastSchemaYamlError and ForecastInputDataError.
- Made target_column and target_column mandatory.
- Updated code with relevant errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome, thank you!
A couple of questions about the schema we can resolve later
| target_column: | ||
| type: string | ||
| required: true | ||
| default: target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we remove this? I think it's used in the ads opctl init method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct I use default field when I build forecast specification yaml based by schema. For the required fields it is better to have some default values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, reverted this default value.
| target_category_columns: | ||
| type: list | ||
| required: false | ||
| required: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the code break without specifying this series column? If so we should open a ticket to change that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It breaks and the error message is not meaningful hence made this mandatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ads/opctl/operator/cmd.py Outdated
| # validation | ||
| if not name: | ||
| raise ValueError( | ||
| raise OperatorSchemaYamlError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to change ValueError on the OperatorSchemaYamlError here? The function gets the name attribute, and if the name attribute not provided we just show a message that name is expected. I think switching to the OperatorSchemaYamlError might be a bit confusing, because we don't expect YAML here as input attribute. The same for the other places in the CMD. There are only two methods that expect a YAML as input attribute - run and verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted these changes in cmd.py
| target_column: | ||
| type: string | ||
| required: true | ||
| default: target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct I use default field when I build forecast specification yaml based by schema. For the required fields it is better to have some default values.
| from ads.common.serializer import DataClassSerializable | ||
| from ads.opctl.operator.common.utils import _load_yaml_from_uri | ||
| | ||
| from ..common.errors import OperatorSchemaYamlError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use absolute imports for the operator level modules and classes.
from ads.opctl.operator.common.errors import OperatorSchemaYamlError We can use relative imports inside the particular operator, but for the core modules it would be better to use absolute imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| | ||
| from .common.utils import OperatorValidator | ||
| | ||
| from .common.errors import OperatorSchemaYamlError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's replace this with absolute imports.
from ads.opctl.operator.common.utils import OperatorValidator from ads.opctl.operator.common.errors import OperatorSchemaYamlError There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| Looks like there are some conflicts with the target branch. We will need to merge the |
df7b726 to b8911c8 Compare