Renaming Artifice to Distil

Lots of general rename changes, and a few pieces of minor tidy up.

Change-Id: Ia88b75af0e2d294cfc57164ac42155234d8ba71a
This commit is contained in:
adriant 2014-06-12 12:52:18 +12:00
parent 7225d81a20
commit fcfa0f077d
29 changed files with 51 additions and 67 deletions

View File

@ -1,13 +1,13 @@
VERSION=0.1
NAME=openstack-artifice
INSTALL_PATH=/opt/stack/artifice
NAME=openstack-distil
INSTALL_PATH=/opt/stack/distil
BILLING_PROGRAM=bill.py
BINARY_PATH=/usr/local/bin
WORK_DIR=./work
CONF_DIR=${WORK_DIR}/${INSTALL_PATH}/etc/artifice
CONF_DIR=${WORK_DIR}/${INSTALL_PATH}/etc/distil
clean:
@rm -rf ./work
@ -20,7 +20,7 @@ init:
deb: clean init
@cp -r ./artifice \
@cp -r ./distil \
./scripts \
./README.md \
./INVOICES.md \
@ -36,10 +36,10 @@ deb: clean init
@cp -r ./packaging/fs/* ${WORK_DIR}/
@mkdir -p ${CONF_DIR}
@mkdir -p ${WORK_DIR}/etc/init.d
@mkdir -p ${WORK_DIR}/etc/artifice
@chmod +x ${WORK_DIR}/etc/init.d/artifice
@cp ./examples/conf.yaml ${WORK_DIR}/etc/artifice/conf.yaml
@cp ./examples/csv_rates.yaml ${WORK_DIR}/etc/artifice/csv_rates.yaml
@mkdir -p ${WORK_DIR}/etc/distil
@chmod +x ${WORK_DIR}/etc/init.d/distil
@cp ./examples/conf.yaml ${WORK_DIR}/etc/distil/conf.yaml
@cp ./examples/csv_rates.yaml ${WORK_DIR}/etc/distil/csv_rates.yaml
@fpm -s dir -t deb -n ${NAME} -v ${VERSION} \
--post-install=packaging/scripts/post_install.sh \
--depends 'libpq-dev' \

View File

@ -1,12 +1,12 @@
#!/usr/bin/python
from artifice.api import web
from distil.api import web
import yaml
import sys
import argparse
a = argparse.ArgumentParser("Web service for Artifice")
a = argparse.ArgumentParser("Web service for Distil")
a.add_argument("-c", "--config", dest="config", help="Path to config file", default="/etc/artifice/conf.yaml")
a.add_argument("-c", "--config", dest="config", help="Path to config file", default="/etc/distil/conf.yaml")
a.add_argument("-i", "--interface", dest="ip", help="IP address to serve on.", default="0.0.0.0")
a.add_argument("-p", "--port", help="port to serve on", default="8000")

View File

@ -40,7 +40,7 @@ if __name__ == '__main__':
parser.add_argument("-c", "--config", dest="config",
help="Config file",
default="/etc/artifice/conf.yaml")
default="/etc/distil/conf.yaml")
# commands:
subparsers = parser.add_subparsers(help='commands', dest='command')

View File

@ -2,7 +2,7 @@ from decorator import decorator
import flask
import itertools
import json
from artifice.models import Tenant
from distil.models import Tenant
def _validate(data, *args, **kwargs):

View File

@ -1,12 +1,12 @@
import flask
from flask import Flask, Blueprint
from artifice import database, config
from artifice.constants import iso_time, iso_date, dawn_of_time
from artifice.transformers import active_transformers
from artifice.rates import RatesFile
from artifice.models import SalesOrder, _Last_Run
from artifice.helpers import convert_to
from artifice.interface import Interface, timed
from distil import database, config
from distil.constants import iso_time, iso_date, dawn_of_time
from distil.transformers import active_transformers
from distil.rates import RatesFile
from distil.models import SalesOrder, _Last_Run
from distil.helpers import convert_to
from distil.interface import Interface, timed
import sqlalchemy
from sqlalchemy import create_engine, func
from sqlalchemy.orm import scoped_session, create_session

View File

@ -1,6 +1,6 @@
from sqlalchemy import func
from .models import Resource, UsageEntry, Tenant, SalesOrder, _Last_Run
from artifice.constants import dawn_of_time
from distil.constants import dawn_of_time
from datetime import timedelta
import json
import config

View File

@ -17,13 +17,13 @@ class _Version(Base):
"""
A model that knows what version we are, stored in the DB.
"""
__tablename__ = "artifice_database_version"
__tablename__ = "distil_database_version"
id = Column(String(10), primary_key=True)
class _Last_Run(Base):
"""Model to store time of last completed usage run."""
__tablename__ = "artifice_last_run"
__tablename__ = "distil_last_run"
id = Column(Integer, primary_key=True)
last_run = Column(DateTime, nullable=False)

View File

View File

@ -1,10 +0,0 @@
region | m1_nano | duration | 0.32
region | m1_micro | duration | 0.42
region | m1_tiny | duration | 0.62
region | m1_small | duration | 0.82
region | m1_medium | duration | 1.02
region | incoming_megabytes | bytes | 0.004
region | outgoing_megabytes | bytes | 0.007
region | storage_size | bytes per hour | 0.000513
region | floating_ip | duration | 0.05
region | volume_size | bytes per hour | 0.0076
1 region m1_nano duration 0.32
2 region m1_micro duration 0.42
3 region m1_tiny duration 0.62
4 region m1_small duration 0.82
5 region m1_medium duration 1.02
6 region incoming_megabytes bytes 0.004
7 region outgoing_megabytes bytes 0.007
8 region storage_size bytes per hour 0.000513
9 region floating_ip duration 0.05
10 region volume_size bytes per hour 0.0076

View File

@ -1,6 +0,0 @@
---
storage.objects.size: 15
m1.nano: 5
network.incoming.bytes: 5
network.outgoing.bytes: 1
volume.size: 25

View File

@ -1,12 +1,12 @@
from setuptools import setup
setup(name='openstack-artifice',
setup(name='openstack-distil',
version='0.1',
description='Artifice, a set of APIs for creating billable items from Openstack-Ceilometer',
author='Aurynn Shaw',
author_email='aurynn@catalyst.net.nz',
contributors=["Chris Forbes", "Adrian Turjak"],
contributor_emails=["chris.forbes@catalyst.net.nz", "adriant@catalyst.net.nz"],
url='https://github.com/catalyst/artifice',
packages=["artifice", "artifice.api", "artifice.models"]
url='https://github.com/catalyst/distil',
packages=["distil", "distil.api", "distil.models"]
)

View File

@ -3,8 +3,8 @@ from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session,create_session
from sqlalchemy.pool import NullPool
from artifice.models import Resource, Tenant, UsageEntry, SalesOrder, Base
from artifice import config
from distil.models import Resource, Tenant, UsageEntry, SalesOrder, Base
from distil import config
from .constants import DATABASE_NAME, PG_DATABASE_URI, MY_DATABASE_URI
from .constants import config as test_config

View File

@ -1,5 +1,5 @@
DATABASE_NAME = "test_artifice"
DATABASE_NAME = "test_distil"
PG_DATABASE_URI = "postgresql://aurynn:postgres@localhost/%s" % DATABASE_NAME
MY_DATABASE_URI = "mysql://root:password@localhost/%s" % DATABASE_NAME

View File

@ -1,5 +1,5 @@
import mock
from artifice import models
from distil import models
from datetime import timedelta
import json

View File

@ -1,10 +1,10 @@
from webtest import TestApp
from . import test_interface, helpers, constants
from artifice.api import web
from artifice.api.web import get_app
from artifice import models
from artifice import interface
from artifice.helpers import convert_to
from distil.api import web
from distil.api.web import get_app
from distil import models
from distil import interface
from distil.helpers import convert_to
from datetime import datetime
from decimal import Decimal
import unittest
@ -28,7 +28,7 @@ class TestApi(test_interface.TestInterface):
usage = helpers.get_usage(self.start, self.end)
with mock.patch('artifice.interface.Artifice') as Artifice:
with mock.patch('distil.interface.Interface') as Interface:
tenants = []
@ -42,14 +42,14 @@ class TestApi(test_interface.TestInterface):
t.description = tenant['description']
tenants.append(t)
artifice = mock.Mock(spec=interface.Artifice)
ceil_interface = mock.Mock(spec=interface.Interface)
artifice.tenants = tenants
ceil_interface.tenants = tenants
Artifice.return_value = artifice
Interface.return_value = ceil_interface
# patch to mock out the novaclient call
with mock.patch('artifice.helpers.flavor_name') as flavor_name:
with mock.patch('distil.helpers.flavor_name') as flavor_name:
flavor_name.side_effect = lambda x: x
resp = self.app.post("/collect_usage")

View File

@ -1,5 +1,5 @@
from . import test_interface, helpers
from artifice import database
from distil import database
from datetime import timedelta

View File

@ -1,6 +1,6 @@
import unittest
from artifice.models import Tenant as tenant_model
from artifice.models import UsageEntry, Resource, SalesOrder
from distil.models import Tenant as tenant_model
from distil.models import UsageEntry, Resource, SalesOrder
from sqlalchemy.pool import NullPool
from sqlalchemy import create_engine

View File

@ -2,7 +2,7 @@ import unittest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session,create_session
from sqlalchemy.pool import NullPool
from artifice.models import Resource, Tenant, UsageEntry, SalesOrder, Base
from distil.models import Resource, Tenant, UsageEntry, SalesOrder, Base
import datetime
import subprocess

View File

@ -1,6 +1,6 @@
import artifice.transformers
from artifice import constants
from artifice.constants import states
import distil.transformers
from distil import constants
from distil.constants import states
import unittest
import mock
import datetime
@ -39,8 +39,8 @@ class TestMeter(object):
class UptimeTransformerTests(unittest.TestCase):
def _run_transform(self, data):
xform = artifice.transformers.Uptime()
with mock.patch('artifice.helpers.flavor_name') as flavor_name:
xform = distil.transformers.Uptime()
with mock.patch('distil.helpers.flavor_name') as flavor_name:
flavor_name.side_effect = lambda x: x
return xform.transform_usage('state', data, testdata.ts0,
testdata.ts1)
@ -178,7 +178,7 @@ class GaugeMaxTransformerTests(unittest.TestCase):
{'timestamp': testdata.t1, 'counter_volume': 6},
]
xform = artifice.transformers.GaugeMax()
xform = distil.transformers.GaugeMax()
usage = xform.transform_usage('some_meter', data, testdata.ts0,
testdata.ts1)
@ -196,7 +196,7 @@ class GaugeMaxTransformerTests(unittest.TestCase):
{'timestamp': testdata.t1, 'counter_volume': 25},
]
xform = artifice.transformers.GaugeMax()
xform = distil.transformers.GaugeMax()
usage = xform.transform_usage('some_meter', data, testdata.ts0,
testdata.ts1)