|
|
|||
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>, 2020 0010 0011 0012 """ 0013 Test hyper parameter optimization test client. 0014 """ 0015 0016 import os 0017 # from uuid import uuid4 as uuid 0018 0019 from idds.client.client import Client 0020 from idds.common.constants import RequestType, RequestStatus 0021 from idds.common.utils import get_rest_host 0022 0023 0024 def get_test_codes(): 0025 dir_name = os.path.dirname(os.path.abspath(__file__)) 0026 test_codes = os.path.join(dir_name, 'activelearning_test_codes/activelearning_test_codes.tgz') 0027 return test_codes 0028 0029 0030 def get_req_properties(): 0031 req_properties = { 0032 # 'scope': 'data15_13TeV', 0033 # 'name': 'data15_13TeV.00270949.pseudo.%s' % str(uuid()), 0034 'requester': 'panda', 0035 'request_type': RequestType.HyperParameterOpt, 0036 'transform_tag': 'prodsys2', 0037 'status': RequestStatus.New, 0038 'priority': 0, 0039 'lifetime': 30, 0040 # 'request_metadata': {'workload_id': '20525134', 'sandbox': None, 'executable': 'docker run --rm -it -v "$(pwd)":/payload gitlab-registry.cern.ch/zhangruihpc/endpointcontainer:latest /bin/bash -c "/bin/cat /payload/input_json.txt>/payload/output_json.txt"', 'arguments': '-s --input %IN', 'output_json': 'output.json'} # noqa: E501 0041 # 'request_metadata': {'workload_id': '20525134', 'is_pseudo_input': True, 'sandbox': None, 'executable': 'docker', 'arguments': 'run --rm -it -v "$(pwd)":/payload gitlab-registry.cern.ch/zhangruihpc/endpointcontainer:latest /bin/cat /payload/%IN>%OUT', 'initial_points': [({'A': 1, 'B': 2}, 0.3), ({'A': 1, 'B': 3}, None)], 'output_json': 'output.json'} # noqa: E501 0042 # 'request_metadata': {'workload_id': '20525134', 'is_pseudo_input': True, 'sandbox': None, 'method': 'nevergrad', 'opt_space': {'A': [1, 2, 3], 'B': (1, 10)}, 'initial_points': [({'A': 1, 'B': 2}, 0.3), ({'A': 1, 'B': 3}, None)], 'max_points': 10} # noqa: E501 0043 # 'request_metadata': {'workload_id': '20525134', 'sandbox': None, 'executable': 'docker', 'arguments': 'run -v $(pwd):/data wguanicedew/idds_hpo_nevergrad python /opt/hyperparameteropt_nevergrad.py --max_points=%MAX_POINTS --num_points=%NUM_POINTS --input=/data/%IN --output=/data/%OUT', 'output_json': 'output.json', 'opt_space': {"A": {"type": "Choice", "params": {"choices": [1, 4]}}, "B": {"type": "Scalar", "bounds": [0, 5]}}, 'initial_points': [({'A': 1, 'B': 2}, 0.3), ({'A': 1, 'B': 3}, None)], 'max_points': 20, 'num_points_per_generation': 10} # noqa: E501 0044 'request_metadata': {'workload_id': '20525134', 'sandbox': 'wguanicedew/idds_hpo_nevergrad', 'workdir': '/data', 'executable': 'docker', 'arguments': 'python /opt/hyperparameteropt_nevergrad.py --max_points=%MAX_POINTS --num_points=%NUM_POINTS --input=/data/%IN --output=/data/%OUT', 'output_json': 'output.json', 'opt_space': {"A": {"type": "Choice", "params": {"choices": [1, 4]}}, "B": {"type": "Scalar", "bounds": [0, 5]}}, 'initial_points': [({'A': 1, 'B': 2}, 0.3), ({'A': 1, 'B': 3}, None)], 'max_points': 20, 'num_points_per_generation': 10} # noqa: E501 0045 } 0046 return req_properties 0047 0048 0049 host = get_rest_host() 0050 props = get_req_properties() 0051 test_codes = get_test_codes() 0052 0053 client = Client(host=host) 0054 # props['request_metadata']['result_parser'] = 'default' 0055 0056 request_id = client.add_request(**props) 0057 print(request_id)
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|