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

added progressbar #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions py/rackattack/ssh/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from rackattack.ssh import run
from rackattack.ssh import dirftp
from rackattack.ssh import tunnel
from strato.common.log.progress_bar import progressbar_context


def discardParamikoLogs():
Expand Down Expand Up @@ -75,10 +76,12 @@ def connect(self):

def waitForTCPServer(self, timeout=60, interval=0.1):
before = time.time()
while time.time() - before < timeout:
if self._rawTCPConnect((self._hostname, self._port)):
return
time.sleep(interval)
with progressbar_context("waiting for connection to {}:{}".format(self._hostname, self._port), maxval=timeout, leave=True) as pbar:
while time.time() - before < timeout:
if self._rawTCPConnect((self._hostname, self._port)):
return
time.sleep(interval)
pbar.update(int(time.time() - before))
raise Exception("SSH TCP Server '%(hostname)s:%(port)s' did not respond within timeout" % dict(
hostname=self._hostname, port=self._port))

Expand Down
6 changes: 3 additions & 3 deletions py/rackattack/tcp/allocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def _allocationEventBroadcasted(self, event):
if eventType == "changedState":
self._waitEvent.set()
elif eventType == "providerMessage":
logging.info("Rackattack provider says: %(message)s", dict(message=event['message']))
logging.debug("Rackattack provider says: %(message)s", dict(message=event['message']))
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be debug. It has useful information. Perhaps consult with Michael.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is it of any use if all is fine? not upon failures?

Copy link
Contributor

Choose a reason for hiding this comment

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

No.

elif eventType == "withdrawn":
self._handleWithdrawl(event["message"])

Expand All @@ -148,12 +148,12 @@ def _inauguratorEventBroadcasted(self, event):
msg = "Inaugurator '%(id)s' %(state)s percent: %(percent)s" % dict(
id=event['id'], percent=percent, state=state)
if state == 'fetching':
logging.info(msg)
logging.debug(msg)
self._progressPercent[event['id']] = percent
elif state == 'digesting':
logging.debug(msg)
else:
logging.info("Inaugurator '%(id)s' status %(status)s", event)
logging.debug("Inaugurator '%(id)s' status %(status)s", event)
if self._progressCallback is not None:
self._progressCallback(overallPercent=self._overallPercent(), event=event)

Expand Down