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

Dev/next #23

Merged
merged 59 commits into from
May 9, 2017
Merged

Dev/next #23

merged 59 commits into from
May 9, 2017

Conversation

johan-bjareholt
Copy link
Member

@johan-bjareholt johan-bjareholt commented Mar 28, 2017

  • The event model plurals are now removed
  • A event can now only have one label, if you need more values the new
    keyval item should be used so the data can be tagged properly
  • Added caching to queries on timestamps that is older than now
  • Made caching an option to views
  • Added label_chunk and renamed chunk to full_chunk

@codecov-io
Copy link

codecov-io commented Mar 28, 2017

Codecov Report

Merging #23 into master will increase coverage by 0.55%.
The diff coverage is 87.59%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #23      +/-   ##
==========================================
+ Coverage   82.69%   83.24%   +0.55%     
==========================================
  Files          21       22       +1     
  Lines         913      967      +54     
  Branches      152      185      +33     
==========================================
+ Hits          755      805      +50     
- Misses        131      134       +3     
- Partials       27       28       +1
Impacted Files Coverage Δ
aw_datastore/storages/__init__.py 100% <ø> (ø) ⬆️
aw_core/__about__.py 0% <0%> (ø)
aw_datastore/__init__.py 100% <100%> (ø) ⬆️
aw_core/dirs.py 96.55% <100%> (+0.71%) ⬆️
aw_datastore/storages/peewee.py 100% <100%> (ø) ⬆️
aw_datastore/storages/mongodb.py 98.61% <100%> (+1.31%) ⬆️
aw_core/query.py 85.89% <71.87%> (-3.58%) ⬇️
aw_core/transforms.py 91.89% <89.61%> (+0.8%) ⬆️
aw_core/views.py 93.61% <91.89%> (+10.28%) ⬆️
aw_core/cached_views.py 93.93% <93.93%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b00e4c5...e0d2bbe. Read the comment docs.

@ErikBjare
Copy link
Member

Appveyor seems to be failing?

Example:

    def cache_query(data, viewname, ds, start, end):
        cache_file = get_view_cache_file(viewname, ds, start, end)
        logger.debug("Caching query {}".format(cache_file))
        with open(cache_file, 'w') as f:

E       OSError: [Errno 22] Invalid argument: 'C:\\Users\\appveyor\\AppData\\Local\\activitywatch\\activitywatch\\Cache\\view_cache\\memory\\exview\\None to 2017-03-22 13:35:41.524674+00:00'

aw_core\views.py:69: OSError

@ErikBjare
Copy link
Member

ErikBjare commented Mar 31, 2017

I believe the reason for the AppVeyor failing is that you have a weird filename for the cache.

In the latest build:

E       OSError: [Errno 22] Invalid argument: 'C:\\Users\\appveyor\\AppData\\Local\\activitywatch\\activitywatch\\Cache\\view_cache\\peewee\\exview\\None_to_2017-03-30 17:04:01.208936+00:00'

For instance, : is not a valid characters in NTFS, you should probably also avoid spaces and might want to normalize the datetime timezone to UTC and remove the '+00:00' entirely, adding a Z to the end instead as ISO-8601 states. One valid formatting according to ISO-8601 is 20170331T121646Z, that should certainly not cause any problems.

aw_core/views.py Outdated
if end:
end = end.strftime("%Y%m%dT%H%m%SZ")
end = end.astimezone(timezone.utc).strftime("%Y%m%dT%H%m%SZ")
Copy link
Member

Choose a reason for hiding this comment

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

👍

@ErikBjare
Copy link
Member

ErikBjare commented Apr 17, 2017

  • The keyvals field should be renamed data.

@johan-bjareholt
Copy link
Member Author

I am currently working on that, don't worry! I saw that before aswell.

http://docs.peewee-orm.com/en/latest/peewee/models.html#id3

Any foreign keys to a model with a non-integer primary key will have a ForeignKeyField use the same underlying storage type as the primary key they are related to.

@@ -46,16 +47,21 @@ def json(self):


class EventModel(BaseModel):
bucket_id = CharField(index=True)
bucket = ForeignKeyField(BucketModel, related_name='events')
Copy link
Member

@ErikBjare ErikBjare May 3, 2017

Choose a reason for hiding this comment

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

Probably want to add a index=True here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, nice catch. Fixed

@ErikBjare
Copy link
Member

Wooo, can we merge soon? 😃

@johan-bjareholt
Copy link
Member Author

I don't think we need any more breaking changes for peewee storage which was the critical part, so I guess that we should be good to go.

@johan-bjareholt
Copy link
Member Author

Now even increases coverage slightly :)

@ErikBjare
Copy link
Member

ErikBjare commented May 8, 2017

So, this is pretty much done?

One last thing:

  • Bump the version number in the setup.py to 0.3

@johan-bjareholt
Copy link
Member Author

@ErikBjare Works fine now, we should just make sure to merge all the other pull requests at the same time

@ErikBjare ErikBjare merged commit 834bf9a into master May 9, 2017
@ErikBjare ErikBjare deleted the dev/next branch June 22, 2017 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants