{"action":"created","issue":{"url":"https://api.github.com/repos/cea-hpc/clustershell/issues/257","labels_url":"https://api.github.com/repos/cea-hpc/clustershell/issues/257/labels{/name}","comments_url":"https://api.github.com/repos/cea-hpc/clustershell/issues/257/comments","events_url":"https://api.github.com/repos/cea-hpc/clustershell/issues/257/events","html_url":"https://github.com/cea-hpc/clustershell/issues/257","id":93518003,"number":257,"title":"Incorrect \"in progress\" summary when mixing direct connections and connections through gateways","user":{"login":"martinetd","id":1729331,"avatar_url":"https://avatars.githubusercontent.com/u/1729331?v=3","gravatar_id":"","url":"https://api.github.com/users/martinetd","html_url":"https://github.com/martinetd","followers_url":"https://api.github.com/users/martinetd/followers","following_url":"https://api.github.com/users/martinetd/following{/other_user}","gists_url":"https://api.github.com/users/martinetd/gists{/gist_id}","starred_url":"https://api.github.com/users/martinetd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinetd/subscriptions","organizations_url":"https://api.github.com/users/martinetd/orgs","repos_url":"https://api.github.com/users/martinetd/repos","events_url":"https://api.github.com/users/martinetd/events{/privacy}","received_events_url":"https://api.github.com/users/martinetd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-07T12:20:14Z","updated_at":"2015-07-07T12:24:12Z","closed_at":null,"body":"clush doesn't count nodes it connects directly to in the short summary display\r\n\r\nEasy to reproduce:\r\n # clush -bw direct[1-2],remote[1-8] sleep 10\r\n clush:  2/10 gw 1\r\n clush: interrupt (^C to abort task)\r\n clush: in progress(3): direct[1-2],gw1\r\n clush: [tree] open gateways(1): gw1\r\n clush: [tree] in progress(8) on gw1: remote[1-8]\r\n\r\nThe count corrects itself when all gateway tasks finish e.g.\r\n # clush -bw direct[1-2],remote[1-8] '[[ $(hostname) = direct* ]] && sleep 10'\r\n clush:  8/10\r\n clush: interrupt (^C to abort task)\r\n clush: in progress(2): direct[1-2]\r\n\r\nWe can't just add cnt += len(self.task._engine.clients() (in Clush.py) because gw1 is an active client (listed in \"in progress\") even if there's no task on it, so we'd end up with e.g. -1/10 done\r\n\r\nWould it be possible to not count \"pure\" gateways in active clients?"},"comment":{"url":"https://api.github.com/repos/cea-hpc/clustershell/issues/comments/119188743","html_url":"https://github.com/cea-hpc/clustershell/issues/257#issuecomment-119188743","issue_url":"https://api.github.com/repos/cea-hpc/clustershell/issues/257","id":119188743,"user":{"login":"martinetd","id":1729331,"avatar_url":"https://avatars.githubusercontent.com/u/1729331?v=3","gravatar_id":"","url":"https://api.github.com/users/martinetd","html_url":"https://github.com/martinetd","followers_url":"https://api.github.com/users/martinetd/followers","following_url":"https://api.github.com/users/martinetd/following{/other_user}","gists_url":"https://api.github.com/users/martinetd/gists{/gist_id}","starred_url":"https://api.github.com/users/martinetd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinetd/subscriptions","organizations_url":"https://api.github.com/users/martinetd/orgs","repos_url":"https://api.github.com/users/martinetd/repos","events_url":"https://api.github.com/users/martinetd/events{/privacy}","received_events_url":"https://api.github.com/users/martinetd/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T12:24:12Z","updated_at":"2015-07-07T12:24:12Z","body":"Actually since a worker on a gateway will open another connection anyway, the gateway is counted twice and this seems to work:\r\n\r\n```python\r\ndiff --git a/lib/ClusterShell/CLI/Clush.py b/lib/ClusterShell/CLI/Clush.py\r\nindex 2efeb04..5a7c3a1 100755\r\n--- a/lib/ClusterShell/CLI/Clush.py\r\n+++ b/lib/ClusterShell/CLI/Clush.py\r\n@@ -323,7 +323,7 @@ class RunTimer(EventHandler):\r\n             act_targets = NodeSet()\r\n             for gw, (chan, metaworkers) in self.task.gateways.iteritems():\r\n                 act_targets.updaten(mw.gwtargets[gw] for mw in metaworkers)\r\n-            cnt = len(act_targets)\r\n+            cnt = len(act_targets) + len(self.task._engine.clients()) - len(gws)\r\n             gwinfo = ' gw %d' % len(gws)\r\n         else:\r\n             cnt = len(self.task._engine.clients())\r\n```"}}