2424from pulpcore .constants import TASK_CHOICES , TASK_FINAL_STATES , TASK_STATES
2525from pulpcore .exceptions import AdvisoryLockError , exception_to_dict
2626from pulpcore .tasking .constants import TASKING_CONSTANTS
27+ from pulpcore .app .loggers import deprecation_logger
2728
2829_logger = logging .getLogger (__name__ )
2930
@@ -212,6 +213,19 @@ def _hash_to_u64(value):
212213 return int .from_bytes (_digest , byteorder = "big" , signed = True )
213214
214215
216+ class TaskManager (models .Manager ):
217+ def filter (self , * args , ** kwargs ):
218+ value = kwargs .pop ("reserved_resources_record__resource" , None )
219+ if value is not None :
220+ deprecation_logger .warning (
221+ "Filtering tasks with 'reserved_resources_record__resource' is deprecated"
222+ " and may be removed as soon as pulpcore==3.15;"
223+ " use 'reserved_resources_record__contains' with a list of values instead."
224+ )
225+ kwargs ["reserved_resources_record__contains" ] = [value ]
226+ return super ().filter (* args , ** kwargs )
227+
228+
215229class Task (BaseModel , AutoDeleteObjPermsMixin , AutoAddObjPermsMixin ):
216230 """
217231 Represents a task
@@ -236,6 +250,8 @@ class Task(BaseModel, AutoDeleteObjPermsMixin, AutoAddObjPermsMixin):
236250 worker (models.ForeignKey): The worker that this task is in
237251 """
238252
253+ objects = TaskManager ()
254+
239255 state = models .TextField (choices = TASK_CHOICES )
240256 name = models .TextField ()
241257 logging_cid = models .CharField (max_length = 256 , db_index = True , default = "" )
0 commit comments