-
Notifications
You must be signed in to change notification settings - Fork 54
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
Improve messaging for templates processor #1521
Improve messaging for templates processor #1521
Conversation
cc.step( | ||
f"Processing artifact group [{artifact_to_process.src} -> {artifact_to_process.dest}] with templates processor" | ||
) |
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.
I don't see a reason why this should be different from the snowpark processor, which simply uses something like this:
Invoking artifact processors
Processing Snowpark annotations from python/receipts.py
Processing Snowpark annotations from python/regions.py
I think that from the POV of the user, too much information ends up being noise. What we're really trying to convey is the transformation that's happening for each file.
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.
I can change it to be consistent.
if src.is_dir(): | ||
return | ||
with self.edit_file(dest) as file: | ||
file_name = src.relative_to(self._bundle_ctx.project_root) |
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.
minor, but when we chain processors, there might not be a source in the case of generated files.
In any case, the Snowpark processor outputs the dest path (relative to the deploy root), not the src path. At the very they should both align, so consider changing the Snowpark processor logic to match yours.
raise InvalidTemplateInFileError(file_name, e) from e | ||
|
||
if expanded_template != file.contents: | ||
cc.message(f"Expanding templates in {file_name}") |
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.
too late, since there could be errors raised before this is output. I get that you don't want to say anything about non-templated files, but we should then at least buffer the exceptions until we have a chance to tell the user what step is about to fail.
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.
I thought about this, but since all errors will have the file name included, it might not be worth it. WDYT?
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.
Definitely worth it IMHO. We should always tell the user what we're doing, and do so accurately.
|
||
def test_has_sql_templates(): | ||
assert has_sql_templates("abc <% %> abc") | ||
assert has_sql_templates("abc <% abc") |
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.
This example does not have SQL template, right?
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.
From Jinja perspective it's considered it has it, and it will fail when expanding.
src/snowflake/cli/_plugins/nativeapp/codegen/templates/templates_processor.py
Outdated
Show resolved
Hide resolved
…es_processor.py Co-authored-by: Bruno Dufour <bruno.dufour@snowflake.com>
Pre-review checklist
Changes description
Improve messaging for templates processor:
Update:
Now it's a bit different, after discussion: