You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.
I liked what @DnPlas did in the training operator where she bound a few commonly used things from the model to local attributes in __init__. Should we add some standard ones to our template? Yes, these are things that are already available (via self.model... etc), but to new people they're hard to find (and sometimes interpret, for example namespace). At a minimum, bindings tend to read better in the code.
I'm thinking something like:
def__init__(...):
self._name=self.model.app.nameself._namespace=self.model.name# Or even better, we put in the template the more robust namespace solution @jnsgruk proposed a few weeks back, I think to handle when something is accidentally deployed into the controller model?self._model_name=self.model.name# (other things)
The text was updated successfully, but these errors were encountered:
I'm not sure about including this in the template itself. Particularly given that not all charms will necessarily use them, and in particular, the variable _namespace makes little sense in the context of a machine charm.... (I accept that the template has containers/pebble stuff in it...)
ca-scribner
pushed a commit
to ca-scribner/operator-template-1
that referenced
this issue
May 19, 2022
I liked what @DnPlas did in the training operator where she bound a few commonly used things from the model to local attributes in
__init__
. Should we add some standard ones to our template? Yes, these are things that are already available (viaself.model...
etc), but to new people they're hard to find (and sometimes interpret, for examplenamespace
). At a minimum, bindings tend to read better in the code.I'm thinking something like:
The text was updated successfully, but these errors were encountered: