Permalink
Browse files

Added perfmetrics.

  • Loading branch information...
1 parent c5fb9c5 commit 1edf4b98ec7fca8ed6e6800ac1b40e468905f015 @hathawsh hathawsh committed Sep 1, 2012
Showing with 42 additions and 13 deletions.
  1. +9 −0 .externalToolBuilders/nosetests-repozitory.launch
  2. +1 −0 .gitignore
  3. +10 −0 .project
  4. +0 −11 .pydevproject
  5. +8 −0 CHANGES.txt
  6. +11 −0 repozitory/archive.py
  7. +3 −2 setup.py
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
+<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="true"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/repozitory/bin/nosetests}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="--with-coverage --cover-package=repozitory"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/repozitory}"/>
+</launchConfiguration>
View
@@ -13,3 +13,4 @@ parts
doc/build
dist
docs/_build/
+.pydevproject
View
@@ -10,6 +10,16 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
+ <triggers>auto,full,incremental,</triggers>
+ <arguments>
+ <dictionary>
+ <key>LaunchConfigHandle</key>
+ <value>&lt;project&gt;/.externalToolBuilders/nosetests-repozitory.launch</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
View
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?eclipse-pydev version="1.0"?>
-
-<pydev_project>
-<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Python for repozitory</pydev_property>
-<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
-<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
-<path>/repozitory</path>
-<path>/repozitory/parts/omelette</path>
-</pydev_pathproperty>
-</pydev_project>
View
@@ -1,3 +1,11 @@
+Changes
+=======
+
+1.3 (2012-09-01)
+----------------
+
+- Added performance metrics using the perfmetrics package.
+
1.2 (2012-01-30)
----------------
View
@@ -1,5 +1,6 @@
from cStringIO import StringIO
+from perfmetrics import metricmethod
from repozitory.interfaces import IArchive
from repozitory.interfaces import IContainerRecord
from repozitory.interfaces import IDeletedItem
@@ -90,6 +91,7 @@ def _create_session(self, engine):
session.configure(bind=engine)
return session
+ @metricmethod
def archive(self, obj):
"""Add a version to the archive of an object.
@@ -261,6 +263,7 @@ def _prepare_blob_id(self, f):
session.flush()
return arc_blob.blob_id
+ @metricmethod
def history(self, docid, only_current=False):
"""Get the history of an object.
@@ -280,6 +283,7 @@ def history(self, docid, only_current=False):
return [ObjectHistoryRecord(row, created, current_version)
for row in rows]
+ @metricmethod
def get_version(self, docid, version_num):
"""Return a specific IObjectHistoryRecord for an object.
"""
@@ -294,13 +298,15 @@ def get_version(self, docid, version_num):
.one())
return ObjectHistoryRecord(row, created, current_version)
+ @metricmethod
def reverted(self, docid, version_num):
"""Tell the database that an object has been reverted."""
session = self.session
row = session.query(ArchivedCurrent).filter_by(docid=docid).one()
row.version_num = version_num
session.flush()
+ @metricmethod
def archive_container(self, container, user):
"""Update the archive of a container.
@@ -400,6 +406,7 @@ def archive_container(self, container, user):
)
session.add(row)
+ @metricmethod
def container_contents(self, container_id):
"""Return the contents of a container as IContainerRecord.
"""
@@ -409,6 +416,7 @@ def container_contents(self, container_id):
.one())
return ContainerRecord(self, session, row)
+ @metricmethod
def iter_hierarchy(self, top_container_id, max_depth=None,
follow_deleted=False, follow_moved=False):
"""Iterate over IContainerRecords in a hierarchy.
@@ -491,6 +499,7 @@ def iter_hierarchy(self, top_container_id, max_depth=None,
seen.add(docid)
to_examine.append(docid)
+ @metricmethod
def filter_container_ids(self, container_ids):
"""Return which of the specified container IDs exist in the archive.
"""
@@ -502,6 +511,7 @@ def filter_container_ids(self, container_ids):
.all())
return [container_id for (container_id,) in rows]
+ @metricmethod
def which_contain_deleted(self, container_ids, max_depth=None):
"""Return the subset of container_ids that have something deleted.
"""
@@ -573,6 +583,7 @@ def which_contain_deleted(self, container_ids, max_depth=None):
return res
+ @metricmethod
def shred(self, docids=(), container_ids=()):
"""Delete the specified objects and containers permanently.
View
@@ -2,7 +2,7 @@
from setuptools import setup, find_packages
import os
-version = '1.2'
+version = '1.3'
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.txt')).read()
@@ -13,7 +13,7 @@
version=version,
description="Simple document versioning for web apps, "
"especially Pyramid apps.",
- long_description=README + '\n\nChanges\n=======\n\n' + CHANGES,
+ long_description=README + '\n\n' + CHANGES,
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[],
keywords='pyramid pylons document version versioning sql sqlalchemy',
@@ -25,6 +25,7 @@
include_package_data=True,
zip_safe=False,
install_requires=[
+ 'perfmetrics',
'psycopg2',
'simplejson',
'SQLAlchemy>=0.7.1',

0 comments on commit 1edf4b9

Please sign in to comment.