Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Commit

Permalink
Issue #528: Record cluster extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
robhudson committed Jul 25, 2017
1 parent f68aaa6 commit a877715
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions atmo/clusters/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ def extend(self, hours):
self.lifetime_extension_count = models.F('lifetime_extension_count') + 1
self.save()

Metric.record('cluster-extension')

def deactivate(self):
"""Shutdown the cluster and update its status accordingly"""
self.provisioner.stop(self.jobflow_id)
Expand Down
2 changes: 2 additions & 0 deletions tests/clusters/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def test_extend(client, user, cluster_factory):
assert cluster.expires_at > original_expires_at
assert cluster.expires_at == original_expires_at + timedelta(hours=3)

assert Metric.objects.get(key='cluster-extension').value == 1


def test_metric_records(cluster_provisioner_mocks, cluster_factory):
cluster = cluster_factory()
Expand Down

0 comments on commit a877715

Please sign in to comment.