Giter Club home page Giter Club logo

accloudtant's People

Contributors

ifosch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

accloudtant's Issues

Adopt AWS Pricing API

AWS has published API for getting prices.
In the announcement, they also offer a [documentation[(http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/price-changes.html).
This will probably replace current JS page, and also, it seems a faster way to fix that.

Minimal CLI interface

Provide a command hierarchy to access current features, like:

accloudtant print
accloudtant report

It should allow common and specific options, following aws-cli style and naming for them.

Fails with Python 3

My system have Python 3 installed by default (Archlinux). This is the output of accloudtant report:

Traceback (most recent call last):
  File "/usr/bin/accloudtant", line 22, in <module>
    cli()
  File "/usr/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/bin/accloudtant", line 19, in report
    click.echo(Reports())
  File "/usr/lib/python3.5/site-packages/click/utils.py", line 221, in echo
    message = text_type(message)
  File "/usr/lib/python3.5/site-packages/accloudtant/aws/reports.py", line 69, in __repr__
    instance.name,
  File "/usr/lib/python3.5/site-packages/accloudtant/aws/instance.py", line 68, in name
    return names[0]['Value']
IndexError: list index out of range

I can't verify that it works well on Python 2 so fell free to close this issue and open a new one if the problem is not caused by the Python version.

Check flake8 errors

Check errors when using flake8 on repo root:

$ flake8 --max-complexity 5
./accloudtant/aws/reports.py:17:1: C901 'Reports.find_reserved_instance' is too complex (6)
./accloudtant/aws/instance.py:79:1: C901 'Instance.match_reserved_instance' is too complex (7)
./tests/aws/conftest.py:44:1: C901 'ec2_resource' is too complex (9)
./tests/aws/conftest.py:73:1: C901 'ec2_client' is too complex (8)
./tests/aws/conftest.py:101:1: C901 'mock_requests_get' is too complex (6)
./tests/aws/conftest.py:125:1: C901 'process_ec2' is too complex (7)

It would be great to fix these over complexity, even when happening in tests.

Improve region service presence in accloudtant.aws.prices

Different AWS services not always are present in regions in the all regions. This may also happen for service details.
In that aspect, the pricing should signal there's no service in a region, by showing something like '-' or, maybe clearer, 'N/A'.

Setup autopep8

Not a critical issue, but would be nice to setup and use autopep8 for fixing style issues in all files.

Release 0.1.3

This story implies:

  • Update CHANGELOG.md
  • Update CONTRIBUTORS.md to add thanks to @jsoucheiron and @xsb
  • Update setup.py
  • Publish to Test PyPI: python setup.py sdist upload -r pypitest
  • If everything is ok there:
    • Add tag 0.1.3
    • Publish to PyPI: python setup.py sdist upload -r pypi

CSV as output format

The table format is great to see the data in the terminal, but to facilytate the import into other tools, CSV is a best (and simple) choice.

Improve help

The help message don't explain the existing commands.

Missing requirements.txt file

I wanted to run accloudtant inside Docker using FROM python:2.7-onbuild.

This is the output of docker build:

# Executing 3 build triggers...
Step 1 : COPY requirements.txt /usr/src/app/
lstat requirements.txt: no such file or directory

More info on how onbuild works
https://hub.docker.com/_/python/

Get prices from AWS EC2

For some of the EC2 pricing tables, get current values from internet. For MVP 0.1, we require the following:

  • On Demand
  • Reserved
  • Data Transfer
  • EBS
  • EIP
  • CloudWatch
  • ELB

Suboptimal usage of any, better use or

    def match_reserved_instance(self, reserved):
        if any((self.state != 'running',
                reserved['State'] != 'active',
                reserved['InstancesLeft'] == 0,
                reserved['ProductDescription'] != self.operating_system,
                reserved['InstanceType'] != self.size,
                reserved['AvailabilityZone'] != self.availability_zone)):
            return False
        return True

Using any here requires create the list of conditions to determine if the reserved instance and the instance match enough to consider this instance to be reserved.
If I understood ok, @jsoucheiron points the fact that having to create the list adds too much cost in processing time to the function, while having a generator, or using or instead, should improve the timing of the function.

Not list neither report

I tried to get list of my EC2 instances and its reports followed by https://pypi.python.org/pypi/accloudtant/0.1.3.

I tried from Mac and Ubuntu systems,

with Python3, am keep getting this error msg and not sure whats cause this,

#accloudtant list

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/bin/accloudtant", line 22, in
cli()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/bin/accloudtant", line 14, in price_list
click.echo(Prices())
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/accloudtant/aws/prices.py", line 36, in init
self.output = print_prices(self.prices)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/accloudtant/aws/prices.py", line 92, in print_prices
for size in sorted(instances[ec2_kind][region].keys()):
KeyError: 'linux'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.