Skip to content
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

Fusion: provide better logging for validate saver crash due type error #6082

Merged

Conversation

kalisp
Copy link
Member

@kalisp kalisp commented Dec 21, 2023

Changelog Description

Handles reported issue for NoneType error thrown in conversion int(tool["Comments"][frame]). It is most likely happening when saver node has no input connections.

There is a validator for that, but it might be not obvious, that this error is caused by missing input connections and it has been already reported by "Validate Saver Has Input".

Additional info

Applicable for:
openpype\hosts\fusion\plugins\publish\validate_saver_resolution.py", line 44, in get_tool_resolution width = int(tool["Comments"][frame]) TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Testing notes:

  1. create new saver of render product type - unselect all nodes before!
  2. double check that new saver node is not connected
  3. publish
  4. you should get better log:
AnyDesk_gqWgwgL8Vw

Doesn't make much sense to have it outside of class. Debugging of it is impossible there (because of missing logger). Imho.
Limits uncaught error when resolution info is None, which could happen when saver is not connected.
@ynbot
Copy link
Contributor

ynbot commented Dec 21, 2023

@ynbot ynbot added type: bug Something isn't working host: Fusion size/S Denotes a PR changes 100-499 lines, ignoring general files labels Dec 21, 2023
Handle exception to select broken saver in the Publisher UI.
@kalisp kalisp changed the title Fusion: validate saver crash due type error Fusion: provide better logging for validate saver crash due type error Dec 21, 2023
Copy link
Member

@jakubjezek001 jakubjezek001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in Fusion 18 and was working as expected.

@BigRoy
Copy link
Collaborator

BigRoy commented Jan 15, 2024

Tested in Fusion 18 and was working as expected.

Pretty sure this is not working as expected - it just ends up doing NO validation whatsoever. Right?

@BigRoy
Copy link
Collaborator

BigRoy commented Jan 15, 2024

Also, it makes much more sense to make this validator EXPLICITLY check if the saver has inputs, and it not to then spew out a warning that there is no input connection as opposed to relying on the comment resolution check for that. It'll be way more explicit in the code, and if there are other cases where the resolution check will fail we'll then still be notified of those issues themselves instead of being completely unaware that no validation is occurring - as is the current case with this PR.

@kalisp
Copy link
Member Author

kalisp commented Jan 17, 2024

Also, it makes much more sense to make this validator EXPLICITLY check if the saver has inputs, and it not to then spew out a warning that there is no input connection as opposed to relying on the comment resolution check for that. It'll be way more explicit in the code, and if there are other cases where the resolution check will fail we'll then still be notified of those issues themselves instead of being completely unaware that no validation is occurring - as is the current case with this PR.

I thought that this validator will fail only if inputs are not connected. There is already explicit validator for connected inputs before, but its failure is masked by failure in this validator. But it seems that this validator fails even if inputs are connected, but I couldnt replicate it and logic of this validator is a bit weird and not completely clear what it is actually checking.

@BigRoy
Copy link
Collaborator

BigRoy commented Jan 17, 2024

But it seems that this validator fails even if inputs are connected,

That'd be a bug then. @EmberLightVFX might have more knowledge about why it might fail. (We have this check disabled on our end so haven't hit anything that might be buggy with it since we're not using it.)

Anyway, the current PR basically 'disables' the validation because it'll never pass - so current PR is invalid.

Do you have a comp file that reproduces the issue? I'm fairly certain I tested the initial PR of this feature just fine.

but I couldnt replicate it and logic of this validator is a bit weird and not completely clear what it is actually checking.

It checks:

  • What is the resolution of the image? (what resolution is the saver node outputting)
  • Does it match the resolution of asset document resolution? (what producers usually have defined)

Here it makes more sense. We try to run some expression, but it might still result in None.
@LiborBatek LiborBatek self-requested a review January 23, 2024 07:28
Copy link
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does Validate correctly if no input connected to the render saver node.

image

However could be nice to have better and human readible error message tho...

This is how it looks now:
image

@kalisp @jakubjezek001 as Im now into Fusion too, you can tag me when Review needed too on ongoing Fusion related PRs

@BigRoy
Copy link
Collaborator

BigRoy commented Jan 23, 2024

Thanks @LiborBatek - I'll take a look if I can make a proposal within a day or so.

@LiborBatek
Copy link
Member

LiborBatek commented Jan 23, 2024

@kalisp it seems that in just legacy OP for some reason it works now in both Ayon mode too... the Validator message looks different and more correct:

image

@LiborBatek
Copy link
Member

So I guess its working...fine!

Copy link
Member

@jakubjezek001 jakubjezek001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested in Fusion 18 and works fine, again ;)

Copy link
Collaborator

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current state it'll still break whatever comment might have been there on the saver that a user might have been using if for whatever reason it was disconnected because it doesn't revert to the original value or expression. So marking this as 'request changes' to resolve that. Still want to provide better code, but keep getting 'busy' :D

@kalisp
Copy link
Member Author

kalisp commented Jan 26, 2024

I am bit confused about not resetting original expression, it should. It is probably not resetting non expression comment, but it seems that it never had and it is irrelevant to this PR.

@kalisp kalisp merged commit 4709676 into develop Jan 26, 2024
5 checks passed
@ynbot ynbot added this to the next-patch milestone Jan 26, 2024
@kalisp
Copy link
Member Author

kalisp commented Jan 26, 2024

Lets merge and close it for now. It is better than it was before, could be make better if there will be reproducible example where it is causing issues.

@kalisp kalisp deleted the bugfix/OP-7467_Fusion-validate-saver-crash-due-type-error branch January 26, 2024 16:25
Comment on lines +85 to +92
if tool["Comments"][frame] not in ["", None]:
if tool["Comments"].GetExpression() is not None:
has_expression = True
old_comment = tool["Comments"].GetExpression()
tool["Comments"].SetExpression(None)
else:
old_comment = tool["Comments"][frame]
tool["Comments"][frame] = ""
Copy link
Collaborator

@BigRoy BigRoy Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the comment field is being overwritten - IF for whatever reason the user had a value there it would now be lost if the error would get raised below, because the value would not get reverted.

Which could throw meaningful info from the scene away if the user used that comment field.

What ACTUALLY happens even is that the "expression" that is being set:

tool["Comments"].SetExpression("self.Input.OriginalWidth")

Will now persist after the validation and suddenly the user has an expression on the comment field that they don't know about or shouldn't have.

Basically we're altering the user's scene in a way without taking care that it's reverted, which we shouldn't be doing.

We should be doing this through a context manager so that whatever happens, the original state gets reverted - even on the error.

BUT, even better - I'd argue that if the ACTUAL issue is that it errors on having no input connections that we explicitly capture that case - so that if for whatever other reason the resolution can't be computed we still get an error (if e.g. the node network evaluates with errors, or there's a memory overflow issue, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
host: Fusion size/S Denotes a PR changes 100-499 lines, ignoring general files target: AYON type: bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants