File indexing completed on 2026-04-09 07:58:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 """
0013 operations related to collections.
0014 """
0015
0016 from idds.core import collections
0017
0018
0019 def add_collection(scope, name, coll_type=None, request_id=None, transform_id=None,
0020 relation_type=None, coll_size=0, status=None, total_files=0, retries=0,
0021 expired_at=None, coll_metadata=None):
0022 """
0023 Add a collection.
0024
0025 :param scope: The scope of the request data.
0026 :param name: The name of the request data.
0027 :param type: The type of dataset as dataset or container.
0028 :param request_id: The request id related to this collection.
0029 :param transform_id: The transform id related to this collection.
0030 :param relation_type: The relation between this collection and its transform,
0031 such as Input, Output, Log and so on.
0032 :param size: The size of the collection.
0033 :param status: The status.
0034 :param total_files: Number of total files.
0035 :param retries: Number of retries.
0036 :param expired_at: The datetime when it expires.
0037 :param coll_metadata: The metadata as json.
0038
0039 :returns: collection id.
0040 """
0041 kwargs = {'scope': scope, 'name': name, 'coll_type': coll_type, 'request_id': request_id,
0042 'transform_id': transform_id, 'relation_type': relation_type, 'coll_size': coll_size,
0043 'status': status, 'total_files': total_files, 'retries': retries,
0044 'expired_at': expired_at, 'coll_metadata': coll_metadata}
0045 return collections.add_collection(**kwargs)
0046
0047
0048 def get_collection(coll_id=None, transform_id=None, relation_type=None):
0049 """
0050 Get a collection or raise a NoObject exception.
0051
0052 :param coll_id: The id of the collection.
0053 :param transform_id: The transform id related to this collection.
0054 :param relation_type: The relation between this collection and its transform,
0055 such as Input, Output, Log and so on.
0056
0057 :returns: Collection.
0058 """
0059 return collections.get_collection(coll_id=coll_id, transform_id=transform_id, relation_type=relation_type)
0060
0061
0062 def update_collection(coll_id, parameters):
0063 """
0064 update a collection.
0065
0066 :param coll_id: the collection id.
0067 :param parameters: A dictionary of parameters.
0068
0069 """
0070 return collections.update_collection(coll_id=coll_id, parameters=parameters)
0071
0072
0073 def delete_collection(coll_id=None):
0074 """
0075 delete a collection.
0076
0077 :param request_id: The id of the request.
0078
0079 """
0080 return collections.delete_collection(coll_id=coll_id)