Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Prepare process: Enhancements #849
Prepare process: Enhancements #849
Changes from 6 commits
9331187
501cacc
8e9c28a
f3ccccc
2b46eee
d983879
eb4407b
92ce331
3bc9933
173b2f2
9260a80
e5eefc8
e0339ae
725584a
128ff7a
c1d7bb8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 whoever receive this object have any meaningful reason to set the exception and or set the prepared state - I assume not? I have a feeling if maybe we should just be returning a (static?) data object instead to avoid confusion? We're really just returning the prepared state and the exception - that's it?
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.
For my usecase the context has more value as it fills
headless
based on logic I should not know about at that specific case. I did want to be able to get exception to be able to handle the error in custom way (e.g. send report to server or store to a file).For me
ensure_addons_are_process_ready
is just helper wrapper for exactly the content of the function when I don't want to encapsulate the logic to e.g. UI splash screen, but only run preparation and then get context information that was filled automatically.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.
Hmm - I see. I suppose the change is made to fit your use case and there are reasons to do it as such.
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.
Unresolving. Those are relevant comments and questions. This is not yet in any release and I would rather not touch it in future, so criticism is welcome.
Full context:
The main reason this functionality is necessary is to give addons option to prepare them -> what would happen in tray if you would use it, like fill ftrack credentials, fill environment variables that are e.g. filled only in
tray_start
etc. They can stop the process if their need is not matched. Main usage is for webactions, they can be started without ever running tray.This cannot happen automatically, addon that might need it has to request it specifically.
Function
ensure_addons_are_process_ready
was added to simplifyGoal was to make it somewhat reusable, so it is not tight only for applications but can be used for use-cases.
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'm still not entirely sure about the exact use case. I think if we're simplifying it makes more sense to simplify the need to pass the addon version (isn't that e.g. based on the current active bundle for your context?) Why do we need to explicitly pass it the version?
The fact that you need access to any exceptions or whether it's headless or not - I suppose makes sense. I'm also not entirely confident about the need for the
prepared
state.I'd expect a
ensure_addons_are_process_ready
to just return something along the lines of a "boolean" to tell me whether it succeeded or not, potentially with the exception if it's not (which could also be an actual raised exception? Since we're requesting it to ensure it?)Again, take my comment with a grain of salt since I feel I'm quite on a different track than you and still not 100% sure.
Just here proposing an API that may seem more reasonable:
But maybe it's the docstring of
ProcessContext
that needs improving - because it doesn't seem to be 'generic context' but a process context specific to a particular addon? So it's more of aAddonProcessContext
?Like:
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.
First idea was to expect
addon_name
,addon_version
andproject_name
inensure_addons_are_process_ready
. Then I realized that we will in future need to add more data and changing signature of a function is PITE, thusProcessContext
was created, meant as "future-proof data holder".I would like to keep it as functions instead of methods. And it's not meant as preparation for addon, the addon information is meant as "metadata" that might or might not be relevant for preparation.