Back to home page

EIC code displayed by LXR

 
 

    


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

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 Test client.
0014 """
0015 
0016 
0017 import time
0018 from uuid import uuid4 as uuid
0019 
0020 from idds.client.client import Client
0021 from idds.common.constants import RequestType, RequestStatus
0022 from idds.common.utils import get_rest_host
0023 from idds.tests.common import get_example_real_tape_stagein_request
0024 from idds.tests.common import get_example_prodsys2_tape_stagein_request
0025 
0026 
0027 def get_req_properties():
0028     properties = {
0029         'scope': 'test_scope',
0030         'name': 'test_name_%s' % str(uuid()),
0031         'requester': 'panda',
0032         'request_type': RequestType.EventStreaming,
0033         'transform_tag': 's3218',
0034         'status': RequestStatus.New,
0035         'priority': 0,
0036         'lifetime': 30,
0037         'request_metadata': {'workload_id': int(time.time())}
0038     }
0039     return properties
0040 
0041 
0042 host = get_rest_host()
0043 props = get_req_properties()
0044 props = get_example_real_tape_stagein_request()
0045 props = get_example_prodsys2_tape_stagein_request()
0046 # props = get_example_active_learning_request()
0047 
0048 client = Client(host=host)
0049 request_id = client.add_request(**props)
0050 print(request_id)