def cancel(collection_id): """ --- delete: summary: Cancel processing of a collection description: > Cancel all queued tasks for the collection with id `collection_id` parameters: - description: The collection ID. in: path name: collection_id required: true schema: minimum: 1 type: integer responses: '200': content: application/json: schema: $ref: '#/components/schemas/CollectionStatus' description: OK tags: - Collection """ collection = get_db_collection(collection_id, request.authz.WRITE) cancel_queue(collection) refresh_collection(collection_id) return ("", 204)
def reset_collection(collection): """Reset the collection by deleting any derived data.""" drop_aggregator(collection) Match.delete_by_collection(collection.id) db.session.commit() cancel_queue(collection) refresh_collection(collection.id)
def delete_collection(collection, keep_metadata=False, sync=False): cancel_queue(collection) aggregator = get_aggregator(collection) try: aggregator.drop() finally: aggregator.close() flush_notifications(collection, sync=sync) index.delete_entities(collection.id, sync=sync) xref_index.delete_xref(collection, sync=sync) deleted_at = collection.deleted_at or datetime.utcnow() Entity.delete_by_collection(collection.id, deleted_at=deleted_at) Mapping.delete_by_collection(collection.id, deleted_at=deleted_at) Diagram.delete_by_collection(collection.id, deleted_at=deleted_at) Document.delete_by_collection(collection.id) if not keep_metadata: # Considering linkages metadata for now, might be wrong: Linkage.delete_by_collection(collection.id) Permission.delete_by_collection(collection.id, deleted_at=deleted_at) collection.delete(deleted_at=deleted_at) db.session.commit() if not keep_metadata: index.delete_collection(collection.id, sync=True) Authz.flush() refresh_collection(collection.id, sync=True)
def reset_collection(collection, sync=False): """Reset the collection by deleting any derived data.""" drop_aggregator(collection) Match.delete_by_collection(collection.id) cancel_queue(collection) index.delete_entities(collection.id, sync=sync) refresh_collection(collection.id) db.session.commit()
def reset_collection(collection, sync=False): """Reset the collection by deleting any derived data.""" drop_aggregator(collection) cancel_queue(collection) flush_notifications(collection, sync=sync) index.delete_entities(collection.id, sync=sync) xref_index.delete_xref(collection, sync=sync) refresh_collection(collection.id, sync=sync)
def delete_collection(collection, keep_metadata=False, sync=False): cancel_queue(collection) aggregator = get_aggregator(collection) aggregator.drop() flush_notifications(collection, sync=sync) index.delete_entities(collection.id, sync=sync) xref_index.delete_xref(collection, sync=sync) deleted_at = collection.deleted_at or datetime.utcnow() Mapping.delete_by_collection(collection.id) EntitySet.delete_by_collection(collection.id, deleted_at) Entity.delete_by_collection(collection.id) Document.delete_by_collection(collection.id) if not keep_metadata: Permission.delete_by_collection(collection.id) collection.delete(deleted_at=deleted_at) db.session.commit() if not keep_metadata: index.delete_collection(collection.id, sync=True) Authz.flush() refresh_collection(collection.id)
def cancel(foreign_id): """Cancel all queued tasks for the dataset.""" collection = get_collection(foreign_id) cancel_queue(collection) update_collection(collection)
def cancel_user(): """Cancel all queued tasks not related to a dataset.""" cancel_queue(None)
def cancel(collection_id): collection = get_db_collection(collection_id, request.authz.WRITE) cancel_queue(collection) return jsonify(get_status(collection))
def cancel(collection_id): collection = get_db_collection(collection_id, request.authz.WRITE) cancel_queue(collection) return ('', 204)