<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Cory, Alex, good pointers!</p>
    <p>I had provider set to GLOBAL and require in UNIT. Maybe that's
      why. Let me take a look your example and follow your instructions
      here to give it another try. <br>
    </p>
    <p>Thank you guys!<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 06/07/2017 11:44 AM, Cory Johns
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOnY7SM1sLarhR_egWPoN8T-mOkDrWr7rBZ8wAZiApkFLW7spg@mail.gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div dir="ltr">Alex beat me to it, but here's a marginally more
        complete example: <a
          href="https://gist.github.com/johnsca/a91cb5897d92dfb6741ee1a09d82b39b"
          moz-do-not-send="true">https://gist.github.com/johnsca/a91cb5897d92dfb6741ee1a09d82b39b</a>
        <div><br>
        </div>
        <div>The key points are:</div>
        <div><br>
        </div>
        <div>* The interface needs to be UNIT scoped (because you care
          about individual units)</div>
        <div>* The joined handler sets a state for each unit that joins</div>
        <div>* The @when('rel.connected') predicate in the charm layer
          matches all units that have had that state set, so the set of
          conversations in the interface layer includes those units, and
          only those units.  This is trivially all of the units in my
          example, but you could also set a different state in a
          -changed handler based on data sent by each remote unit, and
          the conversations would only include the units that had that
          specific state set when you matched that state using @when</div>
        <div><br>
        </div>
        <div>Alex: A conversation will always have a scope, so that list
          comprehension isn't necessary.</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Wed, Jun 7, 2017 at 11:38 AM, Alex
          Kavanagh <span dir="ltr"><<a
              href="mailto:alex.kavanagh@canonical.com" target="_blank"
              moz-do-not-send="true">alex.kavanagh@canonical.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Hi
              <div><br>
              </div>
              <div>I'm assuming you are using charms.reactive; if not
                then look into relation_ids command.</div>
              <div><br>
              </div>
              <div>In your interface, count the number of conversations
                that have a scope set to something other than None.
                 scope shouldn't be None, but I've had cases where it
                has been (it may have been a bug):</div>
              <div><br>
              </div>
              <div>So in the provider.py RelationBase derived class,
                something along the lines of:</div>
              <div><br>
              </div>
              <div>num = len([c for c in self.conversations() if
                c.scope])</div>
              <div><br>
              </div>
              <div>in a method would be a relatively simple way of doing
                it.</div>
              <div><br>
              </div>
              <div>(There may be better ways of doing this!)</div>
              <div><br>
              </div>
              <div>Cheers</div>
              <div>Alex.</div>
            </div>
            <div class="gmail_extra">
              <div>
                <div class="h5"><br>
                  <div class="gmail_quote">On Wed, Jun 7, 2017 at 4:22
                    PM, fengxia <span dir="ltr"><<a
                        href="mailto:fxia1@lenovo.com" target="_blank"
                        moz-do-not-send="true">fxia1@lenovo.com</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
                      Juju,<br>
                      <br>
                      I'm building two charms and linking them with one
                      relation, one charm ("A") will provide and the
                      other ("B") will require.<br>
                      <br>
                      The deployment will have one "A" and three "B"s.
                      How do I know all three Bs have joined? I'm
                      thinking to use a counter in A's relation, then at
                      relation-joined hook by B to add this counter. But
                      set_remote() and set_local() didn't work. Not sure
                      what's the right way to achieve this?<span
                        class="m_-3447999939082871597HOEnZb"><font
                          color="#888888"><br>
                          <br>
                          <br>
                          -- <br>
                          Feng xia<br>
                          Engineer<br>
                          Lenovo USA<br>
                          <br>
                          Phone: <a href="tel:5088011794"
                            value="+15088011794" target="_blank"
                            moz-do-not-send="true">5088011794</a><br>
                          <a href="mailto:fxia1@lenovo.com"
                            target="_blank" moz-do-not-send="true">fxia1@lenovo.com</a><br>
                                  <br>
                          Lenovo.com<br>
                          Twitter | Facebook | Instagram | Blogs |
                          Forums<br>
                          9<br>
                          <br>
                          <br>
                          -- <br>
                          Juju mailing list<br>
                          <a href="mailto:Juju@lists.ubuntu.com"
                            target="_blank" moz-do-not-send="true">Juju@lists.ubuntu.com</a><br>
                          Modify settings or unsubscribe at: <a
                            href="https://lists.ubuntu.com/mailman/listinfo/juju"
                            rel="noreferrer" target="_blank"
                            moz-do-not-send="true">https://lists.ubuntu.com/mailm<wbr>an/listinfo/juju</a><br>
                        </font></span></blockquote>
                  </div>
                  <br>
                  <br clear="all">
                  <div><br>
                  </div>
                </div>
              </div>
              <span class="HOEnZb"><font color="#888888">-- <br>
                  <div class="m_-3447999939082871597gmail_signature"
                    data-smartmail="gmail_signature">
                    <div dir="ltr">Alex Kavanagh - Software Engineer
                      <div>Cloud Dev Ops - Solutions & Product
                        Engineering - Canonical Ltd</div>
                    </div>
                  </div>
                </font></span></div>
            <br>
            --<br>
            Juju mailing list<br>
            <a href="mailto:Juju@lists.ubuntu.com"
              moz-do-not-send="true">Juju@lists.ubuntu.com</a><br>
            Modify settings or unsubscribe at: <a
              href="https://lists.ubuntu.com/mailman/listinfo/juju"
              rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.ubuntu.com/<wbr>mailman/listinfo/juju</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
<a class="moz-txt-link-abbreviated" href="mailto:fxia1@lenovo.com">fxia1@lenovo.com</a>
        
Lenovo.com 
Twitter | Facebook | Instagram | Blogs | Forums
</pre>
  </body>
</html>