Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
/ pulp Public archive

Commit

Permalink
Removes TaskLock
Browse files Browse the repository at this point in the history
TaskLock should have been removed with the RQ transition. It is no
longer used.
  • Loading branch information
Brian Bouterse committed May 30, 2018
1 parent 6f492ee commit 1c352b5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
2 changes: 1 addition & 1 deletion pulpcore/pulpcore/app/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
RepositoryVersion,
)

from .task import CreatedResource, ReservedResource, Task, TaskLock, TaskReservedResource, Worker # noqa
from .task import CreatedResource, ReservedResource, Task, TaskReservedResource, Worker # noqa

# Moved here to avoid a circular import with Task
from .progress import ProgressBar, ProgressReport, ProgressSpinner # noqa
33 changes: 0 additions & 33 deletions pulpcore/pulpcore/app/models/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,39 +247,6 @@ def lock_resources(self, task, resource_urls):
TaskReservedResource.objects.create(resource=reservation, task=task)


class TaskLock(Model):
"""
Locking mechanism for services that utilize active/passive fail-over
Fields:
name (models.TextField): The name of the item that has the lock
timestamp (models.DateTimeField): The time the lock was last updated
lock (models.TextField): The name of the lock acquired
"""
RESOURCE_MANAGER = 'ResourceManager'
LOCK_STRINGS = (
(RESOURCE_MANAGER, 'Resource Manager Lock'),
)

name = models.TextField(db_index=True, unique=True)
timestamp = models.DateTimeField(auto_now=True)
lock = models.TextField(unique=True, null=False, choices=LOCK_STRINGS)

def update_timestamp(self):
"""
Update the timestamp field to now and save it.
Only the timestamp field will be saved. No other changes will be saved.
Raises:
ValueError: When the model instance has never been saved before. This method can
only update an existing database record.
"""
self.save(update_fields=['timestamp'])


class Task(Model):
"""
Represents a task
Expand Down

0 comments on commit 1c352b5

Please sign in to comment.