1- from typing import Union
21from jsonargparse .typing import (
32 PositiveInt ,
43 NonNegativeInt ,
1514
1615# Collection of restricted types
1716IP_ADDRESS_TYPE = restricted_string_type (
18- name = "ip_address_type " ,
17+ name = "IP_ADDRESS_TYPE " ,
1918 regex = r"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$" ,
2019)
2120IP_PORT_TYPE = restricted_number_type (
22- name = "ip_port_type " ,
23- base_type = int ,
21+ name = "IP_PORT_TYPE " ,
22+ base_type = int ,
2423 restrictions = [(">" , 0 ), ("<" , 65536 )],
2524)
2625
@@ -42,10 +41,17 @@ def _process_common_args(args: Namespace) -> None:
4241 if args .timeout is not None :
4342 args .timeout = round (args .timeout * 3600 )
4443
45- # Temp: Ray ConcurrencyLimiter expects `int` type for args.jobs
44+ # --- Conversion into python primitive types for Ray compatibility. ---
45+ # Ray ConcurrencyLimiter expects `int` type for args.jobs
4646 if args .jobs is not None :
4747 args .jobs = int (args .jobs )
4848
49+ # Ray workers are unable to import custom jsonargparse types.
50+ if args .server is not None :
51+ args .server = str (args .server )
52+ if args .port is not None :
53+ args .port = int (args .port )
54+
4955 def _validate_tune_args (args : Namespace ) -> None :
5056 """Validate and process arguments specific to tuning."""
5157 if args .tune .eval == "ppa-improv" and args .tune .reference is None :
0 commit comments