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

How to use adaptiveETA when execution time is unknown? #37

Open
GoogleCodeExporter opened this issue Jun 18, 2015 · 0 comments
Open

How to use adaptiveETA when execution time is unknown? #37

GoogleCodeExporter opened this issue Jun 18, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Hi Guys,

I'm running AWS SDK and call API to create instance. The finish time is unknown 
operation, how can I adjust progressbar to accomodate this?

as soon as progress bar reaches the highest value - it crashes with the 
following code:

Traceback (most recent call last):
  File "D:/Projects/devops/development/experiments-elasticbeanstalk.py", line 124, in <module>
    pbar.update(difference)
  File "C:\Programming\Python275\lib\site-packages\progressbar\progressbar.py", line 252, in update
    raise ValueError('Value out of range')
ValueError: Value out of range

my code:
print "Waiting for prod-web-env to launch | " + status
pbar.start()
while status <> "Green":
    ret = conn.describe_environments(application_name='Web', environment_ids=eid)
    status = ret['DescribeEnvironmentsResponse']['DescribeEnvironmentsResult']['Environments'][0]['Health']
    time.sleep(5)
    later = time.time()
    difference = int(later - now)
    pbar.update(difference)
    # I tried this solution to adjust maxval dynamically and increase it to 10% each time we hit 90% of progress - but that didn't work
    if int((difference/pbar.maxval)*100)>90:
        pbar.maxval = pbar.maxval + int(pbar.maxval*0.1)
    if status=="Terminated":
        break


pbar.finish()
if status=="Terminated":
    print "Major problem running the environment"
    exit(1)

Original issue reported on code.google.com by dmi...@saritasa.com on 2 May 2014 at 11:51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant