File indexing completed on 2026-04-09 07:58:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 """
0013 Test active learning client.
0014 """
0015
0016 import os
0017
0018 from idds.client.client import Client
0019 from idds.common.constants import RequestType, RequestStatus
0020 from idds.common.utils import get_rest_host
0021
0022
0023 def get_test_codes():
0024 dir_name = os.path.dirname(os.path.abspath(__file__))
0025 test_codes = os.path.join(dir_name, 'activelearning_test_codes/activelearning_test_codes.tgz')
0026 return test_codes
0027
0028
0029 def get_req_properties():
0030 req_properties = {
0031 'scope': 'data15_13TeV',
0032 'name': 'data15_13TeV.00270949.physics_Main.merge.AOD.r7600_p2521_tid07734829_00',
0033 'requester': 'panda',
0034 'request_type': RequestType.ActiveLearning,
0035 'transform_tag': 'prodsys2',
0036 'status': RequestStatus.New,
0037 'priority': 0,
0038 'lifetime': 30,
0039 'request_metadata': {'workload_id': '20525134', 'sandbox': 'https://', 'executable': 'hostname', 'arguments': '-s --input %IN', 'output_json': 'output.json'}
0040 }
0041 return req_properties
0042
0043
0044 host = get_rest_host()
0045 props = get_req_properties()
0046 test_codes = get_test_codes()
0047
0048 client = Client(host=host)
0049 test_codes_url = client.upload(test_codes)
0050 props['request_metadata']['sandbox'] = test_codes_url
0051 props['request_metadata']['executable'] = 'test.sh'
0052 props['request_metadata']['arguments'] = '-1 -2 test'
0053
0054
0055 request_id = client.add_request(**props)
0056 print(request_id)