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

Track component initialisations for error messages #420

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

elikoga
Copy link
Contributor

@elikoga elikoga commented Dec 19, 2023

closes #278

provides a warning if a component is initialized, but not prepared:

Say we have the tutorial-helloworld:
component.py:

class Hello(Component):
    def configure(self):
        self += File("hello", content="Hello world")
        File("")

This gives us an error message like this:

batou/2.5.dev0 (cpython 3.7.16-final0, Darwin 23.1.0 arm64)
================================== Preparing ===================================
main: Loading environment `tutorial`...
main: Verifying repository ...
main: Loading secrets ...
================== Connecting hosts and configuring model ... ==================
localhost: Connecting via local (1/1)
WARN: A Component 'File' was initialized but was not prepared (configured).
This may not be what you want
================================== Deploying ===================================
localhost: Scheduling component hello ...
=================================== Summary ====================================
Deployment took total=0.23s, connect=0.23s, deploy=0.00s
============================= DEPLOYMENT FINISHED ==============================

Of course the warning is yellow too:

image

@elikoga elikoga marked this pull request as ready for review December 19, 2023 02:11
ctheune
ctheune previously approved these changes Dec 19, 2023
src/batou/environment.py Outdated Show resolved Hide resolved
@ctheune ctheune dismissed their stale review December 19, 2023 06:30

incorrectly approved

Copy link
Collaborator

@ctheune ctheune left a comment

Choose a reason for hiding this comment

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

See the note about that this should be erroring out instead of just warning.

@elikoga elikoga force-pushed the 278-track-component-initialisations-for branch from d2f74c9 to b675af2 Compare December 20, 2023 14:19
@ctheune
Copy link
Collaborator

ctheune commented Feb 28, 2024

What does the output look like now? Does the user have a chance to figure out where this happened? (We can keep track of the call stack during init and then use that to indicate the problem later.)

Copy link
Member

@zagy zagy left a comment

Choose a reason for hiding this comment

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

The changelog is missing.

@elikoga
Copy link
Contributor Author

elikoga commented Apr 23, 2024

We can keep track of the call stack during init and then use that to indicate the problem later.)

PR doesn't included that yet so I'll draft this one

@elikoga elikoga marked this pull request as draft April 23, 2024 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn if subcomponent is not added
3 participants