Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:58:19

0001 #!/usr/bin/env python
0002 #
0003 # Licensed under the Apache License, Version 2.0 (the "License");
0004 # You may not use this file except in compliance with the License.
0005 # You may obtain a copy of the License at
0006 # http://www.apache.org/licenses/LICENSE-2.0OA
0007 #
0008 # Authors:
0009 # - Wen Guan, <wen.guan@cern.ch>, 2019
0010 
0011 
0012 """
0013 operations related to Transform.
0014 """
0015 
0016 from idds.core import transforms
0017 
0018 
0019 def add_transform(transform_type, transform_tag=None, priority=0, status=None, retries=0,
0020                   expired_at=None, transform_metadata=None, request_id=None):
0021     """
0022     Add a transform.
0023 
0024     :param transform_type: Transform type.
0025     :param transform_tag: Transform tag.
0026     :param priority: priority.
0027     :param status: Transform status.
0028     :param retries: The number of retries.
0029     :param expired_at: The datetime when it expires.
0030     :param transform_metadata: The metadata as json.
0031 
0032     :returns: content id.
0033     """
0034     kwargs = {'transform_type': transform_type, 'transform_tag': transform_tag, 'priority': priority,
0035               'status': status, 'retries': retries, 'expired_at': expired_at,
0036               'transform_metadata': transform_metadata, 'request_id': request_id}
0037     return transforms.add_transform(**kwargs)
0038 
0039 
0040 def get_transform(transform_id):
0041     """
0042     Get transform.
0043 
0044     :param transform_id: Transform id.
0045 
0046     :returns: Transform.
0047     """
0048     return transforms.get_transform(transform_id)
0049 
0050 
0051 def update_transform(transform_id, parameters):
0052     """
0053     update a transform.
0054 
0055     :param transform_id: the transform id.
0056     :param parameters: A dictionary of parameters.
0057 
0058     """
0059     return transforms.update_transform(transform_id, parameters)
0060 
0061 
0062 def delete_transform(transform_id=None):
0063     """
0064     delete a transform.
0065 
0066     :param transform_id: The id of the transform.
0067     """
0068     return transforms.delete_transform(transform_id)