Client¶
RPC client.
- class lorien.tune.rpc.client.RPCClient(configs: argparse.Namespace, silent=False)¶
The RPC client.
- fetch_results() List[Tuple[str, str]] ¶
Fetch tuned results from the server. Only the client with root permission is allowed to fetch results.
- Returns
results -- A list of serialized (job, result) pairs.
- Return type
List[Tuple[str, str]]
- init_server(job_configs: lorien.tune.job.JobConfigs)¶
Initialize the server options. The client that initializes the server becomes the root client, which is authorized to submit jobs and fetch results.
- Parameters
configs (argparse.Namespace) -- The system configurations including tune and measure options.
job_configs (JobConfigs) -- The job configurations.
- init_worker(configs: argparse.Namespace)¶
Initialize the worker with tuning options.
- Parameters
configs (argparse.Namespace) -- The system configure for RPC server.
- is_server_init() bool ¶
Check if the server is initialized.
- Returns
init -- True if all options are ready; False otherwise.
- Return type
bool
- num_workers() int ¶
Get the number of live workers.
- Returns
n_workers -- The number of live workers.
- Return type
int
- register_as_worker() Tuple[bool, str] ¶
Register client self as a tuning worker.
- Returns
token_or_msg -- A tuple of (success, token or error message).
- Return type
Tuple[bool, str]
- request_job() Optional[str] ¶
Request a job from the server. The result will be stored in cached_result so this function will not return anything.
- send_result(job_n_result: Tuple[str, str]) str ¶
Send the serailized job and result back to the server.
- Parameters
job_n_result (Tuple[str, str]) -- A string pair of job and result.
- Returns
msg -- The error message.
- Return type
str
- submit(job_str: str) bool ¶
Submit a serialized job to the server. Only the client with root permission can submit jobs.
- Parameters
job_str (str) -- The serialized job to be submitted.
- Returns
success -- True if the job is submitted successfully; False otherwise.
- Return type
bool