Add del_task method
@@ -862,6 +862,7 @@ class MongoengineSocket:
"""
meta = get_metadata_template()
+
query, error = format_query(
program=program,
method=method,
@@ -1678,6 +1679,22 @@ class MongoengineSocket:
return updated
+ def del_tasks(self, id: Union[str, list]):
+ """Delete a task from the queue. Use with cautious
+
+ Parameters
+ ----------
+ id : str or list
+ Ids of the tasks to delete
+ Returns
+ -------
+ int
+ Number of tasks deleted
+ """
+
+ return TaskQueue.objects(id__in=id).delete()
+
+
def handle_hooks(self, hooks):
# Very dangerous, we need to modify this substatially
