Skip to content

Commit

Permalink
database: add profile column to afe_host_queue_entries_table
Browse files Browse the repository at this point in the history
Store the profile as a string in the database.

Signed-off-by: Nishanth Aravamudan <[email protected]>
  • Loading branch information
Nishanth Aravamudan authored and lmr committed Jun 28, 2012
1 parent dbcd286 commit 1ec1559
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions frontend/afe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ class HostQueueEntry(dbmodels.Model, model_logic.ModelExtensions):

job = dbmodels.ForeignKey(Job)
host = dbmodels.ForeignKey(Host, blank=True, null=True)
profile = dbmodels.CharField(max_length=255, blank=True, default='')
status = dbmodels.CharField(max_length=255)
meta_host = dbmodels.ForeignKey(Label, blank=True, null=True,
db_column='meta_host')
Expand Down
7 changes: 7 additions & 0 deletions frontend/migrations/069_add_profile_afe_host_queue_entries.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
UP_SQL = """
ALTER TABLE afe_host_queue_entries ADD COLUMN profile VARCHAR(255) AFTER host_id;
"""

DOWN_SQL = """
ALTER TABLE afe_host_queue_entries DROP COLUMN profile;
"""
2 changes: 1 addition & 1 deletion scheduler/scheduler_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def cmp_for_sort(cls, a, b):

class HostQueueEntry(DBObject):
_table_name = 'afe_host_queue_entries'
_fields = ('id', 'job_id', 'host_id', 'status', 'meta_host',
_fields = ('id', 'job_id', 'host_id', 'profile', 'status', 'meta_host',
'active', 'complete', 'deleted', 'execution_subdir',
'atomic_group_id', 'aborted', 'started_on')

Expand Down
3 changes: 2 additions & 1 deletion scheduler/scheduler_models_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def tag(self):
self.god.stub_with(scheduler_models, 'Job', MockJob)
hqe = scheduler_models.HostQueueEntry(
new_record=True,
row=[0, 1, 2, 'Queued', None, 0, 0, 0, '.', None, False, None])
row=[0, 1, 2, 'rhel6', 'Queued', None, 0, 0, 0, '.', None, False, None])
hqe.save()
new_id = hqe.id
# Force a re-query and verify that the correct data was stored.
Expand All @@ -167,6 +167,7 @@ def tag(self):
self.assertEqual(hqe.id, new_id)
self.assertEqual(hqe.job_id, 1)
self.assertEqual(hqe.host_id, 2)
self.assertEqual(hqe.profile, 'rhel6')
self.assertEqual(hqe.status, 'Queued')
self.assertEqual(hqe.meta_host, None)
self.assertEqual(hqe.active, False)
Expand Down

0 comments on commit 1ec1559

Please sign in to comment.