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 Processings.
0014 """
0015 
0016 from idds.core import processings
0017 
0018 
0019 def add_processing(transform_id, status, submitter=None, granularity=None, granularity_type=None,
0020                    expired_at=None, processing_metadata=None):
0021     """
0022     Add a processing.
0023 
0024     :param transform_id: Transform id.
0025     :param status: processing status.
0026     :param submitter: submitter name.
0027     :param granularity: Granularity size.
0028     :param granularity_type: Granularity type.
0029     :param expired_at: The datetime when it expires.
0030     :param processing_metadata: The metadata as json.
0031 
0032     :returns: processing id.
0033     """
0034     kwargs = {'transform_id': transform_id, 'status': status, 'submitter': submitter,
0035               'granularity': granularity, 'granularity_type': granularity_type,
0036               'expired_at': expired_at, 'processing_metadata': processing_metadata}
0037     return processings.add_processing(**kwargs)
0038 
0039 
0040 def get_processing(processing_id=None, transform_id=None, retries=0):
0041     """
0042     Get a  processing
0043 
0044     :param processing_id: Processing id.
0045     :param tranform_id: Transform id.
0046     :param retries: Transform retries.
0047 
0048     :returns: Processing.
0049     """
0050     return processings.get_processing(processing_id=processing_id, transform_id=transform_id,
0051                                       retries=retries)
0052 
0053 
0054 def update_processing(processing_id, parameters):
0055     """
0056     update a processing.
0057 
0058     :param processing_id: the transform id.
0059     :param parameters: A dictionary of parameters.
0060 
0061     """
0062     return processings.update_processing(processing_id, parameters)
0063 
0064 
0065 def delete_processing(processing_id=None):
0066     """
0067     delete a processing.
0068 
0069     :param processing_id: The id of the processing.
0070     """
0071     return processings.delete_processing(processing_id)